<    April 2017    >
Su Mo Tu We Th Fr Sa  
                   1  
 2  3  4  5  6  7  8  
 9 10 11 12 13 14 15  
16 17 18 19 20 21 22  
23 24 25 26 27 28 29  
30
00:00 robertkennedy joined
00:00 YongJoon joined
00:01 marvin2 joined
00:03 a3Dman joined
00:03 jlael joined
00:04 benl23 joined
00:08 cic joined
00:09 lambda-11235 joined
00:10 uglyfigurine joined
00:11 DexterLB joined
00:11 squotro joined
00:13 Axman6 joined
00:13 <Jello_Raptor> Hmm, I'm looking for algorithms for sub-hypergraph isomorphism with a few caveats. Basically, the vertices on the hypergraph are typed, the edges are typed, and each edge has named vertices, all the types and names must match for the sub-hypergraphs to be isomorphic.
00:14 <Jello_Raptor> that has so many additional constraints that it should be easier than the raw problem, but I'm wondering what the literature would call problems like that.
00:15 <Jello_Raptor> I'm not sure what terms to search for.
00:15 squotro joined
00:15 pera joined
00:16 squotro joined
00:19 e14 joined
00:20 a3Dman joined
00:22 eacameron joined
00:22 squotro left
00:23 danza joined
00:23 jgertm joined
00:25 bencryption joined
00:26 revprez_atlanta joined
00:26 squotro joined
00:27 squotro joined
00:28 mekeor joined
00:29 <mniip> Jello_Raptor, you probably could assemble gadgets to reduce your problem to a regular graph iso problem
00:29 nh2 joined
00:29 nh2 left
00:29 binaryplease joined
00:30 ahf joined
00:32 fizbin joined
00:32 cpup joined
00:33 carlosdagos joined
00:33 ExpHP joined
00:34 cic joined
00:34 dosequis joined
00:35 <Jello_Raptor> mniip: yes, but there's no way that's going to vaguely efficient
00:35 <mniip> that depends
00:36 <Jello_Raptor> Though I should probably go through a graph-io and hypergraph-iso algorithms to see if any are adaptable.
00:36 <Jello_Raptor> mniip: mmm?
00:36 nomicflux joined
00:36 Kuros` joined
00:37 plutoniix joined
00:38 <dosequis> hi all - not sure how to search for this. Basically, I want a function like this: http://lpaste.net/6008476942922153984 - I was expecting to be able to do this via pattern matching, but that doesn't appear to be the case
00:38 <jle`> huh, these docs definitely got mangled during rendering
00:38 <jle`> http://hackage.haskell.org/package/data-default-0.7.1.1/docs/Data-Default.html
00:38 np356 joined
00:39 <jle`> dosequis: 'Show a => a -> String' means that your function has to work for *all* types 'a' that are instance sof Show
00:39 <jle`> dosequis: so, you should be able to pass (), Maybe Int, Double, etc.
00:39 <jle`> dosequis: but, how you've pattern matched, it seems like it only works for Maybe-something's
00:39 <Koterpillar> dosequis: what is the type of (Just x)?
00:39 <dosequis> jle`: ah ok I see
00:40 <dosequis> well basically I want to avoid having the "Just x" printed out
00:40 crobbins joined
00:40 <dosequis> where x could be an Int, for example
00:40 le_frogballs joined
00:40 <dosequis> basically, I just want a 'short' string representation
00:40 <dosequis> instead of "Nothing", just want ""
00:41 <Koterpillar> dosequis: that's fine, what is the type of (Just x)?
00:41 <jle`> dosequis: maybe change the type signature, show' :: Show a => Maybe a -> String
00:42 <dosequis> jle`: yeah but they won't always be Maybe's
00:42 plutoniix joined
00:42 <jle`> dosequis: if they aren't Maybe's, then use show
00:42 <dosequis> jle`: hmmm ok - basically I have another block of code that maps show over a list of 'things'
00:43 <dosequis> jle`: I just figured I would have a custom show function that would do this for me
00:43 <dosequis> jle`: instead of having to go in and 'figure' that out
00:43 <dosequis> jle`: on the collection of things that is
00:43 <jle`> dosequis: well, don't you know if your things are Maybe or not?
00:44 <jle`> or do you want it to work polymorphically for all Show a's?
00:44 <jle`> Haskell's type system enforces something called parametric polymorphism
00:44 <jle`> which means that any implementation you write for a polymorphic function has to work equally/the same for *all* possible instances/types that it is given
00:44 hamishmack joined
00:45 <dosequis> jle`: yeah I want it polymorphic - basically, they are usually not Maybe's, but if someone maps a function that generates Maybes, then I want to display them "compressed"
00:45 <jle`> yeah, that would break parametric polymorphism if done directly
00:45 <dosequis> jle`: ok - I was thinking I could just handle the cases I care about and default to show
00:45 <jle`> you have to treat the input identically, no matter what type it is
00:46 eacameron joined
00:46 <jle`> there are hacks you can do to get around this
00:46 <dosequis> jle`: hmm ok seems like I would have to read up on this
00:46 <dosequis> jle`: ok yeah I think I understand
00:46 <jle`> yup, it's the same principle that lets you prove that 'id :: a -> a' has only one implementation
00:46 <jle`> it can only return the same value it is given
00:46 <jle`> because it has to work identically on all types, regardless of what type is given
00:46 <jle`> if what you were proposing could be done, you would be able to write something like:
00:46 <jle`> id 'c' = 'a'
00:47 <jle`> id x = x
00:47 <dosequis> jle`: yeah I suppose that makes sense - but I mean in this case it would always still return a String
00:47 <jle`> so id would work different when given a Char, then when given a different type
00:47 <dosequis> jle`: basically I am just defaulting to the default show implementation
00:47 <jle`> so there goes all type safety in haskell
00:47 <jle`> out the window :'(
00:47 <dosequis> jle`: hmm ok I think I have to thing / research this one - thanks for pointing me on the right track
00:48 <dosequis> jle`: think*
00:48 <jle`> no problem. there are some hacks that would let you get this behavior, but i don't think any of them are ideal
00:48 <dosequis> jle`: yeah I generally prefer to avoid the hacks when possible
00:49 <jle`> parametric polymorphism is pretty powerful in what it tells you you can or can't do, heh
00:49 serendependy joined
00:49 <dosequis> jle`: yeah never stop learning with Haskell
00:50 ph88_ joined
00:50 <dosequis> jle`: still not sure why I can't pattern match in this case - is it because the compiler figures that I am always using Maybe's, when I am also trying to support 'all other types' in my last statement?
00:51 <jle`> whatever implementation you use has to work uniformly across all types
00:51 <dosequis> jle`: if you don't mind me asking, of course...
00:51 JamEngulfer joined
00:51 eacameron joined
00:51 <jle`> so pattern matching on Just *only* if it was Maybe would mean a different implementation for Maybe types
00:51 <jle`> than for normal types
00:51 <jle`> you are essentially able to branch on "is this maybe or not"
00:51 Eagle_Erwin joined
00:52 <dosequis> jle`: hmmm ok so would I be able to rewrite the function by checking if it's a Maybe? like if Maybe do this, if not, just show 'a'
00:53 <dosequis> jle`: or is the mere fact that I am making this check breaking the guarantees haskell imposes
00:53 <jle`> yes, you can't make that check and keep it polymorphic for all Show a
00:53 <ski> "if Maybe do this, if not, just show 'a'" is also against parametricity, unless you add some extra info to enable that
00:54 <dosequis> jle`: ok thanks again!
00:54 alx741 joined
00:54 <dosequis> ski: thanks!
00:54 <jle`> kind of like my example with id. if you could check such a thing, then you could write 'fakeId :: a -> a; fakeId (Just x) = Nothing; x = x'
00:54 <jle`> then 'fakeId :: a -> a' breaks parametricity
00:55 <dosequis> jle`: hmmm ok thanks again for taking the time - I'll read up on this and make sense of it
00:55 eacamero_ joined
00:55 <jle`> the ways to get around this are essetnailly to pass in extra information that lets you branch on the type
00:55 <jle`> so it's not "perfectly polymorphic", but constrained to only be things you have runtime information for typechecking on
00:55 <jle`> s/typechecking/checking the type
00:55 mac10688 joined
00:56 <jle`> or other ways of passing in information, like using typeclasses
00:56 <jle`> that's what the 'Show' typeclass does, by the way
00:56 <dosequis> jle`: ah ok I think I understand now
00:56 <JamEngulfer> I'm having some really tricky issues with types and stuff. I've got a lambda in a map being applied to an array, that's supposed to end up with an array of strings. The thing is, " map (\(x,y) -> "") a " works fine, but " map (\(x,y) -> replicate (3 'x')) a " fails to compile, telling me this error: https://gist.github.com/anonymous/3d7f90dc67f3ee7ee7332dff325cd136
00:56 <jle`> the Show typeclass associates a unique 'show' method for every type, so every type gets its own "showing" function
00:56 <jle`> so one thing you might be able to do as a hack is a 'ShowTruncated' typeclass, and those instances can be written on a per-type basis
00:57 <dosequis> jle`: yeah I was trying to avoid having my own typeclass for this usecase, but I think that would solve my problem
00:57 <JamEngulfer> I've been at this nearly an hour and I can't for the life of me figure out what's wrong
00:57 <jle`> it would solve your problem but introduce new ones for sure, heh
00:57 cic joined
00:57 <jle`> JamEngulfer: can you post your code too
00:57 <dosequis> jle`: yeah but I think in most cases, I will just have to deal with Maybe or 'normal' values
00:57 <dosequis> jle`: anyways thanks for your time
00:57 <Koterpillar> dosequis: what do you want to do with this value:
00:57 <Koterpillar> :t Just (Just (Just 3)))
00:57 <dosequis> jle`: very helpful
00:57 <lambdabot> error: parse error on input ‘)’
00:57 <Koterpillar> :t Just (Just (Just 3))
00:57 <lambdabot> Num a => Maybe (Maybe (Maybe a))
00:58 <Koterpillar> dosequis: how many layers will you peel off
00:58 <Koterpillar> also
00:58 <Koterpillar> :t [Just 1, Nothing]
00:58 <lambdabot> Num a => [Maybe a]
00:58 <dosequis> Koterpillar: yeah I see - didn't think about it that way
00:58 <dosequis> Koterpillar: I think I will just create a typeclass for my particular usecase
00:59 <dosequis> Koterpillar: seems like the simplest solution
00:59 <jle`> "i had a problem, so i made a typeclass. now i have two problems"
00:59 <JamEngulfer> jle`: https://gist.github.com/anonymous/49bae37d6c04e4155ce4e42d9c4bb769
00:59 <ski> JamEngulfer : it's not an array, it's a (single-linked) list. remove the pair of brackets following `replicate'
00:59 <dosequis> jle`: haha yeah
00:59 <jle`> JamEngulfer: what do you think replicate (3 'c') does
00:59 <jle`> actually, what do you think 'replicate' does?
00:59 <JamEngulfer> makes an array containing 3 instances of 'c'
00:59 <jle`> not quite
01:00 <jle`> replicate 3 'c' make sa list of 3 'c's
01:00 <Koterpillar> JamEngulfer: no need for brackets around function parameters
01:00 <JamEngulfer> It couldn't be that simple XD
01:00 <jle`> bot replicate (3 'c') doesn't quite make sense
01:00 eacameron joined
01:00 <jle`> s/bot/but
01:00 <jle`> that means that you're applying the function 3 to 'c'
01:00 <jle`> but in most sane situations, 3 isn't a function
01:00 <dosequis> jle`: I mean basically I have a "Fretboard" which is just a [[Note]], where Notes have a "nice" show like C, C#, D, etc. Now if I map say "notes2degrees", I end up with a Maybe Degree, and now my "Fretboard" looks awful because I have Just and Nothing all over the place. I want to have a nice compact representation.
01:01 <jle`> dosequis: if you're only going to use it with Note, then just write a separate function for showing [[Note]]s and [[Maybe Note]]s
01:02 <JamEngulfer> That's super infuriating. I *swear* I tried it without the brackets around the arguments.
01:02 <JamEngulfer> Well, it's all fixed now
01:02 <dosequis> jle`: yeah I guess I just wanted to have that be transparent. So if you have fretboard A, and then you map some transformer over it, you can just display it in the console without having to call a different funciton depending on the type
01:03 <JamEngulfer> Thanks for the help! I guess habit from other programming languages just tripped me up
01:03 <ski> JamEngulfer : also, you could use `concatMap'
01:03 jsgrant-_ joined
01:03 <monochrom> It is in fact possible to write your own class, and make two instances: one for Note, one for Maybe a.
01:03 <dosequis> jle`: mostly just for convenience/elegance on my end
01:03 <dosequis> jle`: and not having to remember to call a different function depending on what I end up with
01:03 <* geekosaur> would not use Show for this but instead make a FretV class
01:03 <JamEngulfer> ski: oh neat, thanks for the tip
01:04 <jle`> using a different function depending on what type you have isn't too painful, though
01:04 <geekosaur> with a default class method that requires Show, so it can be "auto-derived" as a fallback. or provide your own
01:04 <jle`> especially if you only have two possibilities
01:04 <dosequis> monochrom: ok yeah that's what I think I will do
01:04 <geekosaur> although yes, it does depend on whether there will be other instances...
01:04 DataComputist joined
01:05 <ski> > [c | (x,y) <- range ((0,0),(1,2)),c <- "ccc"]
01:05 <dosequis> ok thanks for all the suggestion all - I have some different options to explore
01:05 <monochrom> If you really have 10 or fewer types in question, write your own class and instance them.
01:05 <lambdabot> "cccccccccccccccccc"
01:05 meiji11 joined
01:05 <dosequis> monochrom: yeah probably just 1-3 types, I suspect
01:05 <geekosaur> but it does simplify this kind of thing
01:05 <dosequis> I think I'll just have a FretShow class
01:06 <dosequis> that will default to using show
01:06 raycoll joined
01:06 dan_f joined
01:07 a3Dman joined
01:07 <dosequis> have to leave but thank you everyone for the help - much appreciated!!
01:09 roboguy` joined
01:09 conal joined
01:10 eacameron joined
01:11 nomicflux joined
01:13 Biggs joined
01:14 Biggs left
01:18 qzo joined
01:18 eacameron joined
01:19 Kundry_Wag joined
01:27 pent joined
01:30 Apocalisp joined
01:33 carlosdagos joined
01:34 hamishmack joined
01:35 mthek joined
01:36 sdothum joined
01:37 kirillow_ joined
01:38 <JamEngulfer> Is there any function to convert a char to the int it represents and back without having to add and subtract 48 from it after using chr and ord?
01:39 Rodya_ joined
01:41 ebzzry joined
01:42 <monochrom> One moment, I think I have seen it before.
01:43 <monochrom> Ah digitToInt in Data.Char. Convert's A-F to 10-15 too.
01:43 <monochrom> > digitToInt '4'
01:43 <lambdabot> 4
01:43 <monochrom> > digitToInt 'b'
01:44 <lambdabot> 11
01:44 <JamEngulfer> oh nice, thanks !
01:44 mkoenig joined
01:45 adolby joined
01:50 hybrid joined
01:50 swhalen joined
01:51 a3Dman joined
01:51 karls joined
01:51 MarioBranco joined
01:52 Ushakovo joined
01:53 eacameron joined
01:53 Goplat joined
01:54 <Ushakovo> Is there anyone around who could answer a newbie question about folds?
01:55 <Sornaensis> don't ask to ask just ask
01:55 larsivi joined
01:56 le_frogballs joined
01:56 <Ushakovo> Ok I am having trouble understanding how to pass more than two arguments to a fold function
01:56 <Koterpillar> what do you want that to do?
01:56 <pacak> What kind of fold function? And what kind of arguments do you have in mind?
01:58 Rainb joined
01:59 Supersonic112_ joined
01:59 uglyfigurine joined
02:00 <Ushakovo> Never mind I realized that what I wanted to do would work with just a fold
02:00 hucksy_ joined
02:01 <pacak> Rubber duck debugging.
02:01 <pacak> Works always.
02:01 <exio4> rubber duck debugging is precious
02:01 <exio4> had been fighting with a few bugs since yesterday, got it solved when I asked about it :)
02:01 <exio4> it was in the details I had to explain that the issue was obvious
02:02 fizruk joined
02:02 danthemyth joined
02:02 <Ushakovo> I have never heard that term before but that's just what I need to do
02:03 mac10688 joined
02:05 roboguy` joined
02:05 crobbins joined
02:06 splanch joined
02:06 roboguy` joined
02:09 louispan joined
02:13 sleffy joined
02:13 takle joined
02:14 bbcue joined
02:15 freeside joined
02:15 exferenceBot joined
02:18 HoierM joined
02:19 geekosaur joined
02:19 hexagoxel joined
02:19 Lynxium joined
02:19 darjeeling_ joined
02:20 Lynxium joined
02:22 chachi joined
02:24 Netwolf joined
02:24 Netwolf joined
02:25 pavonia joined
02:25 pavonia joined
02:27 DataComputist1 joined
02:27 <freeside> m4lvin[m]: if you turn up in the next few weeks, ping me, i'd like to chat about your work
02:28 dfranke joined
02:28 <freeside> m4lvin[m]: i've been researching model checking for modal logics and have come across a load of work by Gerardo Schneider and Cristian Prisacariu that i'd like to discuss with you
02:29 markasoftware joined
02:29 thimoteus joined
02:31 <freeside> so far I have identified three languages for non-epistemic logics that are equipped to various degrees with verifiers -- CLAN (Gothenburg), CDL (Stanford), and SPINdle+ (Data61). in particular Prisacariu's PhD thesis looks very close to your work: "A Dynamic Deontic Logic over Synchronous Actions".
02:35 sleffy joined
02:36 theDon joined
02:36 joe9 joined
02:37 lambdafan joined
02:39 pera joined
02:39 HallaSurvivor joined
02:40 todaystomorrow joined
02:40 Rodya_ joined
02:42 DexterLB joined
02:43 jlael joined
02:44 <lpaste> lambdafan pasted “interleaving problem with conduits” at http://lpaste.net/354263
02:44 <lambdafan> yo
02:47 m00n joined
02:47 <Cale> isolate :: Monad m => Int -> Conduit a m a -- perhaps try this?
02:47 mizu_no_oto joined
02:47 sleffy joined
02:48 <lambdafan> Cale: thanks I was about to write my own version of sourceHandle ;)
02:48 <lambdafan> Cale: what module is isolate in?
02:48 <Cale> Data.Conduit.List
02:49 jlael joined
02:49 <jayshua> I was trying to learn about Haskell's sequences, but my searches for "sequence" on hackage only came up with this library: http://hackage.haskell.org/package/sequence-0.9.8/. I finally stumbled across a link on stack overflow to the real sequence docs: http://hackage.haskell.org/package/containers-0.5.10.2. Any reason it was so hard to find? Am I m
02:49 <jayshua> issing some search secret?
02:50 <lambdafan> how did you go about doing the serch, did you try using hoogle?
02:50 <Cale> https://www.google.ca/search?q=Haskell+Data.Sequence
02:50 <Cale> first result for me is the generic link to the containers package
02:50 <jayshua> I was here: http://hackage.haskell.org/packages/search?terms=sequence
02:50 <Cale> https://hackage.haskell.org/package/containers-0.5.10.2/docs/Data-Sequence.html
02:51 <Cale> That search is really only good for searching by module name
02:51 <Cale> er, package name
02:51 <Cale> Or package name and description, I suppose
02:51 <Cale> If you were to search for "containers" you'd find the package there
02:52 <Cale> But even Data.Sequence doesn't find you containers.
02:52 <Cale> It's better to either use google or some specialised API search like Hoogle
02:52 <jayshua> I see. Normally I do search on Hoogle, I didn't realize they gave two different results.
02:52 <Cale> https://www.haskell.org/hoogle/?hoogle=Data.Sequence
02:53 <jayshua> Thank you!
02:53 hydroacoustic joined
02:53 <lambdafan> Cale: ah you use it with the sink not the source
02:54 <lambdafan> I was trying to constrain the source
02:55 MP2E joined
02:55 pavonia_ joined
02:55 argent0 joined
02:55 <Cale> you might prefer pipes
02:56 LuckyRawApe joined
02:56 np356_ joined
02:57 <Cale> Well, at least I find the way that it does things makes a bit more sense
02:57 <Cale> In pipes, the corresponding thing is called 'take', and its implementation is simply this:
02:57 <lambdafan> Cale: next time maybe, but I'm too invested in this codebase to start over
02:57 <Cale> https://hackage.haskell.org/package/pipes-4.3.2/docs/src/Pipes-Prelude.html#take
02:59 benl23 joined
02:59 le_frogballs joined
02:59 jlael joined
03:00 <lambdafan> Cale: Thanks so much. This did motivate an ivestigation into pipes next time I have a streaming problem
03:00 <lambdafan> but that did the trick
03:05 cpennington joined
03:05 eklavya joined
03:08 takle joined
03:09 dan_f joined
03:09 HoierM joined
03:10 winter_ joined
03:13 xtreak joined
03:13 nomicflux joined
03:19 sleffy joined
03:28 felixsch_ joined
03:32 markasoftware joined
03:33 ebsen joined
03:34 mmachenry joined
03:35 carlosdagos joined
03:35 takle joined
03:43 Destol joined
03:43 wlemuel joined
03:45 otto_s_ joined
03:47 coeus joined
03:48 uglyfigurine joined
03:48 falafel joined
03:53 {emptyset} joined
03:54 wlemuel left
03:54 mmachenry joined
03:54 eklavya joined
03:55 mazeinmaze_ joined
03:57 wlemuel joined
04:00 <vaibhavsagar> I'm trying to configure Hakyll to route a blog post based on both the date and the filename. The date is in the metadata and there doesn't seem to be a simple way to construct a route based on both the Identifier and the Metadata. Is there something I'm missing?
04:01 <vaibhavsagar> One option is to add a "slug" field to the metadata and another is to add the date to the filename
04:02 <vaibhavsagar> but is there a customMetadataRoute?
04:02 lambdafan joined
04:04 Tertiary joined
04:04 uglyfigurine joined
04:06 jlael joined
04:07 Sose joined
04:08 le_frogballs joined
04:08 le_frogballs joined
04:08 vlatkoB joined
04:10 mmachenry joined
04:12 Xanather joined
04:13 afnizarnur joined
04:14 deepfire joined
04:15 raycoll joined
04:18 <dmj`> vaibhavsagar: you mean like blog.com/<date>/<name>
04:18 takle joined
04:19 whaletechho joined
04:19 <Myrl-saki> "The reason is that the semi-algorithm terminates for all typable expressions and only fails to terminate for a very small fraction of untypable expressions
04:20 <vaibhavsagar> dmj`: exactly
04:20 <Myrl-saki> Polymorphic Type Inference, p. 20
04:21 <vaibhavsagar> that's the way it works in the SSG I'm switching from
04:21 mstruebing joined
04:22 <vaibhavsagar> actually more like blog.com/yyyy/mm/dd/<name>
04:23 <vaibhavsagar> currently I'm using <date>-<name>.md for my filenames and https://github.com/vaibhavsagar/hakyll-website/blob/6010314e7dd2ba778ba4955dfdf14f3dcceb5e13/site.hs#L86-L97
04:24 Guest55029 joined
04:26 <dmj`> yea, hakyll isn’t simple
04:27 <dmj`> did you try to match on metadata
04:27 <dmj`> https://hackage.haskell.org/package/hakyll-4.9.5.1/docs/Hakyll-Core-Rules.html#v:matchMetadata
04:29 <dmj`> ah there is a metadata route, https://hackage.haskell.org/package/hakyll-4.9.5.1/docs/Hakyll-Core-Routes.html#v:metadataRoute
04:30 pera joined
04:31 <vaibhavsagar> the metadata doesn't contain the filename :(
04:32 Rodya_ joined
04:33 <dmj`> hmm, what does it contain?
04:33 <vaibhavsagar> customRoute would give me the Identifier but grabbing the Metadata from an identifier requires me to be in IO
04:34 <vaibhavsagar> just YAML frontmatter
04:34 takle joined
04:35 JoshS joined
04:36 carlosdagos joined
04:36 <dmj`> and the filename isn’t in the yaml front matter?
04:36 <vaibhavsagar> nope
04:36 <jle`> you can get the metadata without IO
04:37 jmcarthur joined
04:37 <vaibhavsagar> tell me more jle` :)
04:37 <jle`> in fact you aren't supposed to use IO get metadata
04:37 <jle`> http://hackage.haskell.org/package/hakyll-4.9.5.1/docs/Hakyll-Core-Metadata.html
04:37 <vaibhavsagar> ah, I see
04:37 <vaibhavsagar> but I can't do it within a pure function
04:38 <jle`> you're trying to make your route, right?
04:38 Tertiary joined
04:38 filterfish joined
04:38 roboguy` joined
04:38 <dmj`> vaibhavsagar: I think you need to add both date and title to your markdown files, and then it will be in the metadata
04:39 <vaibhavsagar> jle`: yes
04:39 <vaibhavsagar> dmj`: this is what I meant by a 'slug' field
04:39 <jle`> vaibhavsagar: can you use metadataRoute?
04:39 <vaibhavsagar> jle`: that doesn't contain the filename
04:39 <jle`> for my blog it uses slug first and filename if it doesn't have one
04:39 <jle`> vaibhavsagar: you can compose routes
04:40 <jle`> using composeRoutes
04:40 <dmj`> jle`: I didn’t know your blog was hakyll, thought it was homegrown
04:40 <vaibhavsagar> I'm trying to replicate my Pelican setup
04:40 <jle`> nah its hakyll :) i made a whole blog post abotu the transition
04:40 <vaibhavsagar> so I already have a cleanUrls route
04:40 <jle`> actually you don't even need to use composeRoutes
04:41 <jle`> metadataRoute :: (Metadata -> Routes) -> Routes
04:41 <dmj`> jle`: ah yes, I vaguely remember
04:41 louispan joined
04:41 <jle`> vaibhavsagar: so you can check the metadata, and use the title to make your route
04:41 <dmj`> https://blog.jle.im/entry/blog-rewrite-with-hakyll-and-purescript.html
04:41 <dmj`> so when is the ghcjs rewrite?
04:41 <dmj`> ;)
04:42 <vaibhavsagar> jle`: I want the filename though
04:42 Ferdirand joined
04:42 Jeanne-Kamikaze joined
04:42 <jle`> you can think of "route" as (FilePath -> ...)
04:42 <jle`> a Route has access to the filepath
04:42 <dmj`> vaibhavsagar: so you’re assuming that filename won’t be accessible because you need IO to fetch it
04:43 <jle`> i mean, look at 'setExtesion :: String -> Route'
04:43 <vaibhavsagar> dmj`: no, I can get that with customRoute
04:44 <vaibhavsagar> jle`: I think I understand about "route"
04:44 <jle`> you can use gsubRoute
04:45 <jle`> to manipulate the filepath arbitrarily
04:45 <vaibhavsagar> and I do currently
04:45 <jle`> you can use gsubRoute w/ metadata route, and then you have access to both the filepath and to the metadata
04:46 <jle`> metadataRoute (\md -> gsubRoute (something) (something involvimg metadata))
04:46 <vaibhavsagar> hmm, that makes sense
04:46 <vaibhavsagar> then that becomes a composeRoute?
04:46 <jle`> this way you don't need composeRoute, unless you want to compose the gsubRoute
04:46 sellout- joined
04:47 <vaibhavsagar> cool, I will try that, thanks!
04:47 takle joined
04:49 <jle`> no problem! my blog is open source at https://github.com/mstksg/blog btw if you ever wanted to peek
04:49 <jle`> when iwas making it i actualy transitioned from a different system so i had to put in some work to make everything match up
04:49 robotroll joined
04:49 <jle`> so it might be a good example of twisting hakyll past its comfort zone, heh
04:50 Swizec joined
04:51 <vaibhavsagar> yeah, I feel like that's what I'm trying to do here
04:51 baldrick1 joined
04:52 jhrcek joined
04:52 <vaibhavsagar> my dream is to swap my Pelican blog over to it and have all the links still work
04:52 <vaibhavsagar> preferably with minimal post edits
04:53 BartAdv joined
04:55 nshepper1 joined
04:59 takle joined
05:02 filterfish_ joined
05:02 plutoniix joined
05:03 <jle`> i almost got it perfect for me, except for the fact that github pages serves the wrong mime types for some of my files
05:05 peterhil` joined
05:05 ultalbot joined
05:05 nakal joined
05:06 burp_ joined
05:06 stig_ joined
05:06 houli_ joined
05:06 AlainODea_ joined
05:06 metalrain_ joined
05:06 feepo_ joined
05:06 dec0n joined
05:06 hansihe_ joined
05:06 yminsky_ joined
05:07 rizary_ joined
05:07 darjeeling_ joined
05:07 esssing joined
05:07 makufiru_ joined
05:07 ggherdov_ joined
05:07 peteretep_ joined
05:07 nbouscal_ joined
05:07 Dunearhp joined
05:07 trig-ger_ joined
05:08 ichor joined
05:08 pelegreno__ joined
05:08 kadoban joined
05:08 FrankZappa_ joined
05:08 zmanian___ joined
05:08 fakenerd_ joined
05:08 bjarki joined
05:09 Scorchin_ joined
05:09 youmu_ joined
05:09 chindy_ joined
05:09 otto_s joined
05:09 drtop joined
05:09 Gredu_ joined
05:09 tlevine_ joined
05:09 supki_ joined
05:09 Vivek_ joined
05:09 jrkp joined
05:09 zerokarm1left joined
05:09 mmarusea1ph2 joined
05:09 meck_ joined
05:09 tjt__ joined
05:09 lokydor_ joined
05:09 MitchellSalad_ joined
05:09 jmnoz_ joined
05:09 worch_ joined
05:10 CodeKiwi joined
05:10 valdyn_ joined
05:10 jophish_ joined
05:10 xall joined
05:10 jgt joined
05:11 Natch_n joined
05:11 padre_angolano_ joined
05:12 kolmodin_ joined
05:12 stefan-__ joined
05:12 x1n4u- joined
05:12 jdt- joined
05:12 CoderPuppy joined
05:12 afldcr_ joined
05:12 pmade- joined
05:12 niklasb_ joined
05:12 azahi joined
05:12 HappyEnte joined
05:12 sbrg_ joined
05:12 snsapiens joined
05:12 mw_ joined
05:13 keb joined
05:13 Arguggi_ joined
05:13 codolio joined
05:13 MK_FG joined
05:13 MK_FG joined
05:13 Chobbes_ joined
05:13 chirpsal1 joined
05:14 takle joined
05:14 theorbtwo joined
05:15 space-marmot joined
05:15 Fairy joined
05:15 acro joined
05:16 Geekingfrog joined
05:16 Deaddy joined
05:17 Supersonic112 joined
05:18 codedmart joined
05:19 youmu_ joined
05:19 zariuq joined
05:20 wedens joined
05:20 esph joined
05:20 gspia joined
05:20 petermw joined
05:20 voidrays joined
05:20 Aidan[m] joined
05:20 NopeMarker[m] joined
05:21 Philonous joined
05:21 fnurglewitz joined
05:21 mou joined
05:21 jokester joined
05:21 alecbrick joined
05:21 kus_ubuntui686 joined
05:21 QRealm joined
05:21 mzf joined
05:21 majoh joined
05:21 vishesh joined
05:21 Jesin joined
05:21 M-Illandan joined
05:21 chef_excellence[ joined
05:21 FederalRick[m] joined
05:21 _kit_ joined
05:21 rakete joined
05:21 rdesfo[m] joined
05:21 KaneTW joined
05:22 diamat joined
05:22 kefin_ joined
05:22 unclechu joined
05:22 bananagram joined
05:22 justanotheruser joined
05:22 SaidinWoT joined
05:25 _6a68 joined
05:26 insitu joined
05:30 Sose joined
05:32 danvet joined
05:32 pdgwien joined
05:33 peterbecich joined
05:33 Kuros joined
05:34 louispan joined
05:34 madgoat joined
05:34 madgoat left
05:35 takle joined
05:36 yellowj joined
05:39 uglyfigurine joined
05:40 Kuros joined
05:44 mstruebing joined
05:47 brynedwardz joined
05:48 takle joined
05:48 ThomasLocke joined
05:50 freusque joined
05:51 xtreak joined
05:53 xtreak joined
05:55 fre joined
05:56 Levex joined
05:57 meandi_2 joined
05:58 xall_ joined
05:58 shesek joined
05:58 Sebastian__ joined
06:00 osa1 joined
06:00 osa1 joined
06:00 BartAdv joined
06:01 juhp joined
06:02 _sras_ joined
06:02 xinming joined
06:03 connrs joined
06:04 abrick joined
06:04 insitu joined
06:05 Itkovian joined
06:05 ogrady joined
06:05 takle joined
06:06 hurkan joined
06:07 Itkovian joined
06:07 xall_ joined
06:07 raichoo joined
06:08 xall joined
06:12 eacameron joined
06:15 dni joined
06:15 nick_h joined
06:16 <_sras_> Does Stack caches packages. I have an extra dep that uses a git url. I cannot get stack to use the latest commit.
06:16 MoALTz joined
06:16 kritzcreek_ joined
06:17 <ezyang> _sras_: Stack caches the package index
06:17 Ferdirand joined
06:17 <ezyang> not sure about git
06:17 <_sras_> ezyang: I changed the git url to some bogus url, and stack builds just fine.
06:18 <MarcelineVQ> in my experience stack is over-eager about rebuilding sources from git, if anything
06:18 <MarcelineVQ> _sras_: what does your stack.yaml look like, and which commit are you trying to use?
06:19 thoradam joined
06:20 <_sras_> MarcelineVQ: http://lpaste.net/4925618887627636736 , please look at line 40. That is an invalid url
06:20 balor joined
06:20 <_sras_> MarcelineVQ: But stack clean and stack build works fine
06:21 free_beard joined
06:21 louispan joined
06:21 <MarcelineVQ> hmm, you should get an http exception
06:22 <MarcelineVQ> What version of stack do you have?
06:23 Reisen joined
06:23 Levex joined
06:24 jgertm_ joined
06:24 <_sras_> MarcelineVQ: Version 1.3.2, Git revision 3f675146590da4f3edf768b89355f798229da2a5 (4395 commits) x86_64 hpack-0.15.0
06:24 <MarcelineVQ> hmm that's reasonabnly new, though there is newer. backing up a step though, what did your stack.yaml look like for this problem: "I have an extra dep that uses a git url. I cannot get stack to use the latest commit."
06:26 <_sras_> MarcelineVQ: Not quite following you...
06:27 zeroed joined
06:27 zeroed joined
06:28 ner0x652 joined
06:28 Edith joined
06:28 <cocreature> _sras_: paste your stack.yaml :)
06:28 <cocreature> oh you already have
06:28 <cocreature> nvm
06:29 <MarcelineVQ> I must be misunderstanding then, it seemed like you were having two problems, so I was asking about the first
06:30 jake__ joined
06:31 mbuf joined
06:31 mmachenry joined
06:32 <cocreature> _sras_: upgrading stack to see if the issue disappears is probably not a bad idea
06:32 <MarcelineVQ> all I can reccomend is to delete the downloaded folder in .stack-work/
06:32 des_ joined
06:33 <MarcelineVQ> or you can use stack clean --full and it'll nuke the whole .stack-work
06:33 <MarcelineVQ> That is assuming you have some old zip downloaded already, since you should be getting an error with the url you specified
06:34 <_sras_> MarcelineVQ: That does not work too. It seems that it has stored the original url somewhere....
06:36 <MarcelineVQ> that's really quite suspicious
06:37 carlosdagos joined
06:38 <MarcelineVQ> what package is the zip providing?
06:38 dni joined
06:38 balor joined
06:39 alfredo joined
06:41 <MarcelineVQ> it'
06:41 teggi joined
06:42 e_svedang joined
06:42 eacameron joined
06:43 Ssunday joined
06:44 balor joined
06:45 <Ssunday> I'm trying to use Data.Sequence but ghc is complaining that Data.Sequence does not export "lookup" even though it should
06:45 <Ssunday> What am I missing here?
06:46 <MarcelineVQ> What version of containers do you have?
06:46 <_sras_> MarcelineVQ: Found something. It seems that the stack is runnign from a different folder. I have moved my working directory to this location couple of days back. Stack seem to still run from the old location
06:47 <MarcelineVQ> Ssunday: if it's containers-0.5.7.1 which is likely then it doesn't export lookup
06:48 <Ssunday> How can I check/ update containers? It looks like that is the issue
06:48 louispan joined
06:48 oish joined
06:49 magthe joined
06:49 <MarcelineVQ> depends how you normally manage packages, if it's stack then you can type stack list-dependencies for a list of the specific version of packages your project is using
06:49 _gio joined
06:50 thimoteus joined
06:50 _gio left
06:50 <Cale> Use index instead
06:51 levex_ joined
06:52 <Ssunday> I've been using cabal. Is stack recommended instead?
06:52 quchen joined
06:52 <Cale> It's probably reasonable to have both installed, since you'll run into projects that use either one.
06:53 carlosdagos joined
06:53 thc202 joined
06:54 <Ssunday> Good to know thanks!
06:54 ubsan_ joined
06:54 <cocreature> Ssunday: you can use "cabal hc-pkg list" to list dependencies with cabal
06:54 ragepandemic joined
06:56 jvtbatman joined
06:56 <Ssunday> Ah I see thanks
06:56 <Ssunday> Might as well get stack anyway
06:56 <MarcelineVQ> sorry my ram died, use whatever you're comfortable with :> to use a specific version of containers in a project you'd specify it in your .cabal build depends afaik, so something like containers >= 0.5.8.2
06:56 <jvtbatman> Hi! I'm trying to install foundation on Arch via Cabal but it fails with gcc linker error. Anyone else have this problem?
06:57 <MarcelineVQ> or whichever version, that's just a random pick that has lookup
06:57 <cocreature> jvtbatman: could you show us the error and the exact command you ran?
06:58 Gurkenglas_ joined
06:58 <Cale> Ssunday: Where I'm working presently, we use nix to manage our projects. It's nice for larger things, because you can have guaranteed versions of all the system dependencies as well, rather than just Haskell deps, so deployments go more smoothly. The configuration language is a bit annoying though, and I wish it was Haskell instead.
06:58 Rodya_ joined
06:58 <Ssunday> I've never used a .cabal file so I'll have to do some reading on that
06:58 detrumi joined
06:59 <jvtbatman> I ran 'cabal install foundation' and the error is https://pastebin.com/0Br8pbWk
06:59 Mortomes|Work joined
06:59 <Ssunday> Cale: I've never heard of nix but this is just a one man project so hopefully cabal and stack should be enough
06:59 <Cale> yeah
07:00 plutoniix joined
07:00 freusque joined
07:00 <cocreature> jvtbatman: huh that looks weird. did you run cabal update before?
07:00 mszczygiel joined
07:01 plutoniix joined
07:02 <jvtbatman> Yes, I have. No luck there. Seems that foundation-0.0.4 installs fine but the foundation 5 is a dependency so I need that one...
07:02 edsko joined
07:03 jake__ joined
07:05 xtreak joined
07:05 eacameron joined
07:05 Levex joined
07:07 <Ssunday> It looks like that was the problem. Thanks for the help!
07:07 xtreak joined
07:07 <cocreature> jvtbatman: fwiw I was able to install it just fine on arch
07:07 <cocreature> jvtbatman: maybe try installing in a clean sandbox?
07:08 ventonegro joined
07:09 <jvtbatman> cocreature: It is actually a dependency for AUR elm-platform so I don't think I can sandbox it?
07:09 mzf joined
07:09 <jvtbatman> cocreature: The weird thing is I get the same error on my Antergos desktop at home...
07:10 takle joined
07:10 <cocreature> jvtbatman: tbh I wouldn’t try to install haskell packages via your system package manager. that’s usually an easy way to run into problems
07:10 Gloomy joined
07:10 Aruro joined
07:10 vlatkoB_ joined
07:11 albertid joined
07:12 <jake__> -beginner study question- I have a function sum :: [Int] -> Int sum = foldr (+) 0 which I understand. It replaces each cons in a list with the function (+) and the last value with 0. How do I expand this so this so that sum :: [(Int, Int)] -> (Int, Int) . I think it needs a lambda function to extract the fst and snd values and then apply the (+) function to each. Am I at least on the right train of thought?
07:12 <jvtbatman> cocreature: All right, same as with system wide installs with pip and npm I suppose? Any idea on how I could install elm then?
07:12 jessicah left
07:13 <cocreature> jvtbatman: the elm website seems to recommend installing via npm so I would probably try that
07:14 Nycatelos joined
07:14 TabAtkins joined
07:14 tomjaguarpawaway joined
07:15 zph joined
07:15 clog joined
07:15 reem joined
07:15 <jvtbatman> cocreature: Yeah, I got a different error message when trying that but I guess I'll try solving that instead then. Thanks for the help!
07:16 raichoo joined
07:16 <cocreature> jake__: you can split the problem in two parts: first write a function "[(Int, Int)] -> [Int]" and then use the sum function you already have
07:16 dawehner joined
07:16 wizonesolutions joined
07:16 <cocreature> jake__: oh nvm, sry I didn’t read your question properly
07:17 connrs joined
07:18 msko joined
07:18 <jake__> cocreature: the fact it's a tuple is really confusing me :/
07:18 <cocreature> jake__: so let’s say you want to implement this function using foldr
07:18 <cocreature> :t foldr
07:18 <lambdabot> Foldable t => (a -> b -> b) -> b -> t a -> b
07:18 guiben joined
07:19 <cocreature> jake__: what is "a" and "b" in your case?
07:19 zeroed joined
07:20 Salih joined
07:21 Salih joined
07:22 <jake__> cocreature: a would be a function, the (+) function and b would be an integer value, from the pair in the list
07:23 laz joined
07:23 <cocreature> jake__: no I mean what is the specific type of "a" and "b" if you want to use it to implement a function [(Int, Int)] -> [Int]
07:24 darjeeling_ joined
07:24 <jake__> :t (+)
07:24 <lambdabot> Num a => a -> a -> a
07:25 <jake__> and Int?
07:25 <cocreature> jake__: let’s step back for a moment, let’s say you implement sum :: [Int] -> Int by "sum = foldr (+) 0"
07:25 <cocreature> now look at the type signature of foldr
07:26 <cocreature> :t foldr
07:26 <lambdabot> Foldable t => (a -> b -> b) -> b -> t a -> b
07:26 <cocreature> so the first argument you are passing to it is (+)
07:26 <cocreature> in your specific case (+) has type "Int -> Int -> Int"
07:26 <cocreature> so "a -> b -> b" has to unify with "Int -> Int -> Int"
07:27 <cocreature> thereby both a and b have to be Int
07:27 <cocreature> does that make sense?
07:27 <jake__> I'm following
07:27 <cocreature> jake__: alright, now you’re trying to implement "sum :: [(Int, Int)] -> [Int]"
07:28 <cocreature> by something like foldr _somefunction _someinitialvalue
07:28 <cocreature> where somefunction and someinitialvalue are things that you still need to figure out
07:28 <cocreature> eh you want "sum :: [Int, Int)] -> (Int, Int)" sorry
07:29 takle joined
07:29 <cocreature> so foldr accepts a list of as
07:29 <cocreature> in your specific case that list has type [(Int, Int)]
07:29 <cocreature> so what does a have to be?
07:29 mattyw joined
07:30 Itkovian joined
07:31 CurryWurst joined
07:31 Netwolf joined
07:31 Netwolf joined
07:33 Croniamental joined
07:33 balor joined
07:34 <jake__> cocreature: so a has to be (Int, Int) right?
07:34 sanett joined
07:34 <cocreature> jake__: exactly!
07:34 <cocreature> jake__: alright so now we need to figure out what "b" is
07:35 <cocreature> foldr returns something of type "b" and you want your sum function to return something of type (Int, Int). so what is b?
07:35 uncertainty joined
07:36 <jake__> cocreature: so that must be (Int, Int) aswell
07:36 <* ski> idly recalls Wittgenstein's suggestion that different variable names have to stand for different things
07:37 <cocreature> jake__: right, so now you know that somefunction has to be of type "(Int, Int) -> (Int, Int) -> (Int, Int)" and someinitialvalue has to be of type "(Int, Int)"
07:37 <dysfun> ski: i hear programming errors are made when variables go on holiday
07:37 <cocreature> jake__: now try writing the function and figure out what the initial value is
07:38 <cocreature> jake__: just write it as a top-level function. if you want you can try to express it as a lambda after that
07:38 nighty-- joined
07:38 <ski> (or a function defined in a `where'/`let'-`in')
07:38 <mutsig> #haskell is so awesome. People are so helpful and open minded
07:39 <scav> opposed as to what most people like to portrait the haskell community as
07:39 <* ski> undrar stilla om mutsig har tappat en bokstav
07:39 <cocreature> ski: I have no idea what that means
07:39 <mutsig> ski: lol :)
07:39 <scav> ski hello neighbour! :)
07:39 JoshS joined
07:40 <mutsig> hej
07:40 dni joined
07:40 <ski> hejhej. det finns även #haskell.se och #haskell.scandinavian
07:41 <scav> really?
07:41 louispan joined
07:41 <scav> Legendary topic!
07:41 cicppi joined
07:42 f-a joined
07:42 deepfire joined
07:42 DataComputist joined
07:43 <f-a> I am getting this error while uploading to hackage http://paste.debian.net/plain/925840
07:43 DataComputist joined
07:43 DataComputist joined
07:43 sanett joined
07:44 <f-a> and this is the .cabal file http://ariis.it/link/repos/lentil/lentil.cabal , which seems correct to me (conditional -Werror, default off)
07:44 DataComputist joined
07:44 freusque joined
07:44 <f-a> welp, test suite too :s sorry for the noise
07:44 DataComputist joined
07:45 hurkan joined
07:45 DataComputist joined
07:45 <otulp> Rubber Duck debugging in action. :)
07:46 <f-a> hehe
07:47 jshjsh joined
07:48 <Reisen> Dumb question
07:49 <Rembane> Reisen: Shoot!
07:49 <Reisen> Inside a do block with ExceptT, if I want to ignore a failure case, how can I do so?
07:49 <Rembane> Catch it and return () ?
07:50 <Reisen> I feel so dumb, catchE it is
07:50 <Rembane> :D
07:50 <Reisen> Thanks, brain just completely crapped itself
07:50 <Rembane> No worries.
07:50 <Rembane> It does from time to time and IRC can fix this. :)
07:51 <Reisen> Very true
07:52 Ferdirand joined
07:53 <quchen> ski: Hah, Wittgenstein as a variable naming authority. I’m sure he’d have liked that.
07:54 <quchen> data Box a = Box a
07:54 <quchen> data Beetle = …
07:56 le_frogballs joined
07:56 Rainb joined
07:57 eacameron joined
07:57 takle joined
07:58 Beetny joined
08:00 uncertainty joined
08:00 sypwex joined
08:00 np356 joined
08:01 zeroed joined
08:02 takle joined
08:04 eklavya joined
08:04 dcoutts_ joined
08:05 harfangk joined
08:06 ub joined
08:06 bollu joined
08:06 Yuras joined
08:07 fizruk joined
08:11 lep-delete joined
08:12 redeemed joined
08:14 mekeor joined
08:16 <otulp> module Acme.Wittgenstein ( Box, beJustAsSloshedAsSchlegel ) where ...
08:18 <tsahyt> I decided to put my hoogle powered gtk haddock viewer on github. https://github.com/tsahyt/hdocview in case anyone cares or wants to tear my code apart.
08:18 <tsahyt> it's really just a little convenience tool for personal use but I figured someone else might want it too
08:18 cobreadmonster joined
08:19 oish joined
08:19 raichoo joined
08:19 eacameron joined
08:21 alexelcu joined
08:22 jchia_1 joined
08:24 jchia joined
08:24 oisdk joined
08:24 <quchen> tsahyt: Add screenshots!
08:24 <quchen> :-)
08:24 <quchen> (Probably *the* most important thing to do to get users.?
08:25 <quchen> s/?/)/ <- ugh
08:25 eacameron joined
08:25 np356 joined
08:26 <tsahyt> that's not a bad idea
08:26 itachi joined
08:26 <otulp> tsahyt: Thanks. I had a quick look and learned something new, which is always nice.
08:26 <tsahyt> especially since this is built with haskell-gi, the whole of which takes literally an eternity to compile
08:27 <tsahyt> otulp: I mostly learned that compiling OverloadedLabels heavy code is incredibly time consuming
08:27 <tsahyt> otulp: out of curiosity, what did you find?
08:28 tlaxkit joined
08:29 <otulp> Uhm, well. That time-consuming haskell-gi world for one. It's been a while since I had a look at GUI stuff. Nothing
08:29 <otulp> ... Nothing's ever fit quite right.
08:29 eacamero_ joined
08:30 <tsahyt> I'm still not quite sure what the best way to write GUIs in haskell is either. The gi-gtk stuff is okay to work with, FRP makes it all a bit nicer. What I'm unsure about is mostly organization. Here I pass a GUI type around most of the time to retain access to the handles I nedd
08:30 <tsahyt> need*
08:30 <tsahyt> of course I could also do this in a reader monad
08:32 sanett joined
08:32 darjeeling_ joined
08:32 mstruebing joined
08:33 marfoldi joined
08:34 mohsen_ joined
08:34 <tsahyt> quchen: screenshot added
08:35 <tsahyt> bind shall serve as the example
08:35 <otulp> Sure, but passing gui around works fine, too. I don't think anybody's getting lost in all the function parameters.
08:37 ebzzry joined
08:37 vaibhavsagar joined
08:37 <tsahyt> at this project size, yes. I'm unsure how well it scales though.
08:38 eacameron joined
08:38 <tsahyt> in fact for this particular project I'm also getting very little mileage out of using FRP
08:38 <tsahyt> but it still feels cleaner than dealing with callbacks explicitly, so there's that
08:39 <otulp> The screenshot helps immensely. All apps should have at least one.
08:40 <tsahyt> I agree. as the author you tend to forget that though, because you of course already know what it looks like
08:40 falafel joined
08:40 <tsahyt> for me this is really the one logical layout for such an application, but I suppose other people would come up with different ones
08:40 <tsahyt> UI design can be surprisingly tricky
08:40 gregman_ joined
08:41 Itkovian joined
08:41 <otulp> FRP is also one of those things I haven't quite made up my mind about. At the current complexity of hdocview I guess it serves as a fine practical introduction to using reactive-banana with gtk.
08:42 eacamero_ joined
08:42 <otulp> Oh, you could surely have made something that looked terrible. The screenshot establishes nicely that you didn't.
08:42 albertid joined
08:43 <tdammers> as far as I am concerned, GUI programming is still an unsolved problem
08:46 <tsahyt> tdammers: agreed. I think FRP is a good start though
08:47 <Jello_Raptor> Is there an ST like abstraction with support for parallelism? computations that look (and act) pure from the outside, but are implemented with mutable state and multiple threads for efficiency?
08:47 <tsahyt> otulp: thanks! I'm still looking for something that allows me to use FRP more extensively. I once did a small asteroids clone using the wires AFRP library.
08:47 <Jello_Raptor> ST doesn't look like it does parallelism :/ I can't find anything like forkIO
08:47 dni joined
08:48 <cocreature> Jello_Raptor: well how do you ensure that it’s deterministic if you can introduce race conditions via multiple threads?
08:48 eacameron joined
08:48 <cocreature> Jello_Raptor: you can probably use "par" in ST but that’s a different model of parallelism than forkIO
08:48 <otulp> All I want is a cross-platform, perfect looking, efficient GUI toolkit that lets me decouple everything from everything while being foolproof, very strongly typed and opinionated (with opinions matching my own). I mean, is that so hard?
08:49 <Jello_Raptor> cocreature: i thought "par' was just concurrency on a single thread
08:49 <tsahyt> otulp: the opinionated part might be very hard. there are a lot of opinions out there
08:49 <tdammers> tsahyt: definitely
08:49 <cocreature> Jello_Raptor: are you talking about OS threads or Haskell threads?
08:49 <cocreature> Jello_Raptor: "par" definitely parallelizes using multiple OS threads
08:49 <tsahyt> otulp: One day I want to attempt writing a GUI library in Haskell, just to explore the design space
08:50 <tsahyt> but that'd have to be a bigger project than I have time for at the moment
08:50 stef204 joined
08:50 <cocreature> I’m not sure if it uses multiple Haskell threads. it relies on sparks and I’m not sure how they interact with haskell threads
08:50 oish joined
08:50 <otulp> tsahyt: Best of luck to you. Surely someday *someone*
08:50 fre joined
08:50 <otulp> tsahyt: ... will get most things right.
08:50 <otulp> My pinky's too long, it seems.
08:51 <Jello_Raptor> cocreature: It's one of those "assuming all the laws hold, it's a provably convergent process even in the presence of race conditions" type thing
08:51 <cocreature> Jello_Raptor: if you are really sure that you’re code presents a pure interface, just use "unsafePerformIO"
08:51 <tsahyt> I actually rather like gtk, except for a few quirks. but that's also because I don't really care about other platforms.
08:51 _sg joined
08:51 <tsahyt> I suppose if you wanted that, wrapping qt into better abstractions would be an option
08:51 <cocreature> the point of ST is that you can’t present a non-pure interface using it
08:51 <cocreature> and not “trust me I know it’s pure”
08:52 <tsahyt> there's also wxwidgets which supposedly looks native on every platform, but the bindings seem to be unmaintained.
08:52 <cocreature> that’s what unsafePerformIO is for
08:52 <Jello_Raptor> cocreature: ahh, okay, interesting. The ideal case would be something where I can end up using more than one CPU while living inside an ST monad. But that makes sense, cool.
08:53 <cocreature> Jello_Raptor: if you can express your algorithm using "par" that should work I think.
08:53 <cocreature> but I don’t think "par" and mutable state interact very well
08:54 uncertainty joined
08:55 Gurkenglas_ joined
08:56 fotonzade joined
08:56 <Jello_Raptor> cocreature: *nods* yeah, that interface doesn't give you any good way to thread thing around. It sounds like I should get the guarantees I want with STM and IO, and the interface I want with unsafePerformIO.
08:58 cgfbee joined
08:58 augur joined
08:59 danvet joined
08:59 permagreen joined
08:59 Fairy joined
09:00 jgertm joined
09:35 irclogger_com joined
09:35 Topic for
09:35 <cocreature> augur: hm? what other choice do you have?
09:35 <_sras_> cocreature: The only thing is that my old path was inside a linux vm, and the new path is on my host machine, mac os, and the folder is shared with the linux vm.
09:35 <augur> * -> * -> *
09:35 <ph88^> cocreature, how can i express to consume any char except ; and then at the end a ; ?
09:35 <cocreature> augur: well that’s less general :)
09:35 <augur> i mean, i get that b doesn't need to be so constrained since we never try to take an argument of it
09:36 <cocreature> ph88^: noneOf is probably what you’re looking for
09:36 <augur> im just curious what the use cases are that motivate this
09:36 <cocreature> augur: iirc I’ve used it with DataKinds at some point
09:36 <augur> interesting!
09:36 <ph88^> ok
09:39 cpup joined
09:40 <tsahyt> Aruro: why did you need the sugar for (>>) to begin with?
09:41 <tsahyt> I suppose for use in do notation?
09:41 fendor joined
09:43 <jake__> cocreature: Hey, I'm still working on the same problem. I managed to solve it recursively, but I can figure out how to do it using foldr & or lambda functions. I think i'll just do some more study into this area, i'm having a lot of trouble wrapping my head around the concepts. I just wanted to say thanks for your help earlier :)
09:43 <tsahyt> I wonder whether this would also be possible by abusing Const and ApplicativeDo
09:43 <jake__> *can't
09:43 <tsahyt> but I guess not
09:44 <cocreature> jake__: what kind of problems did you ran into while writing "f :: (Int, Int) -> (Int, Int) -> (Int, Int)"?
09:44 <cocreature> jake__: if you want I can ofc show you the solution but usually you learn more if you come up with it yourself :)
09:44 Booba joined
09:45 <lpaste> Booba pasted “LimitedHangman.hs” at http://lpaste.net/354266
09:46 afnizarnur joined
09:46 <Booba> ertes: Hello! I'd struggled a bit with maybies and monoids and finally figured it out, I guess. Mind taking a look and giving your opinion? http://lpaste.net/354266
09:46 Brando753-o_O_o joined
09:46 Wizek joined
09:47 ragepandemic joined
09:47 bennofs joined
09:47 Wizek_ joined
09:48 Blkt joined
09:49 <jake__> cocreature: even getting started on it, I couldn't really figure out where to begin. I would start on a solution, and then realize I was solving it recursively, and start again. Also knowing the types everything needed to be didn't help much as I couldn't figure out how to write a function that actually expresses those types.
09:49 dni joined
09:51 <cocreature> jake__: alright, let me just show you the solution http://lpaste.net/354267
09:51 <cocreature> jake__: feel free to ask if you have trouble understanding what this function does
09:52 <jake__> cocreature: I swear I did this!!! GHCI was chuckin errors at me! :P What are the commas after the x?
09:52 <ski> pairs
09:52 <cocreature> jake__: (x, y) is a tuple of two elements with the elements being x and y
09:52 <cocreature> :t (1, "hi")
09:52 <lambdabot> Num t => (t, [Char])
09:52 <* ski> . o O ( components )
09:52 <cocreature> :t (True, "hi")
09:53 <lambdabot> (Bool, [Char])
09:53 bollu joined
09:53 etehtsea joined
09:53 drdo joined
09:54 <jake__> cocreature: Not the commas, the x' sorry. Inverted comma? Apostrophe?
09:54 <cocreature> jake__: oh x' is just a variable name like any other
09:54 <ski> that's part of the variable name
09:54 <cocreature> jake__: call it "z" or "foobar" or whatever you like :)
09:54 <ski> by convention, adding an apostrophe means roughly "a variant"
09:54 drdo joined
09:55 <jake__> cocreature: whaaat... I did that and it wouldn't work
09:55 <cocreature> jake__: it’s hard to tell you what you did wrong without seeing the code :)
09:55 <bollu> is there a maintained implementation of miniKraken for haskell?
09:56 drdo joined
09:56 <jake__> cocreature: I understand. It's reassuring that i'm not going insane and that i'm on the right theoretical track :P I'll have another try, thanks
09:58 locallycompact joined
09:58 afnizarnur joined
09:59 fizruk joined
09:59 <jake__> cocreature: IT WORKS. MY CODE WORKS :'( I spent so long on it and i had it right at the beginning. I must have had a typo or something... I was reading the ghci errors and didn't see anything indicating typos. Thank you so much for helping hahaha :)
09:59 Ch3ck_ joined
09:59 <cocreature> jake__: I’m happy, you got it working :)
10:01 drdo joined
10:01 locallycompact joined
10:03 locallycompact joined
10:07 hive-mind joined
10:09 jhrcek_ joined
10:09 fizruk joined
10:10 kosorith joined
10:13 jluttine joined
10:15 TCZ joined
10:16 <peddie> bollu: if you mean miniKanren, then I don't think there is, I looked around a few months ago
10:17 <cocreature> peddie: heh, I first thought it was a typo as well, but it looks like minikraken is actually a thing as well :)
10:18 <peddie> oooops, sorry :)
10:18 <cocreature> although maybe it was a typo and that’s just a coincidence :)
10:19 <peddie> cocreature: the BLAST program?
10:19 <cocreature> peddie: it looked like something related to DNA processing but I didn’t really look into it
10:20 <peddie> got it! well, bollu, I don't know of any miniKraken implementations in Haskell either ;)
10:21 <vaibhavsagar> bollu: this looks like the least unmaintained one https://github.com/sergv/hkanren
10:23 jchia_ joined
10:24 jchia_ left
10:24 ragepandemic joined
10:26 contiver joined
10:26 louispan joined
10:27 juhp joined
10:27 carlosdagos joined
10:27 araujo joined
10:29 emilijus2 joined
10:29 coot joined
10:31 vektorweg1 joined
10:32 etehtsea joined
10:33 danza joined
10:36 merijn joined
10:36 zoran119 joined
10:36 jlael_ joined
10:40 theelous3 joined
10:41 Kundry_Wag joined
10:41 cyborg-one joined
10:41 Einwq joined
10:41 Kundry_Wag joined
10:44 sphere joined
10:47 uncertainty joined
10:50 HugoDaniel joined
10:50 <HugoDaniel> hello
10:50 JuanDaugherty joined
10:50 <HugoDaniel> i was asked to give a 2h workshop on begining haskell, any advice from the pros ?
10:51 <JuanDaugherty> get paid first
10:52 yoneda joined
10:52 Yuras joined
10:52 <bollu> peddie: yes, I did mean miniKanren :)
10:52 <bollu> peddie: brain chose to fill it in as "Kraken"
10:53 doomlord joined
10:54 augur joined
10:54 doomlord joined
10:55 byte512 joined
10:56 np356 joined
10:58 Aruro joined
10:59 buoto joined
11:00 cpennington joined
11:02 przembot joined
11:03 <ertes> Booba: on a first glance that looks fine
11:04 mmhat joined
11:04 <liste> minikraken sounds cute
11:05 <tdammers> (V) ;,,; (V)
11:05 <tdammers> zoidberg agrees
11:06 Wamanuz joined
11:08 etehtsea joined
11:10 <tsahyt> TIL logic programming with proper types is already a thing
11:10 <tsahyt> well there goes another phd thesis idea
11:10 <tsahyt> not that it was a serious idea to begin with, but still. this is interesting though
11:10 <* ski> . o O ( Mercury )
11:13 xall joined
11:14 xtreak joined
11:15 MindlessDrone joined
11:15 insitu joined
11:15 eacameron joined
11:18 dawehner joined
11:19 teggi joined
11:20 etehtsea joined
11:21 eacameron joined
11:21 fizbin joined
11:21 phaji joined
11:22 <JuanDaugherty> tsahyt, y, higher order ones even
11:23 skeuomorf joined
11:24 <{AS}> Is there a monadic version of traverse that also joins?
11:25 etehtsea joined
11:26 Wamanuz joined
11:26 <{AS}> i.e. (a -> f (t b)) -> t a -> f (t b)
11:28 exferenceBot joined
11:28 <tsahyt> JuanDaugherty: do you have a link perhaps?
11:28 abhiroop joined
11:29 <abhiroop> does anybody have experience with the optparse-applicative library?
11:29 govg joined
11:30 <JuanDaugherty> tsahyt, http://teyjus.cs.umn.edu/
11:31 mmn80 joined
11:31 <hpc> abhiroop: are you having some particular problem with it?
11:31 <JuanDaugherty> (e.g. there are others)
11:31 np356 joined
11:31 SimpleL joined
11:31 <abhiroop> hpc: yes I was wondering if its possible to parse a list of filepath using it?
11:32 <hpc> should be quite possible
11:33 <hpc> i would expect you would need to do something like make an argument you can pass multiple times (like grep's -e) or parse a comma-separated value
11:34 <tsahyt> JuanDaugherty: thanks
11:34 xenog joined
11:35 <JuanDaugherty> np
11:35 <abhiroop> hpc: currently my single file parser looks like this http://lpaste.net/354269
11:36 Levex joined
11:36 jathan joined
11:36 <abhiroop> I was wondering if I can modify this to include multiple files
11:36 mzf joined
11:36 sh0rug0ru joined
11:39 rubenz joined
11:39 takle joined
11:39 <brynedwards> abhiroop: maybe http://lpaste.net/354269
11:39 tirez joined
11:39 <rubenz> how come the Haskell Platform on Ubuntu is GHC 7.10.3 instead of GHC 8 ?
11:40 armyriad joined
11:40 <xenog> I would like to know if there is a way to know whether a thread has died knowing only its ThreadId.
11:41 <merijn> xenog: Make the thread signal an MVar/TVar/whatever upon exit?
11:41 <xenog> By thread I mean a lightweight thread created with forkIO.
11:41 <hpc> abhiroop: a rather lazy solution would be to replace strOption with option auto
11:41 <cocreature> :t threadStatus
11:41 <lambdabot> error: Variable not in scope: threadStatus
11:41 <ertes> xenog: use the 'async' library
11:41 <hpc> abhiroop: which would use the Read instance for [FilePath]
11:42 <JuanDaugherty> rubenz, b/c ubuntu don't give a shit?
11:42 <cocreature> xenog: threadStatus might be what you’re looking for
11:42 stephAne_ joined
11:42 <cocreature> xenog: it’s in GHC.Conc
11:42 <xenog> @merijn, yes, I know that. @ertes, I also know about the async library. Perhaps threadStatus is what I need.
11:42 <lambdabot> Unknown command, try @list
11:42 <hpc> abhiroop: the first thing i might try is writing a value of type ReadM [String] that just splits on ',' though
11:42 <hpc> and passing that to option instead
11:42 <xenog> @cocreature, thank you. That I think will help me solve my problem.
11:42 <lambdabot> Unknown command, try @list
11:43 <abhiroop> The solution which brynedwards : gave seems correct too
11:43 <abhiroop> http://lpaste.net/354269
11:43 <xenog> Damn, this is IRC, I don't have to prefix names with '@'.
11:43 <ertes> xenog: if this is really the only thing you care about, then yes, but as soon as you need things like clean exits, use async
11:44 <brynedwards> I think with my code you would have to do `:main --file <file1> --file <file2>` etc.
11:44 sh0rug0ru joined
11:44 <Booba> ertes: so if I would want to make a LimitedHangman game, should I expose Hangman constructors? I mean, once I have a constructred Hangman game, there is no way I can run it. Only hangmanStdio can run it.
11:44 <ertes> xenog: i would use async even in this case, because importing GHC.* modules makes me feel dirty =)
11:44 <JuanDaugherty> also hp changed structure which likely creates additional work for ubuntu
11:44 <Booba> ertes: Note: I'm trying to build LimitedHangman in a separate module
11:45 <xenog> ertes, I am writing a tiny library for Erlang-style actors. It has to deal with keeping mailboxes automatically for any thread on the system for which it may make sense.
11:45 <ertes> Booba: is there a reason for Hangman to be opaque in your opinion?
11:45 <hpc> abhiroop: oh that's probably better - forgot about Alternative
11:45 <ertes> xenog: single-process?
11:45 danthemyth joined
11:45 <xenog> It's meant to just work and not require any setup. That's why I need to know about threads that aren't longer available. I wouldn't want to keep mailboxes forever.
11:45 dawehner_ joined
11:46 <stephAne_> HI, i need to apply (f1,f2) to a value (a1,a2). I can define a local function that does this or lambda like \(f,f') (a,a') -> (f a, f' a'), it's not that complicated. But I wanted to know if there's not a more direct/elegant/haskellish way to do it.
11:46 <xenog> ertes, yes, single OS process, multiple lightweight or OS threads.
11:46 <merijn> stephAne_: bimap?
11:46 <merijn> :t bimap
11:46 <lambdabot> Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d
11:46 <Booba> ertes: none that I can see right now.
11:46 <stephAne_> perfect, that's what I kind of remembered
11:46 <rubenz> JuanDaugherty, they should warn you about that somewhere so you dont install it
11:46 <stephAne_> bimap
11:46 HugoDaniel joined
11:47 <ertes> Booba: that's correct, Hangman is correct by construction
11:47 <merijn> stephAne_: There's also the cryptic stuff from Arrow, but I would prefer Bifunctor over arrows for this
11:47 sh0rug0ru joined
11:47 <xenog> ertes, I will force users to start/stop processes using provided functions, although they will very well be encouraged to manage them using an OTP-style supervisor library.
11:47 <ertes> Booba: there are no special invariants
11:47 contiver joined
11:48 <xenog> When I mean processes in the last message I mean light threads.
11:48 <xenog> s/mean/said/
11:48 <Booba> ertes: ok, got it. About LimitedHangman. Is it ok to assert that its shape could conform the Hangmans shape? In a sense: representation + next steps
11:49 <Booba> ertes: I can reuse representation of Hngman an define my orn next steps on top of Hangman steps
11:49 stef204 joined
11:49 Yuras joined
11:49 <ertes> Booba: sorry, i don't know what you mean
11:49 <ertes> Booba: ah, the thing that LimitedHangman introduces is a "lost" state
11:50 sh0rug0ru joined
11:50 <ertes> xenog: well, go ahead, although i think there are already a few unused actor model libraries on hackage =)
11:50 <Booba> ertes: yes, LimitedHangman has 'brand new' Lost state and some sort of analogy to Guess - a running game that is a composition over Hangman game
11:51 dni joined
11:51 Qommand0r joined
11:52 sh0rug0ru joined
11:52 <xenog> ertes, I haven't found exactly what I'm looking for. I didn't look much though. I may end up using the existing supervisor library. Cloud Haskell is too much.
11:52 novakboskov joined
11:53 <novakboskov> I have a little problem with stack build tool
11:53 groscoe joined
11:53 <ertes> xenog: i guess my question is why you need a supervisor library in the first place… i can't imagine many scenarios where the "withAsync" pattern isn't enough
11:53 <novakboskov> It this right place for a little question about stack?
11:54 <xenog> ertes, I'm writing a peer-to-peer application.
11:54 <ertes> xenog: and when it really isn't enough, there is the 'resourcet' library
11:54 <brynedwards> novakboskov: what's the question?
11:55 <xenog> ertes, managing many peers as well as some processes that handle state can become a bit annoying with just async. This is yet another iteration where I'm trying an Erlang-like approach to the problem.
11:55 sepp2k joined
11:56 <xenog> I have tried various approaches already. None of them have been satisfactory.
11:56 <ertes> xenog: in a P2P application i would most likely just fire up threads and let them handle themselves
11:56 iputra joined
11:56 iputra left
11:56 <novakboskov> brynedwards: I've made a new project with stack new my-project and done stack setup then tried to stack build and got a weired error that says: In the dependencies for some-completely-unrelated-project ....
11:56 <ertes> xenog: if they die, they die… as long as they clean up properly, that's fine
11:57 <xenog> ertes, I kind of want to separate the logic that deals with threads dying and how to recover from that.
11:57 bennofs joined
11:57 doomlord joined
11:57 <brynedwards> novakboskov: maybe paste the full error here http://lpaste.net/
11:58 xall joined
11:58 <ertes> xenog: well, haskell does support erlang-style concurrency patterns, so go ahead… just keep in mind that haskell actually supports many more patterns
11:58 <ertes> xenog: for example with STM there is often little reason to be really aware of which threads are running
11:59 binaryplease1 joined
11:59 <novakboskov> brynedwards: http://lpaste.net/354270
11:59 <xenog> ertes, yes, I have tried using the withAsync system and asynchronous actors communicating with channels, but the way I was doing it was ugly since I wasn't abstracting the actor management enough. I tried to combine this approach then with STM and no mailboxes, but I have a hard time reasoning about my code now. So the Erlang pattern is what I'll try now.
12:01 <xenog> ertes, STM worked well when I had copy-cat threads all using the same state. When different thread code used the same STM variables, I started encountering unpleasantness.
12:01 coot joined
12:01 <xenog> ertes, I expect in the end use a combination of various techniques.
12:01 xtreak joined
12:02 <xenog> The idea always being that I want the code to be very easy to maintain and reason about, and obviously correct.
12:02 <brynedwards> novakboskov: You'll need to either change your week5.cabal file to allow a newer dependency for containers or use an older stackage snapshot
12:03 <xenog> The Erlang style of communicating processes (threads) allows for quite compartmentalized code free of defensive exception management structures.
12:04 <xenog> I don't really know if in the end I'll achieve what I'm looking for, but a priori it seems that it will make my code easier to maintain and reason about.
12:04 marr joined
12:04 <novakboskov> brynedwards: I've done so. This is the week5.cabal http://lpaste.net/3465455935428755456
12:04 <ertes> xenog: well, of course all threads using the same STM state need to assume the same invariants, and there is a really easy way to achieve that: write a separate module with "allowed transactions"
12:05 <brynedwards> novakboskov: maybe try `stack clean --full && stack build`
12:06 <xenog> ertes, that's an interesting idea. Would you elaborate?
12:06 <brynedwards> novakboskov: another possible solution is, in stack.yaml, change `resolver: lts-X.X` to `resolver: lts-6.30`
12:07 <ertes> xenog: that's pretty much it
12:07 <novakboskov> brynedwards: No change... And why is week5 relevant for a totally unrelated project?
12:07 <brynedwards> novakboskov: I'm afraid I don't know, sorry
12:07 xall joined
12:08 <lyxia> novakboskov: what is in your stack.yaml
12:09 <novakboskov> lyxia: of what project?
12:09 <lyxia> novakboskov: whichever one you are using
12:09 abhiroop joined
12:10 bjz joined
12:11 <novakboskov> lyxia: there is no stack.yaml only .cabal
12:11 chlong joined
12:12 <lyxia> I didn't think you could run stack build with no stack.yaml
12:12 marvin2 joined
12:14 <lyxia> novakboskov: try stack init to set up a stack.yaml file
12:15 oish joined
12:17 <novakboskov> lyxia: It looks like stack init stucks at fetching some indices... It says Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpcomplete.com/) .../home/novak/.stack/indices/Hackage/hackage-security-lock: createDirectory: already exists (File exists)
12:18 piyush-kurur joined
12:18 Arthimus joined
12:18 cyborg-one joined
12:18 nomicflux joined
12:20 <lyxia> https://github.com/commercialhaskell/stack/issues/3055 ?
12:20 jlael_ joined
12:21 sdothum joined
12:21 danthemyth joined
12:22 cpup joined
12:24 <novakboskov> lyxia: Yup, it's it... I've manually deleted that lock and everything is fine again. I haven't seen that error message... My fault... Thanks
12:24 HoierM joined
12:25 CurryWurst_ joined
12:27 aarvar joined
12:27 mrijkeboer joined
12:29 mohsen_ joined
12:30 np356 joined
12:30 MindlessDrone joined
12:30 mekeor joined
12:30 carlosda1 joined
12:34 louispan joined
12:35 <Booba> ertes: I ended up having something like this:
12:35 <lpaste> Booba pasted “LimitedHangman.hs” at http://lpaste.net/354272
12:35 eacameron joined
12:35 <Booba> ertes: Am I at least moving in the right direction?
12:35 takle joined
12:35 augur joined
12:36 <Booba> ertes: Am I supposed to figure out this types properties (Monoid, Monad, Applicative, etc) at this point, or earlier, or later when more features arrive?
12:39 CountryNerd joined
12:43 _sg joined
12:43 <ertes> Booba: yeah, looks reasonable
12:44 AndroUser joined
12:44 <ertes> Booba: not sure about your last question… i figured those structures out as i read docs, as i read code and as others made me aware of them
12:45 <Booba> ertes: that helps =)
12:45 eacameron joined
12:46 presiden joined
12:47 Rainb joined
12:47 AndroUser joined
12:48 <Booba> ertes: is it okay that `run` function is not part of the datatype as opposed to original Hangman?
12:48 mauke joined
12:48 <Booba> ertes: I ask this in scope of a large team project. Does it follow any code styles/conventions set be the original Hangman?
12:49 augur joined
12:49 <Booba> ertes: IOW, if I would extend your Hangman game this way, and you were my codereviewer, will it pass?
12:50 le_frogballs joined
12:50 IRCFrEAK joined
12:52 IRCFrEAK left
12:52 dni joined
12:56 Wuzzy joined
12:56 <ertes> Booba: well, i would have renamed the 'run' function, perhaps to 'move' or 'guess'
12:56 <ertes> other than that it looks reasonable to me
12:57 <ertes> Booba: in fact you recently mentioned the idea of a type class to abstract over things that support "moves"
12:57 <piyush-kurur> alanz: ping
12:57 <ertes> that's probably the approach i would have taken
12:58 jhrcek_ joined
12:58 <alanz> piyush-kurur: pong
12:58 <Booba> ertes: Thanks! That's really helpful.
12:58 Hz joined
12:59 <ertes> Booba: the idea being that you can abstract over this class
12:59 <ertes> Booba: for example you could write a generic bot that tries to beat games that support "moves"
13:00 <lpaste> Booba pasted “LimitedHangman.hs” at http://lpaste.net/354273
13:00 <Booba> ertes: ^ And another option
13:00 scottj joined
13:00 <piyush-kurur> alanz: to handle the -no-pie problem what exactly should be done?
13:00 My_Hearing joined
13:00 <Booba> ertes: I incorporated `move` into datatype and made a smart constructor for it
13:01 mda1 joined
13:01 <ertes> Booba: if you're going to do it that way, you shouldn't expose the Hangman itself
13:01 <ertes> because now you have redundancy
13:01 <ertes> you should only expose the challenge and the move function
13:02 <ertes> and the number of guesses left
13:02 eacameron joined
13:03 <alanz> piyush-kurur: probably best to delete ~/.stack/programs directory, then run stack setup
13:03 ericsagnes joined
13:03 <piyush-kurur> alanz: let me try.
13:03 <ertes> Booba: in fact i like this approach better, because it's closer to the idea of exposing a safe abstraction from the start… this version, once you have eliminated the redundancy, does not assume any invariants that the data type itself doesn't already enforce
13:04 <alanz> It will rebuild the lts into a new subdirectory with nopie in the name
13:04 jlouis joined
13:04 <piyush-kurur> alanz: I hope it is sufficient to just get rid of 7.10.*
13:05 <alanz> liquidhaskell works only with 7.10, so yes
13:05 <Booba> ertes: I'm not sure I understand: I do not expose Hangman from LimitedHangam. You have to construct the game yourself oand pass it to `limited` function.
13:05 <Booba> ertes: limitedHangmanStdio_ $ limited 5 $ fromString "Hello World"
13:05 <alanz> piyush-kurur: but if you are getting linker issues with that one, you may be getting them with others too.
13:06 <alanz> And I just realised there may be another issue affecting this. Let me know how that works first
13:07 <alanz> piyush-kurur: you may need to do this too: https://github.com/commercialhaskell/stack/issues/3072
13:07 <piyush-kurur> alanz: No I do not seem to have problems with 8.*
13:07 <piyush-kurur> I mean ghc-version-8.*
13:07 <piyush-kurur> With stack < 7 the ghc-version becomes 7.10 I guess then all hell breaks loose
13:08 carlosdagos joined
13:08 <ertes> Booba: you see, in Hangman the actual state of the game is completely encapsulated in 'singleton' and 'mappend'
13:08 <alanz> ok. But liquidhaskell specifically uses that lts version, as it needs GHC 7.10
13:08 <ertes> Booba: you can do the same with LimitedHangman… there is no reason to expose the Hangman game
13:09 <Booba> ertes: or you're saying I should push it further and abstract over Hangman demanding that LimitedHangman only wants some representation and a `good` function to get constructed??
13:09 abhiroop joined
13:10 <ertes> Booba: consider that the type signatures of 'limited' and 'move' wouldn't change at all
13:10 edvorg joined
13:10 <Booba> ertes: more like making a LimitedGame instead?
13:10 itachi joined
13:10 <ertes> Booba: it's still Hangman, but if you actually implement the type class idea, then yes, you can use Limited for a wide variety of games
13:11 cpennington joined
13:11 <ertes> (you can already do that, but you would have to write multiple implementations of 'limited', one for each game type)
13:11 <Booba> ertes: I'll try that later. But I still can't see where redundency is in current implementation
13:12 <Booba> ertes: You're saying that Hangman should be opaque, right?
13:12 <ertes> no
13:13 Ferdirand joined
13:13 <ertes> Booba: LimitedGuess Integer [Maybe b] (a -> Maybe (LimitedHangman a b)) -- would this be limiting?
13:13 bjz_ joined
13:14 <Booba> ertes: that was my next suggestion: I can construct the limited game "from scratch", is that what you're saying?
13:14 <ertes> Booba: no, you would still reuse Hangman, but there is no reason to *expose* it once you have handed it to 'limited'
13:15 eschnett joined
13:15 <Booba> ertes: I'll give it a thought, thanks
13:15 cdg joined
13:16 infinity0 joined
13:16 HugoDaniel joined
13:16 <Booba> ertes: ok, so your suggested LimitHangman says that it has a representation and a `move` of its own. But the actual implementation would reuse the ones of Hangman, right?
13:17 <ertes> Booba: yes
13:17 connrs joined
13:17 <piyush-kurur> alanz: I remember doing this editing some time ago but do not remember where. sorry. This was when I was moving from stack-6 to stack-7. As fate would have it, at that time it was stack-7 that was giving problems.
13:18 <piyush-kurur> What I do not understand is that it seems to be fine with travis builds which are on ubuntu
13:18 <Booba> ertes: should I assert that this approach is better because it is more flexible in terms of implementation - I am free to use another game, but Hangman?
13:19 <Booba> ertes: as long as I am able to derive Nothing "state" of its?
13:19 Xanather joined
13:20 <ertes> Booba: basically you're approaching a more generic automaton-based approach step by step
13:20 <ertes> and Limited is a way to stop an automaton prematurely
13:20 contiver joined
13:20 <ertes> if it doesn't conclude within a certain number of steps
13:22 <Booba> ertes: I see. I was thinking about it this way: I am extending the Hangman game to LimitedHangman by composing over it. This I reflect in my datatype: LimitedHangman explicitly uses Hangman.
13:23 electrostat joined
13:23 <Booba> ertes: But it appears that further iterations can abstract over Hangman and make the LimitedHangman more generic, right?
13:24 <alanz> piyush-kurur: the travis vm is ubuntu 12.04 or something equally archaic
13:25 <alanz> And this is the file to edit: ~/.stack/programs/x86_64-linux/ghc-nopie-7.10.3/lib/ghc-7.10.3/settings
13:26 mizu_no_oto_work joined
13:27 <piyush-kurur> alanz: how did you get a ghc-nopie executable there. Did you compile it on your own?
13:27 <piyush-kurur> I do not seem to have any
13:28 <alanz> piyush-kurur: in the liquidhaskell directory, do "stack setup"
13:28 <alanz> or, "stack setup --resolver=ghc-7.10.3"
13:29 <ertes> Booba: you can answer that question yourself
13:29 danvet joined
13:29 mtesseract joined
13:30 ChristopherBurg joined
13:30 trism joined
13:30 uncertainty joined
13:31 carlosda1 joined
13:31 zero_byte joined
13:34 robkennedy joined
13:35 <piyush-kurur> alanz: I am getting the following errors
13:36 <piyush-kurur> in liquidhaskell directory if I do a stack setup it installs ghc-7.10.2 instead of 7.10.3 and then fails with linker error (after the change that you mentioned)
13:37 <alanz> piyush-kurur: what is the precise linker error? Maybe post it via lpaste or similar
13:37 <alanz> and 7.10.2 should be fine too
13:37 robkennedy joined
13:37 <alanz> in which case "stack setup --resolver=ghc-7.10.2"
13:38 dsh joined
13:38 burtons joined
13:39 Yuras joined
13:40 <piyush-kurur> alanz: http://lpaste.net/2636326002313134080
13:42 <alanz> piyush-kurur: that is the wrong compiler, it is not the no-pie version
13:43 meba joined
13:43 Mon_Ouie joined
13:44 <alanz> piyush-kurur: this is what you should see: http://lpaste.net/5657215890182111232
13:44 <piyush-kurur> however the 7.10.3 says a different error. It says no cabal file in liquidhaskell/liquid-fixpoint
13:45 uncertainty joined
13:45 oish joined
13:45 <piyush-kurur> alanz: I fixed the 7.10.2 issues. The liquid haskell that I had was a bit old so I cloned the latest
13:45 <piyush-kurur> but then something new comes up
13:45 <alanz> piyush-kurur: what branch are you using? develop?
13:46 binaryplease joined
13:46 <piyush-kurur> alanz: yes
13:46 ystael joined
13:46 <piyush-kurur> I mean whatever is the default branch from a git clone
13:46 <alanz> you need to make sure you do a "git submodule update --init" to get the right submodules
13:46 <piyush-kurur> okey
13:46 <piyush-kurur> sorry I did not realise there were submodules
13:47 condab joined
13:48 `^_^v joined
13:48 <piyush-kurur> okey that fixed it now gives a lot of dependency problems. Seems to not like the base version.
13:48 <alanz> piyush-kurur: you need these prerequisites too: https://github.com/ucsd-progsys/liquidhaskell/blob/develop/INSTALL.md
13:48 <alanz> z3 or equivalent
13:49 <piyush-kurur> alanz: I have the z3 from debian distro I guess that should be fine
13:49 <alanz> I am on debian testing and it works fine for me
13:49 <alanz> package libz3-dev
13:51 Maxdamantus joined
13:51 bjz joined
13:52 electrostat joined
13:54 dni joined
13:54 richi235 joined
13:54 detrumi joined
13:54 mmachenry joined
13:54 <piyush-kurur> Dependency problem on stack build (http://lpaste.net/852335151789637632)
13:54 gallais joined
13:54 mtesseract joined
13:55 mda1 joined
13:55 <Booba> ertes: Last question for today, I promise! =) Should LimitedHangman has a Won constructor of its own in your suggestion?
13:55 gallais joined
13:56 juliagoda joined
13:56 earldouglas joined
13:57 eacameron joined
13:57 <ertes> Booba: if you hide Hangman, then yes
13:59 e_svedang joined
13:59 <Booba> ertes: Got it! Thank you for your guidance a lot! I really struggled to find a nice guide on how to approach problems the haskell way on the internet.
14:00 bennofs joined
14:01 <piyush-kurur> alanz: finally things are building yaahooooo
14:01 <Aruro> can where span several definitions? would be really handy
14:01 <ertes> Booba: this is of course only one application, but it should give you a general idea of working with DSLs
14:02 <ertes> Booba: both Hangman and LimitedHangman are DSLs, and 'limited' translates from one to the other
14:03 rubenz joined
14:04 <Aruro> f1 x y = 1 + x +y**2, f2 x y = 1+2*x+y**2; i want to say f1 x y = ..+b;f2 x y = ...+b where b = y**2
14:04 <alanz> piyush-kurur: great
14:04 <piyush-kurur> alanz: I jumped around too early looks kiek I am bitten by the pic bug
14:04 <piyush-kurur> s/kiek/like
14:05 unbalancedparen joined
14:05 xall joined
14:06 unbalancedparen left
14:06 <alanz> ok
14:06 pierce__ joined
14:07 <lyxia> Aruro: no
14:08 <alanz> piyush-kurur: heads up, the liquidhaskell develop branch no longer uses the "Prop" keyword. So if the docs say "Prop v", change it to just "v"
14:08 <lyxia> Aruro: this proposal seems close to what you are looking for https://github.com/ghc-proposals/ghc-proposals/blob/context-fixes/proposals/0000-context-fixes.rst
14:08 <Sornaensis> > True <> False
14:08 <lambdabot> error:
14:08 <lambdabot> • No instance for (Monoid Bool) arising from a use of ‘<>’
14:08 <lambdabot> • In the expression: True <> False
14:08 Kreest__ joined
14:08 <Sornaensis> > True <|> False
14:08 jluttine joined
14:08 <lambdabot> error:
14:08 <lambdabot> • Couldn't match expected type ‘f a’ with actual type ‘Bool’
14:08 <lambdabot> • In the first argument of ‘(<|>)’, namely ‘True’
14:08 <Sornaensis> oh
14:08 <Aruro> lyxia: ty
14:09 <ski> > Any True <> Any False
14:09 <lambdabot> Any {getAny = True}
14:09 <ski> > All True <> All False
14:09 <lambdabot> All {getAll = False}
14:11 al-damiri joined
14:11 qzo joined
14:13 <piyush-kurur> alanz: any way thanks for your patience. It is not working as of now. I will hack it when things work out.
14:13 Noldorin joined
14:14 wraithm joined
14:14 <Aruro> lyxia: closest is generator function pattern
14:15 yellowj joined
14:17 Rodya_ joined
14:17 mtesseract joined
14:18 jungnam joined
14:18 carlomagno joined
14:19 des_ joined
14:20 schwuk joined
14:20 <tsahyt> @hoogle (a,b,c) -> (a -> b -> c)
14:20 <lambdabot> Prelude zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
14:20 <lambdabot> Data.List zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
14:20 <lambdabot> GHC.OldList zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
14:20 <tsahyt> hmpf
14:21 dfeuer joined
14:21 <tsahyt> oh that's completely wrong anyhow
14:21 WarmCookie joined
14:21 <tsahyt> @hoogle (a -> b -> c -> d) -> (a,b,c) -> d
14:21 <lambdabot> Data.Tuple.HT uncurry3 :: (a -> b -> c -> d) -> ((a, b, c) -> d)
14:21 <lambdabot> Data.Tuple.Lazy uncurry3 :: (a -> b -> c -> d) -> ((a, b, c) -> d)
14:21 <lambdabot> Data.Tuple.Strict uncurry3 :: (a -> b -> c -> d) -> ((a, b, c) -> d)
14:21 <tsahyt> that's better
14:23 JoshS joined
14:24 sea_wulf joined
14:29 lithie joined
14:30 sssilver joined
14:30 le_frogballs joined
14:32 carlosda1 joined
14:33 vengefulpickle joined
14:33 yoneda joined
14:33 sz0 joined
14:34 aglorei joined
14:34 condab joined
14:35 obadz joined
14:36 edvorg joined
14:38 condab left
14:39 romeoh joined
14:40 <tsahyt> Is there a way to surpress the warning for a specific orphan instance? I could add a pragma for the whole file, but it'd be nicer to do it on a per instance basis imo
14:41 fotonzade joined
14:42 raycoll joined
14:42 uncertainty joined
14:44 <quchen> tsahyt: I don’t think so, no
14:44 <tsahyt> okay, then I'll have to add the pragma
14:44 <quchen> I typically put my orphans into an »Orphan« module for this reason
14:45 <quchen> At least I can group *only* orphans this way
14:45 ragepandemic joined
14:45 <tsahyt> actually this instance is completely pointless to begin with
14:45 <tsahyt> I'll just do away with it altogether, it's an ugly solution here
14:46 Kundry_Wag joined
14:46 deepfire joined
14:47 marsam joined
14:47 winter_ joined
14:48 uglyfigurine joined
14:49 oisdk joined
14:50 guampa joined
14:51 yoneda joined
14:51 lifter joined
14:51 detrumi joined
14:52 coltfred joined
14:52 electrostat joined
14:55 Levex joined
14:56 danthemy_ joined
14:57 <kuribas> why doesn't haskell provide export declarations for instances?
14:57 _sras_ joined
14:58 <shapr> kuribas: huh?
14:58 nycs joined
14:58 <kuribas> like (instance Functor MyType, ...)
14:58 robotroll joined
14:58 <shapr> oh, I don't know.
14:59 <geekosaur> kuribas, instances are always exported and must be
15:00 govg joined
15:00 <geekosaur> (likewise imported)
15:00 <kuribas> must be why?
15:00 <glguy> instances are expected to be globally unqiue, they don't have names so there's no namespace pollution to worry about
15:00 des_ joined
15:01 <geekosaur> iirc the type system is inconsistent if you allow a different version of an instance in different places. (or you'd need to carefully partition data so that you can't use different instances on the same data at different times)
15:02 edvorg joined
15:03 <geekosaur> or, consider: module A has instance Foo Bar, module B has a different instance Foo Bar, module C uses both A and B and needs to use instance Foo --- which one wins? in the presence of polymorphism, it can't reliably pick one
15:03 <geekosaur> (again unless you annotate at runtime every data value with whatever instance was used with it)
15:04 electrostat joined
15:05 <geekosaur> possibly not even then as you have to worry about transfection (value A got used with value B that got associated with instance 1, does it need to be associated with instance 1 as well?)
15:06 geppettodivacin joined
15:06 Vaelatern joined
15:07 Lord_of_Life joined
15:08 Wamanuz joined
15:08 raichoo joined
15:09 <reactormonk[m]> You can get around having multiple instances by wrapping the type in a newtype - see e.g. Sum/Product for Monoid Int or the ZipList for Applicative List
15:11 Boomerang joined
15:11 jmelesky joined
15:12 <mnoonan> here's a terminology question for this maximally-biased audience: locally, people use "applicative style" to mean something akin to "pure functions only" (in a C++ codebase). Would you also make that association, or is "applicative" too overloaded?
15:13 <mnoonan> or: what would you say is the opposite of "imperative style"?
15:13 <eschnett> “declarative”?
15:13 <sm> +1
15:13 <merijn> mnoonan: Applicative means something very different in Haskell
15:13 mtesseract joined
15:13 <mnoonan> I realize, that's why this is the "maximally biased" place to ask :)
15:14 cloudhead joined
15:14 jlael joined
15:14 <mnoonan> declarative could work. it makes me think more of prolog, but still not bad
15:14 jbiesnecker joined
15:14 <merijn> I would say declarative is the opposite of imperative, yes
15:14 <merijn> Imperative == telling the computer what to *do*
15:14 `^_^v joined
15:14 <merijn> declarative == telling the computer the result you want
15:15 <Sornaensis> what does declarative mean specifically
15:15 <mnoonan> I honestly don't know where the use of "applicative style" came from here. via Tom Reps / UW indirectly, I guess.
15:16 Sh4rPEYE joined
15:17 chocopuff joined
15:17 <WarmCookie> Sornaensis: It's a programming philosophy in which you declare the desired outcome to the computer, rather than the steps to achieve the outcome. e.g. `SELECT * FROM table`.
15:17 uncertainty joined
15:17 fosskers joined
15:18 <conal> Peter Landin's seminal "The next 700 programming languages" deprecates the fuzzy terms "declarative" and "functional" in favor "denotative", which really gets to the heart of the matter for me. Some more specifics (quotes & links) here: http://conal.net/blog/posts/is-haskell-a-purely-functional-language#comment-626
15:18 <WarmCookie> Sornaensis: The idea being that the system/computer/language has an abstraction of how it should proceed to successfully get the desired outcome.
15:18 <chocopuff> that's one of the tradeoffs you get, not as much low level control as something like C would give you
15:18 mazeinmaze_ joined
15:18 <Sornaensis> what's wrong with functional though
15:18 <chocopuff> Sornaensis: it's just a style I suppose
15:19 <WarmCookie> Sornaensis: As opposed to what? Dysfunctional?
15:19 <merijn> Sornaensis: Well, not all declarative languages are functional
15:19 <chocopuff> WarmCookie: made me crack up
15:19 <Sornaensis> yea
15:19 <Sornaensis> but functional is well defined
15:19 <Sornaensis> like imperative
15:19 <merijn> conal: Well, does denotative really replace those terms?
15:19 <mnoonan> conal: thanks, 'denotative' actually seems best for the case I had in midn
15:19 <mnoonan> midn
15:19 <mnoonan> heh
15:19 <conal> Sornaensis: "functional" is not well-defined, leading to many pointless arguments.
15:19 <Sornaensis> denotative seems like a superset
15:20 <Sornaensis> how so
15:20 <merijn> conal: Actually, yeah, I suppose prolog could be denotative too
15:20 <merijn> Sornaensis: Try talking to anyone about "functional" programming
15:20 <merijn> Sornaensis: Does it mean ML like, with types? Is Scheme a functional language? Is JavaScript?
15:20 <mnoonan> "functional" feeds that silly "isn't everything a function in functional programming?" conversation
15:20 cfricke joined
15:21 <merijn> Is ocaml functional, despite not being pure?
15:21 <mnoonan> but I guess saying everything is a denotation in denotational programming isn't so bad :)
15:21 <Sornaensis> if you have first class functions you are a functional language, what's the problem with that
15:21 <xenog> Functional is not extremely well-defined, but the union of all definitions would involve functions that can be passed around as arguments to other functions.
15:21 <merijn> mnoonan: Well, wouldn't it be everything HAS a denotation, rather than *is* a denotation
15:21 <Sornaensis> is there some other definition?
15:21 _sras_ joined
15:22 <merijn> Sornaensis: Well, both Haskell and JavaScript have first class functions, yet calling those similar styles of programming seems...odd at best
15:22 <Sornaensis> huh how
15:22 simukis_ joined
15:22 Iceland_jack joined
15:22 <xenog> I would be hard-pressed to consider every language that has first-order functions a functional language though.
15:22 <merijn> Anyway, I leave that discussion up to others, I'm going home :)
15:22 <Sornaensis> k
15:23 <xenog> merijn, you can code in a very functional style with JavaScript.
15:23 <Sornaensis> the implication of functional is just that functions are data
15:23 <Sornaensis> nothing more specific
15:23 <Sornaensis> afaikl
15:24 <Sornaensis> you can even write the Y combinator directly in javascript, because javascript is typeless
15:24 Rainb joined
15:25 <conal> I guess one could reasonably argue that imperative OO languages have first class functions, just with an awkward notation.
15:25 boombanana joined
15:25 <Sornaensis> some do
15:25 <xenog> Functional-mainly languages at their core usually offer first-class functions and tail call elimination.
15:26 sumeet_ joined
15:26 <Sornaensis> you can for instance write modern C++ in a very functional style
15:26 <conal> Sornaensis: no, i mean typically -- as objects.
15:26 Mon_Ouie joined
15:26 mtesseract joined
15:26 <xenog> Oh, and anonymous functions, I almost forgot that one. If you find a language with tail call elimination, first-class functions, and a syntax for anonymous functions, then you are probably looking at a functional language.
15:27 Sh4rPEYE joined
15:27 <Sornaensis> xenog: so, C++? :P
15:27 <xenog> C++ has no tail call elimination at its core.
15:27 <xenog> I think you can do it with trampolines.
15:27 mizu_no_oto_work joined
15:27 <Sornaensis> hmm
15:27 <conal> Sornaensis: i'm pointing out that the criterion of "has first class functions" is probably not going to hold water.
15:27 HarveyPwca joined
15:27 scottj left
15:28 <xenog> But if you have to do it with constructs that aren't part of the language core, then it is not a functional language, but a language that has been beaten into shape. :P
15:28 <sumeet_> hi everyone,i am new to haskell. any tips to get started. thanks
15:28 <Sornaensis> conal: I think that's just arbitrary
15:28 steeze joined
15:28 <xenog> sumeet_, Learn You a Haskell for Great Good.
15:28 <conal> The clearest way I know to start sorting out these language classification issues is to have a precise denotation and then examine its nature.
15:28 <Sornaensis> you can't treat functions as data in java
15:28 vaibhavsagar joined
15:28 insitu joined
15:29 <xenog> Sornaensis, Java is an example of a language that has been beaten into shape, but most definitely not a functional language.
15:29 <Sornaensis> you need the ability to have anonymous functions in order to have functions as data
15:29 ixti joined
15:30 <conal> Sornaensis: why do you think so?
15:30 <Sornaensis> many languages do not support var = function(type: argument) { /*/ */ }; and they would therefore not be functional
15:30 <xenog> Java has the ability to pass around functions as first-class citizens (objects that have a single method), syntax for anonymous functions (lambdas), but it has no tail call elimination.
15:30 <Sornaensis> oh did they finally add lambdas
15:30 _sg joined
15:30 <sumeet_> thanks xenog
15:31 `^_^v joined
15:31 <conal> IIRC, Haskell's predecessor Miranda (non-strict & purely functional) didn't have anonymous functions (and didn't need them).
15:31 Itkovian joined
15:32 <xenog> conal, interesting, so then anonymous functions are not strictly necessary to get a functional language.
15:32 <xenog> That leaves first-class functions and tail call elimination, but I'm not sure of the last.
15:32 <conal> xenog: not in my book. it's the denotation, not the notation.
15:32 carlosda1 joined
15:33 serendependy joined
15:33 <conal> I'm surprised to see tail call elimination put forward as a requirement. It's an implementation notion, not a language/semantics notion.
15:33 <Sornaensis> how do you get around not having anonymous functions
15:33 <xenog> conal, I agree with that.
15:33 fendor joined
15:33 <xenog> That's why I say that I am not sure about it.
15:34 <xenog> Sornaensis, you define a function and you pass it around.
15:34 Gloomy joined
15:34 <Sornaensis> how do you define a function
15:35 <padre_angolano> conal: does haskell need anynomous functions unlike Miranda? If so, when?
15:35 <xenog> `let myFunction x = x + 1 in print (map myFunction [1..3])` is a valid functional statement without having anonymous functions.
15:35 <xenog> It's equivalent to `print (map (+1) [1..3])` and no less functional.
15:35 <Sornaensis> let is just syntax sugar for anonymous functions though
15:35 <conal> padre_angolano: i don't think haskell needs anonymous functions (lambda) any more than Miranda did. convenient, but unnecessary.
15:36 <padre_angolano> conal: ah, ok :-)
15:36 <Sornaensis> also the googling I did says that Miranda doesn't have lets either
15:36 infinity0 joined
15:36 <Sornaensis> I mean haskell is compiled into Core, where everything is transformed into anonymous functions
15:36 <xenog> I do think that JavaScript, for example, should be classified as a functional language.
15:36 sssilver joined
15:36 <bartavelle> is there something like haskeline + optparse-applicative ?
15:36 greeny joined
15:36 raycoll joined
15:36 <WarmCookie> As far as I know, you can adapt the language so that there's no anonymous functions; with the biggest implications for Applicative probably.
15:37 <xenog> Java doesn't feel like it passes though.
15:37 Wamanuz2 joined
15:37 <conal> Sornaensis: Haskell is a language, not an implementation. Core is part of one implementation.
15:38 <xenog> What's the difference between JavaScript and Java that makes the former a functional language and the latter not one?
15:38 <xenog> Perhaps being forced to program using objects makes Java not a functional language?
15:39 <bartavelle> xenog, as there is no definition of "funtional language" it is pretty hard to have a definite answer
15:39 <frontendloader> you can write either in a functional style
15:39 <frontendloader> but neither is explicitly functional
15:39 <Sornaensis> if java has higher order functions then it supports functional programming
15:39 <glguy> bartavelle: I don't know of such a thing (maybe it exists?) but I've got something like that that I use in my IRC client. you get a structured command definition, syntax highlighting, and place-holders for missing command arguments that works in a readline-like environment. It's not a separate library but might be worth looking at for inspiration
15:39 <frontendloader> javascript is usually referred to as "prototypical inheritance"
15:39 <conal> bartavelle: exactly. a factory of fruitless arguments.
15:39 <frontendloader> and java as OO
15:39 <xenog> I'm doing the exercise to try to find a definition of functional language that could work, but I'm having a hard time.
15:39 <bartavelle> glguy, where is that ?
15:40 <* Sornaensis> shrugs
15:40 <conal> "As tedious as arguing about definitions is, it can't hold a candle to arguing without definitions." - David R MacIver (http://www.drmaciver.com/tag/bad-arguments/)
15:40 raycoll joined
15:40 <glguy> Example definition: https://github.com/glguy/irc-core/blob/v2/src/Client/Commands.hs#L286-L292 and then all these modules for implementation: https://github.com/glguy/irc-core/tree/v2/src/Client/Commands
15:40 <bartavelle> conal, nice one
15:40 <conal> bartavelle: yeah!
15:41 electrostat joined
15:41 gawen joined
15:41 osa1 joined
15:41 <xenog> conal, yes, it is frustrating not having a proper definition for what a functional language is, one that would leave Java and C++ out while leaving Scala in, for example.
15:41 <Sornaensis> oh
15:41 <conal> also applicable to arguing without (clear and agreed-upon) definitions: "The single biggest problem with communication is the illusion that it has occurred." - George Bernard Shaw
15:41 <Sornaensis> well there you go
15:42 afnizarnur joined
15:42 <bartavelle> glguy, at first glance, it looks like what I would need. I'll look it up and try to see if it fits, thanks!
15:42 uncertainty joined
15:42 <Sornaensis> xenog: does java support returning a function as a value?
15:42 <xenog> Going to eat. See you later.
15:42 <xenog> Sornaensis, yes.
15:42 <Sornaensis> then it supports functional programming
15:42 <Sornaensis> what is the issue
15:42 <Sornaensis> ..?
15:43 <bartavelle> Sornaensis, the issue is that nobody agrees on what "supports functional programming" means :)
15:44 NeverDie joined
15:44 <Sornaensis> well some people are trying to modify the definition to exclude certain languages
15:45 <bartavelle> there is no definition
15:45 <bartavelle> it is like OOP
15:45 fakenerd joined
15:46 Itkovian joined
15:47 electrostat joined
15:47 kgadek joined
15:47 simukis_ joined
15:47 Kundry_Wag joined
15:48 uglyfigurine joined
15:48 uncertainty joined
15:48 Lord_of_Life joined
15:49 <Sornaensis> bartavelle: but if a language allows treating functions as values then you can write functional code in it. I'm not understanding the issue. You should be able to encode everything the same way you could write λ-calc. Even if it's really awkward compared to purpose built language
15:49 <Sornaensis> even if it doesn't ''work'' because of implementation issues like stack overflows
15:50 raycoll joined
15:50 erisco joined
15:51 fendor joined
15:51 b4ff3r joined
15:53 <bartavelle> Sornaensis, you can encode lambda calculus in any general purpose language, not sure what that proves about that language
15:54 raycoll joined
15:54 <hodapp> Sornaensis: if awkwardness of implementation is completely irrelevant, you can "write functional code" in anything that can perform computations.
15:54 tristanp joined
15:54 <geekosaur> Sornaensis, ^ and I would say an important aspect of support is making it not terribly awkward to write
15:54 <bartavelle> also, then you need to define what "functional code" is :)
15:55 vengefulpickle joined
15:55 <hodapp> the only thing that sets apart a pile of beach sand from a Haskell compiler is how awkward it is to implement things in it
15:55 <Sornaensis> uhh
15:55 dni joined
15:55 <Sornaensis> translating from lambda calc to a language is not what I am suggesting
15:55 <* geekosaur> considers looking for the crab computing article >.> but this starts to feel like a diversion
15:55 <Sornaensis> obviously you can do that
15:55 <bartavelle> also "treat functions like values" works in most languages, for some definition of "value", even in C
15:56 <Sornaensis> I am talking about writing code in the language without any imperative statements
15:56 <erisco> I don't think C has functions as values
15:56 <Sornaensis> you obviously cannot do that in e.g. assembly
15:56 <bartavelle> erisco, you have function pointers, you can create functions on the fly
15:56 <Sornaensis> because all you can do is change registers and stuff
15:56 <bartavelle> erisco, with a LOT of hacking thouhg
15:57 eazar001 joined
15:57 <bartavelle> (for the creating functions part)
15:57 <Cale> bartavelle: Function pointers aren't the same thing as first class functions of course. You can construct closures explicitly using them, but it's hard to actually construct the *abstraction* of first class functions in C.
15:58 <bartavelle> Cale, of course, I just use that to point out that it is mostly a matter of definition
15:58 hackebeilchen joined
15:58 dmwit_ joined
15:58 <Cale> For me, the point where you go from dealing with closures to dealing with functions is when you can no longer separate the code and environment
15:58 <marvin2> bartavelle you can construct functions in C on the fly these days? or are you thinking C++
15:59 sleffy joined
15:59 sssilver joined
16:00 mattyw joined
16:00 <bartavelle> marvin2, these days it's a bit harder because you have to create a writeable + executable mapping if you want to create functions that are exactly like those you can call
16:00 Sonolin joined
16:00 <bartavelle> Cale, not sure I am knowledgeable enough to understand what you mean by "code" and "environment"
16:01 ramatevish joined
16:01 <hodapp> <insert needlessly inflammatory Bob Harper article here>
16:01 <bartavelle> :)
16:01 macivy joined
16:02 <Cale> bartavelle: Well, so the standard way of implementing first class functions is to pair up some code (e.g. what a function pointer gives you would be good enough) representing the "body" of your lambda, with a mapping from the variables occurring freely in that body, to the values that those variables had in the context where the lambda was constructed
16:02 <glguy> Writing functions into executable memory isn't really part of "C"
16:02 <Cale> (and the code will look up the values for those variables in the mapping)
16:02 Raynes joined
16:02 <bartavelle> ah I see
16:03 <Cale> e.g. consider something like (\x -> (\y -> x + y))
16:03 <robkennedy> How can I check whether `popCount word16 == 1` is faster than `countLeadingZeros w16 + countTrailingZeros w16 = 15` is quicker?
16:03 cross joined
16:03 <Cale> after having applied this function to the value 5, we're supposed to get as a result the function (\y -> 5 + y)
16:03 fendor joined
16:03 <Cale> However, we typically don't want to be compiling separate code for that function at runtime
16:04 <Cale> So instead, we'll represent that as a pair, something I might schematically represent like ((\y -> x + y), {x := 5})
16:05 <bartavelle> and what you call "environment" would be the second element of that pair ?
16:05 <Cale> yeah
16:05 <bartavelle> alright
16:05 <Sornaensis> :t error
16:05 <lambdabot> [Char] -> a
16:05 <Cale> With functions in Haskell, or other high level functional programming languages, you can't really tear that pair apart again and inspect or fiddle with the environment, creating the illusion that what you have is really (\y -> 5 + y)
16:05 <Sornaensis> @src error
16:05 <lambdabot> error s = throw (ErrorCall s)
16:05 SpinTensor joined
16:06 cobreadmonster joined
16:06 <bartavelle> Cale, it is interesting that your definition of "first class functions" resides in the absence of a capability!
16:06 <Cale> yep
16:07 <bartavelle> anyway I gtg :/
16:07 <xenog> Perhaps the definition should not only include first-class functions, but closures instead.
16:07 <Cale> Nah, closures are an implementation detail
16:08 <xenog> But that doesn't change much. Java and C++ still are functional languages under that definition.
16:08 <xenog> No, it isn't, it is syntactic.
16:08 <Cale> C "has closures", in that you can implement closures with it.
16:08 <Cale> But you can't implement functions as I've been describing them
16:08 <Sornaensis> idg why it is so important to find a definition that excludes certain languages
16:08 <Cale> because you can't formulate that abstraction barrier
16:08 <Cale> Sornaensis: The point isn't to exclude certain languages
16:08 <xenog> You write a function that closes over lexically-scoped variables defined outside of the function.
16:08 vimto joined
16:08 <xenog> Or lexically-scoped bindings.
16:08 zennist joined
16:09 _sras_ joined
16:09 <Cale> xenog: But that's not "having closures" -- I would separate implementation from interface there :)
16:09 <doomlord> is haskell any good at driving GPUs,
16:09 <Cale> You can also implement first class functions *with the same semantics* in a lot of other ways, some of which don't involve closures.
16:09 <erisco> Sornaensis, because on the other end all languages have all features
16:09 marsam joined
16:09 <erisco> if you can write an interpreter in the language then you can just claim it has all features
16:10 <erisco> well, that's absurd
16:10 <Sornaensis> that's also obviously not what I'm talking about
16:10 <Cale> Closures are specifically the technique of pairing up code for a function, together with an environment that associates free variables in the function body with values. If you can't see the pair any more, it's not really a closure, it's become a function proper :)
16:10 <xenog> Yeah, but if you write an interpreter to add the function, then the interpreted language has the function, but not the language in which the interpreter has been written.
16:10 <Sornaensis> why bother discerning features at all at that point
16:10 <erisco> well, that is why you need definitions that exclude some languages
16:10 <Sornaensis> all turing complete languages are equivalent
16:11 jao joined
16:11 romildo joined
16:11 <Cale> That's why I'm careful to distinguish "closure" from "first class function which captures the values of variables occurring in its body", the latter of which I usually just refer to as "function"
16:11 <erisco> I could claim C# has ADTs because I can make a reasonable emulation of them
16:12 <_sras_> Does Stack cache urls of the locations specified in "packages" section of the stack.yaml file anywhere?
16:12 ziocroc joined
16:12 <erisco> but I wouldn't because it is a type system feature, and C# clearly doesn't have it
16:12 <xenog> Well, we need a proper definition of functional language, and that definition may as well be "because most programmers in traditionally-functional languages like Haskell recognize [lang] as a functional language".
16:12 <Sornaensis> no, a language either supports functions as values or it does not
16:12 <Cale> You can implement the latter via graph reduction instead, and not really involve closures, because the code for your function will consist of a graph which simply has arcs pointing at the right things.
16:12 <xenog> It is a bad definition though.
16:13 <Sornaensis> the implementation of that shouldn't matter
16:13 <romildo> Is there any emacs mode that supports editing alex files? Alex is lexical analyser generator for Haskell.
16:13 <Cale> I'm actually not even certain these days that being a functional language is primarily about first class functions -- certainly those are a prerequisite.
16:14 <erisco> it is necessary but not sufficient, Cale
16:14 <Cale> But pattern matching and algebraic data types are pretty damn important to functional programming, and without them, a language feels very different.
16:14 <hodapp> Sornaensis: Turing-completeness isn't actually relevant here either. Total functional languages are not TC.
16:14 <xenog> Perhaps we are asking the wrong question.
16:14 pita joined
16:15 <erisco> lets begin again: what is computing?
16:15 owiecc joined
16:15 <Sornaensis> hodapp: okay..?
16:15 <xenog> Perhaps a functional language is one that supports functional programming well, and functional programming is a paradigm with a constellation of practices.
16:15 kirillow joined
16:15 <Cale> I agree with that sentiment.
16:15 <Sornaensis> hm
16:16 <Cale> Reasonable people can disagree on whether any given language supports functional programming well.
16:16 <xenog> I think what we have then are languages that support functional programming to varying degrees.
16:16 <Cale> There are a bunch of idioms and features involved in supporting those idioms
16:16 MindlessDrone joined
16:16 amut joined
16:17 glyfrp joined
16:17 <ystael> also many reasonable people will be surprised by a definition of "functional programming" that doesn't extend to the Lisp family, but dynamically typed functional languages don't typically provide pattern matching in core
16:18 <Sornaensis> and LISP is certainly feels different from haskell :P
16:18 <* ski> . o O ( Erlang )
16:18 tomboy64 joined
16:18 <xenog> So, closures, pattern matching, tail-call recursion, abstractions for linked lists, immutable data, all of these things are used in functional programming.
16:19 <cobreadmonster> Man, I've forgotten all my parsec.
16:19 <Cale> xenog: I would again be cautious about those first two, because they discuss details of a language implementation, rather than language features.
16:20 <Cale> Graph reduction is a common implementation technique which, in some of its forms, throws those two things into question.
16:20 guampa joined
16:20 <Cale> First of all, by not involving a call stack at all
16:20 <geekosaur> you mean two out of the first three; pattern matching is very much a thing :)
16:20 <xenog> Cale, would you make your case that closures and pattern matching are an implementation technique as opposed to a syntactic feature of a language?
16:20 <geekosaur> (but might mean different things...)
16:20 <geekosaur> xenog, Cale mean t tail calls not pattern matching there
16:20 <Cale> xenog: I don't use the word "closure" when I want to mean "function"
16:21 <Cale> A closure is a special sort of pair
16:21 <Cale> A function is not.
16:21 <geekosaur> closures and tail calls are implementation details, not fundamentals
16:21 <Cale> (a pair of code and environment, which can be separated and manipulated as such)
16:21 ludat joined
16:21 SolitaryCypher joined
16:21 <Cale> You use closures to implement functions
16:21 <xenog> A closure is a function that has access to free variables that are available to its lexical scope, but not necessarily the lexical scope of the caller.
16:22 <Cale> But they're not the only way to implement them
16:22 <xenog> Perhaps closure can be defined in more than one way.
16:22 sellout- joined
16:22 <Cale> and they're not even the only way to implement functions which have access to free variables in their lexical scope of definition
16:23 <Cale> Template instantiation being another
16:23 <Cale> and many forms of graph reduction don't involve anything which particularly looks like closures
16:23 <xenog> So, when I refer to a closure, I am referring to the syntactic feature of a language that allows creating a first-class function that has access to the lexical scope available at the point of its definition.
16:23 <ski> what the Scheme Report calls "proper tail recursion" (a misnomer), is not so much an implementation detail, as a an symptotic constraint on the operational semantics
16:24 <xenog> (transparently, I must add)
16:24 <Cale> yeah, I'm very picky about that, and that's never what I mean when I use the word "closure"
16:24 danthemyth joined
16:25 <Cale> Because the original meaning of the word is the implementation mechanism of pairing code and environment, and I think it's good to keep the word for that purpose alone.
16:25 <ski> (er, s/a an symptotic/an asymptotic/)
16:25 romildo left
16:26 <xenog> Cale, is there a better/more accepted word than closure to define the language-level feature that I have been referring to as closure?
16:27 <benzrf> xenog: i think it tends to be implied - what languages have first-class functions which can be dynamically created but which DON'T have lexical binding?
16:27 <ystael> benzrf: emacs lisp
16:27 <ski> (namely that the operational semantics can support an unbounded number of active tail calls in bounded space. whether this property is implemented by reusing activation/stack frames, or in some other way (such as heap-allocating (and GCing) the activation frames) is immaterial)
16:27 <Cale> Normally, I just say "functions", but if that's not specific enough, I'll say "lambda terms" if that would be understood, or "functions which capture the values of variables in lexical scope"
16:27 <benzrf> ystael: ...well damn
16:28 <benzrf> ystael: can't i just pretend that all languages are lexically scoped ;u;
16:28 <* ski> . o O ( "first-class functions" )
16:28 <Cale> Or indeed, "first class functions"
16:28 <benzrf> Cale: i think if you need to get as specific as that final term, "closure" isn't the worst word to use
16:28 <ski> (may need qualification about lexical scoping, though)
16:28 <Cale> benzrf: That bothers me though, because it dilutes the meaning of that word in a confusing way
16:29 <benzrf> that's probably true...
16:29 amut joined
16:29 conal joined
16:29 <xenog> Cale, according to the Wikipedia definition, if that is to be considered canonical at all, there is a programming-language-level closure, which is also called a lexical closure, which is what I'm talking about, and there is an operational or implementation-specific definition, which goes with what you say a closure is.
16:29 <Cale> xenog: Yeah, I will freely admit there are whole communities of people which define the terms differently
16:30 <xenog> So when talking in the context of programming language definitions, the lexical closure definition is more appropriate, because implementation details correspond to another level of abstraction.
16:30 <benzrf> Cale: i sympathize with your urge to prescriptivism :>
16:30 <Cale> xenog: I'm just especially picky, because I've seen a lot of flamewars and other "discussions" full of people arguing about whether language X "has closures"
16:30 <benzrf> i dont know whether it's valid in this case, idk
16:30 <benzrf> sorry that was kind of snide
16:31 <Cale> heh
16:31 cfricke joined
16:31 <Cale> I'm not ordinarily much of a prescriptivist, but when it comes to technical definitions, I think it can matter.
16:32 <xenog> So, "lexical closures" should hopefully exclude the lower-level implementation detail also known as closure.
16:32 HarveyPwca joined
16:32 mstruebing joined
16:32 <benzrf> i should get into a habit of clarifying definitions before wading into these arguments...
16:32 <Cale> Note also that it's possible to use closures to implement things which don't behave like functions
16:33 <Cale> and in fact, that's pretty common
16:33 <xenog> Yeah, I just want to come up with a good definition of functional programming to get my friends into it.
16:33 <xenog> - "Dude, you should totally start doing functional programming"
16:33 <xenog> - Sure, what is it?
16:33 <xenog> - It's cool!
16:33 <Cale> Well, it's hard to encircle it properly
16:33 jbiesnecker joined
16:34 <padre_angolano> It's programming with functions. Like function(a) in Pascal!
16:34 cfricke joined
16:34 <Sornaensis> functional programming is defined as programming while being way cooler than other programmers
16:35 <Cale> One thing which I think is pretty central to the idea of functional programming, is the construction of libraries which behave like special purpose programming languages unto themselves, which allow you to describe a space of problems out of various building blocks, and then which serve to solve those problems by recursion over the descriptions.
16:35 qzorg joined
16:35 electrostat joined
16:35 <Cale> That's sort of our ultimate goal with all of these features
16:35 <xenog> Functional programming: programming when done by a hipster.
16:35 moongazer joined
16:35 <* ski> . o O ( EDLSs )
16:36 <Cale> http://ulf.wiger.net/weblog/2008/02/29/simon-peyton-jones-composing-contracts-an-adventure-in-financial-engineering/ -- here's a good talk about the approach
16:37 <Cale> It's not the entire story to functional programming, but embedded domain specific languages, or EDSLs, are one of our major design goals, and when the plan works, it tends to work exceptionally well.
16:37 t7 joined
16:37 <Cale> You end up with programs which are very flexible to a wide variety of changes in design requirements
16:37 <Sornaensis> in the future all programming languages will just be EDSLs within some descendant of haskell
16:37 <Cale> and whose correctness is easier to check
16:38 <Cale> But actually achieving that goal requires an understanding of your problem space which is not always so simple to come by.
16:38 <benzrf> xenog: expression-oriented programming
16:38 <ski> record types (with "message-dispatching") tend to be an important aspect of OO. variant types (with pattern-matching) are big in many expressions of FP
16:39 plutoniix joined
16:39 <benzrf> xenog: one major aspect of FP is the focus on composing expressions rather than sequencing effects
16:39 <ski> another aspect is that FP tend to be expression oriented, and discourage side-effects (partially due to encouraging HOFs, and storing functions in data structures)
16:40 sellout- joined
16:40 vimto joined
16:40 <* ski> fie hives benzrf
16:40 mandeep joined
16:40 alecbrick joined
16:41 mstruebing joined
16:42 mstruebing joined
16:44 <ski> ((even) lists in the lisps can be seen as an implicit expression of pattern-matching, via predicates and selectors. a list is either empty or a "cons")
16:45 sophiag joined
16:46 <Cale> Sometimes I like to imagine an idealised version of the distinction between traditional FP and traditional OO as being an emphasis on inductive data types and coinductive ones.
16:47 crobbins joined
16:47 alecbrick joined
16:47 <Sornaensis> :t bimap
16:48 <lambdabot> Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d
16:48 <lep-delete> :hoogle clamp
16:48 Kundry_Wag joined
16:48 uncertainty joined
16:48 <lep-delete> @hoogle clamp
16:48 <lambdabot> Brick.Util clamp :: (Ord a) => a -> a -> a -> a
16:48 <lambdabot> Clay.Color clamp :: Ord a => Num a => a -> a
16:48 <lambdabot> Numeric.Interval.Kaucher clamp :: Ord a => Interval a -> a -> a
16:50 sellout-1 joined
16:50 <lep-delete> @hoogle Ord a => Interval a -> a -> a
16:50 <lambdabot> Data.Number.Interval ival :: Ord a => a -> a -> Interval a
16:50 <lambdabot> Numeric.Interval (...) :: Ord a => a -> a -> Interval a
16:50 <lambdabot> Numeric.Interval.Internal (...) :: Ord a => a -> a -> Interval a
16:50 <glguy> lep-delete: You can play with lambdabot in private message. Please don't spam the channel
16:50 <lep-delete> not really playing but ok
16:53 alecbrick joined
16:53 jbiesnecker joined
16:58 afnizarnur joined
16:59 Deide joined
16:59 alecbrick joined
16:59 burtons joined
16:59 connrs joined
17:00 hongminhee joined
17:01 abh joined
17:04 argent0 joined
17:04 zcourts joined
17:04 raichoo joined
17:04 jbiesnecker joined
17:04 umib0zu joined
17:05 oisdk joined
17:08 jaspervdj joined
17:09 binaryplease joined
17:10 infandum joined
17:10 madjestic joined
17:11 nbro joined
17:11 guillaum2 joined
17:11 <nbro> hey guys
17:12 ragepandemic joined
17:12 cmsmcq_ joined
17:12 <guillaum2> I'm wondering, but with DataKinds and its friend, we can use any type as kind. But why can't we use any function on value as a function on types ?
17:12 <nbro> maybe you know something about it… why is this https://pastebin.com/Nxuy3MmF grammar not LL(1) ?
17:13 kiltzman joined
17:14 mda1 joined
17:14 <infandum> If I have Map.unionsWith (Map.unionWith (Data.Sequence.><)) on a [Map a (Map b (Data.Sequence.singleton c))], would the resulting Map (Map (Data.Sequence.fromList [c])) conserve the order? Like, index 3 of [c] from one map be from the same "place" as index 3 of [c] from another map? Assuming all maps had the same as and bs.
17:14 <infandum> It's a predictable join, right? Right map added to left, right sequence added to left?
17:15 <infandum> I messed up the parenthases a bit but I hope you get the idea
17:15 <Ferdirand> nbro: because of the ) ?
17:15 <Sornaensis> how does that grammar terminate
17:16 kiltzman joined
17:16 danthemyth joined
17:16 Netwolf joined
17:16 <nbro> Sornaensis: true or false
17:16 Swizec joined
17:17 <Sornaensis> but then it expects a B
17:17 <nbro> Ferdirand: why?
17:17 oish joined
17:17 <nbro> I think something is missing from this grammar
17:17 <Sornaensis> true and false should be lower on the rule list
17:17 <Cale> nbro: The right hand side of every production contains a B
17:17 <nbro> because my original grammar was
17:18 <Cale> nbro: So you'll never be finished
17:18 <nbro> https://pastebin.com/mVhnh2cQ
17:18 <nbro> and I wanted to remove left-recursion
17:19 <Sornaensis> I think if you make the last three rules separate
17:19 CurryWurst_ joined
17:19 <Sornaensis> make them all B, then replace EXPR with B in the first three, that works
17:20 mtesseract joined
17:20 <nbro> Sornaensis: let me see
17:20 <Sornaensis> so B refers to EXP in the last rule, but not to itself, and EXP refers to B, and B terminates
17:21 <nbro> I see
17:21 <nbro> but I’m not sure if that’s enough
17:22 gillesmajor joined
17:22 gillesmajor left
17:22 RayNbow`TU joined
17:22 kaen_ joined
17:22 <Sornaensis> are you trying to use this grammar for something or just remove left recursion
17:22 <nbro> Sornaensis: because Exp && Exp could also be ((Exp || Exp) && Exp), but your idea doesn’t cover it
17:23 <Sornaensis> so you need another rule that says EXP ::= B
17:23 <nbro> Sornaensis: actually I’m trying to implement a recursive descent parser
17:23 <Sornaensis> or move the ! operator down, depends on what you want
17:25 ubsan_ joined
17:27 <EvanR> so...
17:27 <EvanR> conversion of Rationals to Double right
17:27 <EvanR> having issues
17:27 Levex joined
17:28 <EvanR> 117488266195314702899699858804834304 % 166153499473114484104070118945921497 is a close approximation of 1/sqrt2, more than Double can handle. but if you do the conversion with realToFrac, the last digital is not as close as possible
17:28 <EvanR> where as doing literally 1 / (sqrt 2) with doubles gets it right
17:28 sssilver joined
17:28 <EvanR> annoying
17:28 ajaXHorseman joined
17:28 Aruro joined
17:29 HugoDaniel joined
17:30 peterbecich joined
17:30 ph88^ joined
17:31 replay joined
17:32 insitu joined
17:34 carlosda1 joined
17:36 <erisco> nbro, are you asking how to refactor the grammar such that it is not left-recursive?
17:36 initiumdoeslinux joined
17:37 <erisco> it is also ambiguous, so you may want to resolve that as well
17:37 <nbro> erisco: yeah
17:39 wildlander joined
17:39 PennyNeko joined
17:39 ChaiTRex joined
17:40 augur joined
17:41 <erisco> nbro, so what you do, and it as been a while since I've worked with grammars, is you instantiate the left non-terminal to find all the left terminal productions
17:41 <erisco> so what I mean is, for example, Exp || Exp instantiates to true || Exp
17:42 <erisco> you do this for all of them
17:42 <erisco> and you should end up with something like this http://lpaste.net/354282 where S is your starting non-terminal
17:44 Netwolf joined
17:44 Netwolf joined
17:44 lush joined
17:44 <nbro> erisco: before that, my question is, why do you say the grammar is ambigous?
17:44 <nbro> I’m not sure it is or not
17:44 <erisco> what is the parse tree of true || true && true ?
17:45 <glguy> the original grammar I saw pasted used prefix operators, not infix
17:46 <nbro> but actually my original grammar is the one with infix operators
17:46 <erisco> with the grammar I pasted you only get one, but the original you have two
17:47 insitu joined
17:49 <nbro> erisco: yes, you’re right, that can have more than one parse tree, i.e. either (true || true) && true or true || (true && true)
17:49 ner0x652 joined
17:50 <erisco> and I have a mistake, let me correct it
17:50 verement joined
17:50 <erisco> I made a correction with an annotation so you can compare
17:50 DexterLB joined
17:51 uglyfigurine joined
17:52 <erisco> ! true || true is ambiguous
17:52 <nbro> but your production Exp' ::= ! Exp, doesn’t include !true
17:52 <nbro> which can be generated by the original grammar
17:52 JuanMiguel joined
17:52 <erisco> see the correction I just posted
17:53 <nbro> erisco: ok, now we do not have left-recursion, but are you sure this isn’t ambigous?
17:53 <erisco> I just provided another ambiguity :P
17:54 <nbro> if we decide to give precedence to the operators
17:54 <nbro> do you think we can remove ambiguity?
17:55 <nbro> I mean
17:55 <erisco> if you have a grammar which supports precedence, sure
17:55 <nbro> suppose then that I establish the following precendence
17:55 <erisco> it can also be solved just by adjusting the BNF grammar you have here
17:56 <dmwit> > 1/sqrt 2
17:56 <lambdabot> 0.7071067811865475
17:56 <nbro> parenthesis (higher precendence), then true and false, then !, then && and finally ||
17:56 <dmwit> > showCReal 16 (117488266195314702899699858804834304/166153499473114484104070118945921497)
17:56 <lambdabot> "0.7071067811865475"
17:57 <nbro> erisco: what do you mean
17:57 <dmwit> > 117488266195314702899699858804834304/166153499473114484104070118945921497 :: Double
17:57 dni joined
17:57 <lambdabot> 0.7071067811865476
17:57 <dmwit> ouch
17:57 <erisco> I refactored the BNF grammar to remove left recursion. you can also refactor it to remove ambiguity
17:57 jbiesnecker joined
17:58 <byorgey> dmwit: where on earth did that fraction come from
17:59 <EvanR> it came out of my exact real number code
17:59 <EvanR> its 1/sqrt2 at approximation level 1/zillion
17:59 <byorgey> oh, I see the scrollback now
17:59 mmachenry joined
17:59 <lush> Hey! I'm currently trying to do some simple "computation topology" stuff as an university internship (Mathematics student here) in haskell. What do you think is the best way to implement a category as follows in haskell: http://lpaste.net/354285
18:00 <EvanR> clearly i need to not rely on doubles to display the results
18:00 <lush> I know there is no real notion of a topological space but I don't really need that
18:00 <lush> however... is there a way to "enforce" h. g = f ?
18:00 <EvanR> theres are plenty of ways to do topology on the computer
18:00 <jle`> > realTofrac $ 1/sqrt 2 :: Rational
18:00 <lambdabot> error:
18:00 <lambdabot> • Variable not in scope: realTofrac :: Double -> Rational
18:00 <lambdabot> • Perhaps you meant ‘realToFrac’ (imported from Prelude)
18:00 <jle`> > realToFrac $ 1/sqrt 2 :: Rational
18:00 phaji joined
18:01 <lambdabot> 1592262918131443 % 2251799813685248
18:01 <EvanR> topology is really about regions, so you can have a working algebra of regions
18:01 ajaXHorseman joined
18:01 <EvanR> > realToFrac (1592262918131443 % 2251799813685248)
18:01 <lambdabot> 0.7071067811865475
18:01 <EvanR> so roundtrips correctly
18:02 hybrid joined
18:02 <lush> EvanR: yeah I know but I don't think I'll need sth of that right away
18:02 epsilonhalbe joined
18:02 <lush> EvanR: I'm just interested whether it is possible to somehow implement sth similar to the category described in the link and whether it'd still be useful ^^
18:04 madjestic joined
18:04 <EvanR> so a category of topological fields?
18:05 <EvanR> you could certainly build all this up in agda
18:06 <lush> EvanR: yeah I found a paper that interpreted contour trees in a category theoretic way and I was interested in that
18:06 mekeor joined
18:07 <lush> do you think it is possible in haskell as well EvanR?
18:07 <lush> In the end I need it to work very performant as we will test how functional compares to imperative
18:08 jbiesnecker joined
18:08 atomi joined
18:08 Itkovian joined
18:09 contiver joined
18:09 Cale joined
18:10 epsilonhalbe left
18:10 <erisco> tortoise and the hare
18:10 carlomagno joined
18:12 osa1 joined
18:12 <erisco> so I decided I just need the zig-zaggy enumeration of Cartesian product
18:12 <erisco> then if I order each factor I also get the enumeration in the correct order
18:12 caumeslasal joined
18:12 <erisco> implemented that years ago but going to try again
18:12 alx741 joined
18:13 HoierM joined
18:13 <EvanR> lush: haskell is more about programming than math, agda is geared towards formalizing math
18:13 <EvanR> what sort of programming problems would a field interface like that be good for
18:14 sssilver joined
18:14 kosorith joined
18:14 <EvanR> assuming theres a decent way to express it in haskell
18:15 mtesseract joined
18:16 <lush> mhm I need some kind of "scalar field" anyway in my project
18:16 t0by joined
18:16 <nbro> erisco: you’re grammar is still wrong
18:16 <nbro> because you can’t generate true || true && true
18:16 <nbro> for example
18:16 <nbro> I think
18:16 <erisco> try again ;)
18:17 <lush> EvanR: so if it possible to let haskell know this forms a category that'd be cool
18:18 <lush> EvanR: is there a way to enforce laws like g.h = f?
18:18 chaosmasttter joined
18:18 <nbro> erisco: tell me how then
18:18 <cocreature> lush: no, for that kind of stuff you want a theorem prover like agda or coq
18:19 <nbro> you need to start either with Exp’ || Exp or Exp’ && Exp
18:19 <lush> cocreature: mhm ok
18:19 <lush> I see^^
18:19 vengefulpickle joined
18:19 <dmwit> lush: Laws are generally advertised but not enforced in Haskell.
18:19 <erisco> oh I also have another mistake, heh
18:20 <dmwit> (And associated with type classes, specifically.)
18:20 <cocreature> lush: tbf you can’t really express that in any somewhat programming mainstream language :)
18:20 carlomagno joined
18:20 <cocreature> eh s/programming mainstream/mainstream programming/
18:20 <erisco> nbro, you probably got stuck at the last "true"
18:20 <nbro> erisco: you probably meant Exp’ || S or Exp’ && S, at this point
18:20 Emir_28 joined
18:20 anon- joined
18:20 <erisco> yes I added another annotation
18:21 <erisco> I changed it in Exp' on the first fix and forgot to do it in Exp
18:21 <lush> cocreature: ok then, ty though ^^
18:21 <cocreature> lush: if you are interested in that, definitely play around with something like coq or isabelle :)
18:21 <nbro> erisco: anyway, this example is a very similar example to the unambigous grammar with * + where * has higher precendence
18:21 <Sornaensis> nbro: are you using a parser generator
18:22 ajaXHorseman joined
18:22 <erisco> well we didn't really do that here because || and && effectively have the same precedence
18:22 <nbro> but I’m not sure how to convert it to an unambigouous grammar yet
18:22 <Sornaensis> I ask because happy can use left recursive grammars
18:22 <lush> cocreature: I will but I have to finish that project first :-D
18:23 kadoban joined
18:23 <erisco> I'd change ! S to instead be three rules
18:23 bollu joined
18:23 <erisco> ! true, ! false, and ! ( S )
18:24 <erisco> that's saying ! has high precedence
18:24 <nbro> why?
18:25 anon- left
18:25 <nbro> never mind
18:25 <erisco> because in ! true || true we're saying it binds to true, not true || true
18:25 <nbro> you also added the parenthesis
18:25 <erisco> so it has higher precedence than ||
18:25 carlomagno joined
18:26 sssilver joined
18:27 carlomagno joined
18:27 SimpleL joined
18:28 <nbro> erisco: but why do you need !true and !false too?
18:28 chindy joined
18:28 <erisco> you don't
18:28 robertkennedy joined
18:28 <erisco> that removes ! true || true as a sentence though
18:28 <Sornaensis> you can separate precedence levels into rules
18:28 <Sornaensis> where true | false | ( S ) are at the bottom
18:29 <erisco> yes you can, of course, that is an easy refactor
18:29 eyen joined
18:30 <erisco> remember that conjunction distributes over disjunction
18:30 NeverDie joined
18:30 carlomagno joined
18:30 mtesseract joined
18:30 jayjam124 joined
18:30 <jayjam124> anyone here good with threads in Haskell?
18:31 <srhb> jayjam124: Plenty of people, ask. :)
18:31 <glguy> jayjam124: always just ask your actual question
18:31 <jayjam124> ok
18:32 Levex joined
18:32 <jayjam124> I presume there is, I gotta go for a bit but I will be back, thanks
18:32 <erisco> what if we replied and said "no, go away" :P
18:32 <jayjam124> then I would be disappointed hahaha
18:32 anon-- joined
18:32 carlomagno joined
18:33 <srhb> Some day I will learn that (<>) is not in Prelude.
18:33 <cocreature> srhb: someday (<>) will be in Prelude
18:33 <srhb> cocreature: I think that's probably the same day, given past experience.
18:34 <EvanR> <> still isnt in the prelude?
18:34 <srhb> EvanR: How can you not notice ._.
18:34 <Sornaensis> you should probably be using a better prelude anyway
18:34 peterbecich joined
18:34 <* EvanR> goes back to rip van winkle land
18:34 <cocreature> huh, for some reason I thought it made it in 8.2 but ghci says I’m wrong
18:34 sssilver joined
18:34 <srhb> cocreature: 8.2 is out?
18:35 JuanDaugherty joined
18:35 carlosda1 joined
18:35 <cocreature> srhb: preliminary tarballs for rc1 have been released today
18:35 <EvanR> out of the options, "prelude sucks deal with it", "you can use alternative preludes", and "prelude doesnt suck" ...
18:35 <EvanR> :(
18:35 <EvanR> or a combination of the last two
18:35 augur joined
18:35 <srhb> I deal. I just tend to notice that I have to type import Data.Monoid ... post-hoc quite a lot of times for small one offs :P
18:36 jao joined
18:36 <EvanR> i have at least 5 import lines for small one offs
18:36 <srhb> I mean, I _know_ most of the imports I want beforehand, and write them, but then I compile and I've used <> without getting Data.Monoid :P
18:37 mmachenry1 joined
18:37 <EvanR> -X<>IsInPrelude
18:37 <srhb> Hah
18:37 <cocreature> also everytime I switch code from String to Text I need to import Data.Monoid
18:37 dni joined
18:37 <srhb> cocreature: That's actually one of my motivators for using <> to start with. Though i suppose that's probably premature.
18:37 <EvanR> shoulda called <> ++ to start with
18:38 <EvanR> or vice versa
18:38 <cocreature> srhb: nah I use <> in new code as well. but I still have to work with old code occasionally :)
18:38 <srhb> Right. :)
18:39 loki joined
18:39 <cocreature> btw one thing that annoys me about OverloadedStrings is that it results in potential ambiguity. have there been any discussions about something like {-# LANGUAGE OverloadString Text #-} which always defaults to Text instead of resolving via IsString?
18:40 <erisco> parameterised extensions, oh boy
18:40 dni joined
18:40 BlueRavenGT joined
18:40 <erisco> ten years from now there is an entire macro system for them
18:40 <Sornaensis> lmfao
18:41 mjolnir joined
18:41 <Sornaensis> (pls no)
18:41 govg joined
18:41 meoblast001 joined
18:42 <cocreature> great even my Setup.hs fails to build with several errors when I try compile with 8.2
18:43 <cocreature> but those new error messages are really nice!
18:43 jbiesnecker joined
18:44 mda1 joined
18:45 bennofs joined
18:45 oisdk joined
18:46 <erisco> I think I can achieve the n-ary zig zag in a slightly strange way
18:47 <erisco> with a stream of diagonals and non-diagonals
18:48 Cassiopaya joined
18:49 HarveyPwca joined
18:49 OS1NT joined
18:49 Salih joined
18:50 Kundry_Wag joined
18:51 jrajav joined
18:52 robkennedy joined
18:52 pera_ joined
18:52 marsam joined
18:52 osa1 joined
18:52 osa1 joined
18:54 <jayjam124> i <- randomRIO (0,9)
18:54 <jayjam124> let c = "0123456789" !! i
18:55 augur joined
18:55 <jayjam124> how do I put this into a thread?
18:55 insitu joined
18:55 <jayjam124> randomly generating Integers
18:56 gawen_ joined
18:57 argent0_ joined
18:58 ajaXHorseman_ joined
18:58 <lyxia> what are you going to do with c
18:58 <lyxia> why do you want to put this into a thread
18:58 <lyxia> what does it even mean
18:58 <jayjam124> it's to do with my homework it is
18:58 <jayjam124> it generates random digits
18:59 <jayjam124> it generates a new random digit
18:59 <jayjam124> one new random digit sorry
18:59 jbiesnecker joined
18:59 <jayjam124> so basically the game is when you have a thread that generates random digits, and the user has to guess whether a digit is in that random list
19:00 <jayjam124> if the user guesses a random digit in the list it's removed. the user has 10 guesses, so once 10 guesses are done that's it game is over and the number of guesses are returned
19:00 <jayjam124> and how many were removed
19:00 <jayjam124> that's the big picture of what I have to do if interested
19:01 <lyxia> I can't see how threads are involved in this game
19:01 TheLemonMan joined
19:01 <jayjam124> ok so
19:01 <jayjam124> one thread is responsible for generating the digits
19:01 <jayjam124> one thread is responsible for getting the key presses
19:01 <jayjam124> and another is responsible for the logic
19:02 <jayjam124> you could do it without threads but I have to do it with threads
19:02 <dmwit> :t forkIO
19:02 <lambdabot> error: Variable not in scope: forkIO
19:02 <dmwit> ?hoogle forkIO
19:02 <lambdabot> Control.Concurrent forkIO :: IO () -> IO ThreadId
19:02 <lambdabot> GHC.Conc forkIO :: IO () -> IO ThreadId
19:02 <lambdabot> GHC.Conc.Sync forkIO :: IO () -> IO ThreadId
19:02 ajaXHorseman joined
19:02 theelous3 joined
19:02 <dmwit> ?hoogle MVar -- for very simple communication between threads; there are many other fun tools available
19:02 <lambdabot> Control.Concurrent.MVar.Lifted newEmptyMVar :: MonadBase IO m => m (MVar a)
19:02 <lambdabot> Math.FFT.Base lock :: MVar ()
19:02 <lambdabot> Transient.Internals printBlock :: MVar ()
19:03 <jayjam124> so uh, what do I do?
19:04 <jayjam124> I can see that these are related to concurrency but what do I actually do with this?
19:04 ChaiTRex joined
19:05 <srhb> jayjam124: Have you ever used forkIO before?
19:05 <jayjam124> no
19:05 <jayjam124> first time with this assignment
19:05 <dmwit> Write an IO action that does all the random number generation and communicates its results via `MVar`. Then use `forkIO` to spawn a thread with that action.
19:06 <int-e> seriously, hoogle finds lifted-base before base? meh...
19:06 <jayjam124> dmwit the IO acction is this right?
19:06 <jayjam124> i <- randomRIO (0,9)
19:06 <jayjam124> let c = "0123456789" !! i
19:07 <srhb> jayjam124: I think you might benefit from doing some simple experiments with it first then. For instance, try just _printing_ a single number from it first (dealing with the handoff via eg. MVars later) while the main function is waiting on user input or something like that.
19:07 <srhb> jayjam124: ie. hello world but in a forked thread.
19:07 Itkovian joined
19:07 <jayjam124> any example code?
19:07 <srhb> jayjam124: forkIO, getLine and putStrLn is all you need really.
19:08 <jayjam124> this homework is going to be a nightmare xD
19:08 <srhb> jayjam124: Well, you just need some basic building blocks to work with first. :)
19:08 <jayjam124> do you think I can do it in 2 days?
19:09 <jayjam124> I only finished my other piece of work yesterday
19:09 <jayjam124> so it's been non-stop
19:09 <jayjam124> and I panic
19:09 <srhb> jayjam124: No idea. :) THe less time you spend worrying the more time you have to learn and solve it, though.
19:09 <WarmCookie> https://www.youtube.com/watch?v=7kI1d7DMbco
19:10 <WarmCookie> Interesting. Lightning is implemented as a A* algorithm.
19:10 coot joined
19:10 <jayjam124> srhb aight so how do I use forkio?
19:10 <srhb> jayjam124: Well, look at its type again
19:10 <srhb> :t forkIO
19:10 <lambdabot> error: Variable not in scope: forkIO
19:10 <srhb> Ack.
19:11 <srhb> jayjam124: forkIO :: IO () -> IO ThreadId
19:11 NeverDie_ joined
19:11 <srhb> jayjam124: We can ignore the ThreadID for now and think of it as IO () -> IO ()
19:11 <srhb> jayjam124: Meaning it takes an IO action and produces an IO action.
19:11 <nbro> erisco: but if you wanted to give higher precedence to && with respect to ||, how would you change that grammar?
19:11 <srhb> jayjam124: More specifically, it takes an IO action and executes it in a thread.
19:11 <erisco> nbro, similarly to how we did it with !
19:12 phaji_ joined
19:12 <srhb> jayjam124: So given any IO action foo, forkIO foo executes it in a separate (lightweight) thread.
19:13 ludat joined
19:14 Cassiopaya joined
19:14 wraithm joined
19:14 jaspervdj joined
19:14 <jayjam124> I don't even remember how to actually write in Haskell it's been months lol
19:14 jomg joined
19:14 <jayjam124> main = putStrLn "Hello World"
19:14 <jayjam124> first program
19:14 <srhb> jayjam124: That's a good start!
19:14 <jayjam124> yes :D
19:14 <Aruro> jayjam124: u have haskell class in school?
19:14 <jayjam124> yah but I already did it and forgot it
19:14 <jayjam124> terrible memory, terrible
19:14 <srhb> Now, rename that to otherThread and make a new main that forks off otherThread
19:15 <srhb> jayjam124: (Then experiment with it and see what you observce)
19:15 <sophiag> would anyone mind helping me with this snippet: http://lpaste.net/354292? i'm trying to use Either to dispatch to either an error message or two state monads (and a third function "eval," which i could make a state monad for uniformity but doesn't require it)
19:15 <Aruro> jayjam124: not terrible memory, too much information.
19:15 j2j joined
19:15 <jayjam124> you mean teachers give you too much and it just overloads your brain?
19:15 <jayjam124> yeah I can agree with that
19:15 <Aruro> yes. they are no smart.
19:16 <Aruro> t*
19:16 <jayjam124> mmm I do agree
19:16 <erisco> nbro, a typical setup is like this, where Exp1 is the starting non-terminal http://lpaste.net/354293
19:16 <mizu_no_oto_work> jayjam124: did the professor specify that you should use Haskell for this assignment?
19:17 <jayjam124> yes
19:17 <jayjam124> got to use it
19:17 <erisco> nbro, as you go down the precedence becomes higher
19:18 <jayjam124> srhb what's the next thing I do?
19:18 <jayjam124> forkIO
19:18 <jayjam124> ?
19:18 <int-e> sophiag: how are the State monad actions supposed to become strings?
19:18 <erisco> nbro, sorry I had to make an edit to line 7 it should have been Exp3 ::= ! Exp3
19:18 <srhb> jayjam124: What's the type of otherThread now?
19:18 <int-e> sophiag: err, unit actually
19:19 <jayjam124> main =
19:19 <jayjam124> otherThread = putStrLn "Hello World"
19:19 <srhb> jayjam124: Put it differently, what's the type of putStrLn "Hello World" ?
19:19 <jayjam124> it's a String
19:19 <srhb> No, it's not.
19:19 <jayjam124> oh
19:19 <jayjam124> ummmmm
19:19 <srhb> jayjam124: Try defining it in ghci and asking it
19:19 <jayjam124> so :t otherThread?
19:19 <srhb> Or we can do...
19:19 <srhb> Yes
19:19 <jayjam124> ok
19:19 vengefulpickle joined
19:19 <jayjam124> sorry I can't remember a lot of this
19:20 <jayjam124> my apologies
19:20 <srhb> You need to have no errors in the file first though :)
19:20 <jayjam124> yes I removed main
19:20 <srhb> jayjam124: No time for apologies and small-talk, hand-in is in two days! Chop chop! ;-)
19:20 <jayjam124> indeed
19:20 <jayjam124> the type is
19:20 <jayjam124> otherThread :: IO()
19:20 <jayjam124> so IO
19:20 <srhb> IO ()
19:20 <jayjam124> IO()
19:20 <nbro> erisco: what’s the difference between this grammar and your previous, except that apparently now && has higher precedence than ||?
19:21 <jayjam124> ok
19:21 <srhb> So that looks suspiciously like the type of forkIO's argument, doesn't it.
19:21 <erisco> nbro, that is what you asked for
19:21 <sophiag> int-e: they return unit. is that not sufficient? i have alternate versions where they actually return the current state (which i would prefer), but not sure how to write the type signature for evalString
19:22 <erisco> nbro, it also includes the ambiguity fix for !
19:22 felixLam joined
19:22 <jayjam124> main =
19:22 <jayjam124> otherThread = putStrLn "Hello World"
19:22 <jayjam124> so what do I do to do a forkIO on otherThread?
19:22 <erisco> nbro, and the omission of double negation sentences i.e. ! ! x
19:22 hybrid joined
19:23 <srhb> jayjam124: It's argument is exactly something of type IO (), so you just apply forkIO to otherThread like any other function application. Ie. like you used putStrLn on its (String) argument.
19:23 <srhb> Its*
19:23 deepfire joined
19:23 <jayjam124> main = forkIO otherThread
19:23 <jayjam124> otherThread = putStrLn "Hello World"
19:23 <jayjam124> like that?
19:23 <srhb> jayjam124: Yes, exactly.
19:23 <jayjam124> ok
19:24 <jayjam124> ouch
19:24 <jayjam124> not in scope
19:24 <jayjam124> import module I guess
19:24 <srhb> jayjam124: Look up where forkIO is from. :)
19:24 <jayjam124> :t forkIO
19:24 <lambdabot> error: Variable not in scope: forkIO
19:24 <jayjam124> how do I look up?
19:24 <Aruro> import Control.Concurrent
19:24 <srhb> I tend to google things...
19:24 <jayjam124> thanks
19:24 <* geekosaur> uses hayoo
19:24 <int-e> sophiag: You may be misunderstanding what "State" does; it doesn't have any global variable or the like; State s a is essentially the same as the function s -> (a, s) which maps a state to a successor state and a value. The Monad instance allows one to thread that state through several actions in the same state monad. "runState" and friends can be used to specify an initial state and get the...
19:24 <int-e> ...corresponding final state and return value. But any value of type "State s a" is still just that, a value; it doesn't have any effect.
19:25 <jayjam124> lol I got back
19:25 <jayjam124> HeTlhlroe aWdoIrdl d2
19:25 <jayjam124> 7
19:25 <jayjam124> random like that
19:25 <jayjam124> when I call main
19:25 <jayjam124> is that supposed to happen or?
19:25 <mizu_no_oto_work> jayjam124: looks like you have two threads that are both calling putStrLn
19:26 <jayjam124> hmmmmmm
19:26 <jayjam124> import Control.Concurrent
19:26 <jayjam124> main = forkIO otherThread
19:26 <jayjam124> otherThread = putStrLn "Hello World"
19:26 <srhb> jayjam124: ghci is interfering with the order, try compiling it and you'll see some different weirdness
19:26 <jayjam124> all I got it this
19:26 <srhb> jayjam124: Which is what I wanted you to see.
19:26 <jayjam124> ok
19:26 <jayjam124> so you want me to go into GHCI
19:26 <jayjam124> and compile it in there?
19:26 <jayjam124> the way I do it is I double click on the .hs file to compile normally
19:26 <srhb> jayjam124: actually your can probably runhaskell file.hs
19:27 <srhb> jayjam124: or ghc file.hs && ./file
19:27 cyborg-one joined
19:27 <jayjam124> is it ok if I just double click the .hs file?
19:27 <jayjam124> I guess it is
19:27 <srhb> jayjam124: Nope. No idea what that does. Something unpredictable.
19:27 <jayjam124> oh
19:28 <jayjam124> uh wait, so what do I type into GHCI to compile the .hs file?
19:28 <srhb> (Or rather, I have no idea what it does on your system, so i don't care to guess about it.)
19:28 <srhb> jayjam124: Not into ghci, into your terminal.
19:28 fizruk joined
19:28 <jayjam124> oh so windows cmd
19:28 <srhb> Oh oops, Windows is a thing. Yeaaah...
19:28 <jayjam124> ok
19:29 <Aruro> jayjam124: is there no seminars where u can practice with tutor?
19:29 <srhb> No idea how that works. Maybe it's just on PATH :-)
19:29 <Aruro> online course?
19:29 jbiesnecker joined
19:29 <jayjam124> ok
19:29 <jayjam124> so
19:29 <jayjam124> Aruro nah man
19:29 <jayjam124> my University SUCKS
19:29 <jayjam124> they leave you on your own
19:29 <Aruro> :)
19:29 <jayjam124> don't want to vent too much but the attitude they give is
19:29 <sophiag> int-e: i do understand that. i'm using the state monads to take values and cons them onto lists. that's not currently working because of the type signature. i'm asking how to correct it
19:30 <jayjam124> teaching is the second part of their job which they don't want to do
19:30 <jayjam124> they'd rather work on their research and shit
19:30 <jayjam124> srhb
19:30 <jayjam124> Hello World
19:30 <jayjam124> ThreadId 24
19:30 <jayjam124> so this is what returns
19:30 ph88_ joined
19:30 <srhb> jayjam124: That looks like ghci output. Otherwise I've no idea where ThreadId 24 is from
19:30 <jayjam124> I typed runhaskell helloworldthread.hs
19:31 <jayjam124> into Windows CMD
19:31 <srhb> Oh, really?
19:31 <jayjam124> yes
19:31 <jayjam124> I can show a pic but trust me yes that is what returned
19:31 <srhb> jayjam124: Can you try ghc yourfile.hs and then execute the resulting file?
19:31 <jayjam124> in windows cmd?
19:31 <srhb> jayjam124: Yes.
19:31 <jayjam124> I can try that sure
19:31 <jayjam124> ah ok seems to be doing something more now
19:31 <erisco> nbro, how do BNF grammars relate to Haskell for you?
19:32 <jayjam124> "Linking helloworldthread.exe"
19:32 <srhb> jayjam124: It should be compiling an executable first
19:32 <jayjam124> yes
19:32 <srhb> jayjam124: Yes, run that exe file in cmd
19:32 <jayjam124> ok
19:32 <jayjam124> what's linking again out of curiosity?
19:32 <cocreature> hey, GHC 8.2 apparently has a new warning simplifiable-class-constraints. however, I’m having trouble understanding what GHC is telling me to simplify http://lpaste.net/354295
19:32 <int-e> sophiag: I'm not sure what you should do; a workable type could be evalString :: String -> Either String (State ([Amb],[Require a]) (Either [Amb] ())) but this doesn't look very nice. (Also, in order to use State [Amb] ([Amb]) inside the latter monad, you'll end up with something like get >>= \(s1,s2) -> let (x, s1') = execState (amb ast) in put (s1',s2) >> return x ... eww.
19:32 <cocreature> any ideas?
19:32 sssilver joined
19:32 wires joined
19:32 <jayjam124> ok I ran "helloworldthread.exe" and it returns simply Hello World and nothing else
19:32 <srhb> jayjam124: Combining your executable with other libraries, system libraries etc.
19:33 <jayjam124> makes sense
19:33 <srhb> jayjam124: That's a start, that's the base behaviour with all the flavour of ghci etc.
19:33 <jayjam124> ok, what next?
19:33 tumdedum joined
19:33 alonso joined
19:33 <int-e> (is there any light-weight package (not lens) that abstracts from this, running a state monad on a projection of a state?)
19:34 <jle`> microlens has this
19:34 e_svedang joined
19:35 meoblast001 joined
19:35 <srhb> jayjam124: Pick some minor part of the objective and try to integrate that into your program. Like, having the thread do something repeatedly, or waiting for user input, or...
19:35 <jle`> zoom :: Lens' s t -> State t a -> State s a
19:35 <jayjam124> the simplest thing to do is
19:35 Philonous joined
19:35 <jayjam124> is to make a thread that repeatedly generates Integers
19:35 <jayjam124> that's defo the first simplest thing to do in the task
19:35 Lord_of_Life joined
19:36 carlosda1 joined
19:36 <jayjam124> agree or disagree?
19:36 <srhb> jayjam124: OK, maybe start by generating the one random integer then and simply outputting that :)
19:36 <jayjam124> :)
19:36 joe9 joined
19:36 <jayjam124> ok sure
19:36 locallycompact joined
19:37 <joe9> I want to generate C code. It appears that the Language.c is the best way forward. Any suggestions for samples using that library, please?
19:41 <int-e> jle`: thanks
19:42 magneticduck joined
19:45 Deide joined
19:46 twanvl joined
19:48 HugoDaniel joined
19:50 <sophiag> int-e: (sorry for the delayed responses, I'm dealing with several things at once that are making it difficult to focus). i agree about the ugly code. this is why i was thinking it would be easier if i used the versions of the state monads that return unit. but you're saying that doesn't affect the type signature of evalString?
19:50 insitu joined
19:50 <nbro> erisco: apparently this is an equivalent grammar, but unambiguous: https://pastebin.com/abmgN1HG
19:50 Kundry_Wag joined
19:50 <nbro> what do you think?
19:51 <nbro> wait
19:51 <nbro> this one: https://pastebin.com/hS6Mrwex
19:51 chaosmasttter joined
19:53 anon-- left
19:53 j2j joined
19:57 <erisco> nbro, I don't know. The one I posted isn't ambiguous either
19:57 j2j joined
19:58 Nezteb joined
19:58 _Nezteb joined
19:58 marsam joined
19:59 cur8or joined
19:59 Wizek_ joined
20:02 insitu joined
20:04 <nbro> erisco: are you sure about yours?
20:05 <erisco> nbro, yes
20:06 <erisco> the grammar you last posted has a different language because the negation productions are different
20:06 darjeeling_ joined
20:06 <erisco> it does not have ! true for example
20:07 <erisco> what the designer of this grammar has clearly done is ensure that it can be recognised by a lookahead-1 parser
20:07 <erisco> the problem is that in the way this one done it is not going to make for a good executable grammar
20:07 fosskers joined
20:08 <erisco> the way you'd have to construct the AST is awkward
20:08 permagreen joined
20:09 sphere joined
20:12 Itkovian joined
20:13 fendor joined
20:13 ebzzry joined
20:13 <erisco> well, thinking it through more it would be easy
20:14 cdg joined
20:14 <erisco> but generally speaking, with more complicated grammars, I am not sure how easy it would be
20:14 <erisco> that is a reason to have parser generators
20:15 <erisco> so you can write a more obvious grammar without worrying about parsing implementations
20:15 <Sornaensis> there are parser generators that accept left recursive grammars
20:16 <erisco> it can either factor it out or use a parsing implementation that accepts it
20:16 <ggVGc> My favourite parsing tool so far has been LPeg actually
20:16 <ggVGc> but PEG seems not very popular in general
20:16 mojjo joined
20:17 fizbin joined
20:17 yellowj joined
20:17 jbiesnecker joined
20:17 <ggVGc> and I haven't seen an implementation for anything else that's even close to as nice as LPeg (which is lua)
20:18 nahra` joined
20:19 ajaXHorseman joined
20:22 binaryplease joined
20:23 albel727 joined
20:24 meoblast001 joined
20:26 louispan joined
20:28 danthemyth joined
20:29 jbiesnecker joined
20:29 insitu joined
20:30 jgertm joined
20:31 albel727 joined
20:32 merijn joined
20:33 bollu joined
20:33 carlomagno1 joined
20:34 augur joined
20:35 dcoutts_ joined
20:36 carlosda1 joined
20:39 jbiesnecker joined
20:40 fotonzade joined
20:40 dni joined
20:40 replay joined
20:41 lordcirth joined
20:41 springrain joined
20:42 dni joined
20:43 phyrex1an joined
20:44 jsgrant joined
20:46 <Younder> ANS.1 that protocol defining language.
20:46 <merijn> ASN.1, but close enough ;)
20:47 bjz joined
20:48 <johnw> 1N.SA?
20:48 <johnw> not close enough?
20:48 Berra joined
20:49 <Younder> And yes everything comig out of ITU ilike LDAP is heavy and awkward. But what do you expect fom a comity in some dusty office in the bottom of the UN building. (Yes telecom standards are under the UN ..)
20:49 <merijn> honestly, if you give me the choice between "everything is ASN.1 defined" or "everything is JSON (like now)", I'd kill for the ASN.1 option...
20:51 argent0 joined
20:51 Kundry_Wag joined
20:51 <bennofs> i'm still looking for a json-like (self-describing) format with optional schema support...
20:52 <bennofs> where there is a compiler to generate data types out of the schema
20:52 <bennofs> like a mix of protobuf and json
20:53 <merijn> bennofs: Why JSON-like?
20:53 <merijn> JSON can't even do integers
20:53 <bennofs> well it should be self describing and ascii so it can be inspected easily
20:53 <bennofs> rest idc
20:54 sleffy joined
20:55 <bennofs> and preferably self-delimiting so you can easily send multiple messages on a stream
20:55 takle joined
20:56 contiver joined
20:56 falafel joined
20:56 <joe9> would swagger help?
20:57 <erisco> and it can be concatenated, and there is an empty document
20:57 <bennofs> swagger is in the right direction, but I don't really need to spec a whole API, just a data format
20:58 aglorei joined
20:59 <Younder> Doesn't anyone do EBNF and recursive decent anymore?
21:00 nahra` joined
21:01 ChaiTRex joined
21:01 <EvanR> gross
21:02 yellowj joined
21:02 takle joined
21:02 <glguy> There's a decent amount of recursive descent still.
21:03 tomboy64 joined
21:03 <nbro> erisco: you’re grammar actually has problems…
21:03 <nbro> it doesn’t seem to generate true or true
21:03 <nbro> i.e. conditionals with true without parentheses
21:04 <nbro> i.e. where we have an OR
21:05 <erisco> the parse tree is 1 (5 (8 10)) (2 (5 (8 10)))
21:10 <argent0> hi, to reinstall some project's dependencies 'from scratch' is it enough to remove the .cabal-sandox?
21:10 <erisco> it is very similar to the other grammar
21:10 nahra` joined
21:10 <erisco> I just haven't factored out the common prefix in Exp1 and Exp2
21:10 <nbro> I can derive it manually
21:10 augur joined
21:10 <nbro> but there’s some problem
21:10 <nbro> ...
21:11 <erisco> well the grammar does not have that problem then :P
21:13 <erisco> nbro, are you saying it doesn't work with a parser? there is a difference between parsing implementations
21:13 <erisco> they don't all recognise the whole of CFG
21:13 <erisco> instead they recognise different subsets of it for their own performance reasons
21:14 cur8or joined
21:14 phaji_ joined
21:14 <erisco> if you're using a lookahead-1 parser then the grammar I gave is incompatible because Exp1 and Exp2 have multiple productions with the same prefix
21:15 <erisco> a parser generator may be smart enough to refactor this automatically
21:15 <erisco> but the other solution is to refactor it by hand, which is easy to do
21:16 coot joined
21:17 phaji_ joined
21:17 psi__ joined
21:17 Inneedofhelp joined
21:18 <Inneedofhelp> Jion
21:18 <Inneedofhelp> Anyone here?
21:20 <lambdabot> Hello.
21:20 <Inneedofhelp> Hello
21:20 phaji_ joined
21:21 <erisco> nbro, are you focused on analysing grammars or parsing or what is your task here?
21:21 <nbro> erisco: I would like to parse that grammar
21:21 <erisco> the one I gave?
21:21 <nbro> using recursive descent
21:21 <nbro> my original grammar
21:21 <nbro> but I would like to convert it first to LL(1)
21:22 <erisco> your original grammar is ambiguous and left recursive
21:22 <nbro> erisco: I know
21:22 <Inneedofhelp> Can anyone help?
21:22 <nbro> that’s why I was trying to remove left recursion
21:22 <erisco> we did that
21:22 <nbro> and then ambiguity
21:22 <erisco> also did that
21:22 dni joined
21:23 <Inneedofhelp> Anyone reading this?
21:23 <erisco> Inneedofhelp, ask your question
21:23 <glguy> Inneedofhelp: If you have a question about Haskell, you can ask that.
21:23 <nbro> I created a simple parser, but the problem is that it seems to give always precedence to ands and never to ORs
21:23 <nbro> in other words, things like this "true or true" are not recognized
21:23 <erisco> well I think the intent is to give && higher precedence than ||
21:24 SolitaryCypher joined
21:24 mtesseract joined
21:24 <erisco> not recognising "true or true" is not a problem with precedence
21:24 <nbro> erisco: the intent was to give higher precedence to && than to ||
21:25 abhiroop joined
21:25 Rainb joined
21:25 <erisco> a problem with precedence would be getting the wrong tree for true || true && true for example
21:25 <erisco> you should pastebin your parser so we can take a look
21:26 <Inneedofhelp> I have heard that this group is really helpful in general. I have a list of pages on facebook that spread hate speech. I would need help with reporting them.
21:26 <glguy> Inneedofhelp: Nope, the topic here is Haskell programming.
21:26 <dmwit> Inneedofhelp: This isn't the right place, sorry.
21:26 <nbro> erisco: let me try to have a look at it
21:27 <nbro> one more time
21:27 <Inneedofhelp> Ops where should I be going? Sorry guys.
21:27 rotaerk joined
21:27 <glguy> Inneedofhelp: That's up to you, but this isn't the place to ask
21:27 <Inneedofhelp> Okay, thanks
21:27 <dmwit> Inneedofhelp: Sorry, this also isn't the right place to ask where the right place is. =P
21:28 <Inneedofhelp> Hah, thanks anyway.
21:28 <nbro> I should be reading about parsing, but I have no time
21:28 <nbro> that’s why I’m in this shit situation
21:28 albel727 joined
21:28 <nbro> I’m missing the prerequisites
21:28 marsam joined
21:29 <erisco> parsing is made unnecessarily complicated by the myriad of methods
21:29 <erisco> in university they want to go over all these things like LL and SLR and LR and (1) and (k) and (*) and recursive descent and all the things
21:30 <erisco> which is fine once you first have a grasp of what parsing is even about, in my view, but before then it is putting the cart before the horse
21:30 <srk> it's good to know the difference
21:31 <srk> but I agree it's complicated for start
21:31 <srk> indeed
21:32 jbiesnecker joined
21:33 JoshS joined
21:33 <nbro> I don’t think it’s complicated, it’s just that I need to have time to read chapter on a book and put all the info I’ve been gathering on the web together
21:33 <nbro> but yea, I agree, there are different ways of parsing and this may be confusing for a beginner
21:33 mojjo joined
21:34 kmein joined
21:34 rgucluer joined
21:35 bollu joined
21:35 augur joined
21:37 <erisco> I am sure there are many simple ways to start, but one of them is just learning the two fundamental operators of grammars
21:37 <erisco> if you understand these then the problem of parsing is much clearer
21:38 mandeep joined
21:38 rgucluer left
21:39 <srk> what are these?
21:39 <nbro> yeah, indeed
21:39 <nbro> also, I should have practiced more about grammars in the past…
21:40 _arturo joined
21:40 <erisco> they go by many names, unfortunately, so I'll just give them the Haskell names of <*> and <|>
21:40 subttle_ joined
21:40 albertus1 joined
21:40 <erisco> but you might also call these "followedBy" and "choice"
21:41 <erisco> in grammars they are juxtaposition and | respectively
21:42 <srk> yeah, that's why I'm asking :)
21:42 <erisco> though in grammars you can write | differently by instead writing two productions with ::= for the same non-terminal
21:42 strykerkkd joined
21:42 <erisco> same operations, just written differently
21:42 <srk> right
21:43 <* srk> calls | alternative :D
21:43 <erisco> <*> is the product of two languages, and <|> is the union of two languages
21:44 augur joined
21:44 <erisco> once you see that, then parsing is clearly the problem of searching through this space of products and unions for the parse tree which matches the sentence at hand
21:45 jbiesnecker joined
21:46 <erisco> and you can observe the differences between two parsers just by how they implement these two operations
21:46 louispan joined
21:46 <erisco> I haven't spent much time with bottom-up parsing so I don't know how to relate it yet
21:47 ebzzry joined
21:47 conal joined
21:47 <erisco> the problem it is solving can be described in the same way but I am not familiar with implementations of it
21:49 <srk> are there any automated parser generators that can produce parsers from samples of text?
21:49 <erisco> that sounds dubious
21:49 <srk> would be nice to get like basic structure for attoparsec parser and then just finish it by hand
21:49 <erisco> the simple solution is a production for each sample sentence
21:50 <erisco> so to get beyond that you have to start qualifying what a better grammar looks like
21:50 darjeeling_ joined
21:50 <srk> true
21:51 bollu joined
21:52 hiratara joined
21:53 <erisco> srk, that is an interesting problem though, hm
21:54 <erisco> I don't think it is impossible to qualify but that seems the chief problem
21:54 codesoup joined
21:54 Lyraz joined
21:55 <erisco> given arbitrary sentences of a language (not infinite), can you construct a grammar of that language
21:55 <srk> hmm :)
21:55 <EvanR> one rule for each sentence, brilliant
21:55 <erisco> well, it is going to matter in what order they're enumerated
21:56 <erisco> if I take n samples the enumeration could exercise a new production at n + 1
21:57 <erisco> so you need an enumeration such that at some n you've exhausted all the features of the language
21:57 <erisco> whatever qualifies as a "feature"
21:57 <erisco> and lets assume we can know this n when we're trying to reconstruct the grammar
21:57 <erisco> in practical application where we do not know this n we'd just improve our guess as more samples came in
21:58 <erisco> so the question is somewhere around whether it is possible to enumerate the language in such a way that all the features can be seen by a finite n
21:59 <erisco> or if, like my earlier argument, it is always the case that a new feature is revealed at some m > n
22:00 <erisco> maybe there is some informational argument to it as well, I don't know
22:00 <erisco> only touched on my information theory book
22:00 <erisco> but in some sense you'd only expect a grammar to fit together in so many ways
22:00 <erisco> and beyond that you can only repeat known patterns
22:01 louispan joined
22:02 Itkovian joined
22:02 <erisco> then if you solved this problem it would be interesting to see what happened if you ran it over a few gigabytes of English text, heh
22:03 <erisco> the idea being that perhaps the grammar ceases to change because all patterns are exhausted (which I doubt)
22:03 jbiesnecker joined
22:06 binaryplease joined
22:08 crobbins joined
22:09 ali_bush joined
22:09 ali_bush joined
22:09 niteria_ joined
22:11 <srk> you can download lots of gigs of english text from wikipedia :D
22:11 <srk> it might work as there's a lot of repetition
22:11 <srk> I would probably try to employ some heuristics when doing such thing trying to mimic how would one write such parser by hand
22:11 <srk> counting and grouping
22:11 <srk> would end up with an AI..
22:12 Aruro joined
22:14 <erisco> there is something you have to give up
22:14 <erisco> S ::= a | S
22:14 <erisco> there is nothing we can observe from sentences to suggest this grammar
22:14 <erisco> we can definitely find S ::= a
22:15 <erisco> in fact if our grammar is only constructed of choice (and terminals) then we can clearly re-derive it
22:15 Rodya_ joined
22:16 jsgrant joined
22:16 <erisco> but you can take parse tree samples instead to tackle S ::= a | S
22:16 bjz joined
22:17 <erisco> so for just sentence samples then we can only hope to find a language equivalent grammar
22:20 Koterpillar joined
22:21 a3Dman joined
22:21 a3Dman joined
22:22 SpaceGazebo joined
22:22 {emptyset} joined
22:23 marfoldi joined
22:24 vektorweg1 joined
22:24 abhiroop joined
22:24 mizu_no_oto joined
22:24 iqubic joined
22:24 <iqubic> I have a haskell question.
22:25 <iqubic> I understand that monads are great and all, but what if I have a function that requires two values?
22:25 <iqubic> Like +
22:25 <erisco> I am not sure what the relationship is to monads here, can you provide more detail?
22:26 <iqubic> how do I go about adding one maybe int to another maybe int?
22:26 louispan joined
22:26 <iqubic> To get a third maybe int.
22:26 <erisco> oh, use liftA2 (+)
22:26 <dmj`> jle`: ping ping
22:26 <iqubic> What does liftA2 do?
22:26 <erisco> liftA2 (+) is \x y -> (+) <$> x <*> y
22:26 <dmj`> @src liftA2
22:26 <lambdabot> liftA2 f a b = f <$> a <*> b
22:27 <erisco> you don't even need to get into Monad for this, just Applicative
22:27 <Koterpillar> iqubic: you can think of all functions as taking one argument
22:27 <iqubic> And is there a list of important functions like that? Like Lift, liftM, liftA and so on?
22:27 permagreen joined
22:27 atomi joined
22:27 <Koterpillar> iqubic: and returning a function of one less argument
22:27 <iqubic> Koterpillar: And then I use currying to apply them all?
22:27 <erisco> there is liftA2, liftA3, and a few like that
22:27 <Koterpillar> iqubic: yes
22:27 <iqubic> @src curry
22:27 <lambdabot> curry f x y = f (x, y)
22:28 <Koterpillar> not that
22:28 <erisco> the liftM2 and liftM3 and so on are historic relics
22:28 <iqubic> Really?
22:28 <Koterpillar> liftA2, etc. do exactly that for you
22:28 <iqubic> @src liftA
22:28 <lambdabot> liftA f a = pure f <*> a
22:28 <Cale> iqubic: Or for monads specifically, liftM2. It may be instructive to look at the implementation:
22:28 <Cale> liftM2 f x y = do u <- x; v <- y; return (f u v)
22:28 <iqubic> @src liftA3
22:28 <lambdabot> Source not found. I've seen penguins that can type better than that.
22:28 athan joined
22:29 <geekosaur> the database @src uses is lame (and not always related to what the actual source is)
22:29 <erisco> lambdabot, I own a toaster that can find sources better than you
22:29 <iqubic> What would liftM2 (+) [1,2,3] [1,2,3] return?
22:29 <mmaruseacph2> does it run on Haskell?
22:29 <erisco> iqubic, that is easy to test, isn't it?
22:29 <mmaruseacph2> > liftM2 (+) [1,2,3] [1,2,3]
22:30 <lambdabot> [2,3,4,3,4,5,4,5,6]
22:30 <iqubic> Yeah, it is simple to test
22:30 <iqubic> I have ghci on this computer.
22:30 <lyxia> Or you can ask lambdabot
22:30 <erisco> there is no real point to liftA as that is just fmap
22:31 <iqubic> what do I need to import to get liftM2?
22:31 <mmaruseacph2> I've never used liftA, fmap, <$> and <*> all the way
22:31 <nbro> erisco: how would you implement a recursive descent parser for your grammar: http://lpaste.net/354293? For example, in my implementation, if I try to parse true || true, it doesn’t work, but I guess I’m not really implementing a recursive descent
22:31 <erisco> iqubic, liftM2 is instructive in its definition but it is no longer necessary. use liftA2 instead.
22:31 <lyxia> liftA can be useful to derive Functor
22:31 hiratara joined
22:31 <erisco> iqubic, and that comes from Control.Applicative
22:32 <lyxia> but since there is already an extension for that...
22:32 <erisco> there is no real harm though they should have called it liftA1 perhaps
22:32 <erisco> consistency with the rest of the liftA* family is fine
22:32 <erisco> then liftA0 needs to be $>, heh
22:33 <iqubic> Well, I can't run liftA (+) [1,2,3] [1,2,3]
22:33 sleffy joined
22:33 <iqubic> It's liftA2 that I want
22:33 <erisco> that is a type error, use liftA2
22:33 <lyxia> liftA0 = pure
22:33 Wuzzy joined
22:34 <iqubic> Is there a list of all the functor, applicative, and monad laws out there?
22:34 mib joined
22:34 <dmj`> jle`: have some dank types to show you
22:35 <erisco> iqubic, I have seen a few sites/pages with lists but you can also just look on the doc pages http://hackage.haskell.org/package/base-4.9.1.0/docs/Control-Applicative.html
22:35 <iqubic> Are the laws important to follow?
22:35 <erisco> absolutely
22:35 <iqubic> Why?
22:36 <iqubic> Isn't it just more stuff you have to remember?
22:36 <iqubic> @src <*>
22:36 <lambdabot> Source not found. There are some things that I just don't know.
22:36 <mib> The soul of law
22:36 eschnett joined
22:36 <erisco> iqubic, I assure you we don't just want more stuff to remember
22:36 <iqubic> So what's the point behind the laws?
22:36 <erisco> iqubic, the reason is because if you know a property holds for all instances then you can write generic algorithms on those instances
22:37 <iqubic> Ah.
22:37 <iqubic> Is it a good Idea to try writing my own monad?
22:37 <erisco> and know properties of those algorithms
22:37 <iqubic> Or should I not do that?
22:37 <erisco> as an exercise you can do that, sure
22:38 <lyxia> the laws are quite natural in a way. A non-lawful instance of Monad is like the non-associative addition of IEEE floating point numbers.
22:38 carlosda1 joined
22:38 <iqubic> Is see.
22:38 <iqubic> So should I go ahead and just memorize the laws?
22:39 <erisco> I haven't bothered. I just look them up when it is relevant to me
22:39 <iqubic> @src $
22:39 <lambdabot> f $ x = f x
22:39 <lyxia> It is more difficult to program *without* the laws because we're just so used to them.
22:39 <iqubic> @src .
22:39 <lambdabot> (f . g) x = f (g x)
22:40 <iqubic> Why do Haskell coders like to avoid using parentheses and just go for . and $ ??
22:40 <erisco> they don't. we have different style preferences
22:40 Wuzzy joined
22:41 <mmaruseacph2> sometimes it makes for easier to read code, sometimes it makes for harder to read code
22:41 <iqubic> So, how does the state monad work?
22:41 <iqubic> I've been trying to wrap my head around that for a while now.
22:41 <* erisco> cues Cale
22:42 <erisco> so if you're interested how it works I presume you mean you want to know the implementation, not just how to use it
22:42 Solarion_ joined
22:42 eschnett joined
22:43 <iqubic> erisco, that would be helpful
22:43 <erisco> so, a State is just a function s -> (s, a)
22:43 <erisco> a function that takes a state and returns a new state plus some other value
22:43 <erisco> newtype State s a = State { runState :: s -> (s, a) }
22:44 <erisco> get :: State s a -> State s s see if you can implement this function
22:44 <iqubic> I'm not sure what the s and the a mean in the new type declaration.
22:45 antoine9298 joined
22:45 <erisco> those are type variables
22:45 mmachenry joined
22:45 <iqubic> And can be whatever I want?
22:45 <erisco> as long as they have kind *, yes
22:45 <iqubic> Cools.
22:45 <iqubic> So what does run state do?
22:46 <iqubic> I see it in the newtype declaration.
22:46 <erisco> runState :: State s a -> (s -> (s, a))
22:46 <erisco> it just projects the function
22:46 <jayjam124> https://pastebin.com/50uwN5hH
22:46 <jayjam124> what's a good way to generate new digits in this thread?
22:47 <jayjam124> constantly
22:47 <iqubic> What does that tuple repersent? I assume fst is the output of applying the function to the current state, and scnd is the new state?
22:47 <erisco> the first element is the new state, the second element is some other value
22:48 <erisco> I think the official implementation has this tuple the other way around but it is the same thing
22:48 <iqubic> What other value? the output from running the state?
22:48 troydm joined
22:48 <iqubic> So what should the get function do?
22:48 <iqubic> I want to try implementing that.
22:48 <erisco> well, the idea of having a state is we want to do something else with that state
22:49 a3Dman joined
22:49 mib joined
22:49 <iqubic> Sure, like a stack.
22:49 <erisco> so this "other value" is that something else
22:49 <iqubic> Or a random number with a generator.
22:49 <mib> what's is Haskell?
22:49 <Sornaensis> @google haskell
22:49 <lambdabot> https://www.haskell.org/
22:49 <erisco> mib, Haskell is a functional programming language, see the website ^
22:49 hybrid joined
22:49 <iqubic> I ask again, what is get supposed to do?
22:49 <Sornaensis> :t get
22:50 <lambdabot> MonadState s m => m s
22:50 zero_byte joined
22:50 <erisco> no no, they've made it complicated nowadays Sornaensis :P
22:50 <jayjam124> I guess no-one is able to help me with what I asked earlier then?
22:50 <erisco> iqubic, "get" fetches the current state for us
22:50 <Sornaensis> ; _;
22:50 <erisco> jayjam124, I don't know anything about threading in Haskell, sorry
22:51 <iqubic> Can you giveme the type signature for get? I want to try implementing it.
22:51 ertes joined
22:51 <jayjam124> I just wanna know how to generate random digits
22:51 chin-tastic left
22:51 <Sornaensis> @info State
22:51 <lambdabot> State
22:51 <erisco> I did, but here it is again: get :: State s a -> State s s
22:51 <jayjam124> and put them into a variable of some kind
22:51 <iqubic> I don't understand that type signature.
22:51 <Sornaensis> get looks something like get = State $ \s -> (s, s)
22:52 <erisco> sorry, that is the wrong signature -.-
22:52 <erisco> it is get :: State s s
22:53 <iqubic> right. It returns a 2-tuple with both elements being the new state?
22:53 <mib> what's make Haskell special?
22:53 Kundry_Wag joined
22:53 atomi joined
22:53 Jesin joined
22:53 <erisco> yes
22:53 <iqubic> How would I go about writing my own state monad thing?
22:53 <erisco> then there is put :: a -> State s a
22:54 <Sornaensis> mib: the type system
22:54 <iqubic> What is the implementation of put?
22:55 <erisco> mib, Haskell is lazy, pure, has ADTs, type classes, and excellent type inference, to name a few things
22:55 stevenxl joined
22:55 <iqubic> put a = State $ (s, a)
22:55 <iqubic> Is that right?
22:55 <iqubic> I think it should be, but I don't really know.
22:55 <erisco> not quite, that is a type error
22:55 <stevenxl> Hi everyone. I am trying to understand how foldl works, specifically in comparison with foldr.
22:56 <erisco> remember that State is constructed with a function
22:56 <erisco> State :: (s -> (s, a)) -> State s a
22:57 <erisco> > foldl f z [a,b,c,d] -- stevenxl
22:57 <lambdabot> f (f (f (f z a) b) c) d
22:57 <erisco> > foldr f z [a,b,c,d] -- stevenxl
22:57 <lambdabot> f a (f b (f c (f d z)))
22:57 <iqubic> So I need to do: put s = State $ \s -> (s, s)
22:58 <erisco> put a = State (\s -> (s, a))
22:58 <iqubic> No, because that's the implementation of get.
22:58 <erisco> get = State (\s -> (s, s))
22:58 <Sonolin> ooh how do I get ghci to expand statements like that?
22:58 <erisco> Sonolin, afaik that is a lambdabot feature only
22:58 <Sonolin> ah ok, pretty sweet
22:58 <Koterpillar> no, they are special types
22:58 <Koterpillar> :t f
22:58 <peddie> erisco: Sonolin: isn't that the simple-reflect library?
22:58 <lambdabot> FromExpr a => a
22:59 <Koterpillar> ^
22:59 mada joined
22:59 <Koterpillar> http://hackage.haskell.org/package/simple-reflect-0.3.2/docs/Debug-SimpleReflect.html
22:59 <iqubic> Wait, what is that function doing? the \s -> (s, a)
22:59 <stevenxl> thansk erisco I have to keep looking at it.
22:59 <erisco> well yes, but can you actually type something like that into ghci and get that output Koterpillar?
22:59 <iqubic> In put
22:59 <peddie> erisco: https://hackage.haskell.org/package/simple-reflect-0.3.2/docs/Debug-SimpleReflect.html
22:59 <iqubic> How does the put function work with state monads?
22:59 suls joined
23:00 <erisco> ah, okay, I get it :P
23:00 <Koterpillar> erisco: yes, import that
23:00 <Sonolin> nice thanks Koterpillar
23:00 <erisco> I thought it added something to the front end
23:00 <erisco> but no, it just shadows all your variable names, great
23:00 <Koterpillar> just some clever show instances
23:00 <peddie> oh lol Koterpillar I didn't see you'd sent the same link right before I did :)
23:01 <Koterpillar> peddie: you've pointed to the library before I did :)
23:01 <erisco> iqubic, I should stop trying to explain it as I keep screwing it up :P
23:02 <iqubic> Alright how the heck does the modify function work?
23:02 <peddie> iqubic: I think you can write `modify` if you already have `get` and `put`
23:02 <erisco> put :: s -> State s () and put s' = State (\s -> (s, ()) that is the correct version iqubic, sorry
23:03 <mib> do I get an "exe" file of my code?
23:03 <mib> output exe in Windows?
23:03 <iqubic> peddi, let me try to write modify myself
23:03 <erisco> mib, ghc myprogram.hs -o myprogram.exe
23:04 <stevenxl> erisco: I know that it is possible to define map and filter in foldr.
23:04 <mib> erisco, Okay interesting.
23:04 <stevenxl> Can you suggest a function that I can implement in foldl to test if I am getting it.
23:04 <erisco> mib, so it works the same as if you were compiling C code
23:05 <erisco> stevenxl, sure, define filter and map :P
23:05 <iqubic> So, do I need to pass in a state monad to my modify function for states?
23:05 <stevenxl> those can be done in terms of foldl? Cool. I'll take a shot at it.
23:06 <mib> erisco, is Haskell open source and free?
23:06 coltfred joined
23:06 shterrett joined
23:07 <iqubic> modify s f = put $ get s $ f
23:07 <iqubic> I think that is correct
23:07 <iqubic> where s is a state.
23:07 <iqubic> Not sure how to make that point free though, like put and get are.
23:07 <erisco> mib, yes
23:08 <iqubic> Not sure how to avoid passing in the state to my function, but I think I just wrote modify correctly
23:08 <erisco> iqubic, you can always try it in ghci
23:08 <iqubic> How do I create a state that I can try that on?
23:09 <erisco> use whatever, like Int
23:09 <mib> erisco, last question, what about making GUI application in Windows?
23:09 <erisco> > runState get 5
23:09 <lambdabot> (5,5)
23:09 kuribas left
23:10 <iqubic> why does it return (5,5)?
23:10 <peddie> stevenxl: implement foldr using foldl
23:10 <erisco> mib, there are several packages on Hackage which can assist you in developing different kinds of applications on different platforms
23:10 myfreeweb joined
23:10 <erisco> iqubic, you can evaluate it by hand to find out
23:10 <mib> GUI?
23:10 <iqubic> Can I?
23:10 <erisco> yes, including GUI
23:10 jplasmeier joined
23:10 <nbro> erisco: I think I implemented a recursive descender, but not using your grammar
23:11 <iqubic> @src runState
23:11 <lambdabot> Source not found. My pet ferret can type better than you!
23:11 <erisco> you'll find bindings to many popular GUI libs as well as APIs brewed in Haskell
23:11 ludat joined
23:11 <iqubic> Wait a minute. get = return
23:11 <erisco> iqubic, there is no source to that function, but if there was it would be runState (State f) = f
23:11 <iqubic> I am so stupif
23:11 <mib> Thanks erisco
23:11 <nbro> erisco: I used this grammar: https://pastebin.com/QdhFJWZu
23:12 <erisco> return :: a -> State s a and get :: State s s so no, they are not the same
23:12 <iqubic> right, return makes a stateful computation that always returns a
23:12 <iqubic> or rather always evaluates to a
23:13 <iqubic> How does one make a state?
23:13 <iqubic> With a function?
23:13 <erisco> you make a State with a function, yes
23:13 <erisco> :t State
23:13 <lambdabot> error:
23:13 <lambdabot> • Data constructor not in scope: State
23:13 <lambdabot> • Perhaps you meant one of these:
23:13 <erisco> okay, well it is State :: (a -> (s, a)) -> State s a
23:13 <mib> So, if I developed application in Linux I can compile it in Windows? Do I?
23:13 abhiroop joined
23:13 <erisco> or you can choose State :: (a -> (a, s)) -> State s a
23:14 <erisco> I can't remember which the official one is
23:14 <iqubic> the official one puts the s second.
23:14 <erisco> mib, if you use portable libraries then yes
23:14 <sophiag> anyone have time to help me with a (theoretically) simple list processing function? i have two versions, one that uses pattern matching and another with a list comprehension. i'm having trouble figuring out the (very long list of) errors in the former, but i don't think it does what i want anyway: compare every element in one to every element in the other rather than mapping elements of the same index. here's the code:
23:14 <sophiag> http://lpaste.net/354300
23:14 <iqubic> s is supposed to be the current state of the monad
23:15 <erisco> nbro, sorry I didn't get time to write a parser
23:15 fakenerd_ joined
23:15 m1dnight_ joined
23:16 <iqubic> Why the heck won't GHCI accept "let s = get 5"?
23:16 <nbro> erisco: you don’t have to say sorry, of course
23:16 <nbro> I appreciate all your help ;)
23:17 <nbro> anyway, my implementation is in Scala
23:17 <nbro> if someone wants to see it
23:17 <erisco> iqubic, because get is not a function
23:17 theDon_ joined
23:17 <iqubic> it isn't
23:17 <erisco> you are using it as one by applying it to 5
23:17 <iqubic> Oh.
23:17 nomicflux joined
23:17 <iqubic> So how do I create a state in ghci?
23:18 <erisco> you make any function which unifies with the type s -> (a, s)
23:18 <erisco> then you apply it to the State constructor
23:19 <iqubic> Alright I just tried let x = State $ /s -> (s, s) and got an error saying that State is not in scope.
23:19 <iqubic> What the heck?!?!
23:19 <erisco> that isn't usually what you're going to do though
23:19 crobbins joined
23:19 <iqubic> What do I usually want to do?
23:19 <erisco> instead you'll use get, put, return, and >>=
23:20 <erisco> did you define State?
23:20 BlueRavenGT joined
23:20 markus1209 joined
23:20 naushadh joined
23:20 <iqubic> No. I thought that would be done by importing Control.Monad.State
23:20 markus1219 joined
23:21 nakal_ joined
23:21 <iqubic> Also let x = return $ get 5
23:21 <iqubic> just doesn't work at all either.
23:21 <erisco> try import Control.Monad.Trans.State
23:21 <erisco> you are still using get as a function
23:21 <iqubic> Why do I have to import that?
23:22 <iqubic> How is get supposed to be used?
23:22 <erisco> because State is defined in transformers
23:22 <erisco> Control.Monad.State is from mtl iirc and that is old
23:22 a3Dman joined
23:22 fizbin joined
23:23 eacameron joined
23:23 <iqubic> How does one correctly use get?
23:23 <erisco> well, you use it to retrieve the current state
23:23 <erisco> get :: State s s
23:24 <erisco> so you use it like you'd use a State s s
23:24 <pacak> :t get
23:24 <lambdabot> MonadState s m => m s
23:24 <erisco> I gave the trivial example of runState get 5
23:24 jmcarthur joined
23:24 <iqubic> And that doesn't use get as a function???
23:24 jplasmeier joined
23:24 <erisco> no, because it is not a function
23:24 dan_f joined
23:25 <iqubic> So what is get 5 doing?
23:25 <erisco> runState get 5 = (runState get) 5
23:25 <pacak> :t runState
23:25 <lambdabot> State s a -> s -> (a, s)
23:25 <pacak> 5 - s in this case
23:25 <pacak> > runState get 5
23:25 <lambdabot> (5,5)
23:25 <iqubic> Ah. so get is a state???
23:25 <erisco> yes
23:25 <pacak> > runState (get >> return ()) 5
23:25 <lambdabot> ((),5)
23:26 <erisco> get :: State s s, that means it has the type State s s, so it is a State
23:26 <pacak> > runState (get >>= return . show) 5
23:26 <lambdabot> ("5",5)
23:26 <erisco> I think what you really want is someone to take you from start to end of what State is about and how it works
23:26 mmachenry joined
23:26 <erisco> I'm just giving an overview of the involved functions
23:27 <Sornaensis> > evalState (modify (+2) >> get) 5
23:27 <iqubic> I would like that.
23:27 <lambdabot> 7
23:27 <erisco> usually Cale does that... I don't know if I have the energy
23:27 <iqubic> Where is Cale now?
23:27 <erisco> it doesn't sound like you are confident with simpler concepts yet
23:27 <iqubic> Well I know what a monad is.
23:28 <lapinot> i just asked on #ocaml how they would compare the feature sets of ocaml and haskell so to complete the debate i think i should bring it over here too
23:29 <iqubic> Can I see the implementation of put once more?
23:29 <iqubic> I think that will help me a lot
23:29 <erisco> you can read some on it here https://wiki.haskell.org/State_Monad
23:29 <peddie> iqubic: can you figure out the implementation of `put` from its type?
23:30 <robkennedy> ?src put
23:30 <lambdabot> Source not found. I feel much better now.
23:30 <erisco> put s' = State (\s -> ((), s'))
23:31 <iqubic> Great and get is: get s' = (\s -> (s, s))
23:31 <iqubic> Is that right?
23:31 <iqubic> I think that would be right.
23:31 <erisco> close, but no
23:31 <lapinot> (some conclusion was that haskell typeclass has problems with uniqueness problem of instances and orphan instances)
23:31 <lyxia> lapinot: https://www.reddit.com/r/ocaml/comments/3ifwe9/what_are_ocamlers_critiques_of_haskell/
23:31 <erisco> remember get :: State s s
23:31 <Sonolin> get has no parameter..
23:32 <iqubic> get = (\s -> (s,s))
23:32 <iqubic> is that correct?
23:32 <erisco> iqubic, you may know what a monad is but it seems you have to learn more about types first
23:32 <erisco> iqubic, that will make this easier, as the implementations of put and get are actually determined by the type alone
23:32 <iqubic> What more do I need ot know about types?
23:32 alecbrick joined
23:32 sigmundv joined
23:33 <erisco> well it should be clear that get s' = (\s -> (s, s)) cannot possibly be right because that wouldn't have the type State s s
23:33 <iqubic> Yeah, I see that now.
23:33 <lyxia> lapinot: I like the amount of type-level magic you can do in Haskell, but this can make APIs inaccessible to newcomers.
23:33 DataComputist joined
23:33 <robkennedy> ericso: do you know if a State Monad computation that doesn't call get or put simplies out the state?
23:34 featherlessbiped joined
23:34 <erisco> okay, but, you're either wildly guessing or you need to practice more on these basics, because that should have been obvious to you
23:34 ebzzry joined
23:34 <naushadh> hello #haskell, any persistent/mysql devs here?
23:34 <iqubic> Alright what's the type of modify?
23:35 <robkennedy> I've used persistent with tsql, may be able to help
23:35 <iqubic> I want to try writing the implementation for that.
23:35 <erisco> modify :: (s -> s) -> State s ()
23:36 <iqubic> So it takes a single function of type (s -> s) and returns a state.
23:36 <iqubic> Is that correct?
23:37 <erisco> robkennedy, I am not sure what optimisations GHC can make here, but you can look at the Core output if you're inclined
23:37 <erisco> yes
23:37 <lapinot> lyxia: thanks, that's actually what i looked for!
23:37 <iqubic> Alright, I have no idea what the implementation of modify should be.
23:37 <iqubic> I know that it might be super obvious, but I don't know it.
23:38 <erisco> okay, well, this time it is not entirely determined by the type what we're supposed to do here, but there is an intention to it
23:38 <iqubic> Oh.
23:38 <erisco> the intention is that we apply the function to the state to get a new state
23:38 <erisco> and apply it just once
23:39 <iqubic> But what happens to the other value in the state?
23:39 carlosda1 joined
23:39 <erisco> well, you tell me what that value is
23:39 <iqubic> Is it () ?
23:39 <erisco> yes
23:39 mekeor joined
23:40 <iqubic> Modify f = (\s -> (f s, ()))
23:40 <iqubic> That has the right type.
23:40 <naushadh> robkennedy: I've forked persistent-mysql to create persistent-mysql-haskell. https://hackage.haskell.org/package/persistent-mysql-haskell
23:40 <erisco> not quite, but that is just about it. it is modify f = State (\s -> (f s, ()))
23:40 Kundry_Wag joined
23:40 <naushadh> robkennedy: I'm looking for any kind of feedback
23:41 lambda-11235 joined
23:42 <iqubic> Now I'm having trouble getting GHCi to accept that as a valid function.
23:42 <erisco> if we have put and get defined we can also define it as State (get >>= put . f)
23:42 <iqubic> Ah, yes. Yes you can just do that.
23:42 <erisco> tell me what the error is
23:43 <Sonolin> state is second part of tuple by default guys
23:43 louispan joined
23:43 <erisco> Sonolin, I'll never remember it :P
23:43 <iqubic> But really, GHCi should be accpeting "let modify' f = StateT (\s -> (f s, ()))
23:43 <iqubic> But it doesn't
23:44 <erisco> well try swapping the tuple as Sonolin pointed out
23:44 <iqubic> I will.
23:44 <Sonolin> well iqubic StateT is a monad transformer, that could be your issue
23:44 <iqubic> Oh.
23:45 eschnett joined
23:45 <iqubic> But "State" is not in scope.
23:45 <Sonolin> but you should be able to use either "State" constructor (newer) or "state" (older)
23:45 <erisco> yes, it has become fancier and now we have StateT instead
23:46 Swizec joined
23:46 <iqubic> "State" is not in scope, even though I have Control.Monad.Trans.State imported
23:46 <erisco> yes, use the lowercase "state"
23:46 <iqubic> Why?
23:46 <erisco> State is defined as a type alias of StateT
23:46 <erisco> look here http://hackage.haskell.org/package/transformers-0.5.4.0/docs/Control-Monad-Trans-State-Lazy.html
23:46 <iqubic> But StateT is in scope, and State is not
23:47 <Sonolin> try :i State iqubic
23:47 <Sonolin> it should show you the alias
23:47 <erisco> State is not a value
23:47 <iqubic> It does show me that alias.
23:47 markasoftware joined
23:47 <iqubic> Why won't GHCi use that alias?
23:47 <erisco> in the old days we had newtype State s a = State { runState :: s -> (a, s) } but this has been discarded in favour of transformers
23:48 <erisco> so now there is the more generic StateT on which the old State can be defined
23:48 <erisco> but we no longer have the State type and State constructor
23:48 <erisco> instead we have a State alias and a "state" function which acts as the constructor
23:48 <iqubic> So if I want to use a State constructor what should I do?
23:48 <erisco> it does use the alias
23:48 zv joined
23:48 <iqubic> Not for me.
23:49 <erisco> there is a difference between types and values! there is "State" the type constructor and not "State" the data constructor
23:49 jbiesnecker joined
23:49 <erisco> I mean "State" the type alias
23:49 <iqubic> Ah. Gotcha
23:49 <erisco> type State s = StateT s Identity
23:49 <iqubic> So if I want to write a function modify' what would I do?
23:50 <erisco> so you can use State in types, but there is nothing of the same name defined as a value
23:50 moth joined
23:50 <erisco> use the function called "state"
23:50 <iqubic> So there's no value constructor called "State"
23:50 <erisco> it works the same as the old data constructor named "State"
23:50 <iqubic> Isn't the lowercase version old and outdated?
23:51 <erisco> no, it is the other way around
23:51 <iqubic> Ah. I see
23:53 <robkennedy> naushadu: sorry, I don't think my usecase for ditching persistent is addressed by these sorts of changes
23:54 obadz joined
23:54 <iqubic> Why does "print $ runState get 5" work but not "print $ runState put 5"
23:54 <erisco> look at the types
23:56 YongJoon joined
23:56 <sophiag> ok, trying this again. anyone free to look at some list processing code? i'm mainly struggling with how to compare every element of two lists (rather than just mapping between those at the same indices) using pattern matching, but also have a number of errors in what i've written so far that i think are related to the data types i'm using: http://lpaste.net/354300
23:57 <iqubic> not sure how looking at the types helps me.
23:57 <erisco> the reason it "does not work" is because it is a type error, and so looking at the types will inform you why it is a type error
23:58 <jayjam124> is anyone good at concurrency within Haskell here? I may as well ask because if nobody is I won't ask the question
23:58 <iqubic> Oh, I see the type error now.
23:58 <jayjam124> I mean someone must be here but it depends who is on at the time
23:58 <iqubic> How is put supposed to be used?
23:58 ebzzry joined
23:59 <erisco> you apply it to something, the new state you want to set
23:59 <erisco> > runState (put 2) 1
23:59 <sophiag> iqubic: put is the opposite of get
23:59 <lambdabot> ((),2)
23:59 <robkennedy> naushadu: looking through the package, I'm wondering about the heirarchy, though. I left persistent for it's higher level opinions, but kept with HDBC-odbc as a low-level. I would love to replace that low-level for some translated version of what you've provided, but to do so I'd apparently be back in persistent land.