<    June 2018     >
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 _2_2 23  
24 25 26 27 28 29 30
00:00 <crestfallen> hmm, but in (our basic) recursive functions, there is a concise way to write out the order that is instructive, say the eval_extendEu example. I feel its equivalent to understanding what the function does. fishythefish
00:00 <crestfallen> in value anyway
00:00 emilypi joined
00:01 <crestfallen> but your comment re: overestimation is actually encouraging ! :)
00:01 <fishythefish> crestfallen: okay, so you're potentially asking about two different things. Are you simply trying to understand what output a function produces for a given input, or are you trying to understand how the compiler chooses an evaluation order?
00:02 <fishythefish> the former tends to be easier than the latter
00:03 <typo_> at least, PairF requires 3 parameters, so using it with Kind * -> Constraint wont work
00:03 cobreadmonster joined
00:03 conal_ joined
00:04 <fishythefish> crestfallen: I'd also posit that trying to understand recursion by evaluating all the way down to the base case and then going back up is somewhat self-defeating
00:04 oisdk joined
00:04 <crestfallen> hmm
00:04 pounce joined
00:04 <fishythefish> recursion should feel like an inductive proof - the base case(s) must work, and then in the recursive/inductive step(s), you trust that your recursive call/inductive hypothesis worked and proceed from there
00:06 exarkun joined
00:07 <crestfallen> but in light of pattern matching, the exEuclid problem is something that makes a lot of sense to me, to see it in its entirety the way you wrote it out last week. because the improves the instinct for pattern matching.
00:08 <crestfallen> it*
00:08 <fishythefish> crestfallen: pattern matching is orthogonal to recursion, though
00:09 <fishythefish> you can study pattern matching just as well in a non-recursive context, and even in the recursive case, you only need to look at one level of the recursion at a time
00:09 kmurphy4 joined
00:09 <fishythefish> most of the levels of the recursion were exactly the same thing but with different numbers
00:10 <crestfallen> right, in fact you can only see it in a single level.
00:10 <crestfallen> orthogonal to recursion ....
00:11 <fishythefish> crestfallen: in the programmer jargon sense, meaning unrelated/independent essentially
00:12 <fishythefish> (well, the independent/orthogonal connection comes from linear algebra, I guess)
00:16 <crestfallen> I see, that is helpful.. still, my understanding is the patt. matching comes in handy, because in recursion you are relying on substitution, I guess
00:16 Arcaelyx joined
00:16 <crestfallen> so if its not just a number but a longer expression, you have to keep track
00:16 TCZ joined
00:17 mak` joined
00:17 <fishythefish> pattern matching is useful because you want to do case analysis on a value, recursion or no recursion
00:17 <fishythefish> e.g. implement the `head` function
00:18 <fishythefish> (well, perhaps `listToMaybe` is better, so we can stay total)
00:21 sytherax joined
00:21 Linter joined
00:22 <crestfallen> > f = head . (filter fst)
00:22 <lambdabot> <hint>:1:3: error:
00:22 <lambdabot> parse error on input ‘=’
00:22 <lambdabot> Perhaps you need a 'let' in a 'do' block?
00:22 <crestfallen> @let f = head . (filter fst)
00:22 <lambdabot> Defined.
00:22 <crestfallen> :t f
00:22 <lambdabot> error:
00:22 <lambdabot> Ambiguous occurrence ‘f’
00:22 <lambdabot> It could refer to either ‘Debug.SimpleReflect.f’,
00:22 <crestfallen> @let ff = head . (filter fst)
00:22 <lambdabot> Defined.
00:23 <crestfallen> :t ff
00:23 <lambdabot> [(Bool, b)] -> (Bool, b)
00:23 <fishythefish> crestfallen: you can message lambdabot directly
00:23 <fishythefish> or use a ghci session
00:24 <typo_> seems to work ok with distributing arguments over -> synonyms using a datatype. now getting an error trying to instantiate the class synonym..
00:24 chao-tic joined
00:25 harfangk joined
00:25 <typo_> https://lpaste.net/4682752059135492096
00:25 <crestfallen> sorry I did . I only wanted to say I went through the unification and saw how it is resolved. and to ask if it is a valuable exercise.
00:26 <jle`> typo_: do you mean that you want a version of PairF2 that can be partially applied?
00:26 <fishythefish> crestfallen: I don't think it's particularly valuable for you, no
00:27 <typo_> yes
00:27 <crestfallen> ok thanks kindly fishythefish
00:27 <typo_> though the paste makes do without
00:27 <fishythefish> crestfallen: type unification generally is not something you need to understand right now, nor is it something you should devote time to at this stage
00:27 zfnmxt joined
00:27 <fishythefish> ghci will happily tell you the type of something, so there's no need to work out every type by hand
00:28 <fishythefish> moreover, it's easy enough to work out the type of your function without going through a formal unification procedure, and that intuition is much more valuable
00:28 rcdilorenzo joined
00:29 rcdilorenzo left
00:30 <crestfallen> thanks , a member told me there's no learning path, only a terrain. I liked that, so I just sample things when I tire of the book...
00:31 <fishythefish> there's no single path, but whatever path you take should probably be continuous
00:32 <crestfallen> thanks for the help
00:32 crobbins joined
00:32 louispan joined
00:33 pounce joined
00:34 progfun joined
00:34 <fishythefish> crestfallen: seriously, just write some code. Start a personal project, do project Euler, do exercises from your book, whatever, but just try writing some Haskell
00:34 chao-tic joined
00:35 andyhuzhill joined
00:35 <fishythefish> if you only read theory, then you're probably (a) gonna get bored because you don't do anything with it and (b) fail to understand it, so you won't have the prerequisite knowledge for moving onto more interesting things
00:35 WhatisRT joined
00:37 <crestfallen> thanks, I have some ocd re: what's under the hood. I look at functions as machines that are in motion. "first this happens here, then this happens over here." I try to visualize what is happening to my disservice. will do!
00:37 gregberns joined
00:37 rcdilorenzo joined
00:38 andyhuzhill joined
00:40 <fishythefish> crestfallen: it'll take some getting used to, but I recommend weaning yourself off that mentality. Operational semantics have their uses, but you'll frequently want to think in terms of denotation semantics
00:40 <fishythefish> denotational*
00:41 <crestfallen> homework for tonight. many thanks
00:42 Tauta0 joined
00:44 kendrick_ joined
00:44 danso joined
00:45 wto joined
00:47 zdenal joined
00:47 <fishythefish> jle`: maybe someone already pointed this out, but the implementation of the prism API in terms of match/inject just seems to be preview twice
00:47 <pounce> Ok, so I am just trying haskell out for the first time so please bear with me. I want to make a function `reduceList` that turns [1,2,3] into 123. and I think I could do it like this: `reduceList xs = foldr (func) 0 reverse xs` where `func a b = (b * 10) + a`. Is there anyway I can write func inside reducelist instead of binding it?
00:48 <fishythefish> pounce: you could use a lambda if you really don't want to give it a name
00:48 <fishythefish> but i'm curious why you don't want to give it a binding
00:48 <pounce> I want to learn stuff like lambdas ^W^
00:48 <fishythefish> foldr (\a b -> (b * 10) + a) ...
00:48 <jle`> fishythefish: ah, thanks :) no, hasn't been pointed out yet
00:49 <pounce> thank you :)
00:50 Tauta0 joined
00:51 <typo_> ok, this works; https://lpaste.net/153315244247089152
00:51 <pounce> oh, could I use `where` to?
00:52 <fishythefish> pounce: yup, or `let/in`
00:53 <typo_> Ended up not using the partially applied pair function, still not sure how it could be written
00:54 <typo_> any comment on this Lens definition?
00:54 ericsagn1 joined
00:56 DSM joined
00:56 andreabedini joined
00:56 amirpro joined
00:56 <jle`> typo_: do you just want a version of PairF2 that can be partially applied?
00:57 <typo_> that would be good
00:58 <typo_> its not clear the advantage of replacing classes with tuples of Empty instances, but its something to do with '$> ()'
00:58 <typo_> otherwise the approach has no motivation
00:58 <jle`> some people have done something similar using dummy typeclasses
00:59 codesoup joined
00:59 <jle`> class (c a, d a) => PairF2 c d a
00:59 rprije joined
00:59 <dmwit> This is an awful lot of indirection. Do I want to know what it's all about?
00:59 <jle`> instance (c a, d a) => PairF2 c d a -- -XUndecidableInstances
00:59 tzemanovic joined
01:00 <jle`> that's a version of type PairF2 c d a = (c a, d a) that can be partially applied
01:00 <jle`> *where c and d give constraints
01:02 mounty joined
01:02 <typo_> thats a different kind of empty instance...
01:03 <typo_> thanks though.
01:03 sytherax joined
01:03 woodson joined
01:03 iAmerikan joined
01:03 raingloom joined
01:06 cybai joined
01:06 <typo_> dmwit: the idea was to parametrise functions. e.g. for Get, (f a -> (a,f a)), this becomes (f a -> (a,a->f a->f a)) and then (f a -> (a,i,f a)) along with the constraint Empty (\a -> (f a -> (i -> a -> f a -> f a))) and all the trouble is with these kinds of lambda types...
01:07 plutoniix joined
01:08 <typo_> and then supposing that all classes could have their functions given extra parameters in this way
01:08 jmcarthur joined
01:09 <typo_> recovering the original version as instances where i = () and noting that Empty (x -> ()) is trivial to define.
01:11 earendel joined
01:11 markus1199 joined
01:11 sytherax joined
01:12 zdenal joined
01:13 <typo_> well, various versions of Empty with different numbers of parameters, and associated partially applied tuples and such
01:15 mizu_no_oto_work joined
01:17 conal_ joined
01:17 carlomazzaferro joined
01:18 <typo_> containers with shape can be built up from cons over parametrised empty containers, and parametrised lenses can be used to give default comonadic traversal. because this notion of extending functions of common classes with an additional argument occurs repeatedly, the abstract approach for "extending" classes in this way is motivated.
01:19 <typo_> the paste gives an example of what this looks like
01:19 Destol joined
01:20 bontaq` joined
01:22 <typo_> * Empty (\f a -> (f a -> (i -> a -> f a -> f a)))
01:22 <typo_> ... no thats just wrong
01:22 <typo_> sorry
01:23 <typo_> maybe some other time
01:24 hjdskes joined
01:25 chat_ joined
01:29 <dmwit> I feel like #haskell inhabitants are confusing me more these last few days than usual.
01:29 conal_ joined
01:29 <dmwit> Perhaps my brain is getting old and less nimble.
01:30 <Clint> o_o
01:33 andreabedini joined
01:34 jackdk joined
01:37 saurabhnanda joined
01:37 Welkin joined
01:38 <Welkin> this is odd
01:38 <Welkin> `clang: error: unknown argument: '-no-pie'`
01:38 <Welkin> I get this when installing dependencies for an old servant project I am upgrading
01:38 <Welkin> using cabal new-build
01:42 iAmerikan joined
01:44 dented42 joined
01:50 Ekho joined
01:52 louispan joined
01:54 crobbins joined
01:54 <glguy> Welkin: on mac?
01:54 <pounce> Welkin: give clang some of your pie
01:54 kefin_ joined
01:55 <glguy> $ fgrep pie ~/Tools/ghc-8.4.3/lib/ghc-8.4.3/settings
01:55 <glguy> ("C compiler supports -no-pie", "NO"),
01:55 dbmikus joined
01:55 <glguy> You might need to update that file
01:56 plugin joined
01:57 <Welkin> yeah I just changed that setting
01:57 <Welkin> but it seems wrong
01:57 <Welkin> I have never had to do that before
01:58 xcmw joined
01:58 <glguy> Welkin: something changed in a recent xcode update
01:58 cjreynolds joined
01:58 <Welkin> I don't even have xcode, only the command-line tools
01:59 <Welkin> which I have not updated in a long time
02:00 chao-tic joined
02:00 hucksy_ joined
02:02 iAmerikan joined
02:02 plugin joined
02:03 jackdk39 joined
02:03 zdenal joined
02:04 <enterprisey> Why would I want to use the \& escape character?
02:05 <glguy> enterprisey: To disambiguate some escapes
02:05 louispan joined
02:05 <glguy> > "\x60\&b"
02:05 <pavonia> > "\1234" == "\123\&4"
02:05 <lambdabot> "`b"
02:05 <lambdabot> False
02:05 <glguy> > "\x60b"
02:05 oisdk joined
02:05 <lambdabot> "\1547"
02:05 <enterprisey> oh that's interesting, thanks!
02:05 <xcmw> Is there something like arrow that works for k -> k -> * instead of just * -> * -> *?
02:06 rprije joined
02:06 <Cale> xcmw: with what methods?
02:07 <Cale> :k Category
02:07 <lambdabot> (k -> k -> *) -> Constraint
02:08 fmixing joined
02:08 <Cale> You might be looking for some subclass of Category, of course, it can't include 'arr'
02:08 <Cale> :t arr
02:08 <lambdabot> Arrow a => (b -> c) -> a b c
02:09 <xcmw> Cale: What I'm working with is a category. It is arrowish but not really an arrow.
02:10 gestone joined
02:11 <Cale> https://hackage.haskell.org/package/categories-1.0.7/docs/Control-Category-Monoidal.html
02:11 <Cale> This is pretty close
02:13 <Cale> (you have to go up the superclass hierarchy a bit to really find everything you probably expect...)
02:13 <xcmw> I don't think it is a bifunctor it is profunctorish
02:14 theDon joined
02:17 <Cale> xcmw: hmm, yeah, I'm not sure what to suggest
02:17 louispan joined
02:18 <Cale> It would be possible to define a generalised profunctor class of course... that might be hanging around somewhere
02:18 <xcmw> Cale: https://lpaste.net/3934615584200720384
02:18 Skami joined
02:18 <Welkin> what the heck is `Control.Monad.IO.Unlift.MonadUnliftIO`?
02:19 <Cale> xcmw: The p there looks like a bifunctor
02:20 <xcmw> The p is a bifunctor
02:21 <xcmw> Well bifunctorish
02:21 <Cale> https://hackage.haskell.org/package/categories-1.0.7/docs/Control-Categorical-Bifunctor.html#t:Bifunctor -- so if you look at this, and you pick all the categories (r,s,t) to be the same one (what you're calling arr)
02:21 <Welkin> damn it, more wacky typeclasses from snoyberg
02:21 <Cale> and you pick p = q
02:21 Linter joined
02:22 <Welkin> now what do I need to update
02:22 <Cale> Welkin: It's basically another version of the same thing as MonadBaseControl / MonadTransControl
02:23 <Cale> (and has similar reasons to be avoided, imo)
02:23 lortabac joined
02:24 <xcmw> Cale: I will look at those. Thank you.
02:24 gabcoh joined
02:24 <Welkin> Cale: well this is a 2 year old codebase that is using persistent
02:25 banc joined
02:25 <Welkin> I should switch it over to postgresql simple
02:25 <Welkin> but for now...
02:25 <glguy> Welkin: were you using conduit on that one?
02:25 <Welkin> yes, for file uploads
02:25 `Guest00000 joined
02:25 <glguy> then your upper bound might not be tight enough on that library
02:25 <glguy> that's the place that's pulling in this new unliftio stuff
02:25 <Welkin> I had no upper bounds
02:25 <glguy> there you go :)
02:25 <Welkin> I was previously using stack
02:25 <Welkin> my cabal file has no versions
02:25 <glguy> oops
02:26 <Welkin> so I just ran cabal new-build and let it figure it out
02:26 daniel-s joined
02:26 oisdk joined
02:26 <enterprisey> Is there a way to search for the first occurrence of either of two characters without regex? Or is regex the way to go
02:27 <MarcelineVQ> Welkin: if needed you can tell stack to generate a versioned cabal file using stack sdist --pvp-bounds both
02:27 <Welkin> well, I wanted to update the coebase
02:27 <Welkin> since it has not been for 2 years
02:28 <rotaerk> enterprisey, what's the context? what are you doing?
02:28 <enterprisey> rotaerk: parsing Python's line endings
02:28 <Cale> enterprisey: In what type of thing? A list?
02:28 <Cale> A Text?
02:28 <enterprisey> Python allows \n, \r\n, or \r
02:28 <enterprisey> in any order
02:28 <enterprisey> I have a ByteString, because I haven't decoded it yet
02:28 <rotaerk> are you using a parser combinator library to do this?
02:28 <enterprisey> however, I'm allowed to decode it to UTF-8 only until the second linebreak
02:28 <enterprisey> I am, in fact
02:29 <enterprisey> actually yeah I should probably just use that
02:29 zdenal joined
02:29 <enterprisey> I'm not sure how to make it sufficiently lazy, though
02:29 <xcmw> Cale: ISimpleFunc and IComplexFunc are the types that are arrowish. https://lpaste.net/650475146326310912
02:29 <xcmw> It is in idris
02:29 dbmikus joined
02:29 ystael joined
02:29 <Cale> break :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString) will split a ByteString at the first point which satisfies the condition
02:29 <enterprisey> for example, if I'm looking for a regex that can appear in the first two lines only, how can I make the library avoid going through the whole thing
02:30 <enterprisey> I guess that's the root problem
02:30 <Cale> So you can just test if the Word8 is one of the two bytes you're looking for
02:30 <enterprisey> Cale: yeah, that would work, but I would have to do at worst four successive calls of that
02:30 <enterprisey> and wrapped in control flow, which would be messy
02:31 <Welkin> okay it looks like conduit < 1.3 doesn't have MonadUnliftIO
02:31 <Cale> I'd probably want to decode the thing to Text first...
02:31 <enterprisey> well, I have no idea how to decode it
02:31 <enterprisey> because the end goal of this part of the program is the decoding of the file
02:32 <enterprisey> so, if I had something like "decode only the first two lines", I'd use that
02:32 <enterprisey> "the decoding of the file" <- I meant "encoding", sorry
02:33 <enterprisey> I could probably use takeWhile a bunch
02:33 AetherWind joined
02:34 progfun joined
02:34 gregberns joined
02:37 eschnett joined
02:37 chao-tic joined
02:37 sighingnow_ joined
02:37 <Cale> enterprisey: Does it require the line endings to be consistent at least?
02:37 <enterprisey> sadly, no
02:37 <Cale> haha
02:37 <enterprisey> one line can end with \r, and the next with \r\n
02:37 <enterprisey> ain't Python something
02:37 <enterprisey> (at least, that's how CPython rolls)
02:37 <Cale> It's almost at the point where I'd prefer just using Attoparsec or something
02:38 <enterprisey> yeah
02:38 <enterprisey> my current solution is use break interleaved with running my megaparsec parser
02:38 <enterprisey> this is how newline translation happens in CPython, for reference
02:38 <enterprisey> https://github.com/python/cpython/blob/master/Parser/tokenizer.c#L701-L740
02:38 <Cale> glorious
02:38 <enterprisey> indeed
02:39 c1b01r3 joined
02:39 <enterprisey> the famous "no encodings differ from ASCII on how they map newline"
02:39 lagothrix joined
02:39 <enterprisey> which I suppose *is* true, if only because they say in the spec "we only allow encodings that map newline the same way ascii does"
02:40 louispan joined
02:44 <Welkin> this never seems to end
02:44 <dmwit> enterprisey: I would bet they also need another property (though perhaps they don't realize it): only encodings that do *not* produce newline-like bytes in the encodings of other characters.
02:44 rcdilorenzo joined
02:44 <enterprisey> hahaha, true
02:44 <Welkin> no matter how many packages I restrict under a certain version, this unliftIO stuff seems to come up again
02:44 fmixing joined
02:45 iAmerikan joined
02:45 <glguy> Welkin: How about setting "--constraint=whateverpackage<0"
02:45 <glguy> and then you'll see which packages fail to install given your exclusion of that package
02:45 <Welkin> and my application fails to build because there is no instance ofr MonadUnliftIO for MaybeT
02:45 <glguy> and you can narrow things down?
02:46 hphuoc25 joined
02:46 <Welkin> oh
02:46 <Welkin> I wonder if I can explicitly tell it to not use the unlift-io-core package
02:47 cybai joined
02:47 <Welkin> can I do that?
02:47 <glguy> You can set impossible constraints on it
02:47 <Welkin> unliftio-core < 0
02:47 <glguy> like <0 and >0
02:47 <Welkin> lol
02:47 <Welkin> let me try
02:48 <Welkin> nope :(
02:48 <* hackage> summoner 1.0.3 - Tool for creating completely configured production Haskell projects. http://hackage.haskell.org/package/summoner-1.0.3 (shersh)
02:49 <Welkin> all these persistent packages are probably messing it up
02:49 rcdilorenzo joined
02:50 <Welkin> oh my god
02:50 <Welkin> wtf snoyberg?
02:50 <Welkin> this stupid package is like a disease
02:50 <rotaerk> what package
02:50 <Welkin> it's infected tons of the dependencies
02:51 <Welkin> liftio-core
02:51 <Welkin> anything from snoyberg has it now, it seems
02:51 sword865 joined
02:51 <Welkin> and it's breaking my build
02:51 <enterprisey> you mean unliftio-core?
02:52 <Welkin> yes
02:52 andyhuzhill joined
02:53 <rotaerk> Welkin, why is it demanding that there be an instance of MonadUnliftIO for MaybeT?
02:54 <rotaerk> why are you using a MaybeT as a MonadUnliftIO
02:54 <Welkin> because of the way I have some code written that uses MaybteT
02:54 <Welkin> I am not
02:54 <Welkin> I wrote this code 2 years ago before monadUnliftIO existed
02:54 <Welkin> and I don't want to deal with this dumb typeclass
02:55 cobreadmonster joined
02:56 <Welkin> compiling again
02:56 kasra joined
02:56 hphuoc25 joined
02:56 <Welkin> finally, success
02:57 <Welkin> also, it was MaybeT IO, specifically
03:00 rprije joined
03:01 <EvanR> MonadUnliftIO
03:01 blankhart joined
03:02 plugin joined
03:03 <EvanR> the transformer saga continues
03:03 <Welkin> no, it ends here
03:04 rcdilorenzo joined
03:05 jophish joined
03:07 `Guest00000 joined
03:08 jackdk39 joined
03:09 louispan joined
03:10 <jle`> Welkin: the fpcomplete ecosystem has basically moved from MonadBaseControl to MonadUnliftIO
03:10 <jle`> honestly i don't really miss MonadBaseControl
03:11 <jle`> it's probably an overall benefit...but it does break almost all code, heh
03:11 <Welkin> jle`: I don't care about either of them
03:13 <jle`> yes, was just explaining the story about why all of the code starting breaking
03:13 <jle`> MonadBaseControl has been effectively deprecated
03:14 <Welkin> I don't even know the purpose of either
03:17 sytherax joined
03:17 <jle`> the basic problem they both solve is generalizing functions like forkIO :: IO a -> IO ThreadId, to other things beside IO
03:18 <jle`> a more generic forkIO, catch/handle, etc.
03:19 <jle`> it's overall understandably a very silly/minor thing to wreck the entire ecosystem over
03:19 patbecich joined
03:20 <enterprisey> what's the best way to express the regex .* in a parser combinator?
03:20 <Cale> many anyChar
03:20 <enterprisey> any way to do it with primitives?
03:20 pera joined
03:21 <Cale> hm?
03:21 <enterprisey> like tokens, takeWhileP, takeWhile1P, takeP
03:21 <Cale> which parsing library, sorry
03:21 <enterprisey> ie the Megaparsec "fast" parsers
03:22 <enterprisey> context: I want to parse #.*coding, where # and "coding" are terminal
03:22 <enterprisey> I could use notFollowedBy I guess
03:23 <Cale> takeWhileP (const True)
03:23 <Cale> takeWhileP Nothing (const True)
03:23 <Cale> this might already have a name
03:24 <Cale> Though I'm not sure takeWhileP is actually nondeterministic, in which case that doesn't really do what you want, because it just consumes everything with no potential for backtracking
03:24 <enterprisey> yeah
03:25 <enterprisey> I think backtracking automatically makes something slow, so many anyChar is the way to go here
03:25 <enterprisey> or if I were being extra semantic, skipManyTill anyChar actualParser
03:26 <* dmwit> cooks up a file real quick that reads `#codincodincodincodincodincodincodin...`
03:27 urodna joined
03:28 <* byorgey> imagines recursive fish
03:28 <pavonia> enterprisey: Are you sure you actually want .* there? Perhaps with a more specific parser you could avoid unnecessary backtracking
03:29 <enterprisey> in the original regex, it's .*?
03:29 <enterprisey> and I guess no newlines, which are matched by anyChar so I shouldn't be using it anyway
03:30 <pavonia> Do you have a link to the original grammar?
03:30 <enterprisey> ^[ \t\v]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)
03:30 <enterprisey> ^ full regex
03:31 exarkun joined
03:33 <jle`> it's probably better to not try to translate a regex literally to parser combinators
03:33 <dmwit> `.*?`?
03:34 <geekosaur> non-greedy
03:34 <geekosaur> .* matches the longest possible string, .*? the shortest
03:34 rcdilorenzo joined
03:34 <dmwit> How could it possibly matter? The `[:=]` is a synchronization point.
03:34 <geekosaur> (perl / pcre)
03:35 <geekosaur> no, if there are two, .* will sync to the last, .*? to the first
03:35 <dmwit> But the rest of the regex can't match a colon or an equals sign.
03:35 <geekosaur> but the .* can match both
03:36 <geekosaur> it will sync eventually, yes, but .* will cause much more backtracking
03:36 <dmwit> Right. But if it matches an early one, the rest of the regex will not match the rest of the string.
03:36 <dmwit> oh
03:36 hphuoc25 joined
03:36 <dmwit> Ick. This is what you get for using non-regular expressions. =P
03:36 chat joined
03:36 fujiy joined
03:37 <enterprisey> jle`: I realized that too late, lol
03:37 <geekosaur> although, actually, if thre are two, .*? will cause more backtracking here. because it'll hit the second and realize it has to backtrack over the .*?
03:38 <geekosaur> so the longest munch is more correct in this case.
03:38 <geekosaur> althoguh arguably you want a more precise grammar anyway. this is not something regex handles well, really
03:41 lassulus_ joined
03:41 <enterprisey> I've implemented it with skipManyTill (Megaparsec), using satisfy excluding newlines as the first arg and the rest of the regex as the second
03:45 andreabedini joined
03:47 otto_s joined
03:47 hphuoc25 joined
03:54 sektor joined
03:54 chat_ joined
03:54 gigavinyl joined
03:55 khilan joined
03:56 d6e joined
03:56 fmixing joined
03:57 patbecich joined
03:59 conal_ joined
03:59 Nokurn joined
04:01 Linter joined
04:02 lastmanstanding joined
04:06 replay joined
04:08 <* hackage> warp-tls-uid - set group and user id before running server http://hackage.haskell.org/package/warp-tls-uid- (YoshikuniJujo)
04:09 russruss joined
04:11 klntsky joined
04:11 iAmDecim joined
04:13 rahulr joined
04:14 iAmDecim joined
04:15 conal_ joined
04:17 d6e joined
04:21 zdenal joined
04:26 hphuoc25 joined
04:28 SpinTensor joined
04:30 siraben joined
04:31 znack joined
04:31 conal_ joined
04:32 zdenal joined
04:32 sytherax joined
04:35 carafe joined
04:37 gregberns joined
04:38 tripty joined
04:38 anjannath[m] joined
04:39 Cale joined
04:41 keepLearning512 joined
04:42 jud joined
04:42 hellozee joined
04:44 jhrcek joined
04:48 cybai joined
04:49 vmandela joined
04:52 obi_jan_kenobi_ joined
04:56 chat joined
04:56 saurabhnanda joined
04:57 saurabhnanda joined
04:57 oisdk joined
04:57 saurabhn_ joined
04:57 zdenal joined
04:59 blankhart joined
04:59 hphuoc25 joined
05:00 megaTherion joined
05:02 krone_ joined
05:02 <pounce> I'm really new to haskell. How do I get functions (like from Data.List) in scope?
05:03 d3stiny joined
05:03 <cocreature> pounce: import Data.List
05:03 Lowl3v3l joined
05:04 <pounce> ty
05:05 pally joined
05:06 xtreak joined
05:07 exarkun joined
05:07 fmixing joined
05:09 hphuoc25 joined
05:10 WhatisRT joined
05:11 <pounce> If I take the "primes" example from the front page, and put it in a file, it doesn't compile
05:11 <pounce> do I need to do something so multi-line statements like it do?
05:12 <cocreature> can you show us the error?
05:12 slomo joined
05:12 slomo joined
05:12 <pounce> `error: parse error on input ‘where'`
05:12 <pounce> on the second line of it
05:12 toure joined
05:12 <cocreature> please show us the full error message and the code producing it in some pastebin
05:13 <pally> Hey guys. there is something I can't seem to wrap my head around the following function definition that is different than the others I have seen.
05:13 <pally> abs2 :: [[Integer]] -> [[Integer]]
05:13 <pally> abs :: map (map abs)
05:13 <pally> oops
05:13 <pally> abs = map (map abs)
05:14 <pounce> https://gist.github.com/4e554c4c/0cd49789eb89c54e88f5c7d3229a6b28
05:15 <geekosaur> pally, it's the same as: abs x = map (map abs) x
05:15 <cocreature> pounce: remove the "let". let is not for defining top-level expressions
05:15 <cocreature> (ghci is a bit weird in this regard)
05:15 <geekosaur> only older versions, 8.0+ don;t need the let
05:16 oisdk joined
05:16 <cocreature> right but "let" still works in newer versions so it’s still different from “regular” Haskell
05:16 <pounce> ah, also there seem to be some indentation rules I have to use. Can I read about these somewhere?
05:16 <pally> Hi geekosaur, I was just about to get to the part where it really got me confused, and your version is the one I am more familiar with
05:17 <pally> and what exactly is it that I am confused about with the first version? The missing parameter
05:17 <geekosaur> the precise meaning is: abs = \x -> map (map abs) x
05:17 <pounce> for example, if I keep the expression as is, I get the error " parse error (possibly incorrect indentation or mismatched brackets)" on the definition of `filterPrime`, unless I move it onto one line
05:18 <jle`> pounce: can you show what you are typing?
05:18 <pally> geekosaur, your 'x', which matches the list of lists (i.e., [[Integer]]) parameter makes me more comfortable for me to read, as it makes more sense to me.
05:18 <jle`> ah, is it the gist?
05:18 <Welkin> look up eta reduction
05:18 <geekosaur> pally, basically it's a partial application. and since it agrees as such with the type signature, there's no problems
05:18 <cocreature> pounce: I don’t have a link ready to the formal definition but as a rule of thumb, indentation should increase for things that belong to a definition
05:18 <geekosaur> :t map (map abs)
05:18 <lambdabot> Num b => [[b]] -> [[b]]
05:19 <cocreature> pounce: so the rhs of filterPrime should be indented more than the lhs
05:19 <pounce> yep, it was done that way
05:19 <jle`> pally: yeah, the problem is that because you start a new line at the same indentnation as 'primes', the language thinks you are done with primes, and starting to define a new function or value
05:19 <jle`> * pounce
05:19 <Welkin> ponce?
05:19 <jle`> pounce: it's because you can provide more than one definition within the same 'let' block
05:19 <pally> geekosaur, you kinda knew what was I gonna ask you. :-)
05:20 language_agnosti joined
05:20 <jle`> let def1 = 1234
05:20 <jle`> def2 = 58345
05:20 <jle`> def3 = "hello"
05:20 <jle`> "returning to the same level" is how you indicate that you're making a new definition
05:20 <jle`> and that you're done with your previous one
05:21 <jle`> so in the gist, the only modification you need to do is move the "where" a little bit to the right
05:21 <Welkin> > let a = 1 in let b = 2 in let c = 3 in [a, b, c]
05:21 <lambdabot> [1,2,3]
05:21 <Welkin> it's basically that
05:21 <pounce> ok, but it was at a higher indentation level. (let me update the gist)
05:22 <jle`> oh and also you shouldn't be using the 'let' if it's a haskell file, and not a ghci session
05:22 <jle`> pounce: yes please :) it's pretty difficult to help without seeing what you are actually writing
05:22 <Welkin> `let ... in` is the expression
05:22 <Welkin> I see how that is ocnfusing for anyone not familiar with haskell
05:22 <Welkin> since let is used in many other languages to define variables
05:23 <pounce> https://gist.github.com/4e554c4c/0cd49789eb89c54e88f5c7d3229a6b28 :)
05:23 <jle`> pounce: same deal there
05:23 <cocreature> pounce: line 3 is still indented less than the lhs of filterPrime
05:23 <jle`> with the 'filterPrime' in line 2
05:23 <pounce> ooh, I see
05:23 kvda joined
05:23 <jle`> you return back to the level befor efilterPrime
05:24 <jle`> so you're signaling that you're done defining filterPrime
05:24 <Welkin> install an editor mode for haskell and let it take care of the indentation for you
05:24 <pounce> Is there one I can install for vim?
05:24 <Welkin> yes
05:25 <jle`> it's definitely confusing at first yes. at this point i just basically imagine a vertical wall after my let's and where's and make sure not to return to that level until i'm done with a definition
05:25 <jle`> i think this guide is good? http://www.stephendiehl.com/posts/vim_2016.html
05:25 <jle`> i put together my setup before this guide was made so i didn't follow it myself, but i've heard good things about it
05:26 <Welkin> or use haskell-mode in emacs
05:26 <Welkin> you can use vim bindings in emacs if you wish
05:27 <pounce> D:
05:28 <pounce> I don't think my computer is powerful enough for emacs
05:29 <pally> geekosaur, When you say "the precise meaning is: abs = \x -> map (map abs) x" , do you you mean abs = map (map abs) is in fact a shorthand, or does Haskell need to deduce from the type signature?
05:29 <Welkin> pally: eta reduction. They have the same type
05:29 <Welkin> if you have a variable on the left and right side of an equal sign, you can remove them (if they are at the end of the expression)
05:30 bennofs joined
05:31 <geekosaur> pally, one secret is that all functions mean that: "foo x = x + 1" is internally "foo = \x -> x + 1"
05:31 <pally> Hi Welkin, is eta reduction the same as eta conversion? because I found the haskell wiki for eta conversion.
05:31 <Welkin> and functions are values
05:31 takuan joined
05:31 <dminuoso> Not bad, I managed to new-break cabal.
05:31 <Welkin> and all functions only have one input
05:31 <geekosaur> here, it knows the type of (map (map abs)); that partial application is the same as "\x -> map (map abs))". But it doesn't actually do that, because partial application is natural in Haskell
05:32 <Welkin> because there is no partial application in haskell
05:32 <dminuoso> pally: eta reduction is that direction specifically
05:32 <geekosaur> "foo x y = ..." is "foo = \x -> \y -> ..."
05:32 <dminuoso> pally: you can also eta extend by turning: `f = ...` into `f = \x -> ... x`
05:35 <cocreature> dminuoso: but can you also manage to new-unbreak it? :)
05:35 xtreak joined
05:36 <pally> thanks guys. These concepts will take some time to get used to.
05:36 <dminuoso> cocreature: Possibly, I kept the dist-newstyle/ directory.
05:36 gregberns joined
05:36 slaznick joined
05:38 UnChallengeD joined
05:39 carafe joined
05:41 oisdk joined
05:41 dxld joined
05:42 ozzymcduff joined
05:43 <cocreature> dminuoso: keeping around dist-newstyle should be fine for the most part. ime you need to nuke it about as often as you need to use .stack-work
05:47 <saurabhn_> hello good folks, has anyone been kind enough to push a ghcjs + stack build for 8.2.x branch?
05:48 chao-tic joined
05:49 losangeles173[m] joined
05:50 xtreak joined
05:51 patbecich joined
05:54 tsoernes joined
05:55 progfun joined
05:56 errst joined
05:56 MoarSpaceFi joined
05:59 ddere joined
06:00 pwnz0r joined
06:02 gregberns joined
06:03 vlatkoB joined
06:04 patbecich joined
06:04 plutoniix joined
06:04 keepLearning512 joined
06:06 zdenal joined
06:08 fmixing joined
06:11 lastmanstanding joined
06:12 sytherax joined
06:12 <pounce> Since lists are linked in haskell, there wouldn't be an efficient way to find an item in a sorted list, right?
06:14 <dminuoso> pounce: Correct.
06:14 osa1 joined
06:15 acidjnk joined
06:15 <cocreature> it might be worth pointing out that we do have vectors as well, so while you can’t really do an efficient binary search on a list, you can totally use a vector and search that
06:15 language_agnosti joined
06:15 hamishmack joined
06:16 <pounce> tbh I need an efficient primality test, not list searching.
06:18 <pounce> right now I'm doing `isPrime a = (takeWhile (<= a) (filter (>= a) primes)) /= []` which is disgusting any way you look at it
06:19 bertschn_ joined
06:19 <dminuoso> pounce: You could use AKS?
06:20 <jle`> pounce: note that you shouldn't really be commparing to [] with lists
06:20 <jle`> but pattern matching instead :)
06:20 <jle`> or you can use a function that pattern matches for you, like 'null :: [a] -> Bool'
06:21 XorSwap joined
06:21 <cocreature> pounce: what’s your usecase for this? e.g. if you’re using this for crypto, most implementations go for a probabilistic test afaik
06:21 <pounce> cocreature: just solving a little programming puzzle and trying to make it less computationally terrible
06:22 <jle`> what is the scale of primes you are looking at?
06:22 <jle`> tens or thousands of digits?
06:22 keepLearning512 joined
06:22 <pounce> all under 1mil right now, so in other langs I'd use a sieve
06:22 <pounce> but I'm not quite sure how to do that in Haskell
06:23 <jle`> if 'primes' is your seive, then searching until you find a number higher than your number should be optimal
06:23 <jle`> if you're only doing it once
06:23 <pounce> nope, doing it ~n times ;(
06:24 <jle`> where n is...?
06:24 brocoli joined
06:24 <pounce> I have to do it for 300 numbers rn, not sure if more
06:24 <jle`> yeah, if you're doing it once, a list is an optimal data structure because lists in haskell pretty much corresponds to how you'd use for loops and stuff in imperative languages
06:25 <jle`> pounce: ah, just n as in, some number. not n as in, a number related to largest prime or something
06:25 pavonia_ joined
06:26 <jle`> real world use, you can probably use an efficient prime number checking library like http://hackage.haskell.org/package/arithmoi
06:26 c1b01r3 joined
06:27 <jle`> but if you want to do it from scratch using a seive, we have some nice data structures that are optimized for storing items and checking for membership
06:27 <pounce> I might have some other bottleneck too, lemme look
06:27 <jle`> like IntSet, which is optimized for ints
06:27 bertschneider1 joined
06:28 <jle`> if you know a maximum prime you will be needing to find, you can generate them using a list and store them in an IntSet for optimized membership testing
06:28 `Guest00000 joined
06:29 <pounce> huh, looks like I was confused about my bottleneck after all
06:29 <pounce> So the problem is I have to find a bunch of primes from a to b whose digits reversed were also prime
06:30 dbfunctor joined
06:30 <pounce> and right now finding digits from a to b (which I do `takewhile (<=b) (filter (>=a) primes)`) is what's taking forever
06:30 Kacia joined
06:31 <pounce> is IntSet in the standard library?
06:31 davr0s joined
06:31 <cocreature> it’s in the containers package
06:32 rprije joined
06:33 <jle`> IntSet won't help with the generation of the primes; it'll just help with the primality testing of multiple trials
06:33 <jle`> but it looks like you don't really want membership tests?
06:34 language_agnosti joined
06:34 <jle`> if you want all the primes in a range then something similar to what you've done would make sense
06:34 bertschneider joined
06:35 <jle`> are you sure it's the prime generating that is the bottleneck, and not the checking of palindromeness?
06:35 hphuoc25 joined
06:36 <pounce> yeah, int reversal is p quick. It's mostly finding all of the primes up to that int that's the problem
06:38 XorSwap joined
06:39 <pounce> how would I call an IntSet method like `insert` without importing all the methods into the namespace?
06:39 <cocreature> "import qualified Data.IntSet as X" will make all identifiers from Data.Intset available under a X. prefix
06:39 danso joined
06:40 <pounce> thanks ♥
06:41 encod3 joined
06:41 yuuki_ joined
06:41 <jle`> if all you need is to find all primes between an interval, then using Set here won't really do anything to help
06:41 hjdskes joined
06:41 <jle`> unless you rewrite your whole sieve algorithm in terms of Set
06:42 <jle`> also, be careful when making conclusions about what parts take up what time in your code; things work a bit backwards in haskell than they do in other languages
06:43 <pounce> jle`: well annoyingly I can't find an interval for the primes, because, if I have primes ranging from 7000-8000, I still have to check all primes from 1007-9997 because they can be reversed
06:43 andyhuzhill joined
06:43 chele joined
06:43 pavonia joined
06:43 <pounce> jle`: yeah, I've just been plugging stuff into ghci to see what takes up time
06:43 <jle`> oh ah i see, you need fast membership checking for primes outside the interval.
06:44 <pounce> yeah, that's one of the main issues
06:45 <pounce> I tried to speed it up by doing something like `let range = sectionSorted start end in ...` before my function to speed things up, but it gave me the wrong answer (albeit fast!)
06:45 encod3 joined
06:45 <jle`> hm, okay, if you want to pre-cache your primality test
06:45 <jle`> once you define your list of primes, primes :: [Int]
06:46 <jle`> you can use primeSet = S.fromList (takeWhile (<=9999) primes)
06:46 <jle`> IntSet also has efficient partitioning between ranges
06:47 krone_ joined
06:47 <jle`> at that point though, if you're working interactively, you'll want to force primeSet to actually be made and computed, instead of just "declared"
06:47 dim1tri_ joined
06:47 andyhuzhill joined
06:47 <jle`> so printing something like `S.size primeSet` and getting a number out of it will force ghci to actually compute primeSet and populate it with the primes you need
06:47 exarkun joined
06:48 <jle`> this isn't a huge problem if you aren't doing things interactively, but if you're working interactively, it can be helpful to ensure nothing unexpected happens
06:48 amar joined
06:49 <jle`> also you'll know exactly for sure what the cause of slowdown is :)
06:50 <jle`> once you have your primeSet, you can use the efficient "partition on an interval" function 'split', to make a new set `candidates` that only has primes from 7000 to 8000
06:50 <jle`> and then you can use S.filter to filter that candidates set based on your test :)
06:50 logzet joined
06:51 <pounce> jle`: when I'm doing the first part (IntSet.fromAscList) I'm getting ` Couldn't match type ‘Integer’ with ‘Int’` `Expected [IntSet.key] Actual type [Integer]`
06:52 <jle`> ah it looks like `primes` was inadvertently defined to be `[Integer]` instead of `[Int]`
06:52 <pounce> What's the difference?
06:52 <jle`> different types
06:52 <jle`> so they won't typecheck
06:52 <jle`> Integer is an unbounded integer ("bigint"), Int is just machine integer
06:53 <jle`> you can map the list with `fromIntegral` (which is Integer -> Int) to get the types to match
06:53 nickolay_ joined
06:53 encod3_ joined
06:54 <pounce> ah, gotcha
06:54 <jle`> @let primes = filterPrime [2..] where filterPrime (p:xs) = p : filterPrime [x | x <- xs, x `mod` p /= 0]
06:54 <lambdabot> Defined.
06:54 <jle`> although i'm not really sure how efficient that version is, or if it's optimal
06:55 <pounce> lol if you hover over it on the main page it says it isn't efficient
06:55 <jle`> @let primeSet = IS.fromAscList . takeWhile (<= 9999) . map fromIntegral $ primes
06:55 <lambdabot> Defined.
06:55 <jle`> > IS.size primeSet
06:55 <lambdabot> 1229
06:55 <jle`> huh, i guess it's not that bad :)
06:55 <pounce> oh til of .
06:55 <pounce> what is the `$` for?
06:56 <jle`> it's (IS.fromAscList . takeWhile (<= 9999) . map fromIntegral) primes
06:56 <jle`> the $ is just a dummy user-defined operator with super low precedence
06:56 <jle`> it's useful as a hack for avoiding parentheses, heh
06:56 <pounce> lol
06:57 fujiy joined
06:57 ogrady joined
06:57 <pounce> oof yep it's taking a long time to generate
06:57 <jle`> what is your max bound?
06:58 <pounce> 1mil
06:58 <jle`> @let primeSet' = IS.fromAscList . takeWhile (<= 1000000) . map fromIntegral $ primes
06:58 <lambdabot> Defined.
06:58 <jle`> > IS.size primeSet'
06:58 <lambdabot> mueval-core: Time limit exceeded
06:58 <pounce> I chopped off a zero and it's good
06:59 <jle`> @let (_,gt7000) = IS.split 6999 primeSet
06:59 <lambdabot> Defined.
07:00 WhatisRT joined
07:00 <jle`> @let (primeWindow, _) = IS.split 8001 gt7000
07:00 <lambdabot> Defined.
07:00 megaTherion joined
07:01 <jle`> ^ that's how i'd "window" the set to only contain primes in an interval. intset is optimized for operations like split
07:01 <jle`> but yeah, if you can't build the big set, the generation is probably the bottleneck :|
07:02 sQVe joined
07:03 <jle`> that, or building the set. but i don't think IntSet has any problems with ~1mil items
07:03 <jle`> @let stressTest = IS.fromAscList [1..1000000]
07:03 <lambdabot> Defined.
07:04 <jle`> > IS.size stressTest
07:04 <lambdabot> 1000000
07:05 thc202 joined
07:06 <jle`> no sweat
07:06 <pounce> how do I go from a Int to Integer
07:07 <jle`> fromIntegral works both ways :)
07:07 louispan joined
07:07 <jle`> its general type is polymorphic
07:08 ventonegro joined
07:09 <cocreature> fromIntegral typechecks both ways but might generate overflows
07:10 dejanr joined
07:10 danthemy_ joined
07:11 piark_ joined
07:13 <pounce> oof, still runs out of time
07:15 raichoo joined
07:16 cybai joined
07:16 dddddd joined
07:17 language_agnosti joined
07:18 phenoble joined
07:19 <pounce> night and thank you all for the help :)
07:20 fujiy joined
07:21 fujiy joined
07:21 numarkaee joined
07:21 lortabac joined
07:21 altjsus joined
07:21 <jle`> pounce: have a good night :)
07:22 Mysterious_Light joined
07:22 yuuki___ joined
07:22 ddellacosta joined
07:24 saurabhnanda joined
07:24 lumm joined
07:25 ozzymcduff joined
07:25 encod3 joined
07:28 zakora joined
07:30 mreh joined
07:30 fmixing joined
07:30 <mreh> I deleted my package.yml, can I generate one from my cabal file?
07:31 jedws joined
07:31 <cocreature> mreh: iirc there is a project called "hpack-convert" but I’m not sure if it’s still being actively developed
07:32 <cocreature> note that you don’t need the package.yaml file. working with the cabal file directly is perfectly fine
07:32 <mreh> I just initialised a new git repo in my project dir and .cabal was ignored by default, so I guess it's generated?
07:32 Folkol joined
07:32 bertschn_ joined
07:32 <mreh> cocreature: okay, I read that there's a 1-to-1 correspondence between the two
07:32 <cocreature> if you have a package.yaml file, stack will automatically generate a cabal file from that. if you don’t have one it will use the cabal file directly
07:32 whaletechno joined
07:33 <mreh> cocreature: okay, no problem
07:33 <cocreature> there’s no 1-to-1 correspondence. hpack has various ways to express the same cabal feature
07:35 spear2 joined
07:37 fmixing joined
07:37 <spear2> hi all, i am trying to install xmonad and i get the following error: '/usr/bin/x86_64-linux-gnu-ld.gold: fatal error: -pie and -r are incompatible' https://lpaste.net/679348162757918720 any ideas?
07:38 numarkaee joined
07:39 <sclv> right it's a many-to-one correspondence
07:40 <sclv> each hpack file generates a unique cabal file
07:40 <sclv> but there may be multiple hpack files that generate a single cabal file
07:41 <sclv> that doesn't mean we can't have a cabal-to-hpack converter that picks out a section or retract
07:41 hellozee joined
07:41 <sclv> in fact hpack offers such a feature somewhere, i checked
07:41 tzemanovic joined
07:41 <sclv> that said, you probably don't need it and can just stick to a cabal file :-)
07:42 sytherax joined
07:42 <sclv> spear2: ghc shouldn't be linking with lid
07:42 <sclv> with ld.gold
07:42 <sclv> i think it doesn't work with the gold linker
07:43 Mysterious_Light joined
07:43 connrs joined
07:43 jedws joined
07:44 keepLearning512 joined
07:44 bilal80 joined
07:44 <sclv> hrm or maybe it does now -- it used to but i heard it doesnt' anymore, can't keep track
07:44 <sclv> the weird part is that -r and -pie would be getting passed simultaneously
07:45 zdenal joined
07:45 <cocreature> GHC even links by default with ld.gold these days
07:45 <sclv> -r is for relocatable and is obviously incompat with pie
07:45 <cocreature> (if it’s available at configure time)
07:45 <sclv> cocreature: right, just checked the tickets. i heard somewhere there were issues again, but i guess i was wrong!
07:46 <* hackage> warp-tls-uid - set group and user id before running server http://hackage.haskell.org/package/warp-tls-uid- (YoshikuniJujo)
07:46 Boomerang joined
07:47 <sclv> spear2: what os are you running?
07:47 fmixing joined
07:47 yeevy joined
07:48 <sclv> spear2: oh, i have a theory!
07:48 <spear2> sclv: linux mint 19 xfce beta
07:48 <sclv> go to usr/local/haskell/ghc-___/lib/ghc-___/settings
07:48 <sclv> where the underscores are replaced with your ghc version
07:49 <sclv> and check if the "compiler supports -no-pie" flag is NO
07:49 <sclv> and try changing it to YES
07:49 hphuoc25 joined
07:50 <sclv> unless your ghc is prior to 8.0.2 in which case there's a different fix i guess
07:50 zar joined
07:52 keepLearning512 joined
07:53 language_agnosti joined
07:53 <spear2> sclv: that worked =) now i have an error with xmonad itself =( 'Could not deduce (Semigroup (X a)) ...'
07:53 <sclv> oh no
07:54 curious_corn joined
07:54 saurabhnanda joined
07:54 <sclv> xmonad hasn't been upgraded to work with ghc 8.4 yet
07:54 <sclv> so you have a recent compiler and the code needs to be fixed
07:54 WhatisRT joined
07:54 <sclv> to work with some changes to the core libraries :-/
07:54 bilal80 joined
07:55 sytherax joined
07:55 <sclv> spear2: ok, so there is a fix in git, but not yet released: https://github.com/xmonad/xmonad/pull/153
07:56 <sclv> so if you use the HEAD version there you should be fine?
07:59 keepLearning512 joined
07:59 ozzymcduff joined
08:00 tzemanovic joined
08:00 curious_corn joined
08:00 Krisostoomus joined
08:01 davr0s joined
08:02 jedws joined
08:02 WhatisRT joined
08:05 Ariakenom joined
08:06 <spear2> sclv: thanks that worked, had to do the same for xmonad-contrib
08:07 hphuoc25 joined
08:09 vurtz joined
08:11 taumuon joined
08:12 amar joined
08:13 TMA joined
08:13 yuvali joined
08:15 amar joined
08:15 nuknown joined
08:16 TMA left
08:16 xtreak joined
08:18 nuknown_ joined
08:20 amar joined
08:20 reactormonk joined
08:22 Guest13364 joined
08:23 hphuoc25 joined
08:23 curious_corn joined
08:24 harfangk joined
08:24 curious_corn joined
08:25 freusque joined
08:26 amar joined
08:26 <Krisostoomus> https://www.youtube.com/watch?v=CS9OO0S5w2k&list=RDXEjLoHdbVeE&index=36
08:27 Mysterious_Light joined
08:27 exarkun joined
08:28 whaletechno joined
08:30 Guest13364 joined
08:31 zero_byte joined
08:31 sytherax joined
08:31 dhil joined
08:32 whaletechho joined
08:35 dpyro joined
08:36 bbrodriguez joined
08:38 blankhart joined
08:38 nuknown_ joined
08:39 oberstein joined
08:41 mfukar joined
08:42 meinside joined
08:43 xtreak joined
08:45 <* hackage> Chart 1.9 - A library for generating 2D Charts and Plots http://hackage.haskell.org/package/Chart-1.9 (TimDocker)
08:46 earendel joined
08:47 hphuoc25 joined
08:47 <* hackage> Chart-cairo 1.9 - Cairo backend for Charts. http://hackage.haskell.org/package/Chart-cairo-1.9 (TimDocker)
08:48 progfun_ joined
08:49 Folkol joined
08:50 <* hackage> hadolint 1.7.2 - Dockerfile Linter JavaScript API http://hackage.haskell.org/package/hadolint-1.7.2 (lorenzo)
08:51 <* hackage> Chart-diagrams 1.9 - Diagrams backend for Charts. http://hackage.haskell.org/package/Chart-diagrams-1.9 (TimDocker)
08:51 curious_corn joined
08:54 twandy joined
08:54 kapil___ joined
08:54 keepLearning512 joined
08:56 Mysterious_Light joined
08:57 keepLearning512 joined
08:58 beauby joined
08:59 merijn joined
09:00 progfun joined
09:02 gareth__ joined
09:02 gareth__ joined
09:03 ZeuPiark joined
09:04 curious_corn_ joined
09:05 piyush-kurur joined
09:05 <ZeuPiark> hello
09:06 agander joined
09:06 language_agnosti joined
09:06 Folkol joined
09:06 harfangk joined
09:06 language_agnosti joined
09:07 hphuoc25 joined
09:08 xtreak_ joined
09:08 fugyk joined
09:08 <liste> hi ZeuPiark
09:09 drbean joined
09:10 aijony joined
09:10 reactormonk joined
09:11 simplegauss joined
09:11 vukasink joined
09:11 dpyro joined
09:12 scopedTV joined
09:12 oish joined
09:12 debugloop joined
09:14 soupladler joined
09:15 sns joined
09:16 keepLearning512 joined
09:16 xtreak joined
09:16 ectos joined
09:16 xandaros joined
09:16 FabM joined
09:17 rotaerk joined
09:18 firefly_ joined
09:18 pio_ joined
09:18 Soundquelle joined
09:19 michi7x7 joined
09:21 nonzen joined
09:21 Jacoby6000 joined
09:22 nD5Xjz joined
09:22 <ZeuPiark> hi liste :)
09:22 keepLearning512 joined
09:24 language_agnosti joined
09:25 keepLearning512 joined
09:25 language_agnosti joined
09:25 <electrocat> sclv: if only i could convince someone to make a new release..
09:26 twandy joined
09:26 ericsagn1 joined
09:27 t60r joined
09:28 <electrocat> maybe i should bother yorgey about it again
09:28 keepLearning512 joined
09:29 <pally> I am trying to grasp the notion that "functions are values".
09:30 <dminuoso> pally: a value is just something you can bind to a variable and pass around.
09:30 <pally> Generally, f(x) is a value when it is evaluated at x
09:30 <electrocat> you could define a value as: something you can't evualuate any further
09:30 <pally> dminuoso, in that sense, I see.
09:31 tzemanovic joined
09:32 Folkol joined
09:32 <dminuoso> pally: So from that notion we have some (rather arbitrary) terms like "higher order functions" which is just a function, but one that expects a *function* as an argument.
09:32 <dminuoso> :t map
09:32 <lambdabot> (a -> b) -> [a] -> [b]
09:33 <dminuoso> > map (\x -> x + 1) [1,2,3]
09:33 <lambdabot> [2,3,4]
09:33 hphuoc25 joined
09:33 <merijn> pally: "functions are values" means "anything you can do with values like "True" and "1" can be done with functions"
09:33 <dminuoso> I used a lambda over a section for clarity. Note how I applied `map` to a function?
09:33 <merijn> pally: i.e. you can pass functions as arguments, store them in datatypes and containers, etc.
09:34 sytherax joined
09:35 ahf joined
09:35 dhil joined
09:37 curious_corn joined
09:38 TorkMattar joined
09:39 language_agnosti joined
09:39 gestone joined
09:39 <pally> while most non-functional programmers would interpret 'map' as a function that accepts two parameters, but from Haskell's perspective it's not viewed as such, correct?
09:39 <pally> :t map
09:39 <lambdabot> (a -> b) -> [a] -> [b]
09:40 <Maxdamantus> :t uncurry map
09:40 <lambdabot> (a -> b, [a]) -> [b]
09:40 <Maxdamantus> If you're referring to the fact that in Haskell every function takes exactly one argument, sure.
09:40 <pally> It's Maxdamantus from #English. Hey! :-)
09:40 <Maxdamantus> Hi.
09:40 <[exa]> pally: if you add the invisible parens it starts to look much better: (a->b) -> ([a]->[b])
09:41 <pally> Maxdamantus, yep, that's what I was thinking.
09:41 <Maxdamantus> People will often talk about numbers of "arguments" of functions in Haskell though.
09:41 <Maxdamantus> and I suspect people would generally consider `map` to have two arguments in that informal sense.
09:41 <pally> b/c I have in my notes here that says "A function that takes 2 parameters is also a function that takes 1 parameter and amps it to a function that takes 1 parameter"
09:42 emilypi joined
09:42 <dminuoso> pally: Indeed. We call that "currying"
09:42 language_agnosti joined
09:42 <dminuoso> `f a x = ...` is the same as `f = \a -> (\x -> ...)`
09:42 ub joined
09:42 catsup joined
09:42 <liste> pally: correct. it's common to say that a function takes 2 parameters to mean that the function takes 1 parameter and returns a function that returns another 1 parameter
09:43 <liste> takes another 1 parameter*
09:43 <dminuoso> pally: Consider that function application is not a straight "function has 3 arguments so you need 3 arguments" - it may be easier to think in terms of "apply to one argument, and then apply the result to another argument, etc.."
09:43 rprije joined
09:43 __bo joined
09:43 catsup joined
09:44 <Maxdamantus> Function application takes zero arguments, obviously: ($) = id
09:44 <Maxdamantus> or maybe it takes one argument.
09:45 <liste> @let add x y = x + y
09:45 <lambdabot> Defined.
09:45 <liste> > add 5 2 -- add takes two parameters
09:45 <lambdabot> 7
09:45 <liste> @let add1 = add 1
09:45 <lambdabot> Defined.
09:45 <liste> > add1 20 -- add1 takes 1 parameter
09:45 <lambdabot> 21
09:45 language_agnosti joined
09:46 MrQ joined
09:47 <liste> so you can see "add" as a 'factory' that, given 1 argument, produces 1-argument functions
09:48 hellozee joined
09:48 zincy joined
09:48 <pally> 1 sec here... add takes two parameters and then add1 is bound to add 1
09:48 <pally> that's weird
09:48 <pally> lol
09:49 <zincy> Why is quickcheck only running one example through a test by default? Apparantly only two "examples" were run for two passing tests
09:49 kuribas joined
09:49 <dminuoso> pally: add doesnt really take two parameters
09:49 <dminuoso> pally: imagine I wrote this:
09:49 <Maxdamantus> pally: `add 1 20` is another way of writing `(add 1) 20`
09:49 <dminuoso> @let add' = \x -> (y -> x + 2)
09:49 <lambdabot> Parse failed: NPlusKPatterns language extension is not enabled. Please add {...
09:49 cybai joined
09:50 <dminuoso> @let add' = \x -> (\y -> x + 2)
09:50 <lambdabot> Defined.
09:50 <merijn> Anyone know if there's an easy way to find out when a Travis test started failing?
09:50 <Maxdamantus> pally: so when you do `add1 = add 1`, you're just saving the function in a variable instead of calling it immediately.
09:50 language_agnosti joined
09:50 <cocreature> merijn: scroll through the builds until you see something green? :)
09:51 curious_corn joined
09:51 <dminuoso> pally: ^- when you apply `add'` to just one argument its obvious that you get a function back, right?
09:51 language_agnosti joined
09:51 altjsus joined
09:51 humanoyd joined
09:52 <merijn> cocreature: ugh, looks like there's been no code change since the last successfull test and stuff failing
09:52 <cocreature> zincy: how are you running quickcheck? iirc the default is to run 100 tests but you can change it
09:52 Achylles joined
09:52 <cocreature> merijn: maybe it’s picking up different deps?
09:52 <dminuoso> @undef
09:52 <lambdabot> Undefined.
09:52 <dminuoso> @let add = \x -> (\y -> x + y)
09:53 <lambdabot> Defined.
09:53 <dminuoso> :t add
09:53 <lambdabot> Num a => a -> a -> a
09:53 <dminuoso> :t add 2
09:53 <lambdabot> Num a => a -> a
09:53 jeltsch joined
09:53 <dminuoso> :t add 2 3
09:53 <merijn> cocreature: That'd explain build errors, not run errors
09:53 <lambdabot> Num a => a
09:53 <cocreature> merijn: deps can change their behavior without changing the type :)
09:53 ixian joined
09:54 language_agnosti joined
09:54 zar joined
09:54 <merijn> cocreature: Still seems unlikely given the internal errors
09:55 <Logio> merijn: if there's been no code change, what caused a new test to be run?
09:56 <* hackage> aeson-compat 0.3.8 - Compatibility layer for aeson http://hackage.haskell.org/package/aeson-compat-0.3.8 (phadej)
09:56 <merijn> Logio: Doc change
09:57 <Logio> does reverting it fix the tests?
09:57 twandy joined
09:58 ericsagn1 joined
09:59 <merijn> Well, the commit after that reverts the doc change, but the tests are still broken >.>
10:00 languag__ joined
10:01 mortum5 joined
10:01 language_agnosti joined
10:01 <pally> @let add x y = x + y
10:01 <lambdabot> .L.hs:158:1: error:
10:01 <lambdabot> Multiple declarations of ‘add’
10:01 <lambdabot> Declared at: .L.hs:157:1
10:02 <zincy> cocreature: I am calling runhaskell on the source file
10:02 language_agnosti joined
10:03 <pally> <Maxdamantus> pally: `add 1 20` is another way of writing `(add 1) 20`
10:03 <pally> But what does (add 1) alone mean?
10:03 Folkol joined
10:03 <pally> the add operation requires two operands
10:04 <cocreature> zincy: right but how are you calling quickcheck in that source file?
10:04 <Boomerang> :t add 1
10:04 <lambdabot> Num a => a -> a
10:04 <Boomerang> @let increment = add 1
10:04 <lambdabot> Defined.
10:04 <Boomerang> > increment 5
10:04 <lambdabot> 6
10:04 language_agnosti joined
10:05 <pally> Okay, I see what liste meant when he said it's a function "factory"
10:06 <pally> interesting
10:06 language_agnosti joined
10:06 <Logio> defining add1 = \y -> 1 + y is also equivalent
10:07 simukis joined
10:07 <dminuoso> pally: Check my last definition
10:07 <dminuoso> @undef
10:07 <lambdabot> Undefined.
10:07 <dminuoso> @let add = \x -> (\y -> x + y)
10:07 <lambdabot> Defined.
10:07 <Boomerang> One way to look at the signature "Num a => a -> a -> a", is like this: "Num a => a -> (a -> a)"
10:07 <dminuoso> pally: ^- this is what actually happens.
10:07 <zincy> cocreature: https://lpaste.net/1570306533806309376
10:08 <dminuoso> "add" is equal to "a function that returns.. "a function that returns two things added""
10:08 rzp joined
10:08 earendel2 joined
10:09 simukis joined
10:11 exarkun joined
10:12 hphuoc25 joined
10:12 alex`` joined
10:12 language_agnosti joined
10:14 languag__ joined
10:15 fendor joined
10:17 yuvali joined
10:17 <cocreature> zincy: the number of examples is the number of hspec tests that you are running. for the number of quickcheck tests there should be a line like “OK, passed 100 tests”
10:18 <cocreature> a quickcheck property counts as one hspec example regardless of how many tests it runs
10:19 Yuras joined
10:19 <zincy> ah thanks
10:20 <zincy> not seeing the “OK, passed 100 tests” though
10:20 <zincy> maybe hspec obscures quickcheck msgs when tests pass
10:21 <cocreature> I just tried your example (after modifying the test to remove the dependency on takePocketCards) and I’m definitely seeing the message
10:22 <zincy> hmm weird
10:27 <cocreature> zincy: ah are you on some older version of hspec? it looks like there might have been some changes in 2.5
10:27 language_agnosti joined
10:28 language_agnosti joined
10:28 hellozee joined
10:28 Yuras joined
10:29 <* hackage> serverless-haskell 0.6.0 - Deploying Haskell code onto AWS Lambda using Serverless http://hackage.haskell.org/package/serverless-haskell-0.6.0 (AlexeyKotlyarov)
10:29 twandy joined
10:30 sytherax joined
10:30 language_agnosti joined
10:31 agander_ joined
10:31 <zincy> cocreature - that is possible how would I find out
10:32 language_agnosti joined
10:33 <cocreature> zincy: if you’re just using runhaskell, ghc-pkg list should show you the installed packages and their versions
10:34 matsurago joined
10:35 <zincy> cocreature: hspec isnt there
10:36 <zincy> does ghc-pkg list look globally or locally?
10:36 <cocreature> globally but runhaskell does that as well
10:36 language_agnosti joined
10:36 <cocreature> or depends on what you mean by global and local I guess. it will look in ~/.ghc as well
10:37 <zincy> How do the tests work then with runhaskell if hspec isnt installed globally?
10:37 ozzymcduff joined
10:37 jao joined
10:37 <zincy> One of my assumptions must be wrong
10:37 <cocreature> are you sure you are running runhaskell directly and not via cabal/stack?
10:38 <zincy> oh I am using stack runhaskell
10:38 <cocreature> then try "stack exec -- ghc-pkg list"
10:39 <zincy> hspec-2.4.4 hspec-core-2.4.4 hspec-discover-2.4.4
10:39 <zincy> There we go
10:39 <zincy> How would I upgrade?
10:39 Yuras joined
10:39 <cocreature> either specify the version in extra-deps or switch to a snapshot that has 2.5
10:41 <zincy> what are snapshots?
10:41 <cocreature> the thing you specify via the "resolver" section in your stack.yaml file
10:42 <cocreature> it specifies a set of packages at a specific version that are known to work together
10:42 language_agnosti joined
10:43 <zincy> so resolver is the version of ghc
10:43 <zincy> and resolvers come with snapshots of known to work pkgs
10:45 languag__ joined
10:46 danso joined
10:46 <zincy> what is an elegant way of calling splitAt recursively on a list?
10:47 <zincy> I want to call splitAt 2 on a list n times and return a tuple with ([[a]], [a])
10:47 sdothum joined
10:48 perspectival joined
10:48 language_agnosti joined
10:48 <pavonia> You could use chunksOf from the spit package
10:49 <pavonia> *split
10:50 <zincy> perfect thanks
10:51 yuuki_ joined
10:51 emilypi joined
10:51 guessWho joined
10:51 saurabhnanda joined
10:53 nyberg joined
10:53 language_agnosti joined
10:56 louispan joined
10:56 hackebeilchen joined
10:58 languag__ joined
10:59 rprije joined
10:59 language_agnosti joined
11:00 twandy joined
11:01 cybai joined
11:01 vurtz joined
11:03 language_agnosti joined
11:05 zdenal joined
11:05 infinity0 joined
11:05 fendor joined
11:05 language_agnosti joined
11:09 languag__ joined
11:12 hellozee_ joined
11:13 language_agnosti joined
11:13 encod3 joined
11:14 pfurla joined
11:15 heebo joined
11:16 eubn joined
11:20 hphuoc25 joined
11:22 bezirg joined
11:23 ddellacosta joined
11:26 curious_corn joined
11:26 TorkMattar joined
11:26 hellozee joined
11:26 osa1_ joined
11:27 zdenal_ joined
11:28 ammazza joined
11:29 keepLearning512 joined
11:30 altjsus_ joined
11:34 kmelva joined
11:34 twandy joined
11:35 hellozee joined
11:36 whaletechno joined
11:36 __monty__ joined
11:38 encod3 joined
11:39 fueqw joined
11:42 zdenal joined
11:43 louispan joined
11:45 <* hackage> distributed-process 0.7.4 - Cloud Haskell: Erlang-style concurrency in Haskell http://hackage.haskell.org/package/distributed-process-0.7.4 (FacundoDominguez)
11:47 exarkun joined
11:47 kmel joined
11:48 sqrt2 joined
11:50 hackebeilchen joined
11:53 ijks joined
11:53 revprez_atlanta joined
11:54 Mysterious_Light joined
11:57 revprez joined
11:58 lumm joined
11:58 slaznick1 joined
11:59 kmelva joined
12:00 sighingnow joined
12:00 fendor joined
12:00 agander_ joined
12:03 agander__ joined
12:05 twandy1 joined
12:06 muddywatt joined
12:11 language_agnosti joined
12:11 encod3_ joined
12:12 xtreak joined
12:13 sytherax joined
12:14 khilan joined
12:15 earthy joined
12:19 jedws joined
12:19 LKoen joined
12:20 shdown joined
12:22 <* hackage> asset-map - Asset map support for the JavaScript broccoli-asset-rev library. http://hackage.haskell.org/package/asset-map- (IanDuncan)
12:24 keegans joined
12:26 szymon joined
12:26 altjsus joined
12:26 arianvp2 joined
12:27 <arianvp2> Is there a conneciton between lenses and zippers?
12:27 <arianvp2> both seem to be some kind of "pointed context" into some piece of data
12:28 sytherax joined
12:28 progfun joined
12:29 <maerwald> a zipper is something where you can understand the types
12:30 <dminuoso> arianvp2: The difference is a zipper can move around
12:30 <dminuoso> arianvp2: But there is a deep link in that both split data into "the focus" and "
12:30 <dminuoso> .. and "the whole with a hole"
12:32 encod3 joined
12:36 alex`` joined
12:36 machined1od joined
12:36 shdown joined
12:39 stobix joined
12:40 hphuoc25 joined
12:42 <[exa]> arianvp2: there's term derivation (similar to derivation from calculus) that can more-or-less-automatically produce zippers from anything, maybe some similar intuition exists for lenses
12:42 <[exa]> arianvp2: (brb with the paper)
12:44 davr0s joined
12:44 t0mb joined
12:44 t0mb left
12:45 <[exa]> arianvp2: the paper-- http://strictlypositive.org/diff.pdf
12:45 kapil___ joined
12:47 <[exa]> note that e.g. Const exactly corresponds to C + 0×t
12:47 zdenal joined
12:48 shdown joined
12:49 jedws joined
12:49 c1b01r3 joined
12:50 saurabhnanda joined
12:50 encod3 joined
12:51 ziyourenxiang joined
12:53 fendor joined
12:54 lumm joined
12:55 rasusto joined
12:56 abhiroop joined
12:57 sytherax joined
12:59 encod3 joined
13:01 heebo joined
13:01 <arianvp2> [exa]: yeh I know this construct
13:01 amar_ joined
13:02 <arianvp2> you just apply product and sum rule of calculus on the algebraic representation of ur datatype
13:02 <arianvp2> and then you get a zipper
13:02 davr0s joined
13:06 crobbins joined
13:06 <stobix> If I have a data State a where { SelectNext :: a -> SomeNotRelevantType -> State a ; KeepCurrent :: SomeNotRelevantType -> State a}, how do I get KeepCurrent to have the correct type? ghci complains about it being "ambiguous" when I use KeepCurrent - a better wording would be "irrelevant".
13:07 danso joined
13:09 agander_ joined
13:09 lumm joined
13:10 heebo left
13:12 ZeuPiark joined
13:14 jedws joined
13:15 carlomagno joined
13:17 brocoli joined
13:20 andyo joined
13:20 keepLearning512 joined
13:21 carlomazzaferro joined
13:21 sdothum joined
13:22 iAmerikan joined
13:23 mud joined
13:26 asheshambasta joined
13:26 alexteves_ joined
13:27 gregberns joined
13:28 exarkun joined
13:30 kmurphy4 joined
13:31 slaznick joined
13:31 oisdk joined
13:33 Folkol joined
13:33 agander_ joined
13:36 lumm joined
13:37 <dminuoso> stobix: There's no ambiguous types in there. Are you sure you pasted the correct type?
13:38 logzet joined
13:38 seanparsons joined
13:39 <stobix> dminuoso: The thing is that the "constructor" KeepCurrent doesn't take an as a parameter, and thus can't always infer the a in State a.
13:39 <stobix> take an a as a parameter *
13:40 <dminuoso> stobix: Ambiguous types is the opposite - it's when you have a universal quantification that is not in the return type
13:40 curious_corn joined
13:41 <stobix> hmm
13:42 alexteves__ joined
13:42 revprez_anz joined
13:43 <dminuoso> stobix: Can you share the code in which you use KeepCurrent, perhaps together with a full error in a gist?
13:43 curious_corn_ joined
13:44 <stobix> let's make it simpler: data State a where { SelectNext :: a -> State a ; KeepCurrent :: State a }; If I have a foo :: a -> State a; foo _ = KeepCurrent , will it get the correct type?
13:45 <dminuoso> That depends on what you mean by "
13:45 <dminuoso> "correct type"
13:45 <dminuoso> @let data State a where { SelectNext :: a -> State a ; KeepCurrent :: State a }
13:45 <lambdabot> .L.hs:160:28: error:
13:45 <lambdabot> Ambiguous occurrence ‘State’
13:45 <lambdabot> It could refer to either ‘Control.Monad.State.State’,
13:45 vukasink joined
13:45 <dminuoso> @let data MState a where { SelectNext :: a -> MState a ; KeepCurrent :: MState a }
13:45 <lambdabot> Defined.
13:46 eschnett joined
13:46 <dminuoso> @let foo _ = KeepCurrent
13:46 <lambdabot> Defined.
13:46 <dminuoso> :t foo
13:46 <lambdabot> p -> MState a
13:46 <dminuoso> @let bar :: a -> State a; bar _ = KeepCurrent
13:46 <lambdabot> .L.hs:163:13: error:
13:46 <lambdabot> • Expecting one more argument to ‘State a’
13:46 <lambdabot> Expected a type, but ‘State a’ has kind ‘* -> *’
13:46 <dminuoso> @let bar :: a -> MState a; bar _ = KeepCurrent
13:46 <lambdabot> Defined.
13:46 <dminuoso> :set bar
13:46 <dminuoso> :t bar
13:46 <lambdabot> a -> MState a
13:46 language_agnosti joined
13:47 SpinTensor joined
13:47 <stobix> hmm
13:48 Mysterious_Light joined
13:48 cloudhead joined
13:49 <stobix> I guess it's something more specifi to my case, then.
13:49 ijks joined
13:50 <* stobix> puts the problem on the "things to do in three hours when no longer in transit" heap
13:51 zdenal joined
13:51 keepLearning512 joined
13:52 sytherax joined
13:54 fendor joined
13:56 keepLearning512 joined
13:57 oisdk joined
13:57 gregberns joined
13:57 justaguest joined
13:58 OtakuSenpai joined
13:58 <OtakuSenpai> /join ##ChatterZ
13:58 mizu_no_oto joined
13:59 progfun joined
13:59 ddellacosta joined
13:59 ddellacosta joined
14:00 vukasink joined
14:02 drbrule joined
14:02 <OtakuSenpai> /join ##ChatterZ
14:03 siraben joined
14:05 kefin_ joined
14:06 ericsagn1 joined
14:08 OtakuSenpai joined
14:13 matsurago joined
14:15 skeet70 joined
14:16 <* hackage> blaze-html - A blazingly fast HTML combinator library for Haskell http://hackage.haskell.org/package/blaze-html- (JasperVanDerJeugt)
14:16 siraben joined
14:17 doomrobo joined
14:17 shdown joined
14:18 <doomrobo> I have a Main.hs that uses a module that I'd like to debug. Doing cabal repl doesn't let me inspect the contents of the external module. How do I force that module to be interpreted by GHCI?
14:19 siraben left
14:19 codesoup joined
14:19 <shapr> doomrobo: cabal new-repl ModuleName ?
14:20 <shapr> is the module inside your project, or an external library?
14:20 <cocreature> doomrobo: by “the contents of the external module” you mean definitions that are not exported?
14:20 <cocreature> either way, I would recommend that you take a look at https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#what-s-really-in-scope-at-the-prompt
14:20 jedws joined
14:21 <doomrobo> the module is an external library. cocreature, yes, I believe the problem is that defs aren't exported
14:21 pio_ joined
14:21 <cocreature> oh yeah for an external lib you are out of luck
14:21 <doomrobo> shapr, new-repl seems to be doing something
14:21 dbmikus joined
14:21 <cocreature> but it does sound kind of weird to debug a module in an external library
14:22 <doomrobo> I have a minimal Main.hs that triggers a bug. I wanna trace that bug down
14:22 <cocreature> I would clone the source of the external package and then work in that project
14:23 Gurkenglas joined
14:23 dbmikus_ joined
14:23 <doomrobo> yeah I might do that instead
14:24 wonko77 joined
14:25 dave_uy joined
14:26 <shapr> doomrobo: that's the usual approach
14:27 HarveyPwca joined
14:27 ijks joined
14:28 iAmerikan joined
14:31 silver joined
14:31 ozzymcduff joined
14:31 Jodokus joined
14:34 emilypi joined
14:35 oisdk joined
14:35 dave_uy joined
14:37 <* hackage> websockets - A sensible and clean way to write WebSocket-capable servers in Haskell. http://hackage.haskell.org/package/websockets- (JasperVanDerJeugt)
14:38 sytherax joined
14:38 pancets joined
14:40 rbutler[m] joined
14:41 curious_corn joined
14:45 iAmerikan joined
14:49 progfun joined
14:50 codesoup joined
14:53 rbutler joined
14:54 progfun joined
14:55 Deide joined
14:55 oisdk joined
14:55 oo_miguel joined
14:56 camsbury joined
14:57 zincy__ joined
14:58 <zincy__> Does manually deriving ToJSON instances for any ADT get round the need a ToJSON instance for the types of the field values
14:58 <clever> zincy__: i think so
14:59 hphuoc25 joined
14:59 FreeBirdLjj joined
14:59 Deide joined
14:59 <cocreature> zincy__: what do you mean by “manually deriving”?
14:59 jcarpenter2 joined
14:59 <dgpratt> gonna be spending several hours in a metal tube on Monday and then Saturday -- any suggestions for what a mild to moderate Haskeller would like to have on their e-reader device?
14:59 mizu_no_oto joined
15:00 rofl_ joined
15:00 <zincy__> cocreature: Not using deriveAnyClass extension and GHC.Generics to get the instance
15:01 <zincy__> dgpratt: Hutton if not read already
15:01 <dexterfoo> asyncWithUnmask. It is not clear from the docs if the new thread starts in the masked state, or if I need to call mask_ $ asyncWithUnmask ...
15:02 <cocreature> zincy__: so writing the instance manually rather than deriving it?
15:03 abhiroop joined
15:04 sgraf joined
15:06 <zincy__> cocreature: correct
15:06 <dmj`> dgpratt: typing haskell in haskell
15:07 <lyxia> zincy__: You won't need ToJSON if you don't call toJSON on the fields, something that the generic implementation would do implicitly
15:07 <cocreature> zincy__: depends on how you write the instance then. GHC won’t impose any requirements on the fields in that case but if you call toJSON on the fields you still need the instances
15:07 phlm joined
15:08 <cocreature> zincy__: also just to ease communication in the future: deriving refers to generating the instance using a deriving clause, so “manually deriving” is slightly confusing :)
15:08 <lortabac> dmj`: about the issue we discussed yesterday, I opened this https://github.com/bos/aeson/issues/646
15:09 Luke_ joined
15:09 soupladler joined
15:09 geekosaur joined
15:11 DSM joined
15:11 ystael joined
15:12 exarkun joined
15:14 <dmj`> lortabac: very nice
15:14 TCZ joined
15:15 <dmj`> lortabac: Would be nice to somehow be able to configure how generic deriving works, and optionally apply a Default constraint to the fields of an object if this option was chosen.
15:15 urodna joined
15:16 <zincy__> uhh No instance for (GHC.Generics.Generic Digest) arising from a use of ‘aeson-$dmtoJSON’ • In the expression: aeson-
15:17 <lortabac> dmj`: I think phadej's idea in issue 614 should allow this without requiring Default
15:17 ski joined
15:17 <dgpratt> thanks for the suggestions, dmj` and zincy__
15:18 phenoble joined
15:18 <dmj`> lortabac: Interesting, I can think of a tricky way to do it with an associated type family.
15:18 bezirg joined
15:20 GodotMisogi joined
15:20 johnvonneumann joined
15:22 borkr joined
15:22 <phaazon> damn comonads are powerful
15:22 <shapr> show me!
15:22 <phaazon> oh lortabac you’re there! :D
15:22 <phaazon> shapr: right :D
15:22 <lortabac> dmj`: if I understand his proposal correctly, the FromJSONField class would allow us to define what to return if the key is not there
15:22 <phaazon> > pure "test"
15:22 <lambdabot> error:
15:22 <lambdabot> • Ambiguous type variable ‘f0’ arising from a use of ‘show_M190126258896...
15:22 <lambdabot> prevents the constraint ‘(Show (f0 [Char]))’ from being solved.
15:22 <phaazon> ok
15:23 <phaazon> > @import Control.Comonad
15:23 <lambdabot> <hint>:1:1: error: parse error on input ‘@’
15:23 <phaazon> how do I do that again? :D
15:23 <dmj`> lortabac: if FromJSONField has an associated type family, then I think it’s the asme idea
15:23 <dmj`> same*
15:23 <cocreature> @let import Control.Comonad
15:23 <lambdabot> Defined.
15:23 listquestion joined
15:23 <phaazon> danke red-haired creature! \o
15:23 <lortabac> phaazon: :)
15:23 <cocreature> phaazon: oh no, now my cover is blown!
15:23 <phaazon> @let import Data.List.NonEmpty
15:23 <lambdabot> Defined.
15:23 <phaazon> cocreature: :D
15:24 plugin joined
15:24 <dminuoso> cocreature: By the way - is your name in reference to the tradition in category theory?
15:24 <phaazon> (10 :| [1, 2, 3]) =>> \(h :| l) -> (h * 2, l)
15:24 <phaazon> > (10 :| [1, 2, 3]) =>> \(h :| l) -> (h * 2, l)
15:24 <lambdabot> (20,[1,2,3]) :| [(2,[2,3]),(4,[3]),(6,[])]
15:24 <dminuoso> Do you consider yourself the dual of a creature? =)
15:24 <phaazon> shapr: ^
15:24 <cocreature> dminuoso: yeah :)
15:24 <dminuoso> cocreature: Figures. =)
15:24 <phaazon> it took me several minutes to actually get what was going on
15:24 <phaazon> also, duplicate for non-empty lists is funny
15:25 <phaazon> > duplicate $ 10 :| [1, 2, 3]
15:25 <lambdabot> (10 :| [1,2,3]) :| [1 :| [2,3],2 :| [3],3 :| []]
15:25 ocramz joined
15:25 <ocramz> hullo !
15:25 <dminuoso> phaazon: why is it funny?
15:25 <phaazon> I don’t know
15:25 <phaazon> it generates hilarity in the inner child of mine
15:25 <phaazon> :D
15:25 <shapr> phaazon: looks like a powerset at first glance
15:25 <shapr> for the duplicate call
15:25 <cocreature> hey ocramz :)
15:26 <phaazon> a powerset?
15:26 <phaazon> hello ocramz
15:26 <shapr> uh, all the subsets
15:26 <dminuoso> :t duplicate
15:26 <lambdabot> Comonad w => w a -> w (w a)
15:26 <shapr> hejsan ocramz
15:26 <phaazon> > duplicate (1, 2, "hey")
15:26 <lambdabot> error:
15:26 <lambdabot> • No instance for (Comonad ((,,) Integer Integer))
15:26 <lambdabot> arising from a use of ‘e_112’
15:26 <phaazon> > duplicate (1, "hey")
15:26 <dminuoso> phaazon: This usually replaces each element with the entire container set to that elements focus.
15:26 <lambdabot> (1,(1,"hey"))
15:26 <phaazon> dminuoso: yeah
15:26 <phaazon> I noticed that with extend (i.e. the =>> operator)
15:26 shdown joined
15:26 <shapr> phaazon: where have you been reading about this?
15:27 <phaazon> shapr: what do you mean?
15:27 <phaazon> where did I discover comonads?
15:27 <shapr> sure
15:27 <phaazon> a few years ago, in a blog post
15:27 <phaazon> maybe Gabriel’s one
15:27 <shapr> edwardk has tried to convince me that comonads are powerful, but I don't really get it.
15:27 <phaazon> or someone else
15:27 <dminuoso> phaazon: Note my emphasis on *usually* because formally Comonad is an abstract interface. But the main interesting instances tend to be kind of zipperish.
15:27 <phaazon> shapr: I don’t use them at all
15:27 yuuki_ joined
15:27 <phaazon> but I’m trying to figure out use cases
15:27 <shapr> oh, cool
15:27 DSM joined
15:27 <shapr> will you be writing your own blog post?
15:27 conal_ joined
15:28 <phaazon> shapr: sure
15:28 <phaazon> dminuoso: yeah, it’s kind of the same thing about contravariant functors
15:28 reactormonk joined
15:28 <phaazon> usually, they somehow adapt the input
15:28 <phaazon> but talking about input is wrong, because contravariant functors are an abstraction :)
15:29 <phaazon> shapr: I tend to see comonads as a way to recursively traverse a structure by having a “super zoom” power
15:30 <dminuoso> Right
15:30 <dminuoso> phaazon: (Though Im sure if you asked edward he could tell you endless stories about the joys of Comonad)
15:30 <dminuoso> Just be sure to bring a blanket, because the fire might not last that long.
15:30 <phaazon> dminuoso: also, I’m pretty sure I already had that exact talk with him years ago :D
15:30 <phaazon> I’m almost sure I did
15:31 <phaazon> haha
15:31 gwiley joined
15:31 <phaazon> what I lack about comonads is the “oh, I recognize the use case!”
15:31 <phaazon> I have this for a lot of abstractions in Haskell, like contravariant functors, divisible, etc.
15:31 <phaazon> but comonads…
15:31 <phaazon> I’m always like “yeah whatever, I’ll rewrite the code every time, I don’t have to look for use case of that monster”
15:32 <phaazon> which is a wrong way of reasoning, anyway :)
15:32 <dminuoso> phaazon: Contravariant is boring by the way!
15:32 Boomerang joined
15:32 <shapr> I also learn the most when I try to find ways to use a new tool/toy.
15:32 <dminuoso> Profunctor is where the good stuff is.
15:32 <shapr> arrows!
15:32 <* shapr> goes back to the stone age
15:33 <dminuoso> phaazon: It was a really cool feeling to finally grok the "lenses are coalgebras of the costate comonad" by the way.
15:33 <* shapr> 's brain explodes
15:33 <dminuoso> (I didnt understand it in a useful sense, just enough to understand it roughly)
15:34 <phaazon> dminuoso: you’re speaking chinese te me
15:34 <ystael> dminuoso: i feel like what you just said is the haskell equivalent of that weaponized german joke from the monty python sketch
15:34 <phaazon> dminuoso: well
15:34 <phaazon> Contravariant / Profunctors are not really the same thing
15:34 raichoo joined
15:34 <phaazon> you can’t say Contravariant is boring
15:34 <phaazon> because a predicate is a contravariant functor
15:34 <phaazon> while it’s surely not a profunctor :)
15:34 drets joined
15:34 tzemanovic joined
15:35 <dminuoso> Watch me: Contravariant is boring!
15:35 <phaazon> though, I don’t know what a coalgebra nor a costate is
15:35 <phaazon> dminuoso: please count to infinity
15:35 <phaazon> :D
15:35 <dmj`> lortabac: There’s definitely an easier way of doing this than changing aeson internals
15:35 pera joined
15:35 <dstolfa> dminuoso: heh, yes they are (@ lenses)
15:36 <phaazon> I think I’ve never been to actually using comonads, codensities and all those things because they’re waaaaaaaaaay too more general to actually solve a specific use case
15:38 <dstolfa> phaazon: category theory is a nice way to think about a programming language in order to impose structure on it
15:38 <dstolfa> that's kind of the whole point of it
15:38 <dstolfa> however, solving specific problems by thinking of it in terms of category theory probably isn't sufficient, as you're really just talking about the structure
15:38 <dstolfa> not the details
15:38 <maerwald> it usually just produces more monadic weirdos
15:39 <maerwald> and, even if they are useful, they don't actually solve a *problem*
15:39 jfredett joined
15:39 <dmj`> lortabac: I’ll try to write a small prototype at lunch
15:39 <maerwald> it's just another way of doing something
15:39 zdenal joined
15:39 bjht joined
15:40 tsaka__ joined
15:40 <phaazon> maerwald: sure :)
15:40 hphuoc25 joined
15:40 <maerwald> I like functional programming
15:40 <maerwald> so I write functions, not monads :>
15:40 <tsaka__> I thoroughly enjoyed doing these exercises https://github.com/data61/fp-course are there more like it?
15:41 <phaazon> we have a forever-lasting discussion at work about whether we should use recursion-schemes in our codebase
15:41 <shapr> maerwald: hey, you never did respond to my unit test vs property test question
15:41 <phaazon> it’s a bit opinionated, but I don’t see myself reasoning and thinking in terms of apomorphisms and histomorphisms :D
15:41 <phaazon> my brain is not ready yet
15:41 <phaazon> :D
15:41 xkapastel joined
15:41 saurabhnanda joined
15:41 <lortabac> dmj`: please tell me if you succeed
15:42 <drets> Hi, I have a data type with about 30 records, I also use RecordWildCards extension to build the value of the data type. A lot of records have Maybe Something type. Is there a nice way to default value to Nothing if I didn't provide the record in MyDataType{..}?
15:42 aztecrex joined
15:42 <lortabac> dmj`: I spent a couple of days on this issue, but I couldn't find a solution
15:42 <phaazon> drets: RecordWildCards
15:42 jao joined
15:42 <maerwald> shapr: you use unit tests when you deal with "odd data", which you cannot auto-generate easily (or when it doesn't even make sense to autogenerate, e.g. with certain REST APIs, protocols etc)
15:42 <phaazon> drets: you’re going to be cursed!
15:43 <drets> phaazon: ?
15:43 <glguy> drets: You can make a "default" value of your record type and update it with record wild cards
15:43 hellozee joined
15:43 <glguy> initialValueWithNothings{..}
15:43 <phaazon> drets: I don’t get why people like RecordWildCards
15:43 <phaazon> I truly hate it :D
15:43 <phaazon> it changes the type of a function by dropping a parameter
15:43 <phaazon> it’s so confusing
15:44 ozzymcduff joined
15:44 <glguy> I don't know what "changes the type of a function by dropping a parameter" means, but they are nice when constructing a record value: do field1 <- m1; field2 <- m2; return Record{..}
15:44 dbmikus__ joined
15:44 <listquestion> Hello guys, I have following question....are there possible cases where a list can be written as (x,xs)? I only know (x:xs), but am confused by some homework
15:45 <phaazon> glguy: even in that case, they’re not nice
15:45 <phaazon> because you don’t directly see which bindings go in the Record
15:45 <phaazon> and about the dropping parameter
15:45 <glguy> listquestion: No, (x,xs) always makes a tuple
15:45 <ski> listquestion : no, `(x,xs)' is a pair, not a list
15:45 <phaazon> if you define your type like this:
15:45 <phaazon> data Foo = Foo { x :: Float }
15:45 Akii joined
15:45 <phaazon> the type of x is x :: Foo -> Float
15:45 <listquestion> glguy, ski thank you
15:46 <phaazon> with RecordWildCards, it’s x :: Float
15:46 <drets> glguy, thank you. initialValueWithNothings has original type of MyDataType?
15:46 <phaazon> I remember the first time I read a codebase using it
15:46 <phaazon> I was so confused :)
15:46 <glguy> phaazon: Sure, it shadows the field accessors. I don't like it in patterns.
15:46 <phaazon> I don’t like it at all :D
15:46 pounce_ joined
15:46 <phaazon> I like the Puns extension, though
15:46 <ski> listquestion : the empty list is `[]'. all non-empty lists (at least one element) is of the form `x:xs', where `x' is the first (head) element, and `xs' is the rest of the elements (the tail of the list, which is itself a list, possibly empty)
15:46 vurtz joined
15:46 <phaazon> because it doesn’t change the type
15:47 <ski> listquestion : all lists are of one of these two forms. then there's shorthand notation like `[a,b,c,d]' meaning `a:(b:(c:[]))' / `a:b:c:[]'
15:48 falafel joined
15:48 encod3 joined
15:48 bezirg joined
15:48 <ski> phaazon : yea .. record field extraction syntax is a mess, imho
15:48 <cocreature> phaazon: NamedFieldPuns still “changes” the type (i.e. the identifier has a different type than the one it shadows)
15:48 <dmj`> lortabac: We can piggy-back on top of FromJSON inside the generics instances for our type class to add Default constraints. Another approach is to create a function that returns a Parser while traversing the Generic Rep (where the arguments to this constructed function are the default values for the fields in the record, in the case they are missing).
15:49 xtreak joined
15:49 <phaazon> cocreature: hm, not really IIRC
15:49 bezirg joined
15:49 <ski> (in SML, if there's a field `x' in a record, then the field extraction function is written `#x', not just `x'. less confusing)
15:49 <phaazon> oh yeah you’re right
15:49 obi_jan_kenobi_ joined
15:50 <cocreature> originally you have a selector in scope
15:50 <phaazon> yeah that’s right
15:50 <phaazon> I don’t like it either then
15:50 <phaazon> :D
15:50 <cocreature> in that regard it’s exactly the same as RecordWildCards
15:50 <phaazon> yeah
15:50 bezirg joined
15:50 <cocreature> the difference is that for NamedFieldPuns you at least visually see that the identifier is being shadowed
15:50 <phaazon> it’s a bit better to me because you have to pass the bindings explicitely
15:50 fujiy joined
15:50 <phaazon> yeah
15:51 <listquestion> ski, I am aware of that. I'm just confused by some code that we got as solution for an exercise. Because it takes a list as an input, but then the code is like that "parseProd l = let (summand1,rest1)" in case of....
15:51 bezirg joined
15:52 <listquestion> so I'm trying to figure out where that tupel comes from, but the code is quite long so I don't think it makes sense to paste it all
15:52 fujiy joined
15:52 fujiy joined
15:53 webhackerlol joined
15:55 Akii joined
15:56 <webhackerlol> hi Is it easy to build a board game webapp in haskell
15:57 znack joined
15:57 chokezonhorsey left
15:58 <shiona_> For some it might be
15:58 <shiona_> but not for most
15:58 Solonarv joined
15:58 <webhackerlol> shiona_: telling me ?
15:58 <shiona_> yes
15:58 <webhackerlol> so should I use nodejs ?
15:59 saurabhnanda joined
15:59 desperek joined
15:59 <shiona_> Well...
15:59 <maerwald> no, it isn't
16:00 <maerwald> maybe try elm for simple stuff
16:00 <shiona_> If you are taking a course or have some other sort of deadline to meet and you just need to make a webapp game then probably yes
16:00 oisdk joined
16:00 <shiona_> didn't think of elm. That might be ok also
16:01 Welkin joined
16:01 kapil___ joined
16:01 <* hackage> http-client 0.5.13 - An HTTP client engine http://hackage.haskell.org/package/http-client-0.5.13 (MichaelSnoyman)
16:02 toovs joined
16:02 <pounce_> Hello, I'm just tried to import `Data.List.Ordered` and got an error "Could not find module ‘Data.List.Ordered'" but importing Data.List worked fine
16:03 <sm> We make these webapps in haskell, and master the tools and language and libraries and concepts, and do the other things.. not because they are easy, but because they are hard!
16:03 encod3 joined
16:03 <glguy> pounce_: Data.List comes from the base package which you already had available. Whatever Data.List.Ordered is comes from a package you don't have. Which package did you have in mind?
16:03 <webhackerlol> elm never heard
16:03 <Welkin> pounce_: modules and packages are not the same thing
16:03 c1b01r3 left
16:03 <Welkin> webhackerlol: what about elm?
16:04 <webhackerlol> Welkin: elm I am checking
16:04 <webhackerlol> Never used it
16:04 <Welkin> webhackerlol: I use it
16:04 <pounce_> ooh, I thought it came from the base package. Looks like `data-ordlist`
16:04 wildlander joined
16:05 <pounce> How do I install a package?
16:05 <ski> listquestion : well if there's `let (summand1,rest1) = ...' then the expression `...' there will evaluate to a pair. `parseProd l' doesn't have to evaluate to a pair, though
16:05 <Welkin> the official elm guide is okay, but it takes forever to get updated and is too trivial
16:06 <Welkin> I recently found this extremely good (free) book on elm http://elmprogramming.com/
16:06 <Welkin> it is up to date
16:06 knupfer joined
16:07 conal_ joined
16:07 khilan joined
16:07 <webhackerlol> I have some 3 months deadline to showcase any demo to my boss
16:08 djbeau joined
16:09 <webhackerlol> is it spam ?
16:09 bezirg1 joined
16:09 elfets joined
16:09 <glguy> Yes and no. It's from a chat bridge server that regularly spams us with its unreliability
16:09 conal_ joined
16:09 <glguy> but not unexpected
16:09 Jackneill joined
16:09 <Welkin> thanksyes, it is matrix
16:10 <Welkin> webhackerlol: you should be able to build an app with elm by following that very in-depth guide in less than a week
16:10 <webhackerlol> Wow really
16:11 <webhackerlol> http://elmprogramming.com/ this I am reading now
16:11 <Welkin> yeah
16:11 <Welkin> it took me about 2 weeks to build an app in elm when I started learning it
16:11 <Welkin> if I had that guide it would have been much less
16:12 altjsus joined
16:12 <Welkin> I also did it kind of wrong
16:12 <Welkin> or rather, poorly
16:12 altjsus joined
16:12 jkachmar joined
16:12 ryapric joined
16:13 ryapric left
16:13 <infinisil> That's how you learn stuff!
16:13 <Welkin> yes, indeed
16:13 Akii joined
16:13 fendor joined
16:14 fujiy joined
16:14 altjsus joined
16:15 <webhackerlol> Welkin: do you know this game called ludo ?
16:16 <Welkin> no
16:16 JimmyRcom_ joined
16:17 zar joined
16:17 Gurkenglas joined
16:17 cschneid joined
16:18 greg3 joined
16:19 jfredett_ joined
16:19 altjsus joined
16:20 wazdee_ joined
16:20 <webhackerlol> https://en.wikipedia.org/wiki/Ludo_(board_game) there are many games but I just want to build a duplicate app with different ideas in ind
16:20 <webhackerlol> mind*
16:20 <webhackerlol> chess or checkers should be very hard
16:21 kmurphy4 joined
16:22 Psybur joined
16:23 <wazdee_> I was wondering if there was a way to pass a command to stack ghci from the command line to run
16:24 <glguy> wazdee_: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/using.html?highlight=#eval-mode
16:24 <Psybur> Is there a more concise way to do: f g x y = foldr (\a b -> foldr (\c d -> pure (g a c)) x y) y x ?
16:25 <infinisil> @pl f g x y = foldr (\a b -> foldr (\c d -> pure (g a c)) x y) y x
16:25 <lambdabot> f = join . (flip .) . flip flip id . ((ap . ((foldr . (const .)) .) . flip) .) . flip . ((foldr . ((const . pure) .)) .)
16:25 <wazdee_> @glguy thanks!
16:25 <lambdabot> Unknown command, try @list
16:25 <infinisil> That is more concise, right?!
16:26 ian_andrich joined
16:26 <Psybur> lol
16:26 snahor joined
16:26 ioanluca joined
16:27 lortabac joined
16:27 raichoo joined
16:28 astrofog joined
16:28 hellozee joined
16:29 Deide joined
16:31 bezirg joined
16:32 amar_ joined
16:33 DSM_ joined
16:34 <glguy> Psybur: That one's related to, but behaves differently to, f<$>a<*>b <|> a <|> b that you asked about yesterday. What's actually behavior you're trying to build?
16:34 x0x0_ joined
16:34 <Welkin> how does that expression associate?
16:35 <glguy> as indicated with the spacing
16:35 <Welkin> okay
16:35 <Psybur> If both, apply a function to their contents, otherwise return which one has stuff
16:35 <glguy> at what type?
16:35 davr0s joined
16:35 <glguy> these things behave differently on different types
16:35 son0p joined
16:36 <Psybur> I'm working with maybes but wondering what the most generic way is
16:36 <Psybur> I don't like the alternative optional way because of the extra wrapping in maybe
16:36 obi_jan_kenobi__ joined
16:36 <glguy> Those definitions behave differently on lists
16:36 <Psybur> nested fold seems more efficient
16:37 ft joined
16:37 <Psybur> yes it will only use the heads of the lista
16:37 <Psybur> well head and tail
16:38 <Psybur> wait no heads
16:38 <Psybur> I could make g process the accumulators too to make it more generic
16:39 kar1[m] joined
16:39 valentinbuza joined
16:39 dpyro joined
16:42 rihards joined
16:42 aarvar joined
16:44 oisdk joined
16:47 language_agnosti joined
16:49 emilypi joined
16:49 raynold joined
16:50 ocramz joined
16:50 Achylles joined
16:52 bbrodriguez joined
16:53 HMPerson1 joined
16:53 wilornel joined
16:53 equalunique[m] joined
16:53 freeman42x joined
16:53 javjarfer[m] joined
16:53 spacekitteh[m] joined
16:53 Gratin[m] joined
16:53 M-wamaral joined
16:53 caseypme[m] joined
16:53 berton joined
16:53 turt2live joined
16:53 aspiwack[m] joined
16:53 abhir00p[m] joined
16:53 DSNTravellerbot[ joined
16:53 davidar_ joined
16:53 ahri joined
16:53 lierdakil[m] joined
16:53 RheaParekh[m] joined
16:53 aer[m] joined
16:53 bennofs[m] joined
16:53 albertsg[m] joined
16:53 unknownln joined
16:53 dmp1ce[m] joined
16:53 reactormonk[m] joined
16:53 tehnix[m] joined
16:53 tester668[m] joined
16:53 WilliamHamilton joined
16:53 davidar joined
16:53 jerin[m] joined
16:53 lightandlight joined
16:53 maigel[m] joined
16:53 ayk[m] joined
16:53 M-krsiehl joined
16:53 cocarl[m] joined
16:53 JanPath[m] joined
16:53 rihardsk[m] joined
16:53 MaJoe[m] joined
16:53 TylerCecil[m] joined
16:53 zaphar_ps[m] joined
16:53 drasich[m] joined
16:53 jansc[m] joined
16:53 leifm[m] joined
16:53 nanoplink[m] joined
16:53 rcat[m] joined
16:53 rbutler[m] joined
16:53 hendrik[m]1 joined
16:53 greentrophy[m] joined
16:53 gurkenglas[m] joined
16:53 blaha[m] joined
16:53 jstone[m] joined
16:53 undu[m] joined
16:53 goodboy[m] joined
16:53 semyon[m] joined
16:53 hakan[m] joined
16:53 blaird[m] joined
16:53 rellen joined
16:53 anhduy[m] joined
16:55 yuuki_ joined
16:56 t7 joined
16:57 beefjoe joined
16:58 hphuoc25 joined
17:01 Mysterious_Light joined
17:03 t7 joined
17:03 twandy joined
17:04 vukasink joined
17:04 keepLearning512 joined
17:09 <webhackerlol> #elm dull :(
17:09 <shapr> webhackerlol: sharpen your tools!
17:10 <webhackerlol> shapr: what you mean shapr ?
17:10 ocramz joined
17:11 atmospherian joined
17:11 <cocreature> shapr: more like shapr your tools :)
17:11 <pounce> Hello, when I run `cabal install data-ordlist` "could not find module 'Prelude'" and "could not find module 'Data.List'"
17:13 <pounce> I can use these modules from GHCI too
17:13 <glguy> pounce: That's unusual. To save some work it will help if you can paste the whole terminal contents to a pastebin including the commands you ran and the output you got: https://gist.github.com
17:14 emilypi joined
17:14 pagnol joined
17:15 kritzefitz joined
17:15 cybai joined
17:15 slaznick joined
17:18 <pounce> glguy: here are the commands I ran and their output https://gist.github.com/4e554c4c/7b3b22bb29f8ab633ec5247831f12141
17:18 <glguy> pounce: Is this Arch Linux?
17:19 <pounce> yes
17:19 thunderrd joined
17:19 <glguy> In order to use ArchLinux's package manager provided Haskell packages you have to jump through extra ArchLinux hoops
17:21 <glguy> Like the rest of arch, you can probably figure out how to fix it on the arch wiki. The general recommendation seems to be not to use archlinux's package manager for your Haskell dev, though
17:21 lumm joined
17:21 <pounce> ah, I had this problem with python pip too. pacman doesn't seem to play nice with language package managers
17:21 <cocreature> at least not for anything except for getting GHC
17:22 <geekosaur> like most package managers, it's interested in what it needs for its own ecosystem. not for the ecosystem you need (e.g. for development)
17:22 <glguy> I wouldn't bother getting GHC that way, either. I wouldn't want a pacman update to change my GHC version out from under me when I'm doing development
17:22 <pounce> the only things I installed through pacman were ghc and cabal
17:23 <geekosaur> and you pretty much have to go nix-style to escape that, because it's actually a rather hard problem
17:23 <geekosaur> the base package is wired into ghc
17:23 <pounce> installing cabal already took up half my drive space, but I'll see what I can do XwX
17:25 <* hackage> llvm-hs-pure 6.2.1 - Pure Haskell LLVM functionality (no FFI). http://hackage.haskell.org/package/llvm-hs-pure-6.2.1 (cocreature)
17:26 <pounce> So should I let stack manage ghc and such?
17:26 fujiy joined
17:27 <glguy> I prefer installing GHC myself into my home directory and using cabal's new-build command for building
17:27 LKoen joined
17:29 GodotMisogi joined
17:30 saurabhnanda joined
17:30 enterprisey joined
17:30 Luke joined
17:30 ocramz joined
17:31 MomusInvictus joined
17:33 Ariakenom joined
17:34 mizu_no_oto joined
17:35 fujiy joined
17:36 tzemanovic joined
17:37 paidnode joined
17:38 amar_ joined
17:39 hellozee joined
17:40 mou joined
17:40 <* hackage> llvm-hs 6.3.0 - General purpose LLVM bindings http://hackage.haskell.org/package/llvm-hs-6.3.0 (cocreature)
17:40 <lortabac> dmj`: both solutions seem quite hard in practice
17:41 fmixing joined
17:41 <geekosaur> you will find that a number of other language communities will tell you the same thing (I know this happens with perl, python, ruby in particular): for dev don;t use the package manager, install your own copy
17:42 <t7> snap install haskell
17:43 <Welkin> I prefer to manage my own ghc installations too
17:43 rblaze joined
17:43 <lortabac> dmj`: but if one of them works it would be great :)
17:43 <nshepperd> pounce: install cabal-static from AUR
17:43 <Welkin> lortabac: are you sure you are responding to the correct person?
17:44 <Welkin> I haven't seen dmj` say anything in here yet today
17:44 <lortabac> yes I am sure :)
17:44 <Welkin> lortabac: perhaps a pm would be more appropriate then
17:44 SovietBeer_ joined
17:44 SovietBeer_ joined
17:44 <nshepperd> stack is a good choice too, but I haven't got around to publishing the cleaned up aur package for it yet
17:45 eubn_ joined
17:45 jfredett joined
17:45 mou joined
17:46 <lortabac> Welkin: it's ok, we will resume our conversation tomorrow
17:46 oisdk joined
17:46 phryk joined
17:46 jeltsch joined
17:47 ManiacTwister joined
17:48 insanitea joined
17:48 ft joined
17:48 vilu joined
17:48 Folkol joined
17:48 obfusk joined
17:49 nickolay_ joined
17:49 UnChallengeD joined
17:49 keepLearning512 joined
17:49 gnusosa joined
17:49 gnusosa joined
17:49 danso joined
17:49 agander joined
17:50 ocramz joined
17:50 mimi_vx joined
17:51 Natch joined
17:52 yahb joined
17:52 yahb joined
17:53 LiaoTao joined
17:53 xqb16141 joined
17:54 language_agnosti joined
17:57 ixxie joined
17:57 obi_jan_kenobi__ joined
17:58 <pikajude> does anyone know if there's some useful literature around for writing a pretty-printer for a grammar that has a certain set of operator precedences and associativities
17:59 lumm joined
17:59 connrs joined
17:59 <dmj`> lortabac: I think it’s possible. I currently do the default value if missing in envy for environment variables. But I’d like to try the type family synonym w/ a default generic instance approach.
18:00 amirpro joined
18:01 <pikajude> does the Show instance deriver take precedence into account?
18:01 pio_ joined
18:01 <pikajude> err, associativity
18:01 <pikajude> it doesn't seem to
18:01 curious_corn joined
18:02 <pikajude> ah no, it doesn't, it parenthesizes the expression instead
18:02 <pikajude> i'm trying to write a pretty-printer that doesn't need to do that, though
18:02 <infinisil> pikajude: Idris' Show does: https://github.com/idris-lang/Idris-dev/blob/master/libs/prelude/Prelude/Show.idr#L42-L66
18:03 <pikajude> associativity?
18:03 <pikajude> maybe i'm misunderstanding that code block, i've never written idris
18:03 leonardys joined
18:04 <ixxie> pikajude: there was this really extensive blog post: http://journal.stuffwithstuff.com/2015/09/08/the-hardest-program-ive-ever-written/
18:04 <infinisil> I'm not sure how it works exactly, but it takes precedence into account
18:04 <infinisil> Ah yeah no associativity right
18:05 <glguy> pikajude: I doesn't appear to take associativity into account like you're asking about
18:05 <pikajude> oh that's a good URL slug
18:05 <ixxie> pikajude: they write a dart formatter program, but took great pains to document all the mistakes
18:05 <ixxie> pikajude: so this may be very helpful :)
18:05 fujiy joined
18:05 <infinisil> pretty-printer != formatter though
18:05 <ixxie> pikajude: associated HN discussion found https://news.ycombinator.com/item?id=10195091
18:05 <ixxie> oh
18:05 <ixxie> lol
18:05 <infinisil> a pretty printer is much easier
18:05 <ixxie> thats true
18:05 <pikajude> yeah, i'm writing a formatter
18:05 <infinisil> Oh well then
18:06 <pikajude> lol
18:06 <infinisil> pikajude: What language?
18:06 <glguy> pikajude: it should be as simple as adding an extra parameter with type data Assoc = Left | Right | None (with names that don't collide with Either)
18:06 <pikajude> nix
18:06 pwnz0r joined
18:06 <pikajude> lol
18:06 <pikajude> i hope nix doesn't already have a formatter
18:06 <pikajude> or rather, i hope it does
18:06 <pikajude> because i need one
18:06 <infinisil> pikajude: Lol, I just thought about this too recently!
18:07 <pikajude> glguy: yeah, i have the associativity data available, i was just trying to figure out how to *implement* it
18:07 <pikajude> i'm not as big-brained as some haskell users :(
18:07 lortabac_ joined
18:07 GladBoi joined
18:07 <infinisil> pikajude: I thought about using hnix first, but that doesn't work, because formatting needs whitespace information, which hnix doesn't parse
18:07 <pikajude> it doesn't?
18:07 <glguy> pikajude: I don't know what that comment about other users has to do with anything, but once you have not only a precdence::Int parameter but an associativity one you'll be able to resolve the cases where the precedences match
18:07 <pikajude> oh, you mean like blank lines and comment preservation and stuff
18:08 <infinisil> pikajude: A parser for a language just throws away comments
18:08 <infinisil> pikajude: The linked blogpost mentions this as well
18:08 <pikajude> oh, wait, so i have to write a whitespace preserving parser for nix too?
18:08 <pikajude> ffs
18:08 <infinisil> Yup
18:09 <pikajude> ok this project just became not worth it
18:09 <infinisil> It would be really nice though, but I'm also kind of meh about it
18:09 <pikajude> it would be, yeah
18:09 <infinisil> We could (not) work on it together hah
18:09 <pikajude> yeah, i just realized recently how useful it is to have autoformatting for everything
18:10 <pikajude> at work we have it for every language i work in
18:10 <pikajude> removes a source of cognitive load
18:10 <pikajude> although from the blog post i think dart is a lot harder to format than something like nix or haskell is
18:10 <Welkin> pikajude: except when the autoformatting isn't what you want
18:10 connrs joined
18:10 <pikajude> well, if that day ever comes, then i'm sure i'll find a solution
18:10 <infinisil> FWIW, nix-mode just got an update that makes indentation much better: https://github.com/NixOS/nix-mode/pull/42
18:11 <pikajude> i don't think my brain is big enough for emacs either
18:11 <Welkin> haskell-mode is really good
18:11 <infinisil> vim-nix (or nix-vim?) has good indentation already too
18:11 bertschneider joined
18:11 <pikajude> oh
18:11 <pikajude> yeah
18:11 <Welkin> it makes me feel annoyed at other language modes that aren't as good, or ones that are even awful
18:11 <pikajude> i was looking more for good solutions to format long or confusing expressions
18:11 <Welkin> like elm-mode, which sucks in emacs :(
18:12 <pikajude> which i have a lot of in my darwin-configuration.nix
18:12 <Welkin> sadly some languages only get good modes in editors like vscode for some strange reason
18:12 <pikajude> and i don't feel like putting the effort in to fix it myself
18:12 <infinisil> pikajude: Can I see?
18:12 <infinisil> Welkin: LSP to the rescue
18:12 <pikajude> my configuration?
18:12 <pikajude> or the formatter?
18:12 <Welkin> infinisil: what's that?
18:12 <infinisil> pikajude: Why not both :D
18:12 theelous3 joined
18:13 <infinisil> Welkin: http://langserver.org/
18:14 <pikajude> one sec, i'll pastebin the configuration
18:14 jfredett joined
18:15 <pikajude> https://gist.github.com/pikajude/a5bbb67632eacfbe5e183491e622a465
18:15 <pikajude> look at this monstrosity
18:15 <infinisil> I also want to eventually have a go at implementing an LSP server for Nix
18:15 <* hackage> gym-http-api - REST client to the gym-http-api project http://hackage.haskell.org/package/gym-http-api- (stites)
18:16 knupfer joined
18:16 <infinisil> pikajude: That sure is something! Can I give some tips over on #nixos?
18:16 <pikajude> lol
18:16 <pikajude> sure
18:17 bertschn_ joined
18:19 replay joined
18:19 Cale joined
18:20 cjreynolds joined
18:20 <* hackage> HNumeric - Haskell Numeric Library with pure functionality, R & MATLAB Syntax. http://hackage.haskell.org/package/HNumeric- (edeftg)
18:20 raingloom joined
18:21 sbrg joined
18:21 sbrg joined
18:23 <sbrg> Hello. I'm trying to dockerize an application which uses mueval, which in turn uses hint. my naive try was originally to simply copy the two mueval binaries(mueval and mueval-core). this leads to a runtime error with openFile because it seems to try to open a `settings` file the path to which seems to be hardcoded to use the environment in which the binaries were built. is there something I can do to remedy
18:23 <sbrg> this? I'd prefer to avoid having to built the entire thing inside docker.
18:23 Gurkenglas joined
18:24 rcdilorenzo joined
18:25 keepLearning512 joined
18:26 <geekosaur> sbrg, mueval links in the compiler it was built with. Because that's how the ghc-api works.
18:26 <geekosaur> No, this can't reasonably be changed. Compiler internals do not have a fixed API that can be stable across versions.
18:26 fujiy joined
18:27 <sbrg> i was afraid this was the case. I guess i'll have to bite the bullet and built the entire thing inside docker
18:28 zero_byte joined
18:28 <geekosaur> (there is some work on this that mueval may be able to take advantage of at some point, but it's still in development.)
18:30 <* hackage> s-cargot-letbind - Enables let-binding and let-expansion for s-cargot defined S-expressions. http://hackage.haskell.org/package/s-cargot-letbind- (KevinQuick)
18:30 tvN left
18:30 TCZ joined
18:31 pagnol joined
18:34 <Welkin> s-cargot? lol
18:34 chat_ joined
18:36 kmelva joined
18:38 agander_ joined
18:38 UnChallengeD joined
18:39 conal_ joined
18:43 fujiy joined
18:45 altjsus joined
18:46 curious_corn joined
18:48 connrs joined
18:50 beauby joined
18:51 Mysterious_Light joined
18:53 <dmj`> @package s-cargot
18:53 <lambdabot> http://hackage.haskell.org/package/s-cargot
18:53 mizu_no_oto joined
18:53 <pounce> Hello, I have a function `f :: (a -> bool) -> [a] -> ([a],[a])` and I want to make a recursive expantion that appends to one of the lists. I could do this with `f (x:xs) = (x: (fst (f xs)), snd (f xs))` but that calls `f` twice which doesn't seem to be needed
18:53 <pounce> Can I do this with only calling f once?
18:54 <pounce> (whoops, discard the predicate func for now)
18:54 <Cale> let (us, vs) = f xs in ...
18:54 <sbrg> yes, use a let-binding or `where`
18:55 snahor joined
18:55 fishythefish joined
18:56 knupfer joined
18:58 patbecich joined
19:01 dhil joined
19:02 aztecrex joined
19:02 jonathono joined
19:03 Mysterious_Light joined
19:04 shadowdao joined
19:06 heebo joined
19:07 language_agnosti joined
19:08 lumm joined
19:09 aztecrex joined
19:10 blackandblue joined
19:12 <pounce> lmao I just realized I rewrote the partition function
19:12 zdenal joined
19:13 <geekosaur> isn't there a "stages of a haskell programmer" entry about that?
19:14 <geekosaur> (i.e. we've all been there, one way or another)
19:14 <pounce> I'm probably at stage 0, whatever that is
19:14 <pounce> it was fun though! https://gist.github.com/4e554c4c/a9f634b380d21f5b23181893c2afb39a
19:14 <mitchellsalad__> Hello folks, can someone please help me understand what the purpose of avoiding let-floating here is: https://github.com/HeinrichApfelmus/reactive-banana/blob/ee9d5a3962c2bc48782512f54a3ae14a7a3d5b4b/reactive-banana/src/Reactive/Banana/Internal/Combinators.hs#L161
19:15 <cocreature> pounce: rewriting the standard library is a pretty good way to learn some Haskell :)
19:15 <infinisil> If you were only to write functions that don't exist already you wouldn't be writing much anyways
19:15 <maerwald> cocreature: and it's necessary to do useful stuff
19:16 <pounce> hehe that's what I figure
19:16 <Welkin> geekosaur: this? http://www.willamette.edu/~fruehr/haskell/evolution.html
19:16 ixxie joined
19:16 <geekosaur> that's one of them but there are others
19:17 <pounce> Now I'm looking at the existing definition of partition, and it uses a functino that does patterns like this `select p x ~(ts,fs)...` what's the tilde for+
19:17 <blackandblue> hi. is there anyone here rocking 1366x768 laptop or am I the only crazy one? for haskell coding ofc
19:17 <zfnmxt> blackandblue: I have the same...not that it really matters.
19:17 <geekosaur> mine is retired. mostly because it's older than some of the people in this channel.
19:18 <Welkin> pounce: lazy pattern matching
19:18 <blackandblue> should I waste extra money to get full hd laptop?
19:18 banc joined
19:18 <Welkin> blackandblue: full hd is not very high resolution either, lol
19:18 <blackandblue> hmm so 4k it is?
19:18 <Welkin> and yes, hidpi displays are pretty standard these days
19:18 <Welkin> no, not 4k
19:18 <blackandblue> damn 4k laptops are quite expensive
19:19 <Welkin> you are thinking of televisions
19:19 <blackandblue> then what resolution should I get if full hd is not good enough?
19:19 <geekosaur> I wouldn;t worry much about resolution. I ditched mine not because of resolution but because it's ancient and slooooooow
19:19 <Welkin> it is good enough o.o
19:19 <Welkin> it's just not "high resolution" these days
19:19 <Welkin> I am on 1440x900 for my main laptop
19:19 <dpanth3r_> 1440p is a good middle ground
19:19 <blackandblue> should I keep using 1366x768?
19:19 <Welkin> yes, if it suits you
19:19 <geekosaur> "high resolution" matters if you're playing (or making) games. for coding, not so much
19:20 <dmwit> You can't program Haskell well with any fewer than 16M pixels and 16M colors.
19:20 trevorriles joined
19:20 <Welkin> the vertical space might be a bit tight, but emacs can fix that
19:20 <blackandblue> because everything else I upgraded. its i5 dual core processor with 16 gigs ram and 256gb ssd.
19:20 <cocreature> dmwit: and I thought 2 colors should be enough for everyone
19:20 <Welkin> blackandblue: is this a laptop?
19:20 trevorriles joined
19:20 <dysfun> 1440x900 is quite small though. you surely want at least 1080p
19:20 <blackandblue> Welkin, yes old dell latitude
19:20 <geekosaur> enh. you can get by with less
19:20 <cocreature> a better resolution might be nice but it’s by no means necessary
19:20 <Welkin> dysfun: I find 1440x900 to be perfect
19:20 <blackandblue> I see
19:21 <ystael> blackandblue: once upon a time, X had a wonderful little font called `fixed`
19:21 <blackandblue> I heard its good for eyes when coding on good resolution
19:21 <dysfun> i find 1080 could be a little bit bigger ideally
19:21 <geekosaur> higher res means you get fancier toys alongside, but you don;t necessarily need the toys
19:21 <ystael> it is 6x13 pixels and worked just fine for many years
19:21 <Welkin> but it is nice to see how gorgeous text looks on my 3200x1800 display
19:21 <Welkin> super sharp
19:21 <geekosaur> then again I hail from the days of 80x24 terminals :[
19:21 <geekosaur> :p
19:21 DSM joined
19:21 <blackandblue> geekosaur, the specs I mentioned are good enough ?
19:21 <blackandblue> 3rd gen i5 dual core processor btw
19:21 <Welkin> yeah go with it
19:21 <geekosaur> if they're good enough for you,m they;re good enough
19:22 <geekosaur> there's no hard rules here, there's what you are comfortable with
19:22 <blackandblue> never tried heavy compiling, else it runs good
19:22 <zfnmxt> blackandblue: with xmonad, I think 768p is ok: http://i.hmp.me/m/decb7aa90ca2edd6d105bd5d261bbf66.png
19:22 <[exa]> since when we need super-res displays to code haskell?
19:22 ozzymcduff joined
19:22 <blackandblue> zfnmxt, cheers. you also are in my league
19:22 <* [exa]> crawls back to his 80x24 cave
19:22 <dysfun> you don't *need* it, but it can help you get more useful things on screen at once
19:22 <Welkin> [exa]: expect new reddit
19:22 <Welkin> except*
19:23 <zfnmxt> Haha, right
19:23 <Welkin> I mean, zfnmxt
19:23 <blackandblue> because all the fancy instagram coders I find are using dell xps or macbooks
19:23 <zfnmxt> My laptop started at 1080p actually, but the screen was smashed and I only could find a 768p replacement. It hasn't made so much of a difference, though. Only so much you can see on a 12.5" screen.
19:23 <[exa]> that sounds like I should probably open reddit to see what's new
19:23 <blackandblue> so I feel a bit demotivated
19:24 jrabe left
19:24 <hexagoxel> mitchellsalad__: i suppose let floating creates more sharing than desired in this case. it is a question about the "lifetime" of the `c` binding.
19:24 <blackandblue> zfnmxt, thats your main coding hardware?
19:24 <Welkin> [exa]: slow, bloated single-page-app with things hovering all over the place
19:24 connrs joined
19:24 <dysfun> Welkin: it's the future!
19:24 <zfnmxt> blackandblue: when I'm at uni, yeah. But at home I have a desktop. But it's fine on both. Hardware doesn't matter at all.
19:25 <blackandblue> I see
19:25 brandly joined
19:25 <Welkin> as long as you have at least 2 GB RAM, you are fine
19:25 <Welkin> ghc is a bit of a ram hog
19:25 <hexagoxel> mitchellsalad__: e.g. if you execute the `Moment (Cached Moment a)` action twice, do they use the same `c` ?
19:25 <Welkin> prefer 4 GB (which I have on this machine)
19:25 <dysfun> 2GB? you won't be wanting to run firefox then
19:25 <pounce> what the heck is `=<<`
19:25 <blackandblue> so I shouldn't worry about getting myself a desktop or another laptop right? I can use this laptop as main for coding ? zfnmxt
19:25 <zfnmxt> Buy a $300 chromebook and you'd probably still be okay :P
19:25 <Welkin> pounce: bind
19:25 <dysfun> pounce: it's >>= with arguments reversed
19:26 <zfnmxt> blackandblue: You should worry about writing Haskell and nothing else
19:26 <zfnmxt> :)
19:26 <pounce> what the heck is `>>=`
19:26 <Welkin> pounce: you'll learn in time about it
19:26 <blackandblue> hehe true true. thanks a lot guys. looks like I shouldnt worry about saving up for new laptop
19:26 <Welkin> don't worry until then
19:26 <geekosaur> it's what the <- in a "do" turns into
19:26 <[exa]> Welkin: "omg it's so big"
19:26 <zfnmxt> It pulls the filling out of your burrito and makes a new burrito :)
19:26 <pounce> blackandblue zfnmxt yeah a chromebook is where it's at. I'm running on a chrombook rn.
19:26 jrabe joined
19:27 <blackandblue> where do you save all your files / code? since chromebook has little ssd
19:27 <mitchellsalad__> hexagoxel: Hrm, hard to chat in here with so much crosstalk, but I'll think about this for a moment & get back to you
19:27 dfeuer joined
19:27 <pounce> blackandblue: are you implying you need more than 16GB?
19:27 <geekosaur> there's -overflow
19:27 <pounce> running on 122mb of free space rn
19:27 <blackandblue> for code and files and pdfs etc... pounce
19:28 blankhart joined
19:28 <zfnmxt> blackandblue: pounce: if you guys want to continue the non-haskell discussion you should probably go to #haskell-overflow
19:28 <pounce> ah, ok sorry for flooding
19:29 Lynxium joined
19:30 <pounce> So should I forget about >>= & friends for now and focus on other stuff?
19:30 <Welkin> it depends
19:30 <Welkin> I tach >>= in chapter 1 of my book because it is essential for doing IO
19:30 <Welkin> teach*
19:31 <geekosaur> eventually you should learn it because it'll help you understand what's really going on. But for now you can get by without.
19:31 <geekosaur> because of do notation
19:31 <geekosaur> but you really should learn what do botation is actually doing at some point
19:31 <geekosaur> *notation
19:31 <zfnmxt> Welkin: Can you link your book?
19:31 <Welkin> haskellroguelike.com
19:32 <mitchellsalad__> hexagoxel: Mind if I DM you?
19:32 <hexagoxel> feel free
19:32 <Cale> It's funny, I usually consider explicit use of >>= (at least without immediately being followed by \case) as being a good sign that something could be rewritten in a more legible form.
19:32 <Cale> Usually you simply want do-notation, but if not, at least =<<
19:33 oisdk joined
19:33 <Welkin> Cale: yes, but you know how it all works, so you are free to use do notation without problems
19:33 <Welkin> for someone new, they shuld avoid do notation in my opinion
19:33 bodisiw joined
19:33 <exarkun> when stuff breaks, the closer that stuff is to the machine model, the easier the debugging ... sometimes.
19:34 <cocreature> exarkun: that’s why debugging C is so much easier than debugging Haskell? :)
19:34 <keegans> so, for example. i understand why Maybe is a monad (`Just 1 >>= (\x -> return $ x + 1)`), but why, for example is Redis a monad (in the Database.Redis module)
19:34 <exarkun> cocreature: I am completely and perfectly correct. Because "sometimes". :)
19:34 <Welkin> keegans: it's not that something "is a monad" it's that it has an instance defined for the interface we call "Monad"
19:34 <cocreature> exarkun: well played :)
19:34 <exarkun> cocreature: Also, I don't know if you can remember what it's like to be a Haskell beginner, but for a Haskell beginner, debugging Haskell is not particularly easy.
19:35 altjsus_ joined
19:35 <geekosaur> keegans, because one of the things Monad lets you do is carry around extra information. like database connections.
19:35 <keegans> Welkin: when is it appropriate to define a monad ?
19:35 <exarkun> (of course "easy" is relative and subjective ... so ...)
19:35 <Welkin> keegans: when it makes sense given the interface
19:35 <geekosaur> (this is what StateT and ReaderT do, one r/w and the other r/o)
19:36 <Welkin> Monad allows you to sequence things together and pass information from one thing to the next
19:36 <keegans> but in a kind of contained computation though
19:36 <keegans> so what situation , other than when computation can fail , is a monad needed ?
19:36 <Welkin> yes, with the constraint that they must be the same type of thing
19:36 dented42 joined
19:36 <Welkin> you cannot sequence together Maybe and List, for example
19:36 <geekosaur> in this case it removes a lot of error-proone boilerplate
19:37 crptck joined
19:37 <geekosaur> by carrying things around in the background so you don't have to do so manually, by ensuring that operations happen in the proper order by introducing data dependencies (otherwise, being a pure language, they could be reordered_
19:38 <Welkin> keegans: it's not so much that something can "fail", but that the next thing can depend on the result of the previous thing
19:39 <keegans> Welkin: excuse my possible botching of this , but comparable to a JavaScript 'callback' in the respect that they need to be chained
19:39 danso joined
19:39 <geekosaur> callbacks are actually not a bad comparison. that's what's behind the "haskell-likes" making inroads in the js community
19:39 <Welkin> keegans: yes, a javascript Promise is similar to Monad (but not the same thing)
19:40 wagle joined
19:40 zachk joined
19:40 zachk joined
19:41 <keegans> my next haskell goal is to understand the internals of the (in my inexperienced eyes) Discord.hs haskell library for constructing Discord bots
19:41 amelliaa joined
19:41 <keegans> as of right now i've narrowed it down to the DiscordM monad, Effects and eventing
19:42 <keegans> i also really still don't understand applicative functors (<*>)
19:42 <keegans> functors (fmap ) i can understand however
19:42 yuuki_ joined
19:42 <Welkin> :t fmap
19:42 <lambdabot> Functor f => (a -> b) -> f a -> f b
19:42 <Welkin> :t (<*>)
19:42 <lambdabot> Applicative f => f (a -> b) -> f a -> f b
19:42 <Welkin> see the similarity?
19:43 crptck_ joined
19:43 <Welkin> applicatives are useful for things like this
19:43 <Welkin> > (,) <$> 2 <*> True
19:43 <lambdabot> error:
19:43 <lambdabot> • Couldn't match expected type ‘f a1’ with actual type ‘Bool’
19:43 <lambdabot> • In the second argument of ‘(<*>)’, namely ‘True’
19:43 <Welkin> > (,) <$> Just 2 <*> Just True
19:43 <lambdabot> Just (2,True)
19:44 <Welkin> where <$> = fmap
19:44 <Welkin> the most obvious use for applicatives is parsers
19:44 <Welkin> if you have not yet written your own parser, try it
19:45 DSM joined
19:45 davr0s joined
19:46 <keegans> i have played around with Parsec
19:46 <keegans> but the operator i used that was important was <|>
19:47 <keegans> so your mapping the (,) operator over each of the contents of the functors ?
19:47 <keegans> hmm
19:47 heebo joined
19:47 <keegans> ah
19:47 conal_ joined
19:47 <Welkin> keegans: no, I don't mean using parsec
19:48 <Welkin> I mean writing your own parser library from scratch
19:48 <Welkin> it's really easy using applicatives
19:48 <Welkin> https://www.seas.upenn.edu/~cis194/spring13/lectures.html
19:48 <Welkin> look at the assignment for week 10
19:50 <keegans> Welkin: very cool, thank you
19:50 <keegans> this looks like a fun project
19:50 <Welkin> it is
19:51 fujiy joined
19:51 patbecich joined
19:54 son0p_ joined
19:55 oisdk joined
19:56 RaptorJesus joined
19:58 knupfer joined
20:00 glittershark joined
20:00 RaptorJesus joined
20:00 fujiy joined
20:00 <glittershark> has there been any not-three-years-old
20:00 <glittershark> work on non-endofunctor category stuff in haskell ala ekmett/hask ?
20:00 <blackandblue> Welkin, is it ok to learn the CIS194 course when I am 30+? I feel a bit shame because its university course and I am way old for it
20:01 <glittershark> I keep getting the feeling that `hoist` and `fmap` should be the same function :(
20:01 Solonarv joined
20:01 <Welkin> blackandblue: of course
20:01 <Welkin> there is no shame to be had
20:01 lumm joined
20:01 <Welkin> learning is a lifelong endeavor
20:02 <blackandblue> isnt it too late to learn haskell from university?
20:02 <blackandblue> True that.
20:02 <Welkin> in college I took classes with people who were 3 times my age
20:02 hyperisco joined
20:02 <blackandblue> ahan
20:02 <glittershark> I know certain people in this channel who went back to university at roughly your age to learn math and stuff :)
20:02 <Welkin> back to university after they already had a full career, to get a phd just because
20:02 <maerwald> you are too old to learn! err.. wait, what?
20:02 language_agnosti joined
20:03 <geekosaur> I found I didn;'t have enough free time to take advantage of being staff at CMU, but no problem with taking courses with the undergrads
20:03 <blackandblue> I am so happy that university has released this haskell course online for free
20:04 RaptorJesus joined
20:04 sqrt2 joined
20:04 <blackandblue> so people like me who cant afford to go to uni anymore ( due to age constraints and money) can still study
20:04 <hyperisco> anyone know of a data structure which supports efficient indexing (such as O(nlogn)) and efficient insertion (such as O(nlogn)) ?
20:04 <hyperisco> if you maintain a count of descendants on each node, this can be implemented with a balanced tree, but I figure someone has already done that and at least named it
20:04 <jle`> hyperisco: insertion at the ends, or in the middle?
20:04 <Welkin> hyperisco: Sequence?
20:05 <hyperisco> insertion between and two consecutive indices
20:05 <hyperisco> any* two
20:05 reactormonk joined
20:05 <jle`> Sequence (a finger tree) seems to be good for those cases
20:06 <glittershark> Is there any sort of justification for the classic "GHC ignores constraints when resolving instances" gotcha? I'm trying to explain this to a coworker and coming up short on *why*
20:06 <koala_man> hyperisco: that's not efficient. a linked list is better than that
20:06 <jle`> insertAt is O(log(min(i, n-i)))
20:06 <jle`> and so is index
20:06 <blackandblue> anyway thanks a lot Welkin maerwald geekosaur for motivation. back to learning <3
20:07 <jle`> linked list insertion is on the order of O(length of list) amortized
20:07 <hyperisco> koala_man, a linked list is linear in both operations, so you must have misunderstood me
20:07 <cocreature> hyperisco: you said O(nlogn) you probably mean O(log n)
20:07 RaptorJesus joined
20:08 <hyperisco> so I must have explained myself poorly
20:08 fujiy joined
20:08 <[exa]> Hm, is there any parser for MIME e-mails, like, say, Parser Network.Mail.Mime.Mail ?
20:08 <jle`> http://hackage.haskell.org/package/containers-
20:08 quobo joined
20:08 bbrodriguez joined
20:08 <hyperisco> jle`, I heard you, thanks
20:09 <hyperisco> don't know much about finger trees but I am guessing they keep the size at each node
20:09 <[exa]> hyperisco: BB-alpha trees are nice for that
20:09 oisdk joined
20:09 LKoen joined
20:10 <Welkin> hyperisco: https://apfelmus.nfshost.com/articles/monoid-fingertree.html
20:10 camsbury joined
20:10 <geekosaur> glittershark, separate compilation is one reason. you use that with a library that was compiled a year ago, there is no way it can know about constraints in the program you're linking it against.
20:10 <Welkin> and http://www.staff.city.ac.uk/~ross/papers/FingerTree.html
20:11 <hyperisco> awesome thanks, so I can just take Seq off the shelf here, exactly what I was hoping for
20:11 RaptorJesus joined
20:11 <hyperisco> fyi I was looking for an analog to the (possible) NodeList data structure, which has both indexing and insertion
20:12 <hyperisco> though, copying a linked list to an array for purposes of indexing is also possible… I am guessing browsers don't do that anymore
20:13 <hyperisco> it is funny because in my mind Seq was just about efficient cons on both ends, not efficient inserts into the middle
20:13 <geekosaur> glittershark, there's also questions of correctness, namely making sure everything is using the same rules; this is hard to guarantee if you allow constraints to affect instance selection, and (again) even more so with separate comoilation.
20:13 <jle`> hyperisco: i was on the same boat until i looked into the docs :)
20:13 <Welkin> Sequence remains the coolest data structure ever
20:14 <glittershark> geekosaur: separate compilation bites again...
20:14 <hyperisco> actually I didn't even know it had efficient indexing :P
20:14 <geekosaur> OO systems with virtual methods can do this, effectively by making every data value carry around its own stable of methods. at the cost of needing to always use them in the equivalent of this case
20:14 <geekosaur> becuase, for the same reason haskell ignores constraints here, an OO system can't optimize away the extra method indirections.
20:15 <glittershark> ahh, sure, because the typeclass dictionary gets inlined
20:15 yuuki_ joined
20:15 RaptorJesus joined
20:15 chaosmasttter joined
20:15 <geekosaur> not quite. I mean you can;t treat a 3 as a 3, you have to use its .get and .set methods etc.
20:16 <glittershark> right
20:16 Zije joined
20:16 <glittershark> I'd love to see a concrete example of a backtracking search algorithm breaking coherence somewhere
20:16 lumm joined
20:16 fujiy joined
20:16 <Zije> hey guys
20:16 <glittershark> this is definitely in the top 10 things I have to explain to my less-haskell-experienced coworkers
20:17 <geekosaur> I have seen them but don;t have examples on tap, and searching e.g. -cafe for them is kinda painful
20:17 <glittershark> heh
20:17 <glittershark> yeah
20:18 takuan joined
20:18 <glittershark> might actually send an email there asking for something, see if anyone has something lying around
20:18 <Zije> how can I become an expert IT guy?
20:18 <nshepperd_> Well, it breaks if there is an instance available in module A but not module B and you compile them separately
20:18 <nshepperd_> Since it'll choose a different instance
20:19 aztecrex joined
20:19 RaptorJesus joined
20:19 <glittershark> sure, I guess -fwarn-orphans is just a warning
20:19 elfets joined
20:20 yuuki___ joined
20:21 dented42 joined
20:22 Boomerang joined
20:23 RaptorJesus joined
20:23 oisdk joined
20:24 osa1 joined
20:24 oisdk joined
20:26 <nshepperd_> Maybe you can cause some weirdness if you put (~) in the constraints as well
20:26 Arcaelyx joined
20:26 keepLearning512 joined
20:27 RaptorJesus joined
20:27 <nshepperd_> "cares about constraints" implies -XOverlappingInstances, doesn't it?
20:27 amirpro joined
20:28 kmurphy4 joined
20:28 <nshepperd_> But whereas OverlappingInstances chooses always the most specific instance, in this case we hope that only one of the instances has satisfiable constraints?
20:29 m0rphism joined
20:30 RaptorJesus joined
20:30 <glittershark> yeah basically I'm thinking of not-haskell here
20:30 <[exa]> oh noes, there's really no haskell parser for rfc822/mime/rfc2045 mails?
20:31 <Welkin> [exa]: you could always write one
20:31 oisdk joined
20:31 <glittershark> I'm wondering about what's wrong with a language like haskell with typeclasses that do a real, prolog-style backtracking search for instances
20:31 <glittershark> and I guess multi-module compilation is the answer
20:32 <Cale> glittershark: -XUndecidableInstances
20:32 <* hackage> push-notify-apn - Send push notifications to mobile iOS devices http://hackage.haskell.org/package/push-notify-apn- (hc)
20:32 <glittershark> heh Cale
20:32 <glittershark> no backtracking there though
20:33 <[exa]> Welkin: I was afraid of that, I don't have material to even test a reasonable subset of all MIME
20:33 <glittershark> ie if the instance heads match but only one of the constraint sets is satisfiable then overlapping instances will throw it out
20:34 RaptorJesus joined
20:35 patbecich joined
20:35 ozzymcduff joined
20:35 <glittershark> [exa]: enron email database? lol
20:35 <nshepperd_> glittershark: what if you have two instances but both of them have satisfiable constraints?
20:36 <glittershark> nshepperd_: yep, that's what I'm realizing right now
20:36 <glittershark> that the underlying problem is that there's more than one way to satisfy a given constraint set
20:36 <glittershark> and that breaks coherence
20:36 aztecrex joined
20:37 <Cale> glittershark: Oh, I guess you also need OverlappingInstances
20:37 <glittershark> you could throw those out for overlap... but checking equality of constraint sets sounds undecidable-ish to me
20:37 <Cale> http://okmij.org/ftp/Haskell/poly2.hs
20:37 <glittershark> Cale: OverlappingInstances doesn't do backtracking either if I understand correctly, it only prioritizes some instances over others when doing initial lookup
20:37 oisdk joined
20:37 osa1_ joined
20:38 <[exa]> glittershark: those are in fact quite old
20:38 RaptorJesus joined
20:38 DSM joined
20:38 <[exa]> nvm I'll start by just not being worse than PHP
20:38 <Cale> glittershark: It's possible to basically simulate it :)
20:39 <Cale> (of course, this should be obvious due to the fact that it's also possible to write a lambda calculus evaluator... :)
20:39 <geekosaur> if it would require backtracking, iirc the compiler considers it incoherent
20:39 <geekosaur> and then you enable IncoherentInstances and you get the luck of the draw, because just doing that doesn;t magically make it coherent
20:39 <geekosaur> it just tells the compiler to half-ass it and hope for the best
20:42 RaptorJesus joined
20:42 <Cale> http://okmij.org/ftp/Haskell/PeanoArithm.lhs haha
20:42 <glittershark> I'm personally a fan of the "extra parameter calculated by a closed type family" trick
20:42 bontaq joined
20:42 <Cale> I'd somehow missed that one
20:42 <Cale> (this inverse arithmetic stuff)
20:43 juliagoda joined
20:45 phreedom joined
20:46 RaptorJesus joined
20:46 obi_jan_kenobi__ joined
20:48 RaptorJesus joined
20:48 <* hackage> sqlite-simple - Mid-Level SQLite client library http://hackage.haskell.org/package/sqlite-simple- (JanneHellsten)
20:49 orphean joined
20:49 DSM_ joined
20:49 oisdk joined
20:50 orphean joined
20:50 SovietBeer__ joined
20:50 <lukelau> Is there a good data strucutre for a two way map?
20:50 <lukelau> I.e. a Map a b where I can lookup via either a and b, both are guaranteed to be unique
20:51 orphean joined
20:51 <glittershark> lukelau: http://hackage.haskell.org/package/bimap-0.3.3/docs/Data-Bimap.html
20:52 <lukelau> glittershark: perfect, thank you!
20:52 <glittershark> the if you need a value too my work has a structure built on that internally that I just asked if we can open-source
20:53 <glittershark> ie (k -> v) and (k' -> v)
20:53 orphean joined
20:53 Sp4rrowh4wk joined
20:53 algorev[m] joined
20:53 <lukelau> I don’t need a value with it but that sounds pretty useful
20:53 blankhart joined
20:53 banc joined
20:53 <glittershark> we're also maintaining a fork with some additions at https://github.com/urbint/bimap/commits/rm/export-constructors
20:53 knupfer joined
20:54 ralu joined
20:54 <glittershark> yeah I might just open source it anyway :)
20:54 orphean joined
20:54 connrs joined
20:55 aib joined
20:55 orphean joined
20:55 cloudhead joined
20:57 orphean joined
20:58 <glittershark> woo, got approval to open source it
20:58 <glittershark> should be up this week
20:58 epsilonhalbe joined
20:59 orphean joined
20:59 sarna joined
21:00 pavonia joined
21:01 tzemanovic joined
21:01 patbecich joined
21:01 orphean joined
21:02 sgraf812 joined
21:02 aztecrex joined
21:03 ozzymcduff joined
21:05 iAmerikan joined
21:07 macrover joined
21:07 <ZeuPiark> bye
21:08 philippD joined
21:08 x0x0_ joined
21:08 <Profpatsch> Hm, I wonder which is faster: Text.any (== char) or Text.isInfixOf (Text.singleton char)
21:09 <Profpatsch> First should be linear over the Text and shortcuts because of ==
21:09 <glguy> Profpatsch: I think there's actually a rewrite rule in there for this
21:09 GodotMisogi joined
21:09 <Profpatsch> Ok, and isInfixOf is special-casing on isSingleton.
21:09 <Profpatsch> For the needle element
21:10 <Profpatsch> And you are right, there is a singleton rewrite rule for isInfixOf
21:10 bodisiw joined
21:10 chat joined
21:11 wchresta joined
21:11 <Profpatsch> None for any as far as I can see.
21:11 <Profpatsch> The isInfixOf one rewrites to Stream.elem.
21:11 <Profpatsch> Hm, more of a hypothetical question anyway, since my streams are rather short.
21:12 orbisvicis joined
21:12 <orbisvicis> does anything provide an if-then-else function?
21:12 kar1[m] joined
21:13 zebrah joined
21:13 codesoup joined
21:14 <hexagoxel> :t bool
21:14 <lambdabot> a -> a -> Bool -> a
21:14 oisdk joined
21:15 <hexagoxel> else, then, cond
21:16 hamishmack joined
21:17 <Welkin> if...then...else is already an expression
21:19 <geekosaur> :t bool
21:19 <lambdabot> a -> a -> Bool -> a
21:19 <geekosaur> oh, already did that
21:19 <orbisvicis> hexagoxel: ty
21:19 <geekosaur> if/then/else is not first class
21:19 LKoen joined
21:19 <orbisvicis> yeah, can't partially apply
21:19 <geekosaur> (and desugars to case with guards)
21:23 pera joined
21:23 amirpro joined
21:24 c_dub_ joined
21:26 oisdk joined
21:27 amirpro joined
21:28 conal_ joined
21:29 tzemanovic joined
21:32 beauby joined
21:34 eschnett joined
21:34 Jinxit joined
21:35 sdothum joined
21:36 aztecrex left
21:37 lumm joined
21:37 replay joined
21:37 oisdk joined
21:37 codesoup joined
21:41 cloudhead joined
21:41 youtmon joined
21:42 dekem joined
21:43 duncan_ joined
21:43 duncan_ joined
21:44 astrofog joined
21:45 <dekem> Hey people!
21:46 shannow joined
21:46 <cjay-> yo
21:47 <Rembane> Geevening
21:48 Nawab joined
21:48 <Nawab> /join ##ChatterZ
21:48 skeuomorf joined
21:52 hiratara joined
21:53 fujiy joined
21:55 zenspider joined
21:56 fmixing joined
21:57 conal_ joined
21:58 Nawab left
21:58 Nawab joined
21:59 zenspider joined
21:59 kmurphy4 joined
22:00 <zenspider> hi hi. I'm working on exercises in Hutton's book and I'm up to chapter 10 (interactive programming). I'm in emacs with what I think is a fairly normal setup and now that I'm starting to use IO monad + do, I'm getting indentation errors left and right. Is there advice or settings to deal with this?
22:00 rasusto joined
22:00 lumm_ joined
22:00 <electrocat> zenspider: could you show an example?
22:01 <zenspider> I'm currently in 10.7, working on the game "nim", in the play function that has a nested do / if / do. It's insisting that the `else` must be at the same level of the first inner `do` instead of at the level of the `if`.
22:01 <zenspider> sure. lemme try to annotate this...
22:01 Gurkenglas joined
22:04 WhatisRT joined
22:04 oak joined
22:04 <geekosaur> zenspider, absent the NondecreasingIndentation language flag (nonstandard), then and else must be more indented than the corresponding if in anything using layout (including do)
22:04 <zenspider> https://gist.github.com/zenspider/d4d47d24281f6ece688234ec614af11e
22:05 <geekosaur> or DOAndIfThenElse
22:05 <geekosaur> Hutton is using standard Haskell, so you must indent
22:05 <glguy> The example in Hutton's book has the if and else at the same level
22:06 <glguy> which loads in GHC without an extension, at least currently
22:06 <geekosaur> hm, maybe that one hit H2010, then.
22:06 <glguy> but I think the question is actually about getting emacs to behave in particular
22:07 yuuki_ joined
22:07 mjoldfield joined
22:07 <Tuplanolla> This is the minimum, zenspider: https://lpaste.net/187772328048852992
22:07 duncan^ joined
22:07 duncan_ joined
22:07 <geekosaur> tab is probably obeying strict layout (i.e. without DoAndIfThenElse), onsidering it a continuation of an expression and therefore must be indented further than the start of the expression.
22:07 lortabac_ joined
22:08 <dekem> exit
22:08 <jle`> kkkjkkkkkjjj
22:08 <jle`> ah, sorry :)
22:08 <Tuplanolla> Type :quit<Enter> to exit Vim
22:08 <glguy> :quit<Enter>
22:08 moei joined
22:09 <fishythefish> horrible api design imo, that should obviously be :quit<Exit>
22:10 <jle`> it means "quit entering"
22:11 <fishythefish> "stop opening nested vim sessions"
22:11 <jle`> "quit exit" would mean aborting your exit, keeping you locked in vim for all eternity :)
22:11 DSM joined
22:11 <geekosaur> anyway there's three different indent modes possible with haskell-mode, each of them has its own annoyances
22:12 vurtz joined
22:12 elfets joined
22:13 amar joined
22:13 <zenspider> glguy: yes. I'm trying to get emacs set up to infer indentation more correctly for here I am in this code. I would have thought that hitting return, typing "else" and then hitting tab would toggle back to the if level, then hitting return hitting tab would indent 1 deeper than the else
22:13 <zenspider> (still catching up)
22:14 oak joined
22:14 cybai joined
22:14 flipper joined
22:14 <zenspider> Tuplanolla: I'm not sure what you're saying in that paste. I am not trying to reformat the code. I'm trying to type it and have emacs "Just Work"
22:14 epsilonhalbe joined
22:15 <zenspider> geekosaur: what do you mean by DoAndIfThenElse ? Sounds like a haskell pragma?
22:15 <fishythefish> https://prime.haskell.org/wiki/DoAndIfThenElse
22:15 <geekosaur> it's a language extension, which can be expressed as a pragma or in other ways
22:15 <geekosaur> was an extension to haskell 98, may be in haskell 2010
22:15 <Tuplanolla> I see, zenspider. I'd just disable automatic indentation.
22:16 <geekosaur> which is part of the problem with having an editor do the right thing, it has no clue about indentation that can depend on the language level
22:16 <fishythefish> geekosaur: yeah, it's in H2010 and has full support without flags
22:17 <zenspider> I'm using plain vanilla ghc settings. I think the book expects that too. And the code in question is definitely lined up on if/else.
22:18 oisdk joined
22:18 <glguy> zenspider: emacs is just out of date with Haskell. If you indent the else like we used to have to do it seems to work (for me) like I think you'd expected
22:19 <zenspider> Looking at haskell-indent customization... I've got all standard values including 0 on haskell-indent-thenelse
22:19 <zenspider> I do have these tho: (haskell-indentation-mode) (hindent-mode) -- maybe hindent-mode is messing stuff up?
22:19 <glguy> if_then_else_ is part of the syntax of expressions, not wasn't tied into do-notation
22:20 <glguy> and then in 2010 that was changed and do notation got some if_then_else_ awareness
22:20 <glguy> so if you want emacs to work nicely, do it the old way
22:21 DSM joined
22:23 fujiy joined
22:25 enterprisey joined
22:26 johnw_ joined
22:26 <zenspider> seems like no matter how I format it, whether with hindent, whether do is hanging or not... emacs hates anything after else+do
22:26 ziyourenxiang joined
22:26 <zenspider> (and at some point I need to ask why the inner `do`s are necessary, because I guess I don't get it yet.
22:26 <zenspider> )
22:27 <glguy> the outer do notation doesn't continue inside the then or else branches of an if expression
22:27 <geekosaur> because do is enabling that multiline stuff
22:27 <glguy> if_then_else_ is its own thing separate from do-notation
22:27 <geekosaur> it only applies at the level of top level expressions within it
22:27 <geekosaur> ionce you are inside if-then-else, you are not at the top level of the outer do, it is back in expression syntax, you need another do to switch to do syntax
22:28 ziyourenxiang joined
22:28 <geekosaur> and when you compile haskell, one of the first things that happens is that "do" goes away, it's translated to the actual expressions
22:28 zije joined
22:28 <geekosaur> @undo do x; y; z
22:28 <lambdabot> x >> y >> z
22:28 yuuki_ joined
22:29 <pounce> How difficult is it to write super efficient haskell? like for project euler
22:30 <pounce> I sort of want to solve some problems with it, but I'm up to about lvl 54 and I don't want to do it to learn some Haskell if it's really hard
22:30 <glguy> The hard part of writing efficient project euler is coming up with the right algorithm. Project Euler doesn't generally stress one's Haskell skills directly
22:30 <zenspider> I might be getting ahead of myself... so do is more an expression than a keyword or mode... but if "it only applies at the level of top level expressions within it" how does return work nested inside of if/then/else ?
22:30 <geekosaur> return is not a keyword
22:30 <geekosaur> it's a badly named function
22:30 <glguy> pounce: If you're interested in programming exercises there are better sources of problems out there
22:30 <geekosaur> :t return
22:31 <lambdabot> Monad m => a -> m a
22:31 <zenspider> pounce: I've used euler to learn a number of languages. I think it's not a bad way to go.
22:31 <geekosaur> :t pure -- same with a more permissive constraint
22:31 <lambdabot> Applicative f => a -> f a
22:31 hiratara joined
22:31 <zenspider> geekosaur: I (think I) get that part.
22:32 <zenspider> Yeah. I think I'm getting ahead of myself at this point. I'm gonna let that go instead of go down that rabbit hole.
22:32 <phadej> many euler problems are "bad" for learning haskell, as obvious solutions are very imperative in nature
22:32 <geekosaur> and as such it doesn't "do anything" when nested, because it just lifts a value into a monad, it doesn;t e.g. stop execution
22:32 <zenspider> Right now, emacs is driving me nuts. That seems more pressing.
22:32 rihards joined
22:32 <phadej> not the problems where haskell shines
22:32 <pounce> glguy: do you have any suggestions?
22:33 <zenspider> pounce: I just did problem #50 in a very functional way (using ruby). Try that one to see how it feels.
22:33 <zenspider> I was gonna redo it in haskell this evening...
22:34 <glguy> pounce: I liked the adventofcode.com problems (there are 3 years of them to do) and then there are the various online coding challenge sites that are more programming focused like hackerrank
22:34 <glguy> I'm not saying Project Euler isn't fun, I've done about 200 problems on it, it's just not that good as a source of Haskell exercises
22:34 <zenspider> (just 7 loc in ruby and only slightly optimized)
22:35 xpycm joined
22:35 <zenspider> I should go back and do advent's 2016's CPU problems in haskell. Those were fun.
22:36 mojjo joined
22:37 Guest10279 joined
22:37 <glguy> pounce: A few of us have our adventofcode solutions available on github. If you're working through any of those problems you might enjoy seeing alternative approaches after you finish one
22:38 bontaq joined
22:40 <* hackage> aig 0.2.6 - And-inverter graphs in Haskell. http://hackage.haskell.org/package/aig-0.2.6 (AaronTomb)
22:41 jmcarthur joined
22:41 DSM joined
22:43 rostero_ joined
22:44 UnChallengeD joined
22:45 Kacia joined
22:46 <mojjo> good evening! I'm trying to grasp the concept of lenses following the Control-Lens-Tutorial. I'm a bit stuck at the point where they define a lense 'manually' without using the library. `point k atom = fmap (\newPoint -> atom { _point = newPoint }) (k (_point atom))` I understand this function and I was able to use it GHCI for updating a 'point' field in a record: `point (\x -> pure (x + 1))` So I can imagine how th
22:46 <mojjo> e `over` function is somehow build from this. However, I'm wondering how the `view` function from the lib could ever be generated just from this information. Does anyone have a hint for me?
22:46 tzemanovic joined
22:47 Khisanth joined
22:48 <jle`> mojjo: the lens type signature is (a -> f b) -> (s -> f t)
22:48 <jle`> mojjo: and your 'view' is s -> a, right?
22:49 pally joined
22:49 <zenspider> THIS! https://www.reddit.com/r/haskell/comments/52rkz1/the_state_of_indentation_support_in_emacs/ ALSO UGH
22:49 <mojjo> yes...
22:50 <jle`> mojjo: a (a -> f b) -> (s -> f t) can be thought to "lift" an (a -> f b) to an (s -> f t)
22:50 <geekosaur> as I said earlier, this is always going to be hard when the editor has to guess where you hid the knob saying which language level and accompanying indentation semantics it should use
22:50 ziyourenxiang_ joined
22:50 <geekosaur> or you go full bore and assume it can read your mind
22:50 <jle`> mojjo: the general strategy is to "hitch a ride" on that lifting process
22:50 <pally> foldr (\x r -> x : r) ys lst
22:51 <pally> let's focus on the lambda abstraction part of the above
22:51 <jle`> mojjo: by picking a suitable 'f'
22:51 <pally> r is not bound is it?
22:51 <jle`> mojjo: if i picked an 'f' where `f t' is 'a', do you see how that can implement view?
22:51 <fishythefish> pally: yes, it's bound in the lambda head
22:51 <geekosaur> pally, both x and r are parameters
22:52 <geekosaur> \x r -> ...
22:52 <geekosaur> same as \x -> \r -> ...
22:52 <jle`> mojjo: because if 'f t' is 'a', then lifting your (a -> f b) would give you an (s -> a), essentially
22:52 <zenspider> geekosaur: "which language level"? I'm not writing anything that advanced. Emacs *should* be able to handle this. Parsing an `else` should be able to figure out the `if` that it corresponds to.
22:52 <geekosaur> zenspider, again. wha=ich indentation is correct depends on haskell98 vs. haskell2010
22:52 <geekosaur> and whether DoAndIfThenElse is enabled in H98 mode, or disabled in H2010
22:52 <mojjo> oh.. give me some time to digest those lines...
22:53 <geekosaur> it is not "this rule is always true"
22:53 <jle`> mojjo: so you just need to hand-make an 'f' so that 'f t' is 'a'. then the "lifting" that the lens gives you will turn into (s -> a)
22:53 <jle`> this is usually done using a newtype wrapper, where 'f t' is a newtype that just contains an 'a'
22:53 <fishythefish> mojjo, jle`: fwiw, the tutorial at that point is still using the reduced definition `type Lens' a b = forall f . Functor f => (b -> f b) -> (a -> f a)`
22:53 <pally> ah... it's a shorthand for \x -> \r -> ...
22:53 <jle`> fishythefish: oh, thanks
22:54 <jle`> let me rephrase that then
22:54 <zenspider> I *think* I understand your last point. What's currently happening doesn't seem to fit EITHER of those two options. It's just broken after else/do
22:54 <jle`> a lens is (b -> f b) -> (a -> f a), so you want to make an "a -> b"
22:54 <jle`> so you just need to pick an "f" where "f a" is b :) (usually you can make these yourself using newtype wrappers)
22:55 <jle`> how i do this myself is i make a newtype wrapper that gives me exactly what i want
22:55 <jle`> and then i look at the standard libs to see if one has already been made
22:57 evenzhou joined
22:57 <fishythefish> in this case, it's not hard to jump to `Const b`, though
22:58 evenzhou joined
22:58 <jle`> mojjo asked for a spoiler-free explanation :)
22:58 emilypi joined
22:58 <jle`> but yeah once oyu write your own thing, the jump is clear
22:58 <fishythefish> oops ._.
22:59 <fishythefish> fwiw, http://hackage.haskell.org/package/lens-tutorial-1.0.3/docs/Control-Lens-Tutorial.html#g:6 also spoils it :P
23:01 spear2 joined
23:01 fujiy joined
23:03 xcmw joined
23:06 dfinity-develope joined
23:09 cjbayliss joined
23:10 Tordek joined
23:10 <Tordek> hi; in an attempt to make a "real" haskell program I'm trying to build a chip-8 interpreter
23:12 bgyss joined
23:12 <Tordek> so far, my memory is an UArray Word16 Word8; it works, but I'd assume that it being an immutable structure, it's not gonna be the fastest; what's the next best step? make my "State" happen in IO and use IOUArray?
23:13 darjeeling_ joined
23:14 XorSwap joined
23:14 <c_wraith> Tordek, that's an option. it's not your only option.
23:15 <c_wraith> if you do go that direction, check the vector library, you might prefer its api.
23:16 <jle`> you can also use ST instead of IO
23:16 <c_wraith> another reasonable option might include using Data.IntMap
23:17 Neel joined
23:17 rasusto_ joined
23:17 <Tordek> what'd be another option?
23:18 t7 joined
23:18 sgraf812 joined
23:18 <Tordek> jle`: I thought ST was for, like, contained computations that work well in a stateful way, but you escape them when you're done; the point of the interpreter is to be interactive
23:18 <c_wraith> abuse unordered-containers to remove the hashing part of the HAMT data structure it's built on!
23:19 <Tordek> ...what
23:19 ant23 joined
23:20 cschneid joined
23:21 <c_wraith> the array-mapped trie data structure is space efficient, cache-optimized, and supports fast updates as an immutable data structure.
23:21 <mojjo> thanks for the hints for the lense question.. My head is still spinning... It looks like the `Const` type is an important concept here..I defined it like `data Const a b = Const a deriving (Show)` ... I have problems with the funtor instance: `instance Functor (Const a) where fmap f (Const x) = Const (f x)` does not do..
23:21 <Neel> join ##ChatterZ
23:21 <Neel> guys!
23:21 <Cale> mojjo: To give another explanation, here's the general pattern: we want to break our data structure of type s into a piece of data (of type a) which is in a particular spot, and a function (b -> t) which would take any value of type b and give us back our original structure with the hole filled in (in general changing the type of the overall structure from s to t, given that we've replaced something of type a with something of type b)
23:21 <Cale> with that value plugged into the given spot. Rather than immediately applying that function to the value we popped out to get back our original data structure though, we take an arbitrary function (a -> f b)
23:21 fujiy joined
23:21 <Cale> sorry, edit failure there :)
23:21 <c_wraith> but the only haskell implementation of one is inside unordered-containers, which combines it with hashing.
23:22 <Cale> The first line was good though :)
23:22 <jle`> mojjo: fmap f (Const x) = Const (f x) does not typecheck :)
23:22 <* hackage> yarn-lock 0.5.0 - Represent and parse yarn.lock files http://hackage.haskell.org/package/yarn-lock-0.5.0 (Profpatsch)
23:22 <jle`> check the types of everything goin on
23:22 <jle`> but also in practice you can just derive the Functor instance automatically
23:22 <c_wraith> but you can always abuse your way around that with a custom Hashable implementation
23:22 floryst joined
23:23 DSM joined
23:23 <Cale> So, we split our data up into those two parts, and then we produce something which will apply an arbitrary function a -> f b to the data we popped out, before fmapping the function (b -> t) over the result of that
23:25 <Tordek> those are... words
23:25 <Cale> By picking f appropriately, that lets us do both view and set -- in particular, if we pick f = Identity, and use a suitable constant function, then this will basically give us set
23:25 rprije joined
23:25 <Tordek> thanks, c_wraith, lol, I just think it's a bit advenced for me at this point lol
23:26 <Cale> If we pick f = Const a, and use what is pretty much the identity function, it'll give us view
23:26 <pounce> advent of code #1 done \o/
23:27 <jle`> mojjo: following on what i mentioned earlier, you can use a lens to turn an (b -> f b) into an (a -> f a), and if you pick an 'f' where 'f a' is 'b', then you get a (a -> b) in the end
23:27 <jle`> pounce: congrats :D
23:27 <glguy> pounce: A bunch of people from #haskell have joined the private leaderboard 43100-84040706 if you're interested
23:27 <glguy> pounce: some of that links through to githubs
23:27 <c_wraith> Tordek, yeah, there are a lot of possible solutions that might be good under certain circumstances like that. but mutable arrays/vectors or some kind of tree (Like Data.IntMap) are your best first-pass options.
23:27 <jle`> so we can define a custom 'f' such that 'f a' is 'b':
23:27 <jle`> newtype Viewing b a = Viewing { getViewing :: b }
23:27 <Tordek> also, related; currently my `stepExecution` function is in IO because of one evil little `RND` function... any better ideas on how to handle it? put it into a randomstate monad?
23:28 <jle`> ^ in that data type, do you see how 'Viewing b a' is just 'b'? we essentially defined an f (that is, Viewing b) that makes 'f a' the same thign as 'b'
23:28 conal_ joined
23:28 <mojjo> right now I'm still wondering why my above fmap implementation does not do..
23:28 <jle`> so then view l = getViewing . l Viewing
23:29 <jle`> ^ just some manual newtype wrapping and unwrapping
23:29 <jle`> mojjo: ah, do you mean why it does not compile?
23:29 rasusto_ joined
23:29 <mojjo> yes
23:29 <jle`> check the types :)
23:29 <jle`> what is the type of f, and the type of x?
23:30 <jle`> it might help to re-lable your type variables a bit to make it clearer, `data Const w a = Const { getConst :: w }`
23:31 <pounce> How would I read a line and turn it into a [Integer]?
23:31 <glguy> pounce: make sure you do both parts of day 1
23:31 <pounce> :O I didn't know there were two
23:32 <glguy> The second part is revealed when you successfully complete the first part. This is the case for all but the last day
23:33 Nawab joined
23:33 <Nawab> join ##ChatterZ guys! lets chat and be friends!
23:34 jackdk joined
23:34 x0x0_ joined
23:35 XorSwap joined
23:36 sdothum joined
23:36 <pounce> IS there I can turn a list into a list of (index,item)? (I know I can do this with scanl, but are there methods for it)
23:36 cynapse joined
23:37 <Cale> pounce: zip [0..]
23:37 <geekosaur> zip it against [0..]\
23:38 dfinity-develope joined
23:38 <pounce> ty
23:38 fujiy joined
23:38 zdenal joined
23:39 kar1[m] joined
23:43 karlguy joined
23:43 evenzhou joined
23:45 Linter joined
23:52 youtmon joined
23:53 daniel-s joined
23:54 unknownln joined
23:54 equalunique[m] joined
23:54 reactormonk[m] joined
23:54 HMPerson1 joined
23:54 wilornel joined
23:54 javjarfer[m] joined
23:54 caseypme[m] joined
23:54 freeman42x joined
23:54 spacekitteh[m] joined
23:54 ahri joined
23:54 Gratin[m] joined
23:54 M-wamaral joined
23:54 berton joined
23:54 turt2live joined
23:54 aer[m] joined
23:54 abhir00p[m] joined
23:54 aspiwack[m] joined
23:54 RheaParekh[m] joined
23:54 lierdakil[m] joined
23:54 albertsg[m] joined
23:54 davidar_ joined
23:54 bennofs[m] joined
23:54 dmp1ce[m] joined
23:54 WilliamHamilton joined
23:54 davidar joined
23:54 tester668[m] joined
23:54 tehnix[m] joined
23:54 maigel[m] joined
23:54 lightandlight joined
23:54 jerin[m] joined
23:54 ayk[m] joined
23:54 DSNTravellerbot[ joined
23:54 M-krsiehl joined
23:54 MaJoe[m] joined
23:54 TylerCecil[m] joined
23:54 rihardsk[m] joined
23:54 cocarl[m] joined
23:54 JanPath[m] joined
23:54 nanoplink[m] joined
23:54 jansc[m] joined
23:54 drasich[m] joined
23:54 zaphar_ps[m] joined
23:54 rcat[m] joined
23:54 leifm[m] joined
23:54 greentrophy[m] joined
23:54 rbutler[m] joined
23:54 hendrik[m]1 joined
23:54 blaird[m] joined
23:54 jstone[m] joined
23:54 blaha[m] joined
23:54 undu[m] joined
23:54 goodboy[m] joined
23:54 hakan[m] joined
23:54 rellen joined
23:54 semyon[m] joined
23:54 gurkenglas[m] joined
23:54 anhduy[m] joined
23:55 acarrico joined
23:55 bontaq joined
23:55 DSM joined
23:57 <* hackage> pandoc-types - Types for representing a structured document http://hackage.haskell.org/package/pandoc-types- (JohnMacFarlane)