<     May 2017     >
Su Mo Tu We Th Fr Sa  
    1  2  3  4  5  6  
 7  8  9 10 11 12 13  
14 15 16 17 18 19 20  
21 22 23 24 25 26 _2_7  
28 29 30 31
00:00 nakal joined
00:00 infinity0 joined
00:01 Strikingwolf joined
00:01 <Strikingwolf> question: is there a way to express in contexts that a is not congruent b?
00:01 <mojjo> ReinH: ok, i'll try it
00:01 blym_ joined
00:01 <Strikingwolf> so like instead of (a ~ b) => you would have some way to do (a !~ b)
00:01 <monochrom> erisco: Can you use your version of unfoldForest to produce the same thing as: Data.Tree.unfoldForest (\b -> (b, if b==0 then [] else [b-1])) [3,1,4,5]
00:02 <Cale> Strikingwolf: nope
00:02 anuxivm joined
00:02 <erisco> monochrom, I don't know but that isn't the point
00:02 <erisco> monochrom, how do they get that shape as an unfold?
00:03 <monochrom> I disagree. The answer is the point.
00:03 <erisco> how so?
00:03 infinity0 joined
00:03 <Cale> Strikingwolf: Generally that wouldn't be so useful
00:04 <Strikingwolf> Damn
00:04 <Cale> Strikingwolf: There's nothing you can actually do with the information that two types are unequal
00:04 <Strikingwolf> Well, there is *one* thing I can do
00:04 <Strikingwolf> I'm building a record type
00:05 <Strikingwolf> and so using that would allow me to restrict that only one field is allowed with a particular name
00:05 <Cale> ah, right, "lacks" constraints
00:06 infinity0 joined
00:07 mjora7 joined
00:08 smillmorel joined
00:09 infinity0 joined
00:12 infinity0 joined
00:12 blym_ joined
00:14 plutoniix joined
00:14 Qommand0r joined
00:14 infinity0 joined
00:14 cpennington joined
00:14 <erisco> monochrom, the answer is yes
00:16 <erisco> monochrom, if we call mine unfoldForest2, then theirs unfoldForest = unfoldForest2 . fmap
00:16 <Strikingwolf> I wish you could tell Haskell which instance is "preferred"
00:16 <Strikingwolf> so if one of them matches the other one won't
00:16 <dmwit> data Int = Nat :- Nat
00:17 SCHAPiE joined
00:17 darjeeling_ joined
00:17 <EvanR> Strikingwolf: there is support for controlling overlapping instances, but its best to just avoid them
00:17 MrWoohoo joined
00:17 plutoniix joined
00:17 <dmwit> (a :- b) + (c :- d) = (a + c) :- (b + d) -- has its own kind of beauty
00:17 <ReinH> Strikingwolf: it seems like whatever you're doing is probably a bad idea...
00:17 <monochrom> erisco, not the direction I'm asking.
00:18 <taktoa> dmwit: I read the (:-) constructor as "entails" rather than "minus" and got really confused for a second
00:18 <erisco> monochrom, then I do not understand your question
00:18 <taktoa> although funnily enough you can interpret LEM as meaning that implication is kind of like subtraction
00:18 <monochrom> Rewrite Data.Tree.unfoldForest (\b -> (b, if b==0 then [] else [b-1])) [3,1,4,5] using unfoldForest2.
00:19 <taktoa> !P \/ Q becomes -P + Q
00:19 <erisco> yes, it is easy, because unfoldForest = unfoldForest2 . fmap
00:19 <dmwit> taktoa: cute!
00:19 tromp joined
00:19 <Strikingwolf> ReinH: oh I'm not doing it for practicality or for using it
00:19 <Strikingwolf> just for fun and learning
00:19 <Strikingwolf> it's a horrid idea :P
00:19 <ReinH> :)
00:19 <Strikingwolf> Also, got it working
00:19 <Strikingwolf> type families to the rescue
00:20 <Strikingwolf> I'm amazed I haven't had to call on UndecidableInstances for this
00:20 carlomagno joined
00:20 <erisco> monochrom, how does that not qualify?
00:21 <monochrom> OK, I misread, it's the right direction. Now I have to carefully check it.
00:21 <taktoa> dmwit: relatedly https://en.wikipedia.org/wiki/Residuated_lattice
00:22 <monochrom> So you're saying unfoldForest2 (fmap f [3,1,4,5])?
00:22 <erisco> unfoldForest2 (fmap f) [3,1,4,5]
00:23 <lyxia> I think (not _) being (1 - _) is more common than (- _)
00:23 <erisco> this fmap is specialised to lists, so same being unfoldForest2 (map f) [3,1,4,5]
00:24 <monochrom> OK, I am skeptical. Even about the types. Do you have an implementation for testing?
00:24 sgronblo joined
00:24 <erisco> well I ran into it because I defined a different type and later realised it is exactly that of Forest
00:25 <erisco> and then was confused as to why our unfolds didn't match
00:25 <erisco> so sure I'll pastebin it
00:25 roar joined
00:25 <erisco> http://lpaste.net/355256
00:26 plutoniix joined
00:26 <monochrom> Can you modify it so that it is for Data.Tree.Tree rather than your Tree?
00:27 <Welkin> isn't that a rose tree?
00:27 <erisco> it is Forest
00:27 trashboatjr joined
00:27 codesoup joined
00:28 <monochrom> Or rather Data.Tree.Forest
00:28 trashboatjr left
00:28 <Strikingwolf> Oh god this works
00:28 roar joined
00:28 zcourts joined
00:28 <dmwit> erisco: I don't know if you literally meant "how did we get unfoldForest :: blah", but if you did, I have a pretty good guess: it arises very naturally while implementing `unfoldTree`.
00:28 stoopkid joined
00:28 <lpaste> Strikingwolf pasted “Record Evil” at http://lpaste.net/355257
00:28 robertkennedy joined
00:29 <Strikingwolf> Cale and ReinH you might be interested
00:29 <erisco> dmwit, I do. I also implemented it naturally and had a different answer
00:29 <monochrom> What Scott Aaronson said about mathematicians and computer scientists are very creative in naming things.
00:29 <erisco> monochrom, I am working on it
00:29 <dmwit> erisco: From your paste, you implemented a more different `unfoldForest`, but not an `unfoldTree`.
00:30 <dmwit> erisco: And yes, there can be multiple natural implementations of a thing.
00:30 <erisco> dmwit, I also defined Tree above. I came to the definition of Forest differently
00:30 <erisco> it is also just a tree with labeled edges, which is what I intended
00:30 roar joined
00:31 <dmwit> I'm not sure what you're trying to convince me of. Do you disagree that this is the most likely explanation for how we got an `unfoldForest` of the type we have?
00:31 steeze joined
00:31 <monochrom> I think unfoldForest doesn't even need inspiration from the internal code of unfoldTree. They are just one map away. unfoldForest f = map (unfoldTree f)
00:32 <erisco> monochrom, let unfoldTree f z = fmap (\(a,b) -> Data.Tree.Node a (unfoldTree f b)) (f z) in unfoldTree I think
00:32 zzz joined
00:33 <monochrom> unfoldTree? unfoldForest2?
00:33 <erisco> you asked me to rewrite my unfold to work on Data.Tree.Tree
00:34 <erisco> er, Data.Tree.Forest
00:34 <erisco> too much foliage
00:35 Anonymous0250 joined
00:36 <monochrom> @type let u f z = fmap (\(a,b) -> Data.Tree.Node a (u f b)) (f z) in u
00:36 <lambdabot> (t -> [(a, t)]) -> t -> Forest a
00:36 <monochrom> OK that looks like your proposed type.
00:36 plutoniix joined
00:36 ziyourenxiang joined
00:36 roar joined
00:37 <monochrom> > let u f z = fmap (\(a,b) -> Data.Tree.Node a (u f b)) (f z) in u (\b -> (b, if b==0 then [] else [b-1])) [3,1,4,5]
00:37 <lambdabot> error:
00:37 <lambdabot> • Couldn't match expected type ‘[(a, [t0])]’
00:37 <lambdabot> with actual type ‘([t0], [[t0]])’
00:37 <erisco> > let u f z = fmap (\(a,b) -> Data.Tree.Node a (u f b)) (f z) in u (fmap (\b -> (b, if b==0 then [] else [b-1]))) [3,1,4,5]
00:37 <lambdabot> [Node {rootLabel = 3, subForest = [Node {rootLabel = 2, subForest = [Node {r...
00:38 <monochrom> Ah right.
00:39 <monochrom> OK, I think their design was firstly to stick to (b -> (a, [b])) because unfoldTree did it, and not suddenly switch to (b -> [(a, b)])
00:40 <erisco> mine was based on how I expect unfolds to look
00:40 <monochrom> Once that's decided, it became a case of fmapping from b->Tree to [b]->[Tree]
00:40 <monochrom> That is not an accurate statement.
00:41 <monochrom> The accurate statement is "based on how Forest is defined"
00:41 <erisco> which statement is it correcting?
00:41 <monochrom> "based on how unfolds look"
00:41 <erisco> I knew nothing of Forest when I made my definition
00:43 <erisco> I am expecting unfolds to look like (b -> F b) -> b -> F for some F
00:43 <benzrf> erisco: u mean Fix F at the end there?
00:43 <erisco> sorry I have a little kind error there
00:43 <monochrom> But there are two different F's.
00:43 <monochrom> "they are equivalent" is still not going to cut it.
00:44 <erisco> benzrf, yeah that would clean it up the best, thanks
00:44 <monochrom> Or rather, "their respective Fix F's are equivalent" is not going to cut it.
00:44 <erisco> what is equivalent?
00:44 darlan joined
00:44 <benzrf> like isomorphic but respecting higher morphisms
00:45 <erisco> you mean when I pointed out my Tree is the same as their Forest?
00:45 <monochrom> Not to mention that it is more complicated than two Fix F's.
00:45 <monochrom> There is one functor F2, such that your type is Fix F2.
00:46 <erisco> I've tried to make this clear from the start but it hasn't got through
00:46 <erisco> which is why I was questioning this entire line of investigation
00:46 <monochrom> Data.Tree.Forest, on the other hand, is stranger than that. There is a functor G1, such that Data.Tree.Tree is Fix G1; and then Forest is [Fix G1].
00:46 <erisco> I am not claiming the way I did it is the correct way
00:46 <erisco> I am asking how they derived their answer so I have some basis to compare the two
00:46 ertes joined
00:46 <erisco> because I haven't a clue how they did
00:47 <monochrom> OK, did you see what I said about <monochrom> I think unfoldForest doesn't even need inspiration from the internal code of unfoldTree. They are just one map away. unfoldForest f = map (unfoldTree f)
00:47 <monochrom> unfoldTree is likely what you expect out of Fix G1.
00:47 plutoniix joined
00:48 <monochrom> But what to do with [Fix G1]? Looks to me lifting b->FixG1 to [b]->[FixG1] is pretty natural.
00:49 <erisco> then maybe it is because they're only treating Forest as an alias for [Tree a]
00:50 <erisco> I am not sure how unfolding would generally apply to such cases, but this is what they did, okay
00:52 <erisco> it gives me little reason to use the Data.Tree module for this scenario though... hm
00:52 <erisco> I've been rather annoyed with trying to find some umbrella for these tree-like things
00:53 watabou joined
00:54 <erisco> not sure if that even practically exists or if we just have to accept a zoo of them
00:54 aarvar joined
00:54 <monochrom> The umbrella is Fix.
00:55 <monochrom> All recursive algebraic data types in which the recursion happens at only positive (covariant) positions are trees, and vice versa.
00:55 plutoniix joined
00:55 <monochrom> So all of them are Fix Something
00:55 <erisco> well the annoyance is trying to find how much or little structure is necessary, and what that structure is, to define the interesting algorithms
00:56 takle joined
00:56 <erisco> yes they are all a Fix of something but the somethings are significant
00:56 <monochrom> But you will never be able to escape from this nightmare. Functors H1 and H2 are non-equivalent, but Fix H1 and Fix H2 are. But your cata and ana formulas depend on H1 and H2 directly. Now you have two conflicting stories.
00:57 pent joined
00:57 <erisco> I tried approaching it with zippers, or something inspired by that
00:57 latro`a joined
00:57 <erisco> so I may not know the actual tree type, say, but I have some type which can let me zoom around any tree
00:58 <monochrom> For example "data H1 r = Nil | Cons Int r", "data H2 r = None | One Int r | Two Int Int r", for redundancy's sake.
00:58 <erisco> and then you can define algorithms on that
00:58 plutoniix joined
00:59 <monochrom> Actually I guess this is not an example.
00:59 NeverDie joined
00:59 mr_sm1th joined
01:00 steeze joined
01:01 <erisco> this is the type I started working with
01:01 <erisco> http://lpaste.net/355259
01:01 <erisco> for example, 'Location Pair a' can be the locations in a list
01:02 <erisco> 'Location Triple a' can be the locations in a binary tree
01:03 <erisco> so by knowing just a little bit about j I can write useful algorithms for it... or at least that is the hope
01:03 <monochrom> This is an interesting type. Like free monad but different.
01:03 <erisco> the only charge is to convert your type to Location J A for some J and A
01:03 xcmw joined
01:04 takle joined
01:04 <erisco> the first thing I started thinking about is routes
01:04 anuxivm left
01:04 <erisco> for example, with lists, we have both forwards and backwards available to us
01:04 <erisco> so a route may be to always go forward, for example
01:05 <monochrom> OK yeah I see that Fix is too unspecific. Free monads are Fix's too but we can say so much more about free monads.
01:05 <erisco> and maybe this is done by providing an f :: Pair a -> a which projects the forward location
01:05 <erisco> yeah I also looked at Free and Cofree
01:06 jer1 joined
01:07 <erisco> then you might have more sophisticated routes which are stateful
01:07 <erisco> at least that was the initial thinking... some route through the locations, then some fold over the locations
01:07 <EvanR> can i have syntax for chaining U a -> (a -> V b) -> V b's
01:07 <* ski> . o O ( aka `newtype List ref a = MkList (ref (Cell ref a)); data Cell ref a = Nil | Cons a (List ref a)' )
01:08 lambdamu_ joined
01:08 <erisco> but I was also realising that in my specific use my route splits
01:09 ludat joined
01:09 <erisco> I am actually interesting in the paths of the tree in my particular case
01:09 <erisco> but not just a list of paths as I have to cull them early as I explore them
01:09 <erisco> otherwise my program simply takes too long :)
01:11 plutoniix joined
01:14 epsilonhalbe joined
01:14 blym_ joined
01:14 fDev2179 joined
01:16 ridho joined
01:17 epsilonhalbe left
01:18 takle joined
01:21 <erisco> okay here is another curiosity... maybe some thoughts on it http://lpaste.net/355260
01:21 <erisco> lets not get hung up on whether it resembles a mux or not :P
01:22 <erisco> so we have the recognisable [m a] -> m [a] type which we know as sequence, but this is doing something else
01:22 Supersonic112_ joined
01:23 <erisco> and I am not sure yet if this is something particular to State or if there is really something generic like sequence going on, possibly with something more than just a Monad
01:23 <ski> erisco : that `join' there must be wrong ..
01:24 <erisco> I did a quick retrofit... did I mess up? let me check
01:24 <ski> (or else the type signature is wrong)
01:24 halogenandtoast joined
01:24 plutoniix joined
01:25 oisdk joined
01:25 <ski> `Monoid s => [State s a] -> State s [a]' might be more fun, btw
01:25 scottj joined
01:25 <erisco> yes that should not have been there at all, thanks. I removed it
01:26 <erisco> it generalises from list to any Functor as well
01:27 <erisco> mm perhaps yes, but then if your state is not a Monoid then not so much, heh
01:27 <ski> not with `Monoid'
01:27 <ski> you need `Foldable', i suppose
01:27 <erisco> I was commenting prior to your message
01:28 <erisco> multiplex :: (Functor f) => f (State s a) -> State s (f a)
01:28 <erisco> so another way to look at this, maybe, is interchanging functors
01:28 <erisco> f (g a) for g (f a)
01:29 <erisco> :t sequence
01:29 <lambdabot> (Monad m, Traversable t) => t (m a) -> m (t a)
01:29 Costar joined
01:29 <erisco> that's not such a great way to distinguish it from sequence though, hm
01:29 <erisco> since Monad and Traversable both are Functor
01:30 zcourts joined
01:30 bjz joined
01:31 <erisco> I suppose all I can do is figure out the properties of it and go from there
01:31 <erisco> it is crucial for searching the paths of a tree
01:32 plutoniix joined
01:34 flatmap13 joined
01:35 oisdk joined
01:35 plutoniix joined
01:36 <erisco> EvanR, yeah, if you also have bind for V
01:36 <EvanR> oh?
01:36 <erisco> EvanR, then you do the unthinkable and make a bogus class for the purposes of overloading an operator
01:37 <ski> is `U = State sr' and `V = Reader sr' ?
01:38 <EvanR> no
01:38 <EvanR> but good point, it would be a monad if there was an embeding of U into V
01:38 <erisco> class Heresy f g where (><=) :: f a -> (a -> g b) -> g b; instance Monad m => Heresy m m where (><=) = (>>=)
01:41 bjz joined
01:41 blym_ joined
01:41 systadmin joined
01:42 kgadek joined
01:43 plutoniix joined
01:43 kv_ joined
01:44 permegreen joined
01:44 takle joined
01:47 raichoo_ joined
01:49 tromp joined
01:49 oisdk joined
01:50 <kv_> Hey haskell list! I'm working on a compiler with multiple AST transformations for a little language. I want some of the passes to put a placeholder for another transform to fill in eventually. Currently I am accomplishing this with strings and I feel like there are better type-safe approaches. Any suggestions to google or blog posts I should check out?
01:50 blym_ joined
01:51 <lyxia> kv_: How about defining an ADT for your placeholders
01:52 a3Dman joined
01:52 kgadek joined
01:52 <lyxia> That would be safer
01:52 sqrt2 joined
01:52 <kv_> Yeah i was think about potentially using a phantom type in the AST parameterized over the placeholder ADT
01:52 plutoniix joined
01:53 twomix joined
01:53 steeze joined
01:53 <DrMentats> kv_: I asked a similar question a while ago and people sent this my way
01:53 <erisco> that's good instinct. can you provide more detail on what these placeholders are?
01:53 <DrMentats> https://www.microsoft.com/en-us/research/wp-content/uploads/2016/11/trees-that-grow.pdf
01:53 <DrMentats> maybe it helps you
01:54 Goplat joined
02:00 hucksy_ joined
02:01 vancoder joined
02:02 takle joined
02:04 plutoniix joined
02:05 jsgrant_om joined
02:07 sqrt2 joined
02:07 NeverDie joined
02:09 halogenandtoast joined
02:10 <Xnuk> t
02:12 <kv_> @DrMentats thanks for the link! The context is I am try to create a program that ultimately gets localized to multiple versions. The AST for the program is essentially the same up until the localization step and I need to insert some language specific into parts of the AST
02:12 <lambdabot> Unknown command, try @list
02:14 oisdk joined
02:14 Argue_ joined
02:15 ridho joined
02:15 exferenceBot joined
02:16 cschneid_ joined
02:16 cschneid_ joined
02:17 systemfault joined
02:18 xall_ joined
02:20 takle joined
02:22 brynedwardz joined
02:23 ridho joined
02:24 dofus joined
02:24 mmachenry joined
02:25 mmachenry1 joined
02:31 <rotaerk> is there some way to disable latex awareness in vim for .lhs files?
02:31 <rotaerk> its syntax highlighting is thrown off by the presence of $ in the text of my document...
02:32 <rotaerk> since $ is a special character in latex
02:32 splanch joined
02:32 <rotaerk> I'd rather the lhs be nothing more than a plain-text file with the occasional code indicated by >s
02:33 splanch_ joined
02:34 spacecadetbrown joined
02:35 panovia joined
02:35 kv_ joined
02:36 exferenceBot joined
02:36 systemfault joined
02:36 HEGX64 joined
02:38 halogenandtoast joined
02:39 fDev2179 left
02:40 plutoniix joined
02:40 takle joined
02:41 govg joined
02:41 hexagoxel joined
02:41 splanch joined
02:43 splanch_ joined
02:43 <sophiag> i'm trying to write a monad transformer as an exercise and wondering why MonadState, MonadWriter, MonadReader, etc. aren't showing up in Control.Monad.Trans.State, etc.?
02:44 <glguy> That module is from transformers, but those classes are from mtl
02:44 <dmwit> rotaerk: :syn off
02:44 <sophiag> is the problem i'm using the wrong constructors and it should be StateT instead of MonadState?
02:44 <glguy> transformers provides all of the types and operations. mtl adds the classes.
02:45 <dmwit> sophiag: import Control.Monad.State instead.
02:45 {emptyset} joined
02:45 <rotaerk> dmwit, think that turns off all highlighting; I just mean, the only highlight should be on the code sections
02:45 <glguy> MonadState and StateT are just two different things
02:45 <glguy> first will be to figure out which one you actually needed
02:45 <rotaerk> it's currently highlighting non-code sections because of latex
02:45 <dmwit> rotaerk: Ah, yeah, that change is much more involved. You'd need to find the syntax file being used and strip out the bits you don't like.
02:45 <rotaerk> although ... it just stopped when I did :filetype off and :filetype on ...
02:46 <rotaerk> not sure why
02:46 <sophiag> dmwit: thanks. for some reason i thought i tried that...
02:46 oaao joined
02:46 splanch__ joined
02:46 e14 joined
02:46 <dmwit> rotaerk: vim doesn't parse the whole file by default. So sometimes it needs to update its parse to either look at less context or more.
02:47 <rotaerk> ah
02:47 <glguy> You can press ^L to redraw/update that
02:48 <rotaerk> thanks
02:53 blym_ joined
02:55 typedrat joined
02:56 <sophiag> sorry, another question about monad transformers...the whole reason i went back and did a refresher on them was to try and understand Oleg's version of a zipper that uses continuations. he uses a custom transformer for delimited continuations in that example, but i was hoping to modify it to use ContT
02:57 acertain joined
02:58 NeverDie joined
02:58 halogenandtoast joined
02:59 <sophiag> this is my sad attempt at just creating a type synonym with ContT stacked over his Zipper data type: http://lpaste.net/355263
03:00 <sophiag> i should mention i've yet to go through his continuations tutorial, although i've used ad hoc shift and reset a little bit
03:00 splanch joined
03:01 jer1 joined
03:03 felixsch_ joined
03:05 otto_s_ joined
03:06 meba joined
03:07 <EvanR> where is Fix...
03:07 ADG joined
03:07 eacameron joined
03:08 <ADG> should doing stack upgrade make it to latest version but performing this again does the same thing
03:08 Durbley joined
03:09 sssilver joined
03:10 mrkgnao joined
03:11 joseCova joined
03:13 <MarcelineVQ> the new stack binary, and any other executable created with stack upgrade or stack install, is placed at ~/.local/bin you need to point your path there to be using the latest one
03:13 Argue joined
03:14 <MarcelineVQ> oh, he didn't stick around :(
03:17 biglambda joined
03:19 hybrid joined
03:19 sellout- joined
03:19 <MarcelineVQ> sophiag: you forgot to ask your question :o
03:20 tromp joined
03:21 sellout- joined
03:22 <sophiag> it was more of the stupid child from passover sort of question
03:22 <sophiag> "doesn't know enough to ask one..."
03:23 <sophiag> i'm going to go through Oleg's continuations tutorial, but often it's amazingly helpful when someone here is in the mood to walk you through things. i learn a lot just by keeping this channel open in a buffer when i'm working tbh
03:24 <c_wraith> sophiag: that was a large part of my initial effort in learning haskell, too
03:25 a3Dman joined
03:28 darjeeling_ joined
03:28 uglyfigurine joined
03:29 ridho joined
03:31 bjz joined
03:31 takle joined
03:31 dofus joined
03:35 flatmap13 joined
03:36 Costar joined
03:40 roar joined
03:41 <Welkin> what is oleg's continuations tutorial? link?
03:41 sgronblo joined
03:42 xcmw joined
03:44 <sophiag> http://okmij.org/ftp/continuations/implementations.html
03:46 mzf joined
03:47 takle joined
03:51 spacecadetbrown joined
03:53 amosbird joined
03:55 blym_ joined
03:55 takle joined
04:01 blym_ joined
04:03 OnkelTem joined
04:07 DrMentats left
04:13 takle joined
04:13 pera joined
04:16 splanch joined
04:20 Xanather joined
04:20 takle joined
04:24 commiefornia joined
04:25 sellout- joined
04:25 fruittec joined
04:26 plot joined
04:27 JuanDaugherty joined
04:28 zero_byte joined
04:34 zcourts joined
04:36 paolino joined
04:38 scottj left
04:41 eklavya joined
04:41 takle joined
04:44 dsfox1 joined
04:47 plot joined
04:50 tromp joined
04:54 moongazer joined
04:57 f-a joined
04:58 xcmw joined
04:58 flatmap13 joined
04:59 halogenandtoast joined
04:59 takle joined
05:01 descender joined
05:03 takuan joined
05:10 {emptyset} joined
05:11 biglambda joined
05:12 blym_ joined
05:12 nickolay joined
05:15 wei2912 joined
05:16 uuplusu joined
05:16 <jchia_3> Monad transformer question. I'm making a conduit based on IO that updates state (StateT) and uses some fixed config information (ReaderT). Which stack makes more sense? Consumer (Id, ss) (ReaderT r (StateT s (ResourceT m))) rs or Consumer (Id, ss) (StateT s (ReaderT r (ResourceT m))) rs ? Or it doesn't really matter?
05:17 <jchia_3> Basically, which ordering of ReaderT and StateT is better?
05:17 takle joined
05:18 <glguy> ?unmtl StateT s (ReaderT e IO) a
05:18 <lambdabot> s -> e -> IO (a, s)
05:18 <glguy> ?unmtl ReaderT e (StateT s IO) a
05:18 <lambdabot> e -> s -> IO (a, s)
05:18 <glguy> Doesn't matter
05:19 osa1 joined
05:19 <jchia_3> glguy: Can I expect an difference in performance?
05:21 BartAdv joined
05:22 <glguy> I wouldn't. There shouldn't be, but of course it's possible that it somehow affects an optimization somewhere and there's a slight difference
05:25 JuanMiguel joined
05:25 blym_ joined
05:25 <jchia_3> OK
05:29 Wingsorc joined
05:29 hamishmack joined
05:30 xxalien8dxx joined
05:30 eacameron joined
05:31 dofus joined
05:32 jgertm joined
05:32 systadmin joined
05:32 sleffy joined
05:33 splanch joined
05:34 ilyaigpetrov joined
05:36 <EvanR> k my code literally has fmap (fmap (fmap f)) d in it
05:36 takle joined
05:36 <EvanR> this is silly
05:37 <EvanR> and its the base of a small pyramid of fmaps
05:37 blym_ joined
05:37 <EvanR> DeriveFunctor should really just be locked into enabled
05:40 ghatom joined
05:41 v0latil3 joined
05:42 <ghatom> am I gonna get booted from here for saying: "Sorry, Blackberry - Loved you, but GTFO"?.... sure did at irc.twit.tv -- F-Leo
05:42 sgronblo joined
05:44 <ghatom> deb rc3 + tmux + irssi + mocp + yup still: lynx = decent fri night.....
05:44 <glguy> ghatom: This channel is for discussing the Haskell programming language. Are you here about that?
05:44 <ghatom> X is for fools..... lol
05:44 <glguy> It's not for general chatter
05:45 <ghatom> another douche to boot for open speak.... thx
05:45 <ghatom> glguy = gay-lovin guy
05:45 was kicked by glguy: offtopic
05:47 dmiles joined
05:48 lambda-11235 joined
05:49 <dmwit> EvanR: Learn to love Compose.
05:49 <dmwit> https://hackage.haskell.org/package/base-
05:50 <EvanR> heres another one... i wrote the Monoid instance... now im going to implement Applicative by writing first f a -> f b -> f (a,b). and the code is basically the same
05:50 <EvanR> something fishy
05:51 <EvanR> guess i could implement Monoid with Applicative
05:51 Welkin joined
05:51 <Costar> Is possible a function ((a -> x) -> x) -> a ???
05:52 <dmwit> There's got to be an `instance (Applicative f, Monoid a) => Monoid (SomeNewtypeWrapper f a)` somewhere.
05:52 <dmwit> :t \f -> f id
05:52 <lambdabot> ((a -> a) -> t) -> t
05:52 <dmwit> Costar: If you can pick `x ~ a`, then sure.
05:52 <EvanR> @djinn ((a -> x) -> x) -> a
05:52 <lambdabot> -- f cannot be realized.
05:53 <glguy> Costar's type looks too much like double negation elimination to be realizable
05:53 insitu joined
05:53 <dmwit> :t runCont
05:53 <lambdabot> Cont r a -> (a -> r) -> r
05:53 <Costar> I got it right so
05:53 hurkan joined
05:53 <Costar> I tought x ~ a was bad
05:54 <dmwit> But yeah, you can't implement that type in its full generality. As the other folks are saying.
05:54 <Costar> Thank you
05:54 <EvanR> heh, but then implementing pure is easy with mempty
05:54 <Costar> Im just trying to catch Yoneda Lemma for the Identity Functor
05:55 <EvanR> pure x = fmap (const x) (mempty :: f ())
05:56 <jchia_3> Another monad transformer question. I have a ReaderT r somewhere in the middle of my monad transformer stack. How do I change it to ReaderT (r, a)? Basically, the idea is that you can give me a (r, a) from outside, but I'm still just going to read the r. Concretely, how can I change `ConduitM i o (ReaderT r m) ()` to `ConduitM i o (ReaderT (r, a) m) ()`? Can I accomplish that using the right combination of hoist and withReaderT?
05:56 <EvanR> feeding off of each other
05:56 <glguy> withReaderT fst :: ReaderT r m a -> ReaderT (r, b) m a
05:57 <dmwit> EvanR: Do you have `pure id <*> v = v`?
05:57 nirvinm joined
05:58 <jchia_3> glguy: Yeah, but withReaderT fst expects a "ReaderT ...", not a "ConduitM ...". What else do I need?
05:58 <EvanR> yeah
05:58 <glguy> jchia_3: You'll need ConduitM's version of 'mapReaderT :: (m a -> n b) -> ReaderT r m a -> ReaderT r n b', maybe that's the hoist you mentioned?
06:01 <jchia_3> glguy: Yeah, except I'm not sure what exactly it is.
06:02 drcode joined
06:02 <glguy> I don't have that library memorized, I don't use it
06:03 JeanCarloMachado joined
06:03 <glguy> It seems that it is hoist http://hackage.haskell.org/package/mmorph-1.0.9/docs/Control-Monad-Morph.html#t:MFunctor
06:03 exferenceBot joined
06:05 <EvanR> :t fst <*> snd
06:05 <lambdabot> (b -> b1, b) -> b1
06:05 soniku joined
06:07 spacecadetbrown joined
06:07 Sh4rPEYE joined
06:08 <Sh4rPEYE> Hello. Is there a way to achieve coloring in GHCi, similar to this: https://www.reddit.com/r/haskell/comments/144biy/pretty_output_in_ghci_howto_in_comments/
06:08 <Sh4rPEYE> The method described there doesn't work when a module is loaded in GHCi. Is there a better way now, after 4 years?
06:09 <cocreature> jchia_3: I think "hoist (withReaderT fst)" should do what you want
06:12 <cocreature> :t hoist (withReaderT fst)
06:12 <lambdabot> (Monad m, MFunctor t) => t (ReaderT r m) b1 -> t (ReaderT (r, b) m) b1
06:12 <osa1> anyone know if "Simple unification-based type inference for GADTs" is the most recent paper on GHC GADT type checking?
06:16 takle joined
06:18 jb55 joined
06:19 pandeiro joined
06:20 <osa1> ugh, that paper doesn't even mention desugaring to Core/SystemFC
06:21 <[exa]> osa1: actually I'd suggest reading THIH
06:21 <osa1> what's that?
06:21 <[exa]> Typing Haskell In Haskell
06:21 <osa1> does that mention desugaring to Core?
06:21 <[exa]> nope
06:21 <[exa]> but it gives hints to most complicated situations
06:21 alien8 joined
06:22 <[exa]> aaaaaaaaaaaand has typeclasses.
06:22 <[exa]> btw desugaring isn't that hard, is there something specific you're looking for?
06:22 xtreak joined
06:22 teggi joined
06:23 <osa1> I don't think that paper has GADTs in type system
06:23 takle joined
06:24 <[exa]> oh I see, misunderstood your question, sorry :]
06:24 <cocreature> osa1: maybe there is some paper that explains desugaring of existentials? gadts are just existentials with type equality constraints
06:24 <osa1> I found something relevant: "System FC with Explicit Kind Equality"
06:24 <osa1> cocreature: type equality constraints part is especially important in my case :)
06:25 <osa1> but I think I found the paper I'm looking for
06:25 splanch joined
06:26 jb55 left
06:27 connrs joined
06:27 Wizek joined
06:28 Wizek__ joined
06:28 jb55 joined
06:28 <rotaerk> hmm the > prefixes in literate haskell ruin my ability to indent/unindent lines...
06:28 <rotaerk> since it wants to add/remove the spaces *before* the >
06:28 <EvanR> reprogram the editor
06:29 <rotaerk> I suppose, I mean I can do it with substitutions
06:29 zcourts joined
06:30 cfoch-always joined
06:30 <cfoch-always> hi
06:30 <cfoch-always> can I use Diagrams in other language?
06:31 <Cale> cfoch-always: That sounds like a difficult plan.
06:31 <Cale> Even just porting the library will be tricky given how extensively it relies on type classes
06:32 Gloomy joined
06:33 <cfoch-always> Cale: can I write a software interactive diagrams with Diagrams? I want to create a software to create conceptual maps
06:33 ninedotnine joined
06:34 ubsan_ joined
06:37 takle joined
06:37 fruittec joined
06:37 <Cale> Probably, though it would depend on what you're doing -- it's not totally ideal for fast animations.
06:37 jer1 joined
06:40 blym_ joined
06:40 <jchia_3> glguy, cocreature, yeah, it's hoist that I need.
06:40 raichoo joined
06:40 FreemanXiong joined
06:42 <jchia_3> When I get a type error from ghc, is there an easy way to tell whether it's because I have wrong types or it's because ghc needs some help from type annotation? I just spent 30 minutes scratching my head over a compilation error where it turned out that ghc just needs help with type annotation. The error is "Couldn't match type ... because type variable 'o' would escape its scope"
06:43 vlatkoB joined
06:43 <cocreature> jchia_3: experience helps but apart from that there is no magic trick that tells you whether you need a type annotation or not
06:43 <jchia_3> At first I thought I had wrong types
06:43 <dysfun> that sounds like the errors you get when doing universal quantification accidentally wrong
06:44 <EvanR> you need type signatures when using RankNTypes probably
06:44 <Hafydd> jchia_3: not having the correct type annotations is a form of having wrong rtpes.
06:44 <Hafydd> *types
06:44 <dysfun> types and code are two halves of the same coin
06:44 <jchia_3> Hafydd: By 'wrong' I mean it cannot possibly make sense no matter what types are assigned to the different parts
06:44 <EvanR> that error message should say "type inference epically failed due to use of higher ranked type"
06:44 takle joined
06:44 <EvanR> "put a type signature"
06:45 <Hafydd> Oh...
06:45 <jchia_3> I am indeed using RankNTypes
06:45 FreemanXiong joined
06:45 Welkin joined
06:45 <jchia_3> EvanR: Yeah, that would be a more helpful message
06:45 <EvanR> i usually have to do this when i use a higher ranked type function in a where clause
06:46 <EvanR> and then i have to enable ScopedTypeVariables too
06:46 <EvanR> fun for the whole family
06:46 <cocreature> in general adding type signatures when you’re confused about a type error is always a good first step
06:46 <cocreature> EvanR: and then you forget to add explicit foralls and wonder why enabling ScopedTypeVariables didn’t help :)
06:47 <EvanR> well, i know that now
06:47 <EvanR> but yeah
06:47 <EvanR> thats a "gotcha"
06:52 connrs joined
06:53 Itkovian joined
06:55 takle joined
06:55 eacameron joined
06:56 cschneid_ joined
06:59 codesoup joined
07:00 halogenandtoast joined
07:00 jbgi joined
07:00 blym_ joined
07:02 <dmwit> jchia_3: Type inference for higher-rank types is undecidable, which tells me that "no, there is no easy way to tell whether GHC needs help from type annotation", and possibly no way at all, easy or hard.
07:02 spacecadetbrown joined
07:04 <dysfun> why is it undecidable?
07:04 coot joined
07:04 uglyfigurine joined
07:04 eacameron joined
07:07 soniku joined
07:07 meba joined
07:07 mrkgnao joined
07:08 afarmer joined
07:08 <dmwit> dysfun: http://www.sciencedirect.com/science/article/pii/S0168007298000475 appears to be the canonical reference
07:09 <cocreature> interestingly it is decidable for Rank2Types
07:09 <cocreature> which is why we had both extensions in GHC for a while (we still have Rank2Types but the name is a lie. it just enables RankNTypes)
07:10 <dysfun> dmwit: thanks
07:14 vlatkoB_ joined
07:17 jgertm joined
07:18 javjarfer joined
07:19 torstein_ joined
07:21 <javjarfer> Hi, edwardk I have been thinking in what you said days ago about frp performance scaling
07:22 takle joined
07:22 <javjarfer> Do you think it's​ a problem with the model itself, or with current implementations?
07:28 slack1256 joined
07:29 zeroed joined
07:29 qqwy joined
07:32 insitu joined
07:36 takle joined
07:38 Mon_Ouie joined
07:39 dni joined
07:40 Welkin joined
07:40 matthewbauer joined
07:40 <javjarfer> Could anyone correct me? Is the MonadMoment the responsible of building the event graph under the hood while using the combinators in reactive banana?
07:40 marr joined
07:41 filterfish joined
07:44 louispan joined
07:45 Welkin joined
07:47 pyx joined
07:54 takle joined
07:57 eacameron joined
07:58 geekosaur joined
08:01 Gloomy joined
08:01 spacecadetbrown joined
08:02 baldrick1 joined
08:02 takle joined
08:06 soniku joined
08:06 SlashLife joined
08:07 FreemanXiong joined
08:08 randomguy1997 joined
08:08 tv joined
08:08 tv joined
08:11 matthewbauer joined
08:12 tlevine left
08:12 takle joined
08:13 FreeBirdLjj joined
08:14 randomguy1997 left
08:14 jchia_1 joined
08:15 balor joined
08:17 orhan89 joined
08:20 mohsen_ joined
08:20 dni joined
08:20 electrostat joined
08:21 cloudhead joined
08:25 takle joined
08:27 systadmin joined
08:28 eklavya joined
08:28 dni joined
08:28 lc_ joined
08:29 lep-delete joined
08:29 <NickHu> I'm using haskell persistent - I know with selectList you can provide a SelectOpt of Asc SomeField, but what if I want to order by ascending of one field, and then by another field also to break ties?
08:31 filterfish joined
08:31 jchia_1 joined
08:32 matthewbauer joined
08:32 augur joined
08:32 baldrick1 joined
08:32 FreeBirdLjj joined
08:33 eacameron joined
08:33 takle joined
08:33 dni joined
08:34 splanch joined
08:36 jchia_1 joined
08:38 augur joined
08:39 eacameron joined
08:39 Welkin joined
08:40 takle joined
08:41 <mauke> https://68.media.tumblr.com/4070d7fb14ec7eb5ba122227980431ba/tumblr_inline_onfnngKJao1t88c9m_1280.png
08:41 jchia_1 joined
08:41 conal joined
08:42 mjora7 joined
08:43 <cocreature> NickHu: this is only a guess but have you tried providing multiple Asc options?
08:43 oisdk joined
08:43 jchia_1 joined
08:44 balor joined
08:45 danvet joined
08:45 quobo joined
08:45 Guest__ joined
08:45 gawen joined
08:45 <Myrl-saki> Is there no Indexed Monad Fixedpoint?
08:46 <Myrl-saki> Oh, there is.
08:47 jutaro joined
08:47 jchia_1 joined
08:49 montik joined
08:50 fotonzade joined
08:50 dni joined
08:51 bairyn joined
08:52 tromp joined
08:53 matthewbauer joined
08:53 conal joined
08:54 hurkan left
08:54 rockfordal joined
08:54 <NickHu> cocreature: oh of course, yes
08:55 dni joined
08:55 <NickHu> Is there a way to ensure the results are unique with respect to a certain column during the select? I could nubBy the results, but that feels like it would be slow
09:01 halogenandtoast joined
09:02 eacameron joined
09:03 biglambda joined
09:04 augur_ joined
09:05 takle joined
09:06 dni_ joined
09:08 meba joined
09:09 halogenandtoast joined
09:12 jer1 joined
09:12 takle joined
09:13 matthewbauer joined
09:14 conal joined
09:15 jeltsch joined
09:15 jutaro joined
09:16 zcourts joined
09:17 Itkovian joined
09:19 arquebus joined
09:20 arquebus joined
09:21 arquebus joined
09:22 halogenandtoast joined
09:22 arquebus joined
09:23 mmn80 joined
09:23 Daniel070189 joined
09:23 arquebus joined
09:24 arquebus joined
09:25 _kit_ joined
09:26 ziyourenxiang joined
09:26 acidjnk22 joined
09:26 Daniel070189 left
09:28 ixxie joined
09:30 Levex joined
09:32 <athan> why isn't there a `dumpTChan :: TChan a -> STM [a]`?
09:33 <athan> it would just be `tryReadTChan` repeatidly until Nothing is returned
09:34 Welkin joined
09:34 matthewbauer joined
09:34 jutaro joined
09:35 Itkovian joined
09:35 _kit_ joined
09:36 <srhb> athan: Ask and answered, I guess. :)
09:37 bjz_ joined
09:37 FreeBirdLjj joined
09:38 <Myrl-saki> lol
09:38 <Myrl-saki> srhb: There are a lot of auxiliary functions in libraries though.
09:38 <srhb> True enough
09:40 <systadmin> hello
09:41 robotroll joined
09:41 <systadmin> I was trying to install Pandoc via stack then I ran into this error http://lpaste.net/355268
09:42 <srhb> systadmin: Did you try doing as it suggests?
09:43 <systadmin> I already have GHC installed
09:44 Splike joined
09:44 <systadmin> Oh wait, there seems to be a newer version of GHC available for me now.
09:44 takle joined
09:44 <systadmin> Nevermind, my bad
09:44 <srhb> systadmin: Regardless, it details both cases. :)
09:44 <systadmin> heh
09:44 <athan> srhb: yeah I just thought it would be a common enough need - to dump a TChan, or to empty one explicitly
09:44 <athan> but I guess the intended use case is more granular
09:45 _sg joined
09:49 xall_ joined
09:51 sz0 joined
09:51 eacameron joined
09:52 ADG joined
09:53 <ADG> I am having problem with $ notation, how should I write this: https://hastebin.com/ekukosoyec.hs
09:54 matthewbauer joined
09:55 Argue joined
10:01 meoblast001 joined
10:01 takle joined
10:02 takle joined
10:03 netheranthem joined
10:04 NyanPasu joined
10:04 meoblast001 joined
10:05 DocWinter joined
10:06 <jchia_1> When writing comments or haddock documentation for some function, is there a convention to distinguish between the two different meanings of the word 'return', i.e. the value a function returns and monadic return?
10:06 Yuras joined
10:07 srbaker joined
10:07 JuanMiguel joined
10:07 soniku joined
10:08 <srhb> jchia_1: 'return' is the function, return is the word.
10:08 Michaelt293 joined
10:08 <jchia_1> srhb: So use "`return`" in the comments/docs to indicate monadic return?
10:09 fizbin joined
10:09 <srhb> Apostrophe, iirc, but yes.
10:09 filterfish joined
10:10 <srhb> jchia_1: Other than that, if you're being wordy, you can talk about the value of foo x y z rather than its "return value"
10:10 <srhb> return value is somewhat loaded terminology anyway, and "value" is fully sufficient.
10:10 <jchia_1> ADG: randomR takes as first argument `(a, a)`, not `a`.
10:11 <jchia_1> OK
10:11 <srhb> Result might also be a useful word.
10:12 <srhb> Now exchange 'return' for 'pure' and you'll never have to use the word "return" in either sense! :-)
10:12 <jchia_1> srhb: Actually, I use pure instead of return in my code. I think I never have to use return.
10:13 <srhb> jchia_1: Correct, you don't, since the AMP.
10:13 <jchia_1> However pure is not a verb, so it's weird to say "'pure's blah"
10:13 <srhb> Yes, but "returning" in that sense tends to really mess with newcomers.
10:14 <Myrl-saki> I still prefer return. :(
10:14 <srhb> I would if it didn't have all those strings attached. :-)
10:15 <Myrl-saki> So... do you all use return?
10:15 matthewbauer joined
10:15 phyrex1an joined
10:15 <jchia_1> I'm a newcomer and I prefer to avoid the historical baggage involving synonyms, so I use pure.
10:16 thc202 joined
10:16 <srhb> I use pure because I want to explicitly avoid the confusion arising from the "return" of historical languages.
10:17 <jchia_1> For the same reason, I use traverse instead of mapM
10:18 <Myrl-saki> :t mapM
10:18 <lambdabot> (Monad m, Traversable t) => (a -> m b) -> t a -> m (t b)
10:18 <Myrl-saki> What's wrong with mapM?
10:18 <jchia_1> traverse is more general
10:18 <Myrl-saki> :t traverse
10:18 <jchia_1> and it means the same thing
10:18 <lambdabot> (Applicative f, Traversable t) => (a -> f b) -> t a -> f (t b)
10:18 <Myrl-saki> Oh.
10:18 <Myrl-saki> :t for
10:18 <lambdabot> (Applicative f, Traversable t) => t a -> (a -> f b) -> f (t b)
10:18 a3Dman joined
10:18 jgertm joined
10:19 t7 joined
10:20 sampuka joined
10:22 beerdrop joined
10:22 Xanather joined
10:22 Gurkenglas joined
10:22 ixxie joined
10:23 mstruebing joined
10:26 augur joined
10:26 wildlander joined
10:28 filterfish joined
10:28 Welkin joined
10:28 oisdk joined
10:30 gmcabrita joined
10:30 hoknamahn joined
10:31 jutaro joined
10:33 augur joined
10:34 sillyotter joined
10:35 sillyotter joined
10:36 epsilonhalbe joined
10:37 raatiniemi joined
10:37 gehmehgeh joined
10:38 Mindless- joined
10:39 <Gurkenglas> @let type LensGurk = forall f. Functor f => LensLike f -- why doesnt this work?
10:39 <lambdabot> .L.hs:183:41: error:
10:39 <lambdabot> • Expecting four more arguments to ‘LensLike f’
10:39 <lambdabot> Expected a type, but ‘LensLike f’ has kind ‘* -> * -> * -> * -> *’
10:40 balor joined
10:40 matthewbauer joined
10:42 qwr joined
10:44 alveric joined
10:44 tomphp joined
10:45 wonko7 joined
10:46 dcoutts joined
10:46 dcoutts joined
10:46 conal joined
10:46 mohsen_ joined
10:46 balor joined
10:47 <phadej> Gurkenglas: because type synonyms have to be fully applied, as GHC tells you
10:48 <Gurkenglas> Why is that restriction necessary?
10:49 dni joined
10:52 beerdrop joined
10:53 tromp joined
10:54 SLNP joined
10:54 alveric joined
10:56 richi235 joined
10:56 beerdrop joined
10:57 JuanMiguel joined
10:57 jeltsch joined
11:01 chrisM_1 joined
11:02 Snircle joined
11:03 saep joined
11:04 fotonzade joined
11:05 <lyxia> http://stackoverflow.com/questions/4922560/why-doesnt-typesynonyminstances-allow-partially-applied-type-synonyms-to-be-use
11:06 <Myrl-saki> How ot do nested pattern matching?
11:06 Sonderblade joined
11:06 <Myrl-saki> nested record pattern matching*
11:08 insitu joined
11:08 <geekosaur> shouldn't it just work?
11:08 soniku joined
11:08 _paul0 joined
11:09 <Gurkenglas> lyxia, couldn't it accept that they are equal and only check once the type synonym is fully applied, as it eventually must be if it is to have impact on the runtime? For the second answer, of course e couldn't be set to a type synonym, type synonyms are not a thing to be foralled over.
11:10 <geekosaur> there's an extension to do that
11:11 nesqi joined
11:12 Michaelt293 joined
11:13 <geekosaur> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#type-synonyms
11:13 Big_G joined
11:14 sdothum joined
11:16 <lyxia> mniip also made a proposal related to this https://github.com/mniip/ghc-proposals/blob/partiallyappliedtypefamilies/proposals/0000-partially-applied-type-families.rst
11:17 My_Hearing joined
11:17 baldrick1 joined
11:18 <lyxia> I think there is something fishy about (forall f . Functor f => (... not of kind *)) but I can't quite put my finger on it.
11:19 sgronblo joined
11:20 cyborg-one joined
11:22 Welkin joined
11:23 Levex joined
11:24 dni joined
11:25 dni_ joined
11:25 permegreen joined
11:29 zariuq joined
11:29 <mniip> impredicative polymorphism?
11:29 FreeBird_ joined
11:29 piyush-kurur left
11:31 balor joined
11:32 freusque joined
11:33 ziocroc2 joined
11:35 xtreak joined
11:36 dni joined
11:40 montik joined
11:41 qwertyasdfgh joined
11:41 balor joined
11:42 Wuzzy joined
11:43 Uakh joined
11:43 shangxiao joined
11:44 gri joined
11:44 <gri> Hi everyone
11:45 dni joined
11:45 <gri> I’ve got a straight-forward exercise: send a http request and parse the json in the response
11:45 splanch_ joined
11:45 <gri> the aeson parser results Maybe [MyDataType]
11:46 zeroed joined
11:46 zeroed joined
11:46 spacecadetbrown joined
11:46 ixxie joined
11:46 <gri> should I choose ReaderT ConnectionConfig IO (Maybe [MyDataType] as my signature
11:46 My_Hearing joined
11:46 <gri> or is it better (from the design viewpoint) to hide Maybe behind a MaybeT IO?
11:47 <gri> i.e.
11:47 <lyxia> It's fine to return Maybe
11:47 <gri> ReaderT ConnectionConfig (MaybeT IO) [MyDataType]
11:47 <gri> vs ReaderT ConnectionConfig IO (Maybe [MyDataType])
11:47 ADG joined
11:48 ralu joined
11:48 <gri> what would be a reason to introduce a layer of MaybeT IO?
11:48 <gri> lyxia: thanks
11:48 <ADG> how to generate n distinct random numbers?
11:48 <lyxia> MaybeT is good to compose actions monadically
11:49 <gri> lyxia: and it’s not the case here because…?
11:50 <cocreature> ADG: I don’t think there is something builtin for that. you’ll just have to generate them one by one and generate a new number if you’ve generated it before
11:50 <lyxia> gri: but since there are a fair couple of approaches to exceptions via monad transformers, it's better to have an API that lets users decide what to do with a Maybe result.
11:51 <gri> lyxia: to postpone the decision about the possible failure, so to say?
11:52 <ADG> I am doing: `do gen <- getStdGen delete (randomR (0, length xs - 1) gen) xs...`
11:53 terrorjack joined
11:53 leat joined
11:53 <lyxia> gri: something like that. But it's also mostly a matter of personal preference.
11:53 <cocreature> ADG: that looks weird but I’ll need to see the complete definition to tell if it makes sense
11:53 <gri> ADG you can keep putting your random numbers in a set until its size is n
11:54 <ADG> isn't that imperitive
11:54 <gri> ADG, no it’s just a suggestion :)
11:55 <cocreature> it’s an iterative process but that’s inherent to the task
11:56 <ADG> take n . nub . randomRs
11:57 <cocreature> you can’t nub an infite list
11:57 hackebeilchen joined
11:57 _sg joined
11:57 <gri> and
11:57 <gri> nub is O(n^2)
11:57 cschneid_ joined
11:57 <cocreature> hm maybe you can *looks at the definition*
11:58 <lyxia> > nub [0 ..]
11:58 <lambdabot> [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,2...
11:58 <cocreature> yeah
11:58 <cocreature> then that’s not such a bad solution assuming “n” is small
11:59 anuxivm joined
12:00 <ADG> > take 500 . nub . randomRs (1,671) <$> cocreature getStdGen
12:00 <lambdabot> error:
12:00 <lambdabot> Variable not in scope: cocreature :: IO StdGen -> f g0
12:00 <gri> import Data.Set
12:01 <ADG> > import Data.Set; import System.Random; take 10 . nub . randomRs (1,30) <$> getStdGen
12:01 <lambdabot> <hint>:1:1: error: parse error on input ‘import’
12:01 cpennington joined
12:01 <cocreature> 500^2 might be bad depending on your application
12:01 jgertm joined
12:01 j03_k joined
12:02 <ClaudiusMaximus> if you wanted 4 distinct Ordering values you'll be out of luck whichever way you do it...
12:02 <gri> take n . toList . fromList randomRs
12:02 <gri> smth like this
12:02 FreeBirdLjj joined
12:02 <cocreature> ClaudiusMaximus: 4 distinct bottom values :)
12:03 user__ joined
12:03 JeanCarloMachado joined
12:04 Guest joined
12:07 zero_byte joined
12:07 oisdk joined
12:08 govg joined
12:08 Gloomy joined
12:09 user__ joined
12:12 baldrick1 joined
12:12 eacameron joined
12:14 Levex joined
12:16 piyush-kurur joined
12:16 mtemmerm joined
12:16 Welkin joined
12:16 Shock_ joined
12:17 qwr left
12:17 insitu joined
12:19 Denthir joined
12:28 Destol joined
12:29 Gloomy joined
12:34 govg joined
12:36 wei2912 joined
12:37 pie_ joined
12:41 shangxiao joined
12:42 nilof joined
12:45 nh2 joined
12:45 oisdk joined
12:45 insitu joined
12:46 insitu_ joined
12:49 baldrick1 joined
12:52 teqwve joined
12:53 Levex joined
12:53 leat joined
12:54 Kreest__ joined
12:56 tsmish joined
12:56 wonko7 joined
12:57 FreeBirdLjj joined
12:57 aarvar joined
12:57 Shock_ joined
13:01 darlan joined
13:01 jorj joined
13:09 meba joined
13:10 soniku joined
13:10 Welkin joined
13:10 JeanCarloMachado joined
13:11 FreeBirdLjj joined
13:12 extra- joined
13:20 baldrick1 joined
13:20 leat joined
13:21 epsilonhalbe left
13:26 sepp2k joined
13:26 <robertkennedy> Is there a good way to make `import Test.QuickCheck` work with `stack ghci myProject` when myProject doesn't depend on QuickCheck?
13:26 moongazer joined
13:27 oisdk joined
13:27 <cocreature> robertkennedy: try “stack build QuickCheck”, “stack ghci myProject” “:set -package QuickCheck”
13:28 <athan> Hey everyone. I'm trying to consider a paradigm for a concurrency scenario, where I'd need a "sparse queue" - I mean this as "a TVar stateful map of TChans" - is there a better way to do this? If I recall correctly, `T*` stm variables shouldn't be nested, or "forgotten about" due to scoping (for instance, if the map is the only place where TChan references are stored, and the element gets deleted somehow,
13:28 <robertkennedy> Ah tight didn't know about that `:set` option
13:28 <athan> will garbage collect?), but I'm just not sure if I'll be safe. Can anyone give guidance here?
13:28 <athan> basically, I'm trying to make a system where a thread can be spawned, and check if it has any messages in it's queue, which may be deleted at a later time due to expiration. It's kindof finnicky
13:29 <MarcelineVQ> cocreature, robertkennedy: the short version of all that should be stack ghci --package QuickCheck
13:30 <cocreature> MarcelineVQ: ah right. I switch to often between the various haskell build tools to remember the tool specific solutions :)
13:30 <robertkennedy> athan: I've used a `TVar (Map ClientName (TVar Client))` without problems before
13:31 yqt joined
13:31 <robertkennedy> Or even a `TVar (Map ClientName Client)` where the Client data type has TVar fields
13:31 biglambda joined
13:31 JeanCarloMachado joined
13:32 <athan> robertkennedy: so have I, but I'm trying to ask this from a memory conservative standpoint :)
13:32 <athan> I just want to make sure this won't inhibit garbage collection
13:32 <* athan> isn't sure if TChans are more difficult, too
13:33 levex_ joined
13:33 <robertkennedy> Sorry, in this case is your fear of things being collected too early or too late?
13:34 dm3 joined
13:36 <athan> not collected at all, actually. I'm worried that the actual `x :: TChan a` is needed to be in an actual haskell expression, not some stored data (as in, somewhere inside a `TVar ...` for instance)
13:36 <athan> I know it will work semantically, but I'm not sure if it would be optimal operationally
13:37 bennofs joined
13:38 teqwve joined
13:39 revtintin joined
13:39 soniku joined
13:39 jsgrant_om joined
13:40 SpinTensor joined
13:40 oxcsh joined
13:41 e14 joined
13:41 tpaszun joined
13:41 <fryguybob> athan: I'm not quite sure what your concern is, but you can build any data structure you want with TVars or TChan. It will have some overhead for STM.
13:41 <robertkennedy> Ah I see. The path I took to delete clients, which worked really well for medium numbers of connections (~100 was our usecase, might scale well), was to use `endClient` to switch a `TVar Bool` in the client, and to add another `race_` branch on our client code that watched for that to flip. You can delete from the map on either side.
13:42 insitu joined
13:43 <robertkennedy> In Simon Marlow's book he covers this, if you haven't read it. He doesn't cover the wkRef type though, which may be a better solution
13:45 dni joined
13:48 e14 joined
13:49 nickolay joined
13:49 unyu joined
13:50 teggi joined
13:52 JeanCarloMachado joined
13:54 ckubrak joined
13:58 prophile joined
13:58 JuanMiguel joined
13:59 afarmer joined
14:00 <EvanR> if Reader local is bad, does that mean withReader is really bad
14:00 <cocreature> EvanR: how is “local” bad? I use it all the time
14:00 <EvanR> good question
14:01 moongazer joined
14:01 <EvanR> ive heard opinions expressed but dont really understand them
14:04 permagreen joined
14:04 Welkin joined
14:08 noexcept_ joined
14:09 kmels joined
14:09 cobreadmonster joined
14:09 <nshepperd_> athan: the gc is aware of the contents of mutable variables
14:09 tromp joined
14:12 Noldorin joined
14:14 feth joined
14:14 kiltzman joined
14:15 dni joined
14:15 drets joined
14:15 RayNbow`TU joined
14:15 tromp joined
14:15 thunderrd__ joined
14:16 dni joined
14:17 xtreak joined
14:20 ixxie joined
14:22 jgertm joined
14:22 peterhil joined
14:22 Hjulle joined
14:22 <Hjulle> Is it possible to create type family instances from a fundep class? That is to say, I have "class A a b | a -> b" and want to create all corresponding instances for "type family A' a :: *".
14:23 systadmin joined
14:24 sedeki joined
14:24 shangxiao joined
14:26 NeverDie joined
14:27 <Hjulle> My most promising attempt so far, "class A' a where {type A'_b a :: *}; instance forall a b. A a b => A' a where type A'_b a = b", made the compiler complain that "b" must be bound on LHS. So, my guess is that the answer is no? :/
14:30 JeanCarloMachado joined
14:32 e14 joined
14:32 <robertkennedy> type A' a = A a (A_b a)
14:34 <robertkennedy> But I think you're looking for associated types, right? Why use fundeps? Unless it's in a different library
14:35 eacameron joined
14:36 dni joined
14:38 binaryplease joined
14:40 filterfish joined
14:40 jer1 joined
14:42 theelous3 joined
14:42 acidjnk22 joined
14:42 fosterite joined
14:44 <Hjulle> robertkennedy: Yes, the class and instances are already defined in a different library, and I want to convert them into a type family.
14:45 Deide joined
14:46 simukis joined
14:47 roconnor joined
14:47 <Hjulle> robertkennedy: I think your answer has the kind "Constraint", so there is no way that would work.
14:48 crave joined
14:49 stoopkid joined
14:50 splanch joined
14:50 mrkgnao joined
14:52 mmn80 joined
14:54 <lyxia> I don't think that's possible, unfortunately.
14:55 joseCova joined
14:55 <Hjulle> :(
14:55 ckubrak joined
14:56 <Hjulle> Thanks anyways :)
14:57 <cocreature> might be possible with TH
14:58 biglambda joined
14:58 Gurkenglas joined
14:59 Welkin joined
15:00 systadmin joined
15:00 roconnor_ joined
15:03 pie_ joined
15:03 <robertkennedy> Hjulle: you were looking to create instances = constraints right?
15:04 happyfeet joined
15:04 <happyfeet> hey
15:04 <happyfeet> how can i pass this to a string
15:04 <happyfeet> type Algae = A
15:04 <happyfeet> data A = NA | A A B deriving Show
15:04 <happyfeet> data B = NB | B A deriving Show
15:04 <happyfeet> showAlgae :: Algae → String
15:04 revtintin joined
15:04 jmcarthur joined
15:05 <Hjulle> robertkennedy: You can't easily create all instances given a constraint. Try it yourself.
15:05 pera joined
15:06 <Hjulle> robertkennedy: I want A' a ~ b iff A a b.
15:07 <Hjulle> happyfeet: What do you want to do? Convert something to a string?
15:07 indi_ joined
15:07 <happyfeet> yup
15:07 <Hjulle> happyfeet: Convert what to a string?
15:07 <happyfeet> but the trick part is: i want to do that with a catamorphism
15:08 <happyfeet> cataA :: (Either Null (Prod c d) -> c) -> (Either Null c -> d) -> A -> c
15:08 <happyfeet> cataA ga gb = ga . (id -|- cataA ga gb >< cataB ga gb) . outA
15:08 blbrown_win3 joined
15:08 <happyfeet> so it must be something like:
15:08 <happyfeet> showAlgae = cataA fa fb
15:09 soniku joined
15:11 meba joined
15:11 Goplat joined
15:12 <Hjulle> happyfeet: Since you have "deriving Show", why not just use "showAlgae = show"? ;) (Yes, I know, no catamorphism)
15:13 <happyfeet> @Hjulle: the "standard" defenition i am trying to accomplish is this one:
15:13 <lambdabot> Unknown command, try @list
15:13 <happyfeet> showAlgae (A a1 (B a2)) = "A" ++ showAlgae a1 ++ "B" ++ showAlgae a2
15:13 <happyfeet> showAlgae _ = ""
15:13 <happyfeet> showAlgae (A NA (B NA)) = "AB"
15:13 <happyfeet> and not showAlgae (A NA (B NA)) = "A NA (B NA)" as in your suggestion
15:13 sky58 joined
15:14 <sky58> When does the channel flash: Cannot send to channel
15:14 <sky58> It's happening with me on other channels
15:14 <sky58> ?
15:14 mkoenig joined
15:16 dhil joined
15:16 <Hjulle> :t (><)
15:16 <lambdabot> (Gen a -> Gen a) -> (Gen a -> Gen a) -> Gen a -> Gen a
15:16 flatmap13 joined
15:16 <kosmikus> happyfeet: not sure what exactly your goal is. multirec has a generic show / generic catamorphism for families of mutually recursive datatypes. compdata has as well.
15:17 <zomg> sky58: those channels most likely require you to have a registered nick to talk there. /msg nickserv help
15:17 Welkin joined
15:17 <sky58> okay
15:17 <sky58> So I will have to register first
15:17 <sky58> And then use
15:18 jeltsch joined
15:18 e14 joined
15:18 fizruk joined
15:19 latro`a joined
15:20 RegEchse joined
15:20 <EvanR> crap...
15:21 a3Dman joined
15:21 <EvanR> 10^100 works fine 10^(10^100) does ;)
15:21 <EvanR> not
15:21 <Hjulle> "And then use \n crap..." XD
15:22 <EvanR> im trying to figure out a reasonable maximum Integer for score
15:22 <EvanR> maybe i should ask an ultrafinitist
15:22 <Welkin> > 10^100
15:22 <lambdabot> 1000000000000000000000000000000000000000000000000000000000000000000000000000...
15:22 <Welkin> > 10^(10^100)
15:22 <lambdabot> mueval: ExitFailure 1
15:23 <Welkin> there should be an equation for that
15:23 <Welkin> like gauss's equation for the sum of integers
15:23 <EvanR> its 1 followed by a googol of zeros
15:23 <Welkin> so you can calculate it with just a few operations
15:23 <EvanR> you couldnt represent it in memory
15:24 <mniip> EvanR, 2^(2^(2^20))
15:24 <EvanR> lazy naturals on the other hand
15:24 <EvanR> mniip: whats this
15:24 <mniip> 128KB of digits
15:24 asdfghzxcvbn joined
15:25 <EvanR> my computer still barfs on it
15:26 Maxdaman1us joined
15:27 <EvanR> ill try 2^256-1 arbitrarily
15:27 ADG joined
15:28 {emptyset} joined
15:28 <ADG> can something like this be done via lift "(,) <$> 0 <*> (read .(!!1) <$> getArgs)"
15:28 <ADG> > :t (,) <$> 0 <*> (read .(!!1) <$> getArgs)
15:28 <lambdabot> <hint>:1:1: error: parse error on input ‘:’
15:28 e14 joined
15:28 <ADG> >:type (,) <$> 0 <*> (read .(!!1) <$> getArgs)
15:28 trism joined
15:29 bvad joined
15:30 <miviotros[m]> Yesterday I was looking at conduit, mainly, but also at machines and to a lesser extent pipes.
15:30 <mniip> ADG, liftA2 (,) 0 (red ...)
15:30 <miviotros[m]> I was wondering if there is any point of using e.g. the conduit package with monads other than IO
15:30 <Hjulle> happyfeet: Just follow the types. You want a function A -> String, so replace c with String in the type of catA and see where it gets you. Just divide up in cases like you would do in normal recursion.
15:30 <mniip> no wait
15:30 <miviotros[m]> or if they are actually used with monads other than IO
15:31 <happyfeet> showAlgae = cataA (either (const "") auxA) (either (const "") auxB)
15:31 <happyfeet> where auxA = ("A" ++) . (uncurry (++))
15:31 <happyfeet> auxB = ("B" ++)
15:31 <mniip> are you using 0 in an applicative context?
15:31 <happyfeet> here it is! :)
15:31 kritzcreek joined
15:32 <Welkin> lol, this video of richard stallman is funny
15:32 mrkgnao joined
15:32 sproingie joined
15:33 unyu joined
15:34 benjamingr_ joined
15:34 insitu joined
15:35 xcmw joined
15:35 fizruk joined
15:35 Guest__ joined
15:35 <Hjulle> happyfeet: Gratz!
15:36 <happyfeet> if you were curious this is for a college course called Program Design by Calculation
15:38 shainer joined
15:42 Fendor joined
15:43 <dmwit> EvanR: Why do you need a maximum score?
15:43 jgertm joined
15:43 <Welkin> make it 8 bits
15:43 <Welkin> highest score 255
15:44 <EvanR> the screen can only display so much, but the score should be saved if it goes over, so the question is high much is reasonable
15:44 <EvanR> how much
15:44 <dmwit> What if you picked a number of sig figs instead of a maximum?
15:45 <EvanR> also if the high score file is tampered with...
15:45 urodna joined
15:45 Jesin joined
15:45 asd joined
15:45 <Hjulle> g_64 is a good limit :)
15:45 sellout- joined
15:45 peterbecich joined
15:45 <EvanR> is that a huge number that i could never compute with
15:45 <dmwit> You would prefer that tamperers have to choose MAX_EVANR_INT-1 for some reason?
15:46 <EvanR> hmm right
15:46 <EvanR> the parser is going to bork trying to verify the integers
15:46 <EvanR> i heard yesod or some framework had an issue with that
15:47 <EvanR> > reads (show (2^256)) :: [(Integer,String)]
15:47 <lambdabot> [(11579208923731619542357098500868790785326998466564056403945758400791312963...
15:47 sleffy joined
15:47 <EvanR> > reads (show (2^(2^256))) :: [(Integer,String)]
15:47 <lambdabot> mueval: ExitFailure 1
15:48 <benzrf> ouch!
15:48 Tene joined
15:48 Tene joined
15:48 zero_byte joined
15:48 Shock_ joined
15:48 <EvanR> i guess i should just leave the maximum off
15:48 shainer left
15:48 <dmwit> > reads (repeat '9') :: [(Integer, String)] -- 12-year-old me would have loved this idea
15:48 <lambdabot> mueval-core: Time limit exceeded
15:48 <dmwit> Who needs to write down a lot of nines when the computer can do it for you?
15:49 <EvanR> repeat '9' has got to be the trump card in the "biggest number" schoolyard debate
15:49 <EvanR> or a zipper with 9s in both directions
15:50 dm3 joined
15:50 <EvanR> which is clearly twice as much as repeat '9'
15:52 <EvanR> whats an example of where reads can return more than one result?
15:52 <dmwit> nothing in base
15:52 <Hjulle> What would you get if you added 1 to that number? repeat '0'? >:-]
15:53 <EvanR> '1' : repeat '0' ovb
15:53 henriksod joined
15:53 <dmwit> Hjulle: Is it big-endian or little-endian?
15:54 <Hjulle> We would need a left folding lift for repeat '9' +1 to become 0
15:54 <dmwit> (Choose carefully, I have no choice but to go to tiny war with you if you choose badly.)
15:54 mojjo joined
15:55 <Hjulle> dmwit: Little endian. Otherwise infinity + 1 would not be 0. :P
15:55 Dookie12 joined
15:55 younis joined
15:55 <EvanR> double sided infinity, inf + 1 = inf - 1
15:56 fotonzade joined
15:57 <EvanR> dmwit: i hope youre happy, i removed the upper limit from the validation test, and the parser just naively assumes it can function
15:58 NeverDie joined
15:58 <EvanR> the result seems to be that the game will freeze up if somebody gets enough points, rather than a weird kill screen
15:58 cschneid_ joined
15:59 <EvanR> im still not comfortable with the level of impossibility of this
15:59 <mojjo> hi.. I'm struggleing with a simple parser for positional cli-args. I'm using Either for error messages. And there are three of this kind: "Wrong nr of args", "wrong first arg", "wrong snd arg". I could not get a better working example than those nested ifs in here: http://lpaste.net/355273 Could someone point me to an abstraction that would make sense here?
15:59 eklavya joined
16:00 <Hjulle> mojjo: Monad?
16:01 <EvanR> optparse-applicative ?
16:01 zariuq joined
16:02 <ertes> mojjo: StateT [String] (Either String) -- or optparse-applicative, which is a fancy version of this
16:03 <EvanR> should a config file reader be especially forgiving in terms of formatting, or especially strict?
16:03 <EvanR> the html fiasco comes to mind
16:03 <ertes> @let nextArg = StateT (\args' -> case args' of [] -> Left "Missing argument"; (arg:args) -> Right (arg, args))
16:03 <lambdabot> Defined.
16:04 <nshepperd> mojjo: instead of using nested ifs, you can use guards
16:04 oish joined
16:04 <ertes> @let endOfArgs = StateT (\args -> if null args then Right ((), args) else Left "Too many arguments")
16:04 <lambdabot> Defined.
16:04 <fotonzade> hey guys
16:04 <ertes> > evalStateT (do arg1 <- nextArg; arg2 <- nextArg; endOfArgs; pure (arg1, arg2)) ["arg1", "arg2"]
16:04 <lambdabot> Right ("arg1","arg2")
16:05 <ertes> > evalStateT (do arg1 <- nextArg; arg2 <- nextArg; endOfArgs; pure (arg1, arg2)) ["arg1", "arg2", "arg3"]
16:05 <fotonzade> I've got something like this:
16:05 <fotonzade> data Trie k a = Leaf a | Branch [(Maybe k, Trie k a)]
16:05 <lambdabot> Left "Too many arguments"
16:05 <ertes> mojjo: like that
16:05 <fotonzade> what exactly is Branch here, a list of tuples? How do I access its elements?
16:05 <EvanR> yes, Branch holes a list of tuples
16:05 <EvanR> holds
16:05 <lpaste> nshepperd annotated “No title” with “No title (annotation)” at http://lpaste.net/355273#a355275
16:06 <ertes> fotonzade: you access it by pattern-matching, folding, etc.
16:06 <EvanR> you generally access data structures with pattern matching
16:06 <EvanR> you could also use lenses
16:06 <fotonzade> could you give a small example pls
16:06 <fotonzade> like what would return the first tuple in a Branch
16:07 <nshepperd> mojjo: see my annotation... optparse-applicative is a nice library for this of course, too
16:07 <EvanR> depends on what youre trying to do
16:07 <EvanR> head [1,2,3,4]
16:07 beerdrop joined
16:07 <EvanR> ? head [1,2,3,4]
16:07 <EvanR> > head [1,2,3,4]
16:07 <lambdabot> 1
16:07 <fotonzade> Couldn't match expected type ‘[a]’
16:07 <fotonzade> with actual type ‘Trie k0 Integer’
16:07 <fotonzade> Relevant bindings include it :: a (bound at <interactive>:20:1)
16:07 Mutter joined
16:07 zargoertzel joined
16:08 <ertes> fotonzade: example pattern: Branch ((mk, t) : xs)
16:08 dm3 joined
16:08 <EvanR> so you have a pattern matching case expression to check if its a Branch or a Leaf
16:08 <EvanR> ?
16:08 <fotonzade> no :/
16:08 <EvanR> thats the first step
16:08 <fotonzade> do you think I should read up on user defined types first?
16:08 <EvanR> read up on algebraic data types
16:09 <fotonzade> ah cool
16:09 Welkin joined
16:10 younis left
16:10 soniku joined
16:11 <mojjo> been away for a second, thanks for the many suggestions. I'll see which one I will use...
16:11 flatmap13 joined
16:12 acertain joined
16:12 BlueRavenGT joined
16:12 sw1nn joined
16:12 zariuq joined
16:13 meandi_2 joined
16:14 dolio joined
16:15 anuxivm left
16:15 jason85 joined
16:17 <Hjulle> mojjo: I'd say http://lpaste.net/355273#a355275 is probably the simplest solution and optparse-applicative is the most flexible.
16:19 <Hjulle> dmwit: Btw, which was the incorrect answer to big- vs little-endian?
16:19 leshow joined
16:20 <mojjo> Hjulle: yeah, I was looking for something like this. If things get more compley I'll go for the suggested lib..
16:21 JeanCarloMachado joined
16:21 spacecadetbrown joined
16:22 balor joined
16:24 jgertm joined
16:25 blbrown_win3_ joined
16:25 Shock_ joined
16:26 <Hjulle> mojjo: If you don't want fancy stuff but still more complicated cases, you can try a homemade applicative/monadic parser like ertes suggested. It's surprisingly simple and a good exercise. :)
16:26 Fendor joined
16:28 dni joined
16:28 fosterite joined
16:29 jo`ve joined
16:29 LordBrain joined
16:30 baldrick1 joined
16:31 xxalien8dxx joined
16:32 mmachenry joined
16:32 dni_ joined
16:33 matthewbauer joined
16:33 <Gurkenglas> Anyone got some notorious lens errors to test this patch to lens against?
16:34 ckubrak joined
16:34 xall_ joined
16:35 nyherba joined
16:35 teqwve joined
16:35 <nyherba> https://jobs.lever.co/kittyhawk.aero/89a6630b-4210-4a4a-89d8-936d458f6c8a this looks pretty sweet
16:36 ixxie joined
16:38 My_Hearing joined
16:38 <fotonzade> I don't understand how "Maybe a" can be a user defined type
16:39 <panovia> fotonzade: What do you mean?
16:40 <kosmikus> fotonzade: I don't know exactly what the source of that statement is. but because it *could* be defined by a user, probably? there's nothing magic or built-in about it.
16:40 gugah joined
16:40 <fotonzade> ah the book just shows how its defined
16:40 <fotonzade> data Maybe a = Nothing | Just a
16:40 four33 joined
16:40 four33 joined
16:40 <fotonzade> thanks guys
16:41 <fotonzade> I don't quite understand what "Just" is either
16:41 dm3 joined
16:41 ixxie joined
16:42 <LordBrain> the Just is sort of a tag that tells the compiler, aha! this is a value of type Maybe something
16:42 glamas joined
16:42 mizu_no_oto_work joined
16:43 <LordBrain> its sometimes even called a tag, but usually we call it a data constructor.. as if it is a method for "constructing" a Maybe type.
16:43 rblaze joined
16:43 <LordBrain> fotonzade, what book or tutorial are you reading?
16:44 <fotonzade> learn you a haskell for great good
16:44 <fotonzade> but I had to skip around a lot because I have to finish an assignment relatively soon
16:45 <EvanR> what is the replacement for the high level Network module?
16:45 <LordBrain> fotonzade, well, understanding how to make basic sum and product types is i would argue the most important thing to know in haskell
16:46 <fotonzade> hmm
16:46 matthewbauer joined
16:47 <LordBrain> sum types have one or more of the symbol | ... where product types have only a single data constructor with multiple parameters of different types
16:47 <LordBrain> data TypicalProduct a b c = Prod a b c -- Product type
16:48 <LordBrain> data TypicalSum = Item1 | Item2 | Item3 -- sum type
16:48 zargoertzel joined
16:48 <fotonzade> alright
16:48 baldrick1 joined
16:49 <LordBrain> its easy, but every nontrivial program you write is going to have some of these
16:49 Tanner_devmode joined
16:49 <fotonzade> yeah :/
16:50 <Gurkenglas> Does intero support LiberalTypeSynonyms? Because I'm getting this https://gyazo.com/aa7c0a304b9a1c1586fdc83e52fe59cb (lemme ask #emacs whether theres some command to produce a link to an online interactive version of what I'm looking at)
16:50 <LordBrain> some of the types that come in the prelude have sugar, so the constructor doesnt look like the usual capitalized alphanumeric syntax..
16:50 <Gurkenglas> Oh right some can't load that kind of intermediate page, here's a direct link to the screenshot https://i.gyazo.com/aa7c0a304b9a1c1586fdc83e52fe59cb.png
16:50 <Tanner_devmode> Hi
16:50 sellout- joined
16:51 <Tanner_devmode> Is anyone good in this lang?
16:51 <Tanner_devmode> Becuase i am wondering if there is a way to make a website with this code
16:52 <LordBrain> fotonzade, so for example, all tuples, like (a,b,c) is are product types, and they're isomorphic to the sort of to data Tupl3 = Tupl3 a b c
16:52 <fotonzade> I see
16:53 Maxdamantus joined
16:53 <ertes> Tanner_devmode: with "this code" or "this language"?
16:53 SpinTensor joined
16:54 <Gurkenglas> Tanner_devmode, http://haskell-servant.readthedocs.io/en/stable/
16:54 afarmer joined
16:56 <Tanner_devmode> Gurkenglas:thanks
16:58 cschneid_ joined
17:00 _sg joined
17:00 dfeuer joined
17:00 jeltsch joined
17:02 Hethnoidea joined
17:04 shangxiao joined
17:04 coot joined
17:05 <LordBrain> i should have had the a b c on the type constructor there... data Tupl3 a b c = Tupl3 a b c
17:05 dhil joined
17:06 sibi joined
17:06 <LordBrain> fotonzade, type constructors are what you'd see in a type signature, data constructors appear in code, they look just alike and you can even have the same symbol used twice once as type ctr and again as data ctr, like i did with Tupl3.. the compiler knows from context which you mean.
17:07 <LordBrain> they're always capitalized, unless they're special sugar like [] or ()
17:09 ccomb joined
17:11 matthewbauer joined
17:11 systemfault joined
17:11 meba joined
17:12 teqwve joined
17:12 jsgrant_om joined
17:15 Nicke joined
17:15 <ij> Can I have a dependency for Show a in "data Foo a = { x :: a, y :: [a] }" so I could «… deriving Show»?
17:16 torgdor joined
17:16 <glguy> ij: Once you add the value constructor to that definition you can derive Show without adding any extra constraints
17:16 <glguy> the constraint on 'a' will be automatically added in the Show instance
17:17 e14 joined
17:17 <ij> Ah, cool.
17:17 NeverDie joined
17:18 hybrid joined
17:18 ExpHP joined
17:19 jmcarthur joined
17:20 <fotonzade> thanks a lot for your help LordBrain
17:21 four33 joined
17:21 dni joined
17:22 mda1 joined
17:22 Ascoss joined
17:23 Ascoss left
17:24 takle joined
17:25 asdfghzxcvbn joined
17:25 asdfghzxcvbn joined
17:25 asdfghzxcvbn joined
17:27 ckubrak joined
17:29 <fotonzade> so fellas if I have like Circle Float Float in a function's definiton
17:29 <fotonzade> and in the binding I have the circle as c
17:29 <fotonzade> how to I access the floats?
17:30 <Cale> fotonzade: case c of Circle x y -> ...
17:30 plot joined
17:30 <ertes> fotonzade: or as part of a function definition: f (Circle x y) = …
17:30 <fotonzade> hmm
17:30 matthewbauer joined
17:30 <Cale> I guess if you wanted to bind it both ways:
17:31 <Cale> f c@(Circle x y) = ...
17:31 fizbin joined
17:31 <LordBrain> if you dont need to access the whole thing, you could just do f (Circle x y) =
17:31 <Cale> Yeah, ertes already suggested that one :)
17:31 <LordBrain> its called a pattern match
17:32 <LordBrain> oh, somehow my eyes read over that line
17:32 <Gurkenglas> Anyone got some notorious lens errors to test this patch to lens against?
17:32 <LordBrain> sorry ericbmerritt_
17:32 <glguy> Gurkenglas: as far as I know that's something you'll need to produce
17:33 <fotonzade> insert :: Eq k => [k] -> a -> Trie k a -> Trie k a
17:33 <fotonzade> and the binding is insert (x:xs) a t = Branch []
17:33 <glguy> Gurkenglas: Part of the reason the build failed was that you had some unbound type variables in the new defintions
17:33 <ExpHP> is there any proposal in the works /at all/ to enable a module with an implicit export list to have private items
17:33 <EvanR> :t when
17:33 <lambdabot> Applicative f => Bool -> f () -> f ()
17:33 <Gurkenglas> Whuh? But it built locally
17:33 balor joined
17:33 <glguy> Gurkenglas: You can look at the travis output to see the compiler errors
17:33 <fotonzade> what exactly should I say instead of t if I want to access the stuff
17:33 <EvanR> cant this be Bool -> f a -> f ()
17:34 acidjnk22 joined
17:34 fendor joined
17:34 <ertes> ExpHP: what would that look like?
17:34 msks joined
17:34 <LordBrain> (x:xs) is sugar for a patern match on the list constructor... called cons in lisp, in haskell its just : its another special constructor where we have non-typical syntax
17:35 <ExpHP> ertes: A {-# PRIVATE funcName #-} pragma. Or a "module My.Module hiding (stuff) where" module header
17:35 <ExpHP> anything
17:35 <ExpHP> inner modules
17:35 <ab9rf> how is : nontypical?
17:35 <Gurkenglas> glguy, I saw https://travis-ci.org/ekmett/lens/jobs/229418254 and was confused by the build failing because a file I didn't touch didn't compile
17:35 <fotonzade> right LordBrain I more or less understand what it is
17:36 <LordBrain> sorry
17:36 <fotonzade> I am just curious how to work with k and a
17:36 dmwit_ joined
17:36 <Cale> What are the constructors of Trie?
17:36 <LordBrain> you can have multiple nested pattern matches
17:36 <fotonzade> no problem at all lol I really appreciate your help
17:36 <fotonzade> data Trie k a = Leaf a | Branch [(Maybe k, Trie k a)] deriving (Show)
17:36 <ExpHP> I just want to be able to define a small helper function or a type alias in a module without it potentialy impacting the rest of my codebase
17:36 <Gurkenglas> EvanR, there is disagreement on such things as whether (>>) should take m () or m a as its first argument
17:36 <Cale> fotonzade: So you could, if you wanted, pattern match on those
17:36 <ExpHP> and currently the only solution I know is to make a separate module with just the private stuff
17:37 <fotonzade> Cale, I basically don't know how to pattern match on them
17:37 <fotonzade> because in the binding I only have t
17:37 <Cale> fotonzade: Either with a case expression to the right of the = sign, or just by replacing the t parameter with a pattern to match
17:37 <fotonzade> for the trie
17:37 <fotonzade> ah
17:37 <fotonzade> so if I did like t (k a) or somehting
17:37 <fotonzade> =
17:37 <fotonzade> ?
17:37 <ertes> ExpHP: given the current state of the module system that sounds like a reasonable approach, but personally i just write an export list
17:37 <ExpHP> ertes do you do this manually or do you somehow manage it with tooling?
17:38 <ertes> ExpHP: one reason is that my definitions are sorted alphabetically (for easy source navigation), so i use the export list to reorder them for haddocks
17:38 <Cale> insert (x:xs) u (Leaf v) = ...
17:38 gienah_ joined
17:38 <Cale> insert (x:xs) u (Branch kvs) = ...
17:38 <ertes> ExpHP: i have some helpers in emacs to jump to imports, exports and language pragmas temporarily
17:38 <Cale> (you'll also want to handle the insert [] _ _ = ... case
17:38 <fotonzade> ah I see
17:38 <Cale> )
17:39 eacameron joined
17:44 mda1 joined
17:46 <ExpHP> ertes: I'm curious now, how do you conceptually manage alphabetically sorted definitions? There must be cases where two very similar functions end up drastically separated; things like e.g. 'fst' and 'snd'
17:46 <ertes> ExpHP: yes, those will be separated
17:47 <ExpHP> Maybe it's just a difference in taste, but I don't suppose I could ever get used to thta
17:47 <Cale> ertes: You should just use hasktags
17:47 <ertes> ExpHP: there are two ways to reduce distance: make modules smaller (which i do), and bring them close together in the export list, so the docs are fine
17:47 <ertes> Cale: i do
17:48 <ertes> well, i use haskell-interactive-mode, which uses GHCi for lookup
17:48 codesoup joined
17:49 <sm> ExpHP: I think symbols beginning with _ will remain private when implicitly exporting
17:50 <ertes> sm: nope, the "_" just stops GHC from warning about unused things
17:50 <ExpHP> And I don't suppose types can begin with '_'...
17:51 <LordBrain> do you make an exception for the 'main' function
17:51 <sm> ah
17:51 <ertes> yeah, indeed i do… 'main' is always at the bottom
17:51 <ertes> it's a habit from my C++ days =)
17:52 nh2 joined
17:52 matthewbauer joined
17:53 <LordBrain> ertes, do you keep all the types together, or are they mixed in?
17:53 yyyyy joined
17:53 sssilver joined
17:53 mmn80 joined
17:53 <ertes> first classes, then types, then values
17:53 leat joined
17:53 <LordBrain> sounds very organized
17:54 <monochrom> The types are kept together, but probably only because they're all capital case :)
17:54 <ExpHP> ertes: how about when you use Template Haskell?
17:54 montag451_ joined
17:54 leshow joined
17:54 <ertes> ExpHP: TH ruins everything =)
17:54 osa1 joined
17:54 osa1 joined
17:54 <ertes> i try to keep it organised as much as possible… for example use 'makeLenses' between types and values
17:54 bennofs joined
17:55 <ertes> caveat: can't use lenses in instances, because i keep instances together with either classes or types
17:55 <ertes> fix: write lenses by hand =)
17:56 <ExpHP> that's dedication
17:56 twomix joined
17:57 <ExpHP> ertes: what's the payoff at the end? I would think navigating defs is easy enough by searching for "name ::"
17:57 tromp joined
17:57 <sm> better-organized haddocks is one good reason to use an export list
17:57 <ertes> ExpHP: not much of a payoff… it's just style
17:57 uuplusu joined
17:57 <ExpHP> so it's one less thing to fret over?
17:57 <ertes> same payoff as for using consistent indentation, etc.
17:58 <LordBrain> except when you refactor... now you got to insert everything in the right spot... like when you take a where clause function and move it to the top level
17:59 <ertes> yeah
17:59 chaosmasttter joined
17:59 <LordBrain> change the name of a binding... oops now have to cut and paste
18:00 <LordBrain> maybe it pays off tho, i dont know
18:01 fendor joined
18:03 crobbins joined
18:04 <EvanR> heh
18:04 <EvanR> "your IDE should do it"
18:04 WhiskyRyan joined
18:05 buttbutter joined
18:05 <EvanR> im imagining vedic monks eternally pushing haskell code into alphabetical order
18:05 oish joined
18:07 <ExpHP> I'm conjuring up some mental image of a emacs plugin with keybindings to toggle exportedness of a function, and which renders a different typeface/color for exported names at their declaration site
18:07 <ExpHP> (this is returning back to the "private defs" thing)
18:07 insitu joined
18:08 <ExpHP> it'd produce terrible haddocks though
18:08 <ExpHP> (not that I ever try to manage haddocks for most code unless it's meant to be highly reusable library stuff)
18:09 dquarks_ joined
18:09 northfurr joined
18:10 soniku joined
18:10 Gloomy joined
18:10 <fotonzade> fellows Im getting an error for this code
18:10 <fotonzade> https://paste2.org/6MHjmmFK
18:11 <geekosaur> you should always include the full error
18:11 <fotonzade> https://paste2.org/5ecyJK2K
18:11 <fotonzade> here it is
18:11 <geekosaur> and anything else needed for the code to be understood (here, the definition of Trie)
18:12 <fotonzade> geekosaur, https://paste2.org/dMHF0kMM
18:12 <ExpHP> fotonzade just a guess, did you want "| Just x == m" instead of "| x == m" perhaps?
18:12 <geekosaur> but, here, what see is on line 3 you use Branch [(Just x, ...
18:13 <geekosaur> but on line 5 Branch [(x, ...
18:13 matthewbauer joined
18:13 fizbin joined
18:13 <fotonzade> ExpHP, I don't think that is the problem
18:13 ChaiTRex joined
18:13 lambdaman joined
18:13 <fotonzade> geekosaur, I don't quite understand the problem
18:14 <fotonzade> oh
18:14 <fotonzade> Just
18:14 bungoman joined
18:14 mfukar joined
18:14 <fotonzade> Jus
18:14 <fotonzade> wait that didnt fix it
18:14 <monochrom> You have two problems or more.
18:15 <monochrom> But both have been pointed out.
18:15 <fotonzade> yes I fixed two for now :D
18:15 <fotonzade> ExpHP, you were right
18:15 <fotonzade> but how do I compare this with something else?
18:15 <Gurkenglas> If you want to watch me working on this lens patch (but probably more on wrestling with the tooling), here's a Stream: https://www.liveedu.tv/gurkenglas/2b9EV-wrestling-the-haskell-ecosystem/
18:16 <fotonzade> oh Just
18:16 <fotonzade> :D
18:16 <monochrom> WWF special show: Gurkenglas vs Stack :)
18:16 <geekosaur> I'd also be using pattern matching for the Nothing case, fwiw
18:16 four33 joined
18:16 <EvanR> ive heard more complaints about stack than cabal lately
18:17 pera joined
18:17 <EvanR> well not that lately
18:17 four33 joined
18:17 <fotonzade> could you give an example pls geekosaur
18:17 <fotonzade> I am very noob at this stuff
18:17 <EvanR> youd think something would come out that people praise
18:17 fendor joined
18:17 <EvanR> or is it like positive yelp reviews
18:18 <ExpHP> "In the red corner... dedicated and fun-loving... ranking Haskell as #13 on the most loved languages... the haskell ecosystem!"
18:18 <ExpHP> "No wait, that's a community, not an ecosystem. Eh, same difference."
18:18 <monochrom> Could be only because more people use Stack. Also we only hear questions, not reports of "works 100% for me".
18:18 <kadoban> Gurkenglas: Ugh, also known as "kadoban vs. completely unusable website"
18:18 <sm> Gurkenglas: incidentally are your streams free, "premium", or some of each ? I found liveedu.tv pretty confusing and I'm not sure
18:19 dni joined
18:19 <monochrom> Actually if someone does ask "should I use stack? should I use cabal?" all the answers are "stack works 100% for me".
18:19 shivansh joined
18:19 <sm> also that link is trying but failing start playback here
18:20 shivansh left
18:20 <Gurkenglas> I'm not sure? I intended this to be free, feel free to suggest other websites, I first used this one months back when it, say, didnt block adblock
18:20 <kadoban> I was going to stream some nonsense a week or so ago, but that site is just crap now. I don't know where else to stream programming topics ...
18:20 moongazer joined
18:20 <ExpHP> fotonzade: I think the people at #haskell-beginners might be better at helping you work through these errors
18:20 <sm> I'm wondering about alternatives for foss streaming too
18:21 <kadoban> Maybe just twitch, though there doesn't seem to be a community of coding streams there too much.
18:21 <fotonzade> oh I didnt know there was something like that
18:21 mada joined
18:21 <fotonzade> ExpHP, everyone has been so patient with me here that I didnt think there was another channel
18:21 <lpaste> geekosaur pasted “fotonzade trie” at http://lpaste.net/355278
18:21 <geekosaur> wait
18:21 <lpaste> geekosaur pasted “fotonzade trie” at http://lpaste.net/355279
18:21 <geekosaur> typoed, tried to abort the original paste...
18:21 <sm> Gurkenglas: I was having some success when I found past streams in the hidden-by-default playlist, but then it stopped letting me use that
18:22 whaletechno joined
18:22 <ExpHP> whatever works :)
18:22 safe joined
18:22 <monochrom> If you switch channel you will get the impression of getting your next question answered. But that's only because you have to post complete up-to-date information all over again.
18:23 <fotonzade> ah I see geekosaur
18:23 eacameron joined
18:24 <sm> kadoban: oh, I thought twitch was for gaming only ?
18:24 <geekosaur> sadly you can;t do the same with the x/m comparison, patterns can't test against bindings so something like insert (x:xs) a (Branch [(Just x,t)]) would be an error
18:24 lambdaman joined
18:25 <fotonzade> :(
18:25 splanch joined
18:25 <kadoban> sm: Not sure it matters, from what I can tell they don't care. But livecoding.tv / liveedu.tv is not an option anymore, and I think that was the only coding-specific one.
18:25 <ExpHP> twitch now has some kind of offshoot now for nongaming stuff... Twitch Creative, I think?
18:25 <kadoban> There's some reddit thing that seems to focus on streaming coding stuff, but it was small and kind of funky, I didn't try it.
18:25 <ExpHP> which is funny since twitch was originally an offshoot from justin.tv to get all the gaming stuff off there
18:26 <sm> creating a channel on youtube seems to be another option
18:26 <monochrom> haha
18:26 <geekosaur> you expect people to remember that far back? :p
18:26 <kadoban> Yeah, youtube seemed like an option too
18:27 pi4 joined
18:27 takle joined
18:27 eacamero_ joined
18:27 <sm> https://www.twitch.tv/directory/game/Creative, interesting
18:28 shivansh joined
18:28 shivansh left
18:29 <sm> OT, but https://help.twitch.tv/customer/portal/articles/2176641-creative-faq is pretty funny, too
18:29 <kadoban> Huh, I didn't know that existed. Wonder if it'd work.
18:29 <sm> things forbidden to broadcast: assembling furniture. playing puzzles. :)
18:31 mstruebing joined
18:31 unyu joined
18:31 eacameron joined
18:31 <Gurkenglas> Where in what manual does it say what makes type synonyms be unpacked/stay packed?
18:32 chaosmasttter joined
18:35 simukis joined
18:36 chrisd joined
18:37 pacak joined
18:38 NextHendrix joined
18:39 <Cale> Gurkenglas: I wouldn't expect that to be documented.
18:39 eacameron joined
18:39 simukis joined
18:39 <Cale> Gurkenglas: I think it makes some effort to keep them folded when printing error messages, but there are various things which get in the way of that, and it's probably not easy to characterise.
18:40 <Gurkenglas> Currently trying to do that on-stream. With tools trying to keep me from finding out.
18:43 <Gurkenglas> How do I tell stack to hide the lens it knows from the current project (lens cloned from github with minor changes) so I can test the changes in ghci?
18:44 <sm> specify the precise version in extra-deps list in stack.yaml ?
18:45 <ExpHP> is it possible to get a list of names exported by a module, from e.g. intero?
18:45 <geekosaur> or the location: syntax in stack.yaml
18:45 <kadoban> Gurkenglas: Remove it from the 'package' list or whatever it is in stack.yaml?
18:46 <Gurkenglas> Preliminary experimental results: When it can unpack a type synonym in order to pull a forall to the front, it does so.
18:46 <Gurkenglas> kadoban, I don't think lens has itself in its stack.yaml as a dependency
18:46 chewzerita joined
18:47 FreemanXiong joined
18:47 <chewzerita> @pl rema n x = let w = div n x in (w, n - w * x)
18:47 <lambdabot> rema = ap (ap . (ap (,) .) . (. (*)) . (.) . (-)) div
18:47 <Gurkenglas> I think I've got it globally installed? (I can import Control.Lens from calling stack's ghci outside a project)
18:47 <kadoban> Gurkenglas: Not following. You're using 'lens' in some other thing, right?
18:47 <geekosaur> then just run ghci vs. stack ghci?
18:47 <Gurkenglas> No, I'm working on a pull request to the lens package
18:47 <geekosaur> or if it's installed via stack, I think there's an option to specify the stack.yaml to use so point to the global project instead of the localone?
18:47 <Gurkenglas> geekosaur, I don't have ghci installed, just stack.
18:48 <Cale> Gurkenglas: I... guess start a blank stack project then?
18:48 <kadoban> Gurkenglas: Possibly with -hide-all-packages
18:48 <geekosaur> --stack-yaml=$HOME/.stack/config.yaml I think
18:49 <geekosaur> or Windows equivalent
18:49 <geekosaur> oh, sorry
18:49 <geekosaur> --stack-yaml=$HOME/.stack/global/stack.yaml
18:49 JuanMiguel joined
18:50 jsgrant_om joined
18:50 jgertm joined
18:50 Nicke joined
18:51 <rotaerk> hmm my foray into literate haskell might just end as a temporary phase... guess I'll just use normal haskell but start commenting more
18:51 oisdk joined
18:51 <geekosaur> I think most people only use literate Haskell for blogs
18:51 obadz joined
18:52 alien8 joined
18:52 <rotaerk> I find the code hard to read if I use latex style, and I find it hard to write/edit if I use bird style
18:52 <Gurkenglas> geekosaur, I think the problem is that Im already using the global config's lens rather than the one of the project I'm editing
18:52 sw1nn joined
18:53 <Gurkenglas> "git clone lens; cd lens; <edit a file>;" What stack command should follow in order to open a ghci that uses the lens I've modified?
18:53 srbaker__ joined
18:54 four33 joined
18:55 jophish_1 joined
18:55 nuclx joined
18:55 <geekosaur> `stack ghci` should build and use that project, not the global one
18:56 <geekosaur> unless lens somehow depends on itself, which seems weird and possibly broken
18:56 <sm> lens doesn't have a stack.yaml file. Possibly stack is using the global one ?
18:56 <ertes> rotaerk: if you find latex-style code hard to read, you probably need an editor with better highlighting
18:56 <geekosaur> you may need to force a build first, although I thought `stack ghci` would do that
18:57 <Gurkenglas> Heh, it says to run stack init first
18:57 <geekosaur> then you likely need to do that, since it's not a stack project
18:57 <geekosaur> so stack won't handle it right...
18:58 <ertes> rotaerk: anyway, in real code literate haskell is probably not too useful… i mostly use it for blog entries
18:58 uuplusu joined
18:58 <ertes> with proper editor support editing long regular comments is fine
18:59 dan_f joined
18:59 blarg joined
18:59 <LordBrain> i agree rotaerk... regular haskell with comments is preferred
19:00 doyougnu joined
19:01 yellowj joined
19:02 AX3L joined
19:02 <cocreature> is there a reason to use the “haskell-src” package these days or is it completely superseeded by the “haskell-src-exts” package?
19:02 peterbecich joined
19:02 <geekosaur> if you're working with only haskell98 standard source, I guess
19:02 augur joined
19:03 lambdaman joined
19:03 <geekosaur> since the original reason for haskell-src-exts was that haskell-src didn't support the ghc extensions
19:04 peterbecich joined
19:04 <rotaerk> ertes, just using vim, but didn't adjust anything about its highlighting; just using the built-in lhaskell support
19:04 <cocreature> ah that’s where the slightly confusing “-exts” naming comes from
19:04 <cocreature> geekosaur: alright thanks
19:05 pgiarrusso_ joined
19:06 srbaker__ joined
19:06 oberstein joined
19:08 sleffy joined
19:08 freusque joined
19:08 oisdk joined
19:10 xinming joined
19:10 <ExpHP> okay, I've spent the last 3 hours literally paralyzed at the thought of how to deal with these type aliases conflicting with each other after splitting up a module
19:11 <ExpHP> I think the only reasonable solution at this point that won't cause me to hate myself in the near to far future is to delete the type aliases
19:11 soniku joined
19:11 <ertes> rotaerk: make sure your editor knows how to fill and indent comments properly, then it's a piece of cake
19:12 <Tuplanolla> I'd stop programming for a while if it left me unable to move for three hours, ExpHP.
19:12 <ExpHP> Tuplanolla that's why I'm procrastinating in here
19:14 <ExpHP> (also, yes I know you were ribbing on my use of the word "literally")
19:14 <ExpHP> (but shhhh, don't spoil the joke)
19:16 tomphp joined
19:17 chaosmasttter1 joined
19:17 takle joined
19:18 <ertes> i'd go see a doctor
19:19 garphy`aw joined
19:21 bvad joined
19:26 insitu joined
19:27 <Gurkenglas> You don't wanna know what happens if it lasts more than 4 hours
19:27 <sm> kadoban: one downside of twitch: omg heavy advertising
19:28 blbrown_win3 joined
19:29 <LordBrain> if X is profitable but sucks, but doesnt suck bad enough for anyone to do anything about it, market forces seem to make X inevitable
19:29 taksuyu joined
19:29 <ExpHP> Gurkenglas: I think that's the point when my cat classifies my keyboard as a new bed
19:29 robotroll joined
19:31 sellout- joined
19:32 <CuriousErnestBro> anyone familiar with pcap.gaz files?
19:32 <CuriousErnestBro> pcap.gz
19:32 <CuriousErnestBro> How to open and read them?
19:33 <Tuplanolla> There's a program called `pcap`, no, CuriousErnestBro?
19:33 falafel joined
19:33 oisdk joined
19:34 <CuriousErnestBro> Tuplanolla, ubuntu can't find it in it's repos, no
19:34 noexcept_ joined
19:34 <ChaiTRex> CuriousErnestBro: Wireshark might be able to read it.
19:34 mmachenry joined
19:35 <Tuplanolla> I get lots of hits with `apt search pcap`, CuriousErnestBro.
19:36 <geekosaur> wireshark and tcpdump (with -r option) should be able to read it
19:36 <geekosaur> although you likely need to gunzip first
19:37 Nicke joined
19:37 <geekosaur> also there should be something on hackage although last I checked the options were kinda poor
19:37 <ExpHP> pfft. So after all that, it turns out that I already had a module dedicated to "type aliases I really don't want to become committed to but had to pull out into a module anyways, lol" https://github.com/ExpHP/calc-tblg/blob/master/src/Band/Oracle/API.hs
19:37 jgertm joined
19:37 petervaro joined
19:38 dominik_ joined
19:38 <* ExpHP> adds "type QVec = V3 Double" and washes the blood off his hands
19:40 ccomb joined
19:41 oisdk joined
19:43 epsilonhalbe joined
19:43 Gloomy joined
19:43 <Gurkenglas> "git clone <lens>; cd lens; <edits>; stack init; stack ghci" with I-think-irrelevant stuff in between produces http://lpaste.net/7083755158328311808
19:45 takle joined
19:45 mjora7 joined
19:47 govg joined
19:48 srbaker__ joined
19:48 cyborg-one joined
19:50 avn joined
19:50 jsgrant_om left
19:51 zeroed joined
19:51 raynold joined
19:52 <sm> Gurkenglas: lens.cabal specifies the -traditional flag for cpp. See if yours supports it, mine does (mac sierra)
19:53 jsgrant_om joined
19:53 jeltsch joined
19:54 chrisM_1 joined
19:55 <Gurkenglas> How do I check that? cpp -traditional makes the shell wait for input as if a haskell executable did forever getLine. (What command corresponds to the Ctrl-C of other terminals in emacs's M-x shell?)
19:56 <sm> but cpphs doesn't. I don't know which it's using. Also your error seems to imply the flag is being passed to ghc
19:56 <sm> C-q C-c enter
19:57 <sm> sometimes C-q C-d enter is better
19:57 <Gurkenglas> ...that didn't kill the "cpp -traditional" process :I
19:57 JeanCarloMachado joined
19:57 <Gurkenglas> It does produce "^C"/"^D" lines though
19:57 ubsan_ joined
19:57 <LordBrain> Gurkenglas, in unix, its done via a signal handler
19:57 <Gurkenglas> I'm on Windows
19:57 <LordBrain> i dont recall what windows does
19:58 <sm> if all else fails, I kill and reopen the shell window
19:58 <sm> s/window/buffer/
19:58 geekosaur joined
19:58 <Gurkenglas> That worked.
19:59 tomphp joined
20:02 uuplusu joined
20:02 lambdaman joined
20:03 <hexagoxel> Gurkenglas: i see the same issue with -traditional with stack on linux. i'd wonder if updating stack helps though; mine is a bit dusted.
20:04 <sm> I'm getting the impression that lens uses some flags that stack isn't yet able to pass through (reproduced here with stack 1.4)
20:04 takle joined
20:04 <Gurkenglas> Can I tell stack to act as cabal would in order to get me some sort of repl?
20:05 marr joined
20:05 <sm> stack exec -- ghci -isrc might be a good start
20:05 <sm> :m +*Control.Lens, etc.
20:06 <hexagoxel> "stack exec -- cabal repl"
20:06 <* hexagoxel> runs
20:06 <Gurkenglas> second one complains about GHC_PACKAGE_PATH or something
20:06 <LordBrain> i havnt used stack yet, but having it implies you have cabal doesnt it?
20:07 shangxiao joined
20:07 <Gurkenglas> You can install stack without having a ghci.exe on your path
20:07 <sm> nested stack/cabal commands generally aren't allowed
20:07 dni joined
20:08 <sm> yeah I think you'd be best avoiding stack for now and just do cabal repl
20:08 <Gurkenglas> sm, http://lpaste.net/963041082055065600 ? did you mean something else than literally ":m +*Control.Lens"?
20:09 ed-ilyin-lv joined
20:09 <sm> no I meant that, but I hadn't yet tested it.. it fails as you say
20:09 <Gurkenglas> What stack command gives me access to "cabal repl"? "stack install cabal"?
20:09 <hexagoxel> stack 1.4.0 does not work either. bit surprised; doesn't that mean that lens does not work with stack in general?
20:09 <sm> it looks that way.. worth opening a lens issue I'd say
20:09 <hexagoxel> perhaps HEAD is not released yet.
20:09 <sm> which will probably lead to a stack issue
20:10 <hexagoxel> (rather: whatever commit introduced that flag)
20:10 <sm> agreed, stack installing it from stackage works of course
20:10 muzzle joined
20:11 <muzzle> Hi
20:11 <muzzle> I have a quick question/proposal: couldn't the type of Map's insertWith changed to Ord k => (b -> a -> a) -> k -> b -> Map k a -> Map k a ?
20:11 <Gurkenglas> In order to accumulate a benchmark file that generates notorious lens errors to test patches like mine against, should I open a thread on reddit or stackoverflow?
20:12 <hexagoxel> Gurkenglas: so maybe you can check out the commit from the last release, and work from there.
20:12 <Tuplanolla> :t Data.Map.insertWith
20:12 <lambdabot> Ord k => (a -> a -> a) -> k -> a -> M.Map k a -> M.Map k a
20:12 <Gurkenglas> muzzle, what if there's no a at that k?
20:12 <Tuplanolla> I think not.
20:13 <Gurkenglas> muzzle, perhaps you want adjust
20:14 <Gurkenglas> Because the only possible implementation of "(b -> a -> a) -> k -> b -> Map k a -> Map k a" would pass the b to the (b -> a -> a) and then adjust remains
20:15 <muzzle> Gurkenglas: I actually need alter, sorry
20:15 ed-ilyin-lv joined
20:16 <ExpHP> Gurkenglas: or it could be "f _ _ _ = id"
20:16 <ExpHP> ...I'll show myself the way out
20:17 <Gurkenglas> ExpHP, that'd be "a -> b -> c -> d -> d", not "(b -> a -> a) -> k -> b -> Map k a -> Map k a"
20:17 fendor joined
20:17 ed-ilyin-lv joined
20:18 kritzcreek joined
20:18 <ExpHP> > let f _ _ _ = id in f :: (b -> a -> a) -> k -> b -> Const k a -> Const k a
20:18 <Gurkenglas> Also your f too can be written in terms of passing the b to the (b -> a -> a) and then (failing to) implement adjust
20:18 <lambdabot> error:
20:18 <lambdabot> • No instance for (Typeable b0)
20:18 <lambdabot> arising from a use of ‘show_M201774929903630120617984’
20:18 infinity0 joined
20:19 <ExpHP> > let f _ _ _ = id in const (f :: (b -> a -> a) -> k -> b -> Const k a -> Const k a) ()
20:19 <lambdabot> error:
20:19 <lambdabot> • No instance for (Typeable b0)
20:19 <lambdabot> arising from a use of ‘show_M81368359491340298318039’
20:19 <ExpHP> oh duh
20:20 <* Gurkenglas> shows ExpHP the way into the lambdabot query till he's got an expression
20:20 <ExpHP> > let f _ _ _ = id in const () (f :: (b -> a -> a) -> k -> b -> Const k a -> Const k a)
20:20 acarrico joined
20:20 <lambdabot> ()
20:20 <ExpHP> boom, therefore f :: (b -> a -> a) -> k -> b -> Const k a -> Const k a
20:20 <Gurkenglas> f is still a -> b -> c -> d -> d
20:20 <ExpHP> something something monomorphism restriction
20:21 pgiarrusso_ joined
20:23 JeanCarloMachado joined
20:23 <Gurkenglas> Can someone make a fork of https://github.com/Gurkenglas/lens/commits/master that contains the second commit and all those below the last stackage release or tell me how to do so, so I can get into a position to test my pr?
20:23 darjeeling_ joined
20:23 mkoenig joined
20:24 takle joined
20:25 <sm> Gurkenglas: commenting out cpp-options: -traditional in lens.cabal allows stack ghci lens to work. That line has been there for three years though, so I don't know the real cause
20:26 Sgeo joined
20:26 <LordBrain> hey, if i want to make something like the games in gnome-games package, what libraries tools should i use?
20:26 <LordBrain> something that does as much work for me as possible
20:26 <LordBrain> so i can focus on the concept more so than the code
20:26 <sm> fltkhs, I'd say
20:28 <sm> well, how much does installability and platform support matter ?
20:28 ed-ilyin-lv joined
20:29 <LordBrain> instability?
20:29 <LordBrain> you mean the api?
20:29 <sm> install-ability
20:29 <sm> do you need other folks to be able to install it ?
20:30 <LordBrain> highest priority is just, getting up and running fast i guess
20:30 <LordBrain> oh yes
20:30 <sm> on windows and mac too ?
20:30 <LordBrain> well, i'm not against those
20:30 zeroed joined
20:30 <EvanR> category of causal interactive programs http://lpaste.net/355282
20:30 <LordBrain> but gnome is the priority, or mate desktop
20:31 <LordBrain> mate is what i use
20:31 <LordBrain> android would be very nice
20:31 <Gurkenglas> EvanR, sounds like a conduit/pipe using a state monad?
20:31 <EvanR> no monads
20:31 <LordBrain> i mean the whole thing could be done with javascript and stuff... i guess.. but something doesnt feel right about that
20:32 <EvanR> necessarily
20:32 <EvanR> but yeah its the same signature as pipes
20:32 <LordBrain> think in terms of minesweeper on your desktop
20:32 <Gurkenglas> *reader (since you apparently cant write back to the world)
20:32 <EvanR> but a different interpretation
20:33 <EvanR> Gurkenglas: right i had something with 3 parameters until i wanted a reader... and ended up with this
20:33 <Gurkenglas> Why not replace the reader with a custom monad specified by the user?
20:34 <EvanR> i dont understand where monads comes in?
20:35 <EvanR> i do see how you could implement a program completely internal with whatever monad you wanted, or another way
20:35 <EvanR> but not why itd be in the interface
20:36 <sm> LordBrain: I'd probably still say fltkhs, but you could also look at the gnome and qt options on hackage
20:36 <Gurkenglas> Half bullshitting now, but for the same reason State is StateT Identity
20:37 lc_ joined
20:37 <EvanR> i guess you jumped to something like X-transformer... but i didnt even think this was a monad?
20:37 <EvanR> its a functor in two ways, a bifunctor, a profunctor in two ways, a contrafunctor in two ways...
20:37 <EvanR> a monoid in two ways
20:37 <EvanR> applicative in two ways or biapplicative
20:37 <LordBrain> sm, what about wxhaskell.. if we're talking general gui kits, how does that compare to fltkhs
20:38 <Lokathor> LordBrain, sdl2 or fltkhs
20:38 <sm> LordBrain: there's also things like threepenny-gui
20:38 sfcg joined
20:38 <Lokathor> fltkhs will let you do more stuff with widgets, but note that the compile times can get insane if you don't read the docs and set the fast compile flag they talk about
20:39 CoderPuppy joined
20:39 <LordBrain> hmm
20:39 <cocreature> sdl and fltk are two very different things. sdl mostly gives you an opengl context while fltk is an actual gui library
20:40 <EvanR> and fltk will also give you an opengl context
20:40 <sm> I think wxhaskell is less maintained now
20:40 <Lokathor> SDL is mostly just a 2d canvas you can draw to and get input about, but you have to manage every other detail yourself (such as noting when a player click should count as a click of a particular button)
20:40 sfcg joined
20:40 <LordBrain> yeah i know
20:40 <EvanR> there are libraries to attempt to slap a gui ontop of SDL
20:40 <Lokathor> cocreature, SDL has plenty to work with without knowing OpenGL at all.
20:40 <sm> maybe http://hackage.haskell.org/package/wx is a successor, I dunno
20:40 <cocreature> sm: I’m not sure that’s true. there was a new release just a week ago or so
20:40 <LordBrain> i know of some other libraries like that that are nice
20:41 <Lokathor> one thing with WX and also GTK is that the windows install might turn out difficult
20:41 <sm> cocreature: right you are
20:41 <LordBrain> because its a game, actually sdl or something less widgety oriented seems better
20:42 <sm> LordBrain: those gnome games seemed to have a lot of widgetty things, I figure similar things exist for fltkhs
20:42 dooml0rd joined
20:42 <sm> it's lots of work, no matter how you look at it
20:42 <LordBrain> yeah but decorated widgets.. not standard ones, no?
20:43 <LordBrain> yeah
20:43 <LordBrain> i want something to cut it down as much as possible
20:43 <sm> yeah, but as I understand it custom widgets are easy with fltkhs
20:43 <Lokathor> http://www.fltk.org/shots.php this is what fltk stuff kinda looks like usually
20:43 <sm> more so than gtk etc.
20:43 bennofs joined
20:44 <LordBrain> what about html5 canvas api, is there something that lets me target that in haskell?
20:44 Tuplanolla joined
20:44 cpup joined
20:44 <Lokathor> ghcjs maybe? writing it in purescript instead?
20:46 jimmyrcom joined
20:46 fendor joined
20:47 <sm> many options, no obvious winner
20:47 <ExpHP> I'm using emacs+intero+FlyCheck, and it tends to "give up" and show an error count of zero if there's an error in a different module than the one open, or in cases of module name/filepath mismatch.
20:47 xcmw joined
20:47 <ExpHP> my current solution is to go back and forth with 'stack build' in a terminal. Can I do better?
20:47 <sm> Gurkenglas: check out http://hackage.haskell.org/package/h-reversi
20:48 <Hjulle> How do I prove to the compiler/tell the compiler to prove that a specific constraint is always true for a type family that I've defined?
20:48 <Gurkenglas> sm, wrong target
20:49 <sm> oops sorry. LordBrain.
20:49 <Gurkenglas> http://lpaste.net/4548528472800100352 lulz how do I hide that module list from the prompt on each line?
20:49 <sm> put :set prompt "ghci> " in .ghci
20:50 <cocreature> Gurkenglas: :set prompt "❯ "
20:50 <cocreature> put that in ~/.ghci and it will always be applied
20:50 <monochrom> No no no, my friend recently taught me the greatest prompt idea ever.
20:51 <monochrom> :set prompt "enter your password> "
20:51 <EvanR> metacircular evaluator http://lpaste.net/355284
20:51 armyriad joined
20:52 <sm> LordBrain: that one uses html canvas, but this seems about equivalent to using gloss+opengl, with no browser required
20:52 <Tuplanolla> I'm sticking with `:set prompt "please "`.
20:52 <sm> there's also FunGEn, opengl plus game framework
20:53 <LordBrain> i'm intrigued by blank canvas package anyway
20:53 <LordBrain> i know what you're saying
20:53 <LordBrain> it might be pointless... but i dont think i'm going to know unless i try it
20:53 <sm> then I think you should check out http://hackage.haskell.org/package/threepenny-gui too
20:54 fizruk joined
20:55 takle joined
20:55 <LordBrain> if i combine either of those with the webkit package, can probably make something that is virtually identical to a stand alone app
20:55 fendor joined
20:55 pgiarrusso_ joined
20:56 <LordBrain> and it might be easier to port to android
20:56 <LordBrain> or ios
20:56 <LordBrain> but i dont know, i dont have the experience to know for sure that approach is worthwhile
20:58 mjora7 joined
20:58 DocWinter joined
20:58 JuanMiguel joined
20:59 fendor joined
20:59 ertesx joined
20:59 <dmwit_> Hjulle: It was a bluff. A stupid joke about the origins of the terms big- and little-endian.
21:00 fendor joined
21:01 <LordBrain> if i use the black-canvas package, it seems i have to serve the canvas on a port, whats a good way to pick a random port that is unused?
21:01 <EvanR> use port 0
21:01 tromp joined
21:02 <sm> really ?
21:02 <EvanR> normally yes, dunno if that library gives you access to the resulting OS-chosen port
21:02 <sm> interesting. doesn't look like it does
21:03 <EvanR> bollocks
21:03 dm3 joined
21:05 JeanCarloMachado joined
21:05 uuplusu joined
21:06 <geekosaur> but there should be a way to get it via the network package
21:06 NeverDie joined
21:06 <EvanR> if you get the Socket, then you can get it
21:06 robkennedy joined
21:08 robertkennedy joined
21:09 <LordBrain> can i use the port 0 trick without it rerving the port, just to pick it?
21:09 <LordBrain> reserving*
21:09 <EvanR> probably not
21:09 ChaiTRex joined
21:09 <LordBrain> hmm
21:09 <sm> you need to know it to open a browser on it
21:09 <LordBrain> i dont
21:09 <LordBrain> i mean i dont need to know it to open the browser, because i am going to have the program do it all
21:09 <EvanR> picking a low 4 digit port is what a lot of people do
21:09 <LordBrain> its going to open the browser for me
21:10 <geekosaur> no, port 0 is actually the OS level API to select the next unused port, it has to be "reserved"/opened at that point or something else will take it
21:10 <sm> you can try to connect to whatever you picked, and see if it's active
21:10 <LordBrain> well, as long as its the same process, maybe it doesnt matter that i open the port already?
21:11 <sm> well hey, try it
21:11 doomlord joined
21:11 <EvanR> only one thing in the whole system can be listening on a TCP port at a time
21:11 splanch joined
21:11 <EvanR> only one server socket
21:12 takle joined
21:12 <LordBrain> well, maybe i can hack blank-canvas or something to operate in this mode
21:12 <LordBrain> i dont know
21:12 soniku joined
21:13 pi4 joined
21:13 <LordBrain> i need a break, i'll code it up later
21:13 <EvanR> if you cant get the Socket, then you can certainly hack it to get it
21:13 <EvanR> mumble
21:13 meba joined
21:13 <LordBrain> bbl
21:14 <sm> maybe the fast path to hgnome-games is write a front end for a bunch of existing hackage games
21:14 splanch_ joined
21:15 <EvanR> like what, monao ?
21:17 twomix joined
21:17 <sm> whatever works
21:17 <Gurkenglas> How do I get intero to use some package when I'm not in a project?
21:18 <sm> could be a short list, but it would be a fun project
21:18 MP2E joined
21:19 <ertes> Gurkenglas: does intero even support not being in a project? as far as i know it's heavily stack-bound
21:20 <Gurkenglas> Well it gives me errors for using base stuff wrong or importing a module it doesnt know
21:21 <ertes> Gurkenglas: you should just use the regular haskell-mode while not in a project
21:21 <ertes> … probably
21:22 flatmap13 joined
21:26 e14 joined
21:26 Tuplanolla joined
21:28 slack1256 joined
21:34 mekeor joined
21:36 doomlord joined
21:41 m0d joined
21:43 dunx joined
21:44 dfeuer joined
21:46 modlin joined
21:47 juubla joined
21:47 JoshS joined
21:47 strykerkkd joined
21:47 plot joined
21:47 <juubla> How do I pass options to happy when building with stack/ghc/cabal?
21:48 <juubla> I think there is supposed to be a field you can set in the .cabal file... but I can't find any documentation
21:48 conal joined
21:48 Gloomy joined
21:49 cpennington joined
21:51 bgamari joined
21:52 hiratara joined
21:52 quobo joined
21:54 <lyxia> juubla: https://github.com/haskell/cabal/issues/1223
21:54 <lpaste> ExpHP pasted “type conflict: why do I have two copies of the same package and version with different hashes” at http://lpaste.net/355285
21:54 <c_wraith> ExpHP: built against different dependencies
21:54 <ExpHP> c_wraith: D:
21:56 <ExpHP> I wish to offer the offending incorrectly-built libraries as sacrifice
21:56 <ExpHP> I did "stack clean" but it hungers for yet more
21:59 <tippenein> hmm, I haven't used 'cabal test' in a long time
21:59 <tippenein> it's not finding my test deps. do I have to do something to get it to build the test and run them?
21:59 <tippenein> configure --enable-tests doesn't seem to do anything useful
22:01 k joined
22:03 nh2 joined
22:03 k___ joined
22:03 <juubla> lyxia: whats suggested in that link doesnt seem to actually work
22:03 kuribas joined
22:03 iomonad joined
22:03 padre_angolano_ joined
22:03 <k___> hi all, is anyone familiar with the internals of how realToFrac works?
22:04 <k___> for example:
22:04 <k___> > let f :: Floating a => a -> a -> a; f x y = x * y
22:04 <lambdabot> <no location info>: error:
22:04 <lambdabot> not an expression: ‘let f :: Floating a => a -> a -> a; f x y = x * y’
22:05 <k___> > let x :: Float; x = 4
22:05 <lambdabot> <no location info>: error:
22:05 <lambdabot> not an expression: ‘let x :: Float; x = 4’
22:05 mmachenry joined
22:05 <k___> > let y :: Double; y = 5
22:05 <lambdabot> <no location info>: error:
22:05 <lambdabot> not an expression: ‘let y :: Double; y = 5’
22:05 <geekosaur> lambdabot takes expressions not definitions
22:05 <geekosaur> this is not ghci
22:06 <k___> ah sorry, should i use a code paste service instead?
22:06 <kuribas> I think it's fromRational . toRational
22:06 <kuribas> :t fromRational . toRational
22:06 <lambdabot> (Real a, Fractional c) => a -> c
22:06 <kuribas> :t realToFrac
22:06 <lambdabot> (Fractional b, Real a) => a -> b
22:06 <geekosaur> the default is, yes. there are RULES for various optimized versions for different types
22:07 <k___> i'm wondering about the internal representation about the result of `f (realToFrac x) (realToFrac y)` (with f, x, y as defined above)
22:07 <k___> since its input types are Float and Double, and its output type is `Floating a => a`
22:07 <k___> is its output type internally represented as a Float, Double, something else?
22:08 <geekosaur> what you wrote above is a type error
22:08 <k___> which part?
22:08 <geekosaur> well, no, if you realToFrac the inputs I guess it isn't
22:09 <geekosaur> in any case if you want to see the compiler representation, the easiest way to find out is to install the ghc-core package and use it to inspect the generated GHC Core
22:09 <geekosaur> (you can also do it manually but it's a bit fiddly)
22:10 jer1 joined
22:11 e14 joined
22:11 <k___> geekosaur: okay, thanks, i'll try it
22:11 latro`a joined
22:11 <geekosaur> it's almost certainly easiest because it can be a pain to figure out what RULES pragmas might apply to the conversion
22:12 <geekosaur> (but, probably not many unless you monomorphize it instead of using Floating a)
22:13 biglambda joined
22:13 bcmiller left
22:14 cschneid_ joined
22:14 soniku joined
22:14 <ExpHP> okay, that was weird... it seems like my stack.yaml was automatically updated by something from lts-8.4 to lts-8.5
22:15 <kuribas> given a list l and a function f: "f l = sum $ zipWith mod (scanl (+) 0 l) l", find the maximum value f p, where p is a permutation of l.
22:15 <k___> geekosaur: in my codebase, i'm using RankNTypes and NoMonomorphismRestriction
22:15 splanch joined
22:16 Chefe joined
22:16 <kuribas> it's an "intermediate" question on the current hackerrank competition...
22:16 iqubic joined
22:16 <geekosaur> you should probably know that every time you make something more polymorphic, you remove chances for optimization because it can't choose an implementation until the use site, and in the case of polymorphic recursion it might not be able to choose the implementation until runtime
22:17 <ExpHP> k___: not sure but I doubt it has any internal representation at all until it is monomorphized with a specific Floating typeclass
22:17 <ExpHP> it has a missing, implicit parameter (the typeclass dict)
22:18 <k___> geeksaur: good point, i'm making things polymorphic because a library i'm using (`ad`) requires it
22:19 <Gurkenglas> kuribas, I suppose a lemma there is that permuting a subsequence has no impact on the summands from either side of it
22:19 <kuribas> Gurkenglas: I tried that, but that doesn't work I think
22:19 <k___> ExpHP: what do you mean by a specific Floating typeclass?
22:20 <k___> do you mean an instance of Floating?
22:20 <kuribas> Gurkenglas: I don't know if I am breaking the rules by discussing it...
22:21 <Gurkenglas> kuribas, what's the distribution of l?
22:21 <Gurkenglas> (As in, what values of l is your algorithm to work with)
22:22 <kuribas> Gurkenglas: length l == 20, each element < 10^16
22:22 <geekosaur> k___, they do, yes
22:22 Michaelt293 joined
22:22 <ExpHP> k___: yes that's what I meant, I slipped with the terminology
22:23 hybrid joined
22:24 dni joined
22:24 e14 joined
22:24 <kuribas> Gurkenglas: it a pretty hard question for an "intermediate" exercise.
22:25 <k___> ExpHP: got it. i guess i can monomorphize the result with any instance and hopefully it will be stored in the correct representation (excepting the values that realToFrac has problems with, like NaN and Infinity...)
22:25 <kuribas> Gurkenglas: but an upper bound is "sum $ map (subtract 1) l"
22:25 uuplusu joined
22:26 <Gurkenglas> kuribas, a bound on the time complexity given by the author? Also, why wouldnt "that" work?
22:27 <Gurkenglas> Oh, a bound on the result. Lol
22:27 <kuribas> Gurkenglas: ehm, your right, but it's still O(n!)
22:27 <Gurkenglas> I see O(2^length l)
22:28 matthebauer joined
22:28 <kuribas> Gurkenglas: if I would use the fact that the order of the subsequence doesn't change the result...
22:29 <Gurkenglas> (with a linear factor or two thrown in maybe)
22:29 <kuribas> Gurkenglas: isn't the number of permutations n! ?
22:30 <Gurkenglas> Yep, I dont traverse all permutations
22:30 Durbley joined
22:30 <ExpHP> k___: Actually my guess is that it is an unevaluated thunk; I don't suspect that f (realToFrac x) (realToFrac y) actually performs the multiplication until it is monomorphised, even if you "strictly" evaluate it
22:31 dni joined
22:31 <kuribas> Gurkenglas: I got 5 seconds for the program to terminate
22:31 <ExpHP> k___: but don't take my word for it!
22:31 <EvanR> isnt it monomorphised at compile time
22:31 e14 joined
22:31 <EvanR> if ever
22:31 hiratara joined
22:34 brennie joined
22:34 pent joined
22:34 <ExpHP> What I mean is, I don't suspect that `let !a = f (realToFrac x) (realToFrac y) in a` is different from `let a = f (realToFrac x) (realToFrac y) in a`
22:34 <ExpHP> in fact, we can test this. Who's ready for a stack overflow? =D
22:35 <* ExpHP> pulls out the earth's most terrible weapon: List.fold
22:35 <ExpHP> i mean foldl >_>
22:35 meoblast001 joined
22:35 soniku joined
22:36 fizruk joined
22:36 crave_ joined
22:36 oisdk joined
22:37 sneakysicko joined
22:37 <ExpHP> er, I mean foldl'
22:37 <ExpHP> and minus the "most terrible" part
22:38 <lyxia> ExpHP: they are the same indeed
22:38 <ExpHP> lyxia: spoilers!
22:39 <* ExpHP> has 4 lines of a test file coded >_>
22:39 aarvar joined
22:39 matthebauer joined
22:40 brennie joined
22:40 pera joined
22:41 <* ExpHP> is really not good at using stack and still can't figure out how to just run the file in the app/ dir in the default template >_>
22:42 <k___> ExpHP: i'm excited to find out the result :)
22:42 <plot> q
22:42 <plot> :quit
22:44 slack__ joined
22:44 <lyxia> ExpHP: stack build && stack exec name-of-executable
22:46 coot joined
22:47 paco joined
22:47 <paco> hello!
22:48 <ExpHP> hmmm
22:48 <paco> does anyone have knowledge of comonadic comprehensions (co-for)?
22:48 <paco> I need to solve one question because I'm trying to implement them in another language
22:48 <Gurkenglas> kuribas, is that competition thing public, so I can submit my attempt? If not, can I post it in public? If not, want a look at it?
22:49 <hpc> paco: i believe the term for those is mprehensions ;)
22:49 <paco> and I don't exactly know whether the yield should be wrapped or extracted before returned
22:50 <ExpHP> okay I'm not seeing memory explosions with "let !a = List.foldl' f (0 :: (Floating a)=> a) $ realToFrac <$> xs :: (Floating a)=> a"
22:50 <paco> hpc really?
22:51 robertkennedy joined
22:51 <ExpHP> ahah! that's because it did type defaulting
22:51 <Tuplanolla> Not really, unless you think coconuts are nuts, paco.
22:52 <hpc> paco: no, it's a co-joke
22:52 pent joined
22:52 brennie joined
22:53 <paco> *sigh* it's too late for this
22:53 <paco> I've been coding for too long
22:53 <Tuplanolla> Nap time!
22:53 <paco> no, PR first
22:53 <paco> if you could please help me
22:53 <paco> :P
22:54 <Gurkenglas> hpc, is that when you say something to someone else in order to make yourself laugh?
22:54 <Tuplanolla> I don't really know how comonad comprehensions should look like since we don't even have codo notation.
22:54 e14 joined
22:54 <juubla> Using happy passing the -d (debug) option, but not debugging output is generated, I can see it importing Debug.Trace, but it never actually uses anything from the module...
22:55 typedrat joined
22:56 <reactormonk[m]> Is there a [a] -> Int -> Maybe a in the stdlib?
22:57 <k___> did you try hoogle?
22:57 <Cale> :t findIndex
22:57 <lambdabot> (a -> Bool) -> [a] -> Maybe Int
22:57 <Cale> oh, right :)
22:57 <geekosaur> probably not, on the grounds that you probably shouldn't be using a linked list if you want to do indexing enough for that to be useful
22:57 <Cale> Yeah, there's something in safe probably, but yeah, it's not all that common of an operation on lists.
22:57 <ChaiTRex> @hoogle [a] -> Int -> Maybe a
22:57 <lambdabot> Safe atMay :: [a] -> Int -> Maybe a
22:57 <lambdabot> Agda.Utils.List (!!!) :: [a] -> Int -> Maybe a
22:57 <lambdabot> CLaSH.Util indexMaybe :: [a] -> Int -> Maybe a
22:57 <reactormonk[m]> Tried hayoo
22:58 <reactormonk[m]> geekosaur: it's just a turtle script ^^
22:58 <Gurkenglas> reactormonk[m], you could do a caseof on the list that might have that additional argument at the end
22:58 <ExpHP> okay k___ here we go
22:58 <Cale> :t \xs n -> lookup n (zip [0..] xs)
22:58 <lambdabot> (Enum a, Num a, Eq a) => [b] -> a -> Maybe b
22:59 fotonzade joined
22:59 meoblast001 joined
23:00 <lpaste> ExpHP pasted “k___: monomorphized vs polymorphic infinite folds” at http://lpaste.net/355286
23:00 <ertes> comonad mprehensions
23:01 <ertes> i don't think mprehensions would be very useful, mostly because i think codo would not be very useful
23:01 <ExpHP> btw lyxia was right of course :)
23:02 tromp joined
23:03 <EvanR> od notation for OI
23:04 <ertes> :t flip $ foldr (x go n -> if n > 0 then go (n - 1) else Just x) (const Nothing)
23:04 <lambdabot> error:
23:04 <lambdabot> Pattern syntax in expression context:
23:04 <lambdabot> x go n -> if n > 0 then go (n - 1) else Just x
23:04 <ertes> :t flip $ foldr (\x go n -> if n > 0 then go (n - 1) else Just x) (const Nothing)
23:04 <lambdabot> (Num t1, Ord t1, Foldable t) => t1 -> t a -> Maybe a
23:04 <ertes> i've been doing too much scheme lately
23:04 plutoniix joined
23:05 matthebauer joined
23:06 nyherba joined
23:06 plutoniix joined
23:08 alveric1 joined
23:09 <k___> ExpHP: thanks! i tried running it and it still hangs though
23:09 <ertes> "daddy, i have a wish" – "what is it, dear?" – "i wish that some day all wars will be over, and that the sun will shine forever and… and…" – "and?" – "and that some day GHC is just preinstalled everywhere"
23:09 <ExpHP> k___ the second one? Did you include NoMonomorphismRestriction (otherwise GHC will type-default it)
23:10 <k___> ExpHP: yeah, the pragma is there but GHC still defaulted it
23:10 <k___> to Double
23:10 <ExpHP> D=
23:10 <ertes> you know how they say: "i use vi, because it's available everywhere"… GHC needs that, too
23:11 <EvanR> thatd be interesting
23:11 <ertes> busybox 2.0 change log: "Added GHC"
23:11 <EvanR> GHC for embedded, GHC for arduino
23:12 <ExpHP> k___: what's your GHC version? I've got 8.0.2
23:12 <k___> 7.10.2
23:14 meba joined
23:14 <reactormonk[m]> How do I get myself a total read?
23:14 <k___> ExpHP: GHC issues aside, thanks for the neat example and for trying it! cool to know that realToFrac just thunks everything (if i'm understanding the code right)
23:14 <EvanR> > reads "123abc" :: [(Integer,String)]
23:14 <lambdabot> [(123,"abc")]
23:15 <EvanR> > reads "XXXabc" :: [(Integer,String)]
23:15 <lambdabot> []
23:15 <k___> er, when polymorphic ^
23:15 <EvanR> also readMay from the safe package
23:15 <geekosaur> :t readMaybe
23:15 <lambdabot> error: Variable not in scope: readMaybe
23:15 <EvanR> readMaybe from the Text package
23:15 <geekosaur> oh right :/
23:15 <ertes> busybox FAQ: "Why has busybox become so huge? A: It's not really huge. It's just feature-complete now. You can always disable vi to free up some space."
23:15 <geekosaur> @index readMaybe
23:15 <lambdabot> Text.Read
23:15 <geekosaur> not Text package, just not in Prelude
23:16 <EvanR> ok base
23:17 mkoenig joined
23:17 <reactormonk[m]> @index readMay
23:17 <lambdabot> bzzt
23:17 soLucien joined
23:17 <k___> i didn't know lambdabot could do that
23:17 <ExpHP> how rude
23:17 <reactormonk[m]> Text is fine
23:18 <ertes> lambdabot is full of surprises
23:18 <ExpHP> @yar
23:18 <lambdabot> Aye
23:18 <geekosaur> only for stuff that comes with ghc, I think
23:18 <geekosaur> base and a handful of other packages
23:19 <EvanR> its like u.s.s. enterprise, new beam or force field of the week
23:20 plot joined
23:21 shayan_ joined
23:22 dsantiago joined
23:23 e14 joined
23:25 <mniip> dammit, someone keeps posting HTML to the ML, how dare they
23:25 <ertes> :t dinner
23:25 <lambdabot> p i z z a
23:25 <EvanR> i feel like this is a MUD... i can spot failures to infer RankNTypes errors by the general shape of the page of error message
23:26 <EvanR> i dont even see the error messages anymore
23:26 <ertes> EvanR: XP added, welcome to the next level!
23:26 <EvanR> :\
23:27 <ExpHP> you got 2 AP! How would you like to spend them?
23:27 tromp joined
23:27 <mniip> skill buy Dependent Types
23:28 <ertes> i would install GHC everywhere
23:28 Prutheus joined
23:28 <ertes> if i had 5 AP, i would built it into the OS
23:28 <ertes> *build
23:28 <EvanR> hahaha if haskell were an MMO
23:28 <EvanR> or a class in an MMO
23:29 <EvanR> you could also choose from C++, and scala
23:29 <ExpHP> Haskell used `fix (1:)`!
23:30 <ertes> no, haskell is not an MMO
23:30 <ertes> that's stackoverflow
23:30 uuplusu joined
23:30 <EvanR> start with language basics and upgrade to get extensions
23:30 <ertes> https://ro-che.info/ccc/13
23:30 <EvanR> or weird features
23:31 richi235 joined
23:32 <ExpHP> pay2play for haskell prime
23:32 <mniip> EvanR, a big 'let f=join(,);g=f.f.f in g.g.g' approached from west, [T]ype/[E]valuate?
23:32 <EvanR> lol
23:34 <ExpHP> Somebody should adapt Slime Forest to just that
23:34 <ExpHP> "Curry Forest"
23:34 plot joined
23:34 <mniip> that actually looks cool in the new ghc
23:35 <mniip> or in the old ghc
23:37 <reactormonk[m]> Recommended parser for haskell? Relatively simple parsing, preferably with backtracking.
23:37 <ExpHP> for haskell syntax itself, or for use in haskell?
23:38 <ExpHP> Parsec is pretty huge, and spinoffs like Megaparsec and Attoparsec automatically backtrack
23:38 <ExpHP> I mean huge in terms of usage/popularity
23:39 <mniip> reactormonk[m], psst kid, want to see some stuff? I have a parser library in 5 lines of code
23:39 <reactormonk[m]> mniip: :-P
23:39 <mniip> @hackage yoctoparsec
23:39 <lambdabot> http://hackage.haskell.org/package/yoctoparsec
23:39 <ExpHP> (you just have to wait for the entire haskell ecosystem to build)
23:39 <reactormonk[m]> ExpHP: does parsec backtrack?
23:40 <* hpc> imagines mniip wearing a trenchcoat saying "i got combinators you aint even heard of... what are you, an implementor?"
23:40 <ExpHP> reactormonk[m]: explicitly, through use of the 'try' combinator
23:40 <ExpHP> reactormonk[m]: otherwise, I think if it consumes partial input before failing, it is considered an overall failure
23:40 <mniip> well, to be fair, it could have more combinators
23:40 <mniip> but then it's more lines of code
23:40 <ExpHP> (at least that's what a rust library modeled after parsec does)
23:41 <mniip> it could have e.g lookahead aka language conjunction
23:42 <ertes> > (huge 0 3, huge 1 3, huge 2 3)
23:42 <lambdabot> (4,6,24)
23:42 <ertes> > huge 4 3
23:42 <lambdabot> mueval-core: Time limit exceeded
23:43 <mniip> it could have 'record :: Parser b t a -> Parser b t (a, [t])'
23:43 <mniip> and 'lookahead :: Parser b t a -> Parser b t c -> Parser b t (a, c)'
23:43 <mniip> but for these you have to unpack the FreeT "by hand" which I explicitly avoided in my library :p
23:46 <ExpHP> mniip: gotta conserve those precious points
23:47 theDon_ joined
23:48 <mniip> yeah my library is completely pointless
23:50 prophile joined
23:50 markus1189 joined
23:50 markus1219 joined
23:51 louispan joined
23:53 soLucien joined
23:53 gienah joined
23:53 lambda-11235 joined
23:57 flatmap13 joined
23:58 nakal_ joined
23:59 infinity0_ joined
23:59 infinity0_ joined