<    March 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 31
00:00 louispan joined
00:00 <ana_> ?src update
00:00 <lambdabot> Source not found. Where did you learn to type?
00:00 <ana_> ?src ($)
00:00 <glguy> ana_: You can play with lambdabot with private messages, /query lambdabot and /msg lambdabot
00:00 <ana_> ?src ($)
00:00 <lambdabot> f $ x = f x
00:01 <ana_> ?src (update)
00:01 <lambdabot> Source not found. Have you considered trying to match wits with a rutabaga?
00:01 <ana_> ?src (.)
00:01 <lambdabot> (f . g) x = f (g x)
00:01 <geekosaur> it's not a comprehensive database
00:01 <ana_> ?src (Data.Sequence.update)
00:02 JeanCarloMachado joined
00:03 peterbec` joined
00:04 Kundry_Wag joined
00:05 dan_f joined
00:05 MindlessDrone joined
00:05 <ana_> Hi, How to find source code for update function in Data.Sequence
00:05 <geekosaur> @where hoogle
00:05 <lambdabot> http://haskell.org/hoogle http://fpcomplete.com/hoogle – See also Hayoo, which searches more packages: http://hayoo.fh-wedel.de/
00:05 <geekosaur> @where hayoo
00:05 <lambdabot> http://hayoo.fh-wedel.de/ -- See also Hoogle: http://haskell.org/hoogle http://fpcomplete.com/hoogle
00:06 <ana_> Ok. Thanks I am checking nw.
00:07 superphunthyme joined
00:08 dfeuer joined
00:09 tom7942 joined
00:11 Rodya_ joined
00:11 <lpaste_> robkennedy pasted “Assert universal constraint?” at http://lpaste.net/354080
00:12 <robkennedy> Is there any way to assert that decompose does not need a constraint?
00:12 <lyxia> nope
00:12 plutoniix joined
00:14 plutoniix joined
00:15 crobbins joined
00:15 kosekilokai joined
00:16 louispan joined
00:17 <robkennedy> Is that some sort of `A V -A /= True` logic?
00:18 juhp_ joined
00:19 tromp joined
00:19 Welkin joined
00:19 Rodya_ joined
00:20 <lyxia> I don't think so. It's due to 1) the open world assumption of type classes 2) preserving parametricity guarantees.
00:21 <bitemyapp> ph88: if you have questions about Bloodhound, ask them on Github. IRC is too synchronous.
00:21 nomicflux joined
00:22 <Welkin> Bloodhound?
00:22 <Welkin> bitemyapp: I haven't seen you around in a long time
00:23 <lyxia> robkennedy: a more practical concern is that type class constraints get desugared to an additional parameter. It becomes more difficult to do that if the constraint is not there.
00:23 <Welkin> robkennedy: I can't look at your nick without thinking about the kennedy family; rob kennedy was assassinated
00:24 mizu_no_oto joined
00:25 <bitemyapp> Welkin: yeah it's great
00:25 <lyxia> robkennedy: Parametricity tells you that, ignoring bottoms, the type forall a. a -> a is only inhabited by id. You wouldn't be able to say this if you could erase type classes like that, even if every concrete type had an instance.
00:25 ebzzry joined
00:27 JuanDaugherty joined
00:28 louispan joined
00:28 coot joined
00:28 <Welkin> bitemyapp: even though I have never used elasticsearch, I might want fulltext search in the future, so I starred it
00:29 <dmwit> robkennedy: import GHC.Prim, then ask ghci `:kind! CheckP Any`
00:29 <dmwit> robkennedy: (this is a sad situation)
00:31 _sras_ joined
00:31 <dmwit> `Any` plays approximately the same role at the type level that `undefined` plays at the value level.
00:31 vaibhavsagar joined
00:31 <sophiag> question about haskell asts: if i parse one into type Exp i can match for Literals, but not QOps although they seem to be at the same level. am i missing something and there's actually an intermediate type?
00:31 <_sras_> Why doesn't this standalone deriving work? http://lpaste.net/354081
00:32 hhf joined
00:32 loorke joined
00:33 <loorke> Hello. Can you explain me why haskell isn't popular?
00:33 <sophiag> loorke: it isn't?
00:34 JeanCarloMachado joined
00:34 <Welkin> loorke: type /quit
00:34 <Koterpillar> Welkin: that's not a good way of explaining
00:34 <dmwit> _sras_: Looks like the swagger library implements a custom error when you try to make a ByteString instance of `ToParamSchema` (presumably needed to make an instance for your type).
00:35 <Koterpillar> loorke: exercising every day isn't popular either
00:35 <dmwit> _sras_: I'm not sure whether the library also offers the newtypes it proposes or whether it's expecting you to write your own, but the advice seems pretty clear cut to me.
00:36 <loorke> Koterpillar: Hmm
00:36 andyhuzhill joined
00:36 <_sras_> dmwit: So it is coming from the Generic instance of ToParmSchema, right?
00:36 <loorke> Welkin: Thank you, you have explained me :-)
00:37 <sophiag> lol
00:37 <dmwit> _sras_: In fact, I think you have left off part of the error. From source-diving, I see an additional sentence: "Consider using byteParamSchema or binaryParamSchema templates.".
00:38 wtetzner joined
00:38 <dmwit> _sras_: So this almost certainly explains the issue completely. You need to carefully choose one or the other, and this error is pointing that out so it doesn't quietly choose the wrong one for you.
00:38 <robkennedy> dmwit: could you spoil what `:kind! CheckP Any` gets?
00:39 <_sras_> dmwit: Yes. But what does it mean. Where should I use byteParamSchema or binarayParamSchema?
00:39 <dmwit> robkennedy: `CheckP Any = CheckP Any`
00:39 u7brentt joined
00:39 <dmwit> _sras_: In your instance of `ToParamSchema Foo`, where `Foo` is your newtype wrapper around `ByteString`. At a guess. I have never used swagger.
00:40 <dmwit> robkennedy: Compare `CheckP (P Int Int) = IsP` and `CheckP [Int] = NotP`.
00:40 <_sras_> dmwit: Does this mean I have to implement the instance manually?
00:41 <dmwit> _sras_: You can browse the documentation for such an instance as easily as I can...
00:41 bungoman joined
00:41 <dmwit> _sras_: Perhaps your question is whether you must not use `Generic` to get the instance for your top-level type.
00:41 <_sras_> dmwit: Sure sure. Thankyou.
00:42 <dmwit> _sras_: In which case I believe the answer to that is that you should still be able to use `Generic`.
00:46 <sophiag> dmwit: do you know much about haskell AST types? i'm trying to match for operators (so type QOp), but getting an error making it seem like the _input_ type (Exp) is wrong even though it's in the same infix expression i can match Literals with
00:47 nomicflux joined
00:48 <dmwit> sophiag: You know the drill. Cut down your example to the smallest piece of code that shows the problem, then throw it up on lpaste or hpaste or whatever's in fashion these todays together with the full error you get.
00:48 <dmwit> ?paste
00:48 <lambdabot> Haskell pastebin: http://lpaste.net/
00:48 <dmwit> lpaste, apparently
00:49 <dmwit> English is much too imprecise for these kinds of questions.
00:49 <sophiag> ha, fair. i always think i can verbally explain it well enough, but most of the time even a past results in miscommunication
00:50 gugah joined
00:52 <sophiag> dmwit: if you'd be so kind: http://lpaste.net/354083
00:52 jdt_ joined
00:53 <dmwit> sophiag: `Lit` is a constructor for `Exp`; `QVarOp` is a constructor for `QOp`.
00:54 AdolphusGustavus joined
00:55 <sophiag> oh...is there somewhere that lists all these? all i've found is this: https://hackage.haskell.org/package/haskell-src-exts-1.19.1/docs/Language-Haskell-Exts-Build.html
00:55 <dmwit> https://hackage.haskell.org/package/haskell-src-exts-1.19.1/docs/Language-Haskell-Exts-Syntax.html
00:56 hybris_ joined
00:56 <dmwit> You can discover this for yourself by visiting Hoogle and typing in `Exp`, then clicking the appropriate result.
00:57 <sophiag> it's just not entirely clear from the haddock docs
00:59 uglyfigurine joined
00:59 uglyfigurine joined
01:00 <sophiag> anyway, the confusing part for me is that i'm actually trying to parse both a Literal and QOp out of an Exp since Lambda is a constructor for Exp. so i'm not sure what type signature to use for that function...it needs to start with Exp ->
01:04 <dmwit> What is "it" in "it's not clear from the haddocks"?
01:05 tim joined
01:05 <sophiag> dmwit: do you see what i mean? that third field you can see in the Lambda AST is of type Exp and that's the argument to my function in both cases. but then the field i actually want to match for now is of type QOp
01:05 <dmwit> What is a field? Why do you believe the field you actually want to match for is of type `QOp`?
01:06 <sophiag> the Lambda constructor takes three arguments
01:06 <sophiag> i'm only dealing with the third
01:06 u7brentt left
01:06 <dmwit> Okay so far.
01:07 raycoll joined
01:07 <sophiag> i want to match for operators...and i believe they're of type QOp because they're wrapped in one of its constructors: QVarOp
01:07 <dmwit> Perhaps you should look at what value is in the third argument of your sample value for further guidance.
01:08 <dmwit> (Hint: it isn't `QVarOp`.)
01:08 <sophiag> Symbol?
01:08 <sophiag> that's of type Name
01:08 <dmwit> Sorry, this time I was the one that was imprecise. Look in the third argument to `Lambda` in your sample value.
01:08 yogsototh joined
01:09 <sophiag> oh, that's of type Exp
01:10 <sophiag> "InfixApp l (Exp l) (QOp l) (Exp l)"
01:10 <sophiag> that's the third argument to Lambda
01:10 <* dmwit> nods agreeably
01:11 Supersonic112_ joined
01:11 dolio joined
01:13 tim left
01:13 tput joined
01:13 <sophiag> i tried using "(Lambda _ _ (_ expr _)" as my argument, but that didn't help...
01:14 splanch joined
01:14 Shatnerz0 joined
01:14 [k- joined
01:14 <dmwit> Hm. Have you done a Haskell tutorial that covers the syntax of data types and pattern matching?
01:15 <sophiag> yes, but this is a particularly complicated case
01:15 eacameron joined
01:16 <sophiag> i think i'm thrown off by the fact that i didn't need to unwrap InfixApp in order to match for Lit because the type signature was the same as the whole Lambda
01:17 <dmwit> huh?
01:17 <sophiag> you saw the function where i matched for the Literal types, right?
01:17 <dmwit> `InfixApp` and `Lit` are just different constructors. They're both constructors for the `Exp` type.
01:18 cpup joined
01:18 <dmwit> The fact that `Lambda` is also a constructor for the `Exp` type isn't really relevant, I don't think.
01:18 <sophiag> oh ok
01:19 <sophiag> because i'm already pulling out InfixApp in the argument?
01:19 CurryWurst joined
01:19 nathyong joined
01:19 <dmwit> You ask "because X?". But normally such questions are of the form "is Y true because X?" or similar. What is Y?
01:20 <sophiag> although if i try to have it infer type it guesses Exp
01:20 splanch joined
01:20 <sophiag> Y is of type Name
01:20 <dmwit> "of type Name because I'm already pulling out InfixApp in the argument" doesn't appear to be a sensible question to me.
01:21 noan joined
01:21 MitchellSalad joined
01:21 <dmwit> I kind of want to help, but I'm having a very difficult time understanding what your questions are. I think there's some pretty fundamental (and likely very simple) confusion here that should be easy to clear up, but it's tricky for me to spot what the right guidance is.
01:22 peterbec` joined
01:22 <sophiag> well, Lambda is of type Exp...i pull out another type Exp from it...and then I'm trying to match on type Name inside type QOp
01:23 <dmwit> First of all: you don't match on types. You match on values.
01:23 <monochrom> and data constructors.
01:23 FreeBirdLjj joined
01:23 <sophiag> yes, but you asked what my question is. my qustion is "what's the appropriate type signature?"
01:23 <dmwit> Second: `Lambda` is not of type `Exp`. `Lambda` is a constructor for `Exp`, but its type is `l -> [Pat l] -> Exp l -> Exp l`.
01:24 alx741 joined
01:25 <sophiag> yes, i got that wrong. it's InfixApp that's a constructor for Exp
01:25 edvorg joined
01:25 <sophiag> or rather [Exp 1] -> [QOp 1] -> [Exp 1]
01:25 ExpHP joined
01:26 <dmwit> (Those should be ells, not ones.)
01:26 <sophiag> ah, thanks
01:26 louispan joined
01:27 <dmwit> I suspect the type signature you wrote for `parseSymbol` is mostly fine.
01:27 <nathyong> I'm trying to run some tests through tasty-quickcheck, and timeouts don't appear to be working for me
01:27 <nathyong> I'll paste a small sample -- it only happens when I include the offending function as part of another module
01:28 Scip joined
01:29 <Conjecture> Thanks glguy. Sorry I took _so_ long
01:30 JoshS joined
01:30 danthemyth joined
01:31 <nathyong> https://gist.github.com/anonymous/182b78c18974b5030c189a0e3b9a50af
01:31 darjeeling_ joined
01:32 <nathyong> Clearly the function will never terminate, and should trigger tasty's timeout
01:32 JeanCarloMachado joined
01:32 <nathyong> Running with runghc works as expected, but compiling and running the binary continues running forever
01:33 zcourts_ joined
01:33 <nathyong> Anyone have any idea why this is happening?
01:33 CurryWurst joined
01:36 leat joined
01:36 np356 joined
01:38 <lyxia> It's timing out properly here.
01:38 mkoenig joined
01:38 event_null joined
01:38 <lyxia> nathyong: what versions of tasty/tasty-hunit are you using
01:38 <np356> hello folks, I'm trying to learn conduit and I came across a strange syntax that I have not seen before
01:38 <np356> http://lpaste.net/7230414809584369664
01:39 <np356> specifically lines 11 -> 16
01:39 danthemyth joined
01:39 <Koterpillar> which bit?
01:39 <nathyong> lyxia: I'm using the version in stackage lts-8.6
01:39 <np356> so I tried to break it down in a smaller function (lines 20-23) but it does nit compile
01:39 <np356> I never saw "let x = do ... in x"
01:39 <nathyong> also I'm on OSX 10.11
01:39 <Koterpillar> > let a = 1:[a] in a
01:39 <np356> can someone please explain for me wtf is this syntax?
01:40 <lambdabot> error:
01:40 <lambdabot> • Occurs check: cannot construct the infinite type: a1 ~ [a1]
01:40 <lambdabot> • In the expression: 1 : [a]
01:40 <Koterpillar> > let a = 1:a in a
01:40 <geekosaur> do produces an expression like any other
01:40 <lambdabot> [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1...
01:40 <nathyong> Should be the latest one, I think.
01:40 <Koterpillar> np356: recursion!
01:40 <geekosaur> it's just a way to make a local recursive definition that happens to be an IO action
01:40 <Koterpillar> np356: what error does your rewrite give?
01:40 <np356> but why it doesn't compile in the second isolated case? (lines 20-23)
01:40 <np356> it should keep printing "boom" forever
01:40 <np356> right?
01:41 <geekosaur> yes, but that means it never produces IO ()
01:41 <np356> "Parse error: Last statement in a do-block must be an expression"
01:41 <lyxia> np356: you must indent past the let
01:41 <np356> lyxia, on line 21?
01:41 <lyxia> yes
01:41 <geekosaur> however what lyxia says is correct. let alos uses layout
01:42 robertkennedy joined
01:42 <nathyong> hmm I'll come back to this in an hour or so
01:42 <geekosaur> and line 22 is indented for the let bindings, not for the do
01:42 <lyxia> nathyong: it's still working here on the same resolver
01:42 <nathyong> lyxia: I compiled with `stack exec ghc A.hs && ./A`, did you do so as well?
01:43 <geekosaur> specifically any line that is part of the 'do' has to be indented farther than the 'loop' on line 21
01:43 <np356> worked, thank you. print needed to be indented past the beginning of "loop"
01:43 <np356> I thought that shenanigans like these exist only in python...
01:43 <Koterpillar> nathyong: shouldn't that be stack runghc?
01:43 gugah joined
01:43 <nathyong> Koterpillar: it works with runghc, but doesn't work if I compile it and then run the binary.
01:43 <geekosaur> np356, you can have multiple bindings in a let
01:44 <lyxia> nathyong: that's what I did
01:44 <nathyong> gee
01:44 <nathyong> lyxia: OS and setup?
01:44 <lpaste_> geekosaur annotated “No title” with “let uses layout too” at http://lpaste.net/7230414809584369664#a354086
01:45 nighty- joined
01:45 <lyxia> nathyong: I'm on Arch
01:45 <Koterpillar> nathyong: stack exec falls back to $PATH, e.g. 'stack exec ls'
01:45 <Koterpillar> nathyong: 'stack exec ghc' /= 'stack ghc'
01:45 <nathyong> doesn't work with that either
01:45 <nathyong> I'll test on a Linux system later
01:46 louispan joined
01:46 <lyxia> I think stack exec ghc is special cased
01:46 <nathyong> lyxia: Koterpillar thanks for your help so far
01:46 chenshen joined
01:46 <lyxia> or stack exec is setting up some environment variables
01:47 <geekosaur> it does, to override the package path
01:47 <geekosaur> it also adds various things to $PATH
01:47 <geekosaur> I would be surprised if `stack ghc` were anything but a convenience frontend for `stack exec ghc`
01:47 CurryWurst joined
01:47 chlong joined
01:48 <Koterpillar> but which ghc?
01:49 mkoenig joined
01:49 <Koterpillar> ah, PATH is set, so it'll be the right one
01:50 mac10688 joined
01:52 JeanCarloMachado joined
01:54 <MarcelineVQ> I agree with Koterpillar, stack ghci isn't stack exec -- ghci so it's hard to say without looking closer whether stack ghc is stack exec -- ghc
01:56 <lyxia> "You can use stack exec ghc or stack exec runghc for that. As simple helpers, we also provide the stack ghc and stack runghc commands, for these common cases." stack user guide
01:56 <lyxia> ghci is special however
01:57 CurryWurst joined
01:57 <geekosaur> ^ stack ghci's inspiration is cabal repl which preloads your project into ghci. arguably the problem is stack calling it ghci instead of repl...
01:57 FreeBirdLjj joined
01:58 <MarcelineVQ> ah, well tbf it is both ghci and repl with the same code to parse either
01:58 <geekosaur> repl was added later for cabal-install compatibility, I think?
01:58 <MarcelineVQ> with a naming bias towards ghci internally
01:58 arctictern joined
01:59 <geekosaur> I recall early stack not having repl, just ghci
02:00 hucksy joined
02:01 event_null joined
02:01 Jaxan joined
02:02 zhulikas joined
02:03 <Welkin> Didn't one of you say you used webpack with purescript?
02:03 pera joined
02:04 crobbins joined
02:04 <robertkennedy> So does any function `f :: forall a. a -> T` need a constraint on a?
02:05 <tobiasBora> Hello,
02:05 <tobiasBora> Haskell is getting really weird on a Centos 6.8 server
02:05 <tobiasBora> For example, if I do
02:05 <Welkin> why are you running haskell on a server?
02:05 <MarcelineVQ> iiuc then code-wise I see here that stack ghc really is stack exec ghc just with the opts specialized to be ghc specific
02:05 jshjsh joined
02:05 <tobiasBora> putStrLn $ "User : " ++ getName ++ " is not existing"
02:05 <Welkin> only run the binary executables on your server
02:05 <Welkin> develop locally
02:06 <tobiasBora> Welkin: It's till worse
02:06 <tobiasBora> Welkin: The executable gives errors like /lib64/libc.so.6: version `GLIBC_2.14' not found (required by prog)
02:06 <tobiasBora> (I'm developing on debian sid, maybe that's why)
02:07 <tobiasBora> so the line : putStrLn $ "User : " ++ getName ++ " is not existing"
02:07 <geekosaur> yes
02:07 <tobiasBora> does not gives the same result as
02:07 <geekosaur> debian sid will have a much more recent glibc than centos 6
02:07 <tobiasBora> putStrLn "User"; putStrLn getName; putStrLn " is not existing"
02:08 <geekosaur> that would be expected?
02:08 <Welkin> lol
02:08 <tobiasBora> indeed, the first version displayes only " is not existing", and put "getName" partly AFTER the string "is not existing"
02:08 <geekosaur> uh
02:08 Goplat joined
02:08 <geekosaur> stty sane
02:09 <tobiasBora> geekosaur: hum sorry, I mean instead of reading "User toto is not existing", I have something like "not existing.to"
02:09 <tobiasBora> I'm using ssh
02:09 <tobiasBora> and multicore
02:09 <tobiasBora> but the version works great on my debian
02:09 <tobiasBora> and actually
02:09 <tobiasBora> it should not even say "user not existing", because the user is existing...
02:10 <tobiasBora> So there are really strange things that happened, and I can't explain it. It's dark magic!
02:10 <geekosaur> actually I want to see that output sent to a file, then cat -v. sounds like something has a \r embedded
02:10 <geekosaur> ... did you read that username from the terminal?
02:10 Gurkenglas_ joined
02:10 <Welkin> LOL
02:10 tortal joined
02:10 Kundry_Wag joined
02:11 <monochrom> Trust only hex editors. Text editors lie.
02:11 <geekosaur> if you did then you definitely want to run 'stty sane' and try it again, because your terminal may be in raw mode
02:11 <monochrom> Well, text editors try to protect you from the ugly truth.
02:11 <tobiasBora> geekosaur: I read the username from a file, maybe with DOS lines
02:11 <geekosaur> DOS lines would do it
02:11 <geekosaur> you will need to strip trailing '\r'
02:12 <tobiasBora> I'll try to remove them
02:12 <geekosaur> so it's looking for toto\r (control-M) and outputting the \r also in the error message
02:12 CurryWurst joined
02:12 <Welkin> toto?
02:12 <Welkin> toto\ro ?
02:12 <geekosaur> presumably because the program's not in Kansas any more
02:12 <monochrom> heh
02:12 jayshua joined
02:14 <tobiasBora> geekosaur: Hum you are my god
02:15 <tobiasBora> I convert the file in unix and it works great
02:15 <geekosaur> man, if that's all it takes to become a god...
02:15 <robertkennedy> Sorry, does getName have type string?
02:15 <tobiasBora> I would spend something like 2 month to debug that!
02:15 <sophiag> dmwit: sorry, i got interrupted. what i gathered is that i need to extract the middle term in that function before i try to match for the "+" symbol whereas that wasn't necessary when it was the third term since it was the same type as the whole thing?
02:15 <tobiasBora> robertkennedy: yes
02:16 <geekosaur> embedded carriage returrns are a think you learn to recognize from that kind of overprinted output
02:16 <geekosaur> *thing
02:16 UserJosh joined
02:17 <sophiag> or if anyone else wants to take a look...i'm trying to figure out this error parsing the AST of a lambda: http://lpaste.net/354083
02:19 peterbecich joined
02:21 davesq joined
02:21 <tobiasBora> geekosaur: What is \r supposed to do on linux terminal?
02:21 <tobiasBora> I though that it was like nothing
02:21 <robertkennedy> My earlier statement that `f :: a -> T` requires a constraint might be disproved by `f = maybe 0 id . listToMaybe . toBits` if toBits didn't have a constraint
02:21 exferenceBot joined
02:21 <tobiasBora> but it seems it's not...
02:22 <robertkennedy> *maybe False id
02:22 <geekosaur> tobiasBora, unixlikes convert \r to \n on input and \n to \r\n on output
02:22 <geekosaur> which is why the "stty sane" I suggested; it restores that behavior, among others
02:23 <monochrom> \r tells the cursor to go back to the left edge of the terminal.
02:23 <tobiasBora> But why does the "User" has been deleted if \r is only a newline?
02:23 eacameron joined
02:23 <geekosaur> (line oriented programs behave oddly with `stty -icrnl`. and the output is stairstepped without `stty onlcr`
02:23 <geekosaur> tobiasBora, \r reset tho the beginning of the same line, then the rest of the message overwrote it
02:23 peterbec` joined
02:24 <geekosaur> *to the
02:24 JeanCarloMachado joined
02:24 <geekosaur> this is how programs like wget/curl show progress reports for transfers, for each update it writes \r and outputs the latest status
02:24 <geekosaur> overwriting the previous one
02:24 superphunthyme joined
02:24 jdt_ joined
02:25 <geekosaur> or apt-get update, for that matter
02:25 <sophiag> geekosaur: i never knew that. clever :)
02:25 <monochrom> "working on it" and then 10 seconds later "\rFinished! " is how a lot of low-tech programs first print "working on it" when it is not done, and overwrite it with "Finished!" when done.
02:26 hexagoxel joined
02:26 <tobiasBora> Hum...
02:26 <MarcelineVQ> is there a goto lib for drawing visual data graphs in haskell? mostly in my case to the screen for debugging purposes. I think these are also called charts
02:27 <geekosaur> back when terminals were (loud) printing terminals, you had to output the carriage return and newline separately, and there needed to be a delay during the carriage return or it would start overprinting while the print head was still moving back :)
02:27 <tobiasBora> geekosaur: monochrom Ok great thank you!
02:27 <tobiasBora> I understand everything better now
02:27 CurryWurst joined
02:27 <tobiasBora> Now another strange thing:
02:28 <sophiag> MarcelineVQ: someone in my local Haskell user group was asking that last weekend. i'm trying to remember what she ended up using
02:28 <geekosaur> MarcelineVQ, graphviz package is most common that I've seen
02:28 <Conjecture> How easy can C programs use Haskell libraries?
02:28 <Conjecture> easily*
02:28 <tobiasBora> if my program deal with a small entry, everything is fine
02:28 <Conjecture> Do I have to use a complicated interface like the one Python has for that?
02:28 eacameron joined
02:29 <sophiag> MarcelineVQ: i think this: https://hackage.haskell.org/package/Chart
02:29 <geekosaur> Conjecture, there's some work involved https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ffi-chap.html#making-a-haskell-library-that-can-be-called-from-foreign-code
02:29 <tobiasBora> but if I take a really big file in input, the CPU loads to 100%, and after a few seconds, I've an error "process stopped" (translated from french)...
02:29 <geekosaur> you still have to deal with the fact that haskell has its own runtime that needs to be initialized and deinitialized
02:30 <geekosaur> tobiasBora, sounds like you have a memory leak and the out-of-memory killer is getting invoked.
02:30 <MarcelineVQ> geekosaur, sophiag: thank you
02:30 <sophiag> np
02:31 <tobiasBora> geekosaur: Indeed the RAM explodes
02:31 <tobiasBora> is there any way to know where I do the memory leaks?
02:32 conal joined
02:32 <Conjecture> geekosaur, Is it really slow like the FFI interface for Python?
02:32 <Conjecture> Where, when it's not slow it's very slow
02:33 <geekosaur> compile with profiling (note you'll need to recompile for profiling any packages you use as well) and run with +RTS -h
02:33 louispan joined
02:33 <geekosaur> Conjecture, python is interpreted, haskell is compiled to native code. although if you write it wrong it can be slow, it's rarely as slow as an interpreted language
02:33 inari joined
02:34 <geekosaur> also the border between C and Haskell will force evaluation (C has no idea what to do with a Haskell lazy value) which will tend to make things get done in a timely manner
02:34 <Conjecture> Thanks geekosaur
02:34 <geekosaur> tobiasBora, https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html#profiling-memory-usage
02:35 mentos joined
02:35 <geekosaur> I would then run it with a small file and see if it shows anything accumulating that shouldn't
02:35 <geekosaur> don't use the big one, when the program is killed it's a force-kill that won't finish heap profiling properly
02:36 okra_ joined
02:36 pavonia joined
02:36 Stanley00 joined
02:37 robkennedy joined
02:38 argent0 joined
02:39 <okra_> i'm trying to do bounded enumeration of CFGs (i.e., enumerate all strings using <= k productions). I wrote some code which seems right but behaves weirdly; anyone mind taking a look? http://lpaste.net/354088
02:40 <okra_> by "behaves weirdly" i mean "only ever generates digits and the string '1+1'"
02:40 <sophiag> geekosaur: since (i think?) you're the one who recommended i use haskell-src-exts, do you have any idea what i'm doing wrong trying to parse this one? http://lpaste.net/354083
02:41 JeanCarloMachado joined
02:43 modal joined
02:45 wagle joined
02:45 raycoll joined
02:46 <geekosaur> sophiag, the second one is fairly obvious, a QOp is a token not a function
02:46 <sophiag> i didn't think it was a function
02:46 araujo joined
02:46 araujo joined
02:47 <sophiag> it's the type of the part of the AST i'm matching
02:47 splanch joined
02:47 <geekosaur> but you produce Just (+) while claiming tits type is Maybe QOp
02:47 <geekosaur> *its type
02:47 <geekosaur> grrh where is my typing tonight
02:48 arctictern joined
02:48 sanett joined
02:48 <sophiag> is QOp not the type of infix operators?
02:48 <geekosaur> infix operators *in the AST*
02:48 <geekosaur> not infix operator implementations, which is what (+) in Haskell code gives you
02:48 <lyxia> okra_: it's working just fine here
02:49 <sophiag> ah ok. that makes sense. i think ghc's error messages were just making me more confused
02:49 <geekosaur> QVarOp (UnQual (Symbol "+")) <-- this is a QOp
02:49 <sophiag> yup
02:49 <sophiag> so...is (+) actually the type of itself?
02:49 <geekosaur> amd that's where the first error comes from, because: Lambda l [Pat l] (Exp l)
02:49 ljc joined
02:50 <geekosaur> (+) is a function, here inferred with type Integer -> Integer -> Integer
02:50 <sophiag> ah ok
02:50 <geekosaur> it is not an AST node
02:50 mac10688 joined
02:50 <sophiag> that's where that comes from...
02:50 <geekosaur> it is the actual implementation, not a syntax tree representation of it
02:51 <Koterpillar> (+) is not "+" either
02:51 JeanCarloMachado joined
02:51 <geekosaur> as for the first error, you have that Lambda I mentioned
02:51 <okra_> lyxia: sorry, i'm dumb -- I had a `take 10' in front of everything
02:52 <geekosaur> it's going to expect something of the form: InfixApp l (Exp l) (QOp l) (Exp l)
02:52 <Gurkenglas_> okra_, I have a simplification, interested in it or want to work on it yourself?
02:52 <okra_> appreciate it though
02:52 <geekosaur> but you gave it just the QOp
02:52 <sophiag> oh, i want to use "Just +" with type (Integer -> Integer -> Integer) to get the infix version, yes?
02:52 <geekosaur> I can't tell; I don't know what you are doing with the result of parseSymbol
02:52 <lyxia> okra_: :)
02:52 <okra_> Gurkenglas_: interested -- what kind of simplification?
02:52 <geekosaur> it may be that you don't want the type to be Maybe QOp
02:52 xtreak joined
02:53 CurryWurst joined
02:53 <geekosaur> but you probably can't use Maybe (Integer -> Integer -> Integer) because then you can only handle operators that have that type
02:53 <sophiag> i changed it to be Maybe (Integer -> Integer -> Integer)
02:53 <geekosaur> so you can't handle, say, "/"
02:53 <okra_> I guess there's another approach which is more obviously a breadth-first search
02:53 <sophiag> but then i changed it to return "Just x"
02:53 mson joined
02:53 <geekosaur> or "++"
02:54 <sophiag> yup, many infix operators
02:54 <sophiag> oh, i'll need a seperate function for the ones that return booleans tho
02:54 <geekosaur> you'll need something that can represent all of those, possibly via an ADT. Id not try to use the actual (+) here but an ADT of operator internal representations and then map the internal tag to the actual operator if I need to evaluate later
02:55 <geekosaur> also, there are user defined operators
02:55 <sophiag> ugh, that's exactly what i was trying to avoid since i realized today i could just store lambdas in a list
02:55 <sophiag> i have this: data LambdaType a = LambdaType [a -> Bool]
02:55 <sophiag> with ExistentialQuantification for the record it's stored in
02:56 mson joined
02:56 <geekosaur> that could be a problem since you can't do much with something under existential quantification
02:56 <Gurkenglas_> okra_, lines 14 and 15 are "enumSyms k es = fmap concat $ traverse (enumBounded k) es", and if you pull line 13 into the definition of enumBounded you can eta-reduce and inline enumSyms
02:56 mson left
02:56 <geekosaur> but ... this is a hard problem in general
02:56 <sophiag> i figured it would be okay given what i'm using it for
02:57 <sophiag> like i know what i'm doing with these and i'll be certain the types match based on matching the other field in the records
02:57 mazeinmaze joined
02:57 <geekosaur> but you have to convince Haskell of that, and that can be tricky
02:57 <sophiag> but you may have a point regarding the boolean operators
02:58 <sophiag> i'm wondering if i can use type variables for the boolean infix operators, so like (a -> a -> Boolean) ?
02:58 <sophiag> oh and maybe a constraint of Eq
02:58 <sophiag> Eq and Ord
02:58 <sophiag> depending
02:58 <sophiag> oh actually i don't need Ord (sorry for talking out loud)
02:59 <ChaiTRex> sophiag: Yes.
02:59 <ChaiTRex> :t (==)
02:59 <lambdabot> Eq a => a -> a -> Bool
02:59 <sophiag> :)
02:59 <okra_> Gurkenglas_: interesting, that's very neat - thanks!
02:59 <sophiag> anyway, i have to get going home to bed...but i'm hoping to get this function at least parsing one operator so i can generalize it tomorrow
03:00 <ChaiTRex> sophiag: The only ones that work without constraints are f _ _ = True or f _ _ = False or f _ _ = undefined
03:00 <sophiag> that should be fine for my purposes
03:00 plutoniix joined
03:01 <sophiag> geekosaur: now that i have the right type signature for that function and switched to returning infix + i'm just getting a weird "parse error" on the last line
03:01 <Gurkenglas_> (okra_, also I expect that ekmett's free package can eliminate all explicit recursion there)
03:01 <geekosaur> sophiag, can you update your paste?
03:01 <okra_> cool, I'll check it out
03:01 <sophiag> sure
03:02 <okra_> I've read enough about Traversable and Free but never actually used them of my own volition before
03:03 <sophiag> geekosaur: http://lpaste.net/354083
03:03 <geekosaur> it has to be Just (+)
03:03 <geekosaur> because you're referring to the operator by name, not trying to apply it
03:03 <sophiag> oh ok
03:04 <geekosaur> `Just +` would be an incomplete addition of Just to something else; if it got past the parse error it'd complain about a missing Num instance for a -> Maybe a
03:04 <sophiag> but then i get the type error again...that's why i didn't think that was the problem when i tried it :/
03:04 Beetny joined
03:04 <geekosaur> What's the exact type error now?
03:04 <geekosaur> (At a guess, you lost whatever was specializing to Integer or you need to do that yourself
03:04 <geekosaur> :t (+)
03:04 <lambdabot> Num a => a -> a -> a
03:04 eklavya joined
03:05 <sophiag> " Couldn't match expected type ‘Exp’ with actual type ‘QOp’"
03:05 <geekosaur> yes, that's a different error
03:05 <geekosaur> I tried to explain that one earlier
03:05 <geekosaur> [30 02:49:50] <geekosaur> amd that's where the first error comes from, because: Lambda l [Pat l] (Exp l)
03:05 <geekosaur> [30 02:52:00] <geekosaur> it's going to expect something of the form: InfixApp l (Exp l) (QOp l) (Exp l)
03:05 <sophiag> oh should it be Exp -> QOp -> Maybe ?
03:06 <sophiag> i understood you, but not the implications for the type signature
03:06 <geekosaur> you need to extract the QOp from the InfixApp inside the Lambda
03:06 enitiz joined
03:06 <geekosaur> (InfixApp is one of the constructors for Exp)
03:06 <sophiag> ah, that's what i thought earlier i just wasn't sure how to do it
03:06 <sophiag> i tried adding holes and it kept throwing erros
03:07 <sophiag> *rs
03:07 conal joined
03:07 gugah joined
03:07 <sophiag> i figured it should be something like "(Lambda _ _ (_ expr _))"
03:08 CurryWurst joined
03:08 <sophiag> or similar in the case or a let
03:08 <geekosaur> possibly: InfixApp _ _ (QVarOp (UnQual (Symbol "+"))) _
03:08 <sophiag> ah
03:08 <sophiag> lemme try it
03:09 <sophiag> :D
03:09 <geekosaur> because thelambda doesn;t just have the operator, it's an expression applying the operator (an InfixApp)
03:09 <sophiag> except you accidentally gave it four arguments
03:09 <sophiag> well InfixApp is a constructor for QOp
03:09 <sophiag> or sorry
03:09 <geekosaur> no, it's a constructor for Exp
03:09 <sophiag> yup
03:10 <geekosaur> which is what you pulled out of the Lambda
03:10 <sophiag> right
03:10 splanch joined
03:10 <geekosaur> and the QOp is buried within it
03:10 <sophiag> i wonder if i also could have matched it in the argument?
03:10 <geekosaur> yes
03:10 vaibhavsagar joined
03:10 latro`a joined
03:10 <sophiag> like (Lambda _ _ (InfixApp _ expr _))?
03:11 <geekosaur> the pattern might get a bit painful to work with though; sometimes breaking it up saves your sanity later
03:11 <sophiag> true
03:11 <sophiag> i still didn't break it up much tho
03:11 <geekosaur> something like that, yes
03:11 JeanCarloMachado joined
03:12 <sophiag> phew
03:12 <sophiag> well thanks for the help
03:12 <sophiag> working with these ASTs has certainly been a learning experience, but it was the best choise
03:12 <sophiag> *choice
03:13 <sophiag> i may still use Parsec for the parts that are just strings tho
03:13 <sophiag> especially since i'm using a State monad to cons my records together
03:14 <sophiag> geekosaur: how's your sinus infection?
03:14 isidore joined
03:15 coltfred joined
03:15 <geekosaur> it's not an infection, sadly. it's genetic. if Someone will keep their hands off health care (such as it is) for a few months, it might get surgery
03:16 e14 joined
03:17 <kadoban> geekosaur: In case you're serious, it's quite unlikely that anything will change with health insurance that quickly. It's usually on the timeframe of at least a year or two.
03:17 <geekosaur> surgery's not happening in just a few months either :/ but that was kinda executive summary; it's complex
03:18 <sophiag> ah, my mother had the surgery where the scrape out your sinuses to widen them
03:18 <sophiag> i think before it was laser and they used a knife on the end of a tube...
03:18 <geekosaur> yeh, that's at least part of what needs to happen. have actually needed it for a few decades but previous insurance refused to cover it
03:18 <geekosaur> so it's pretty bad now :/
03:18 <sophiag> well at least while we have the aca you should be able to have it covered through the independent review board
03:19 djapo_ joined
03:19 <sophiag> appeals are pretty fast now so you just go through two of those and then either that board or a fair hearing with a judge. the former seems better since it's just doctors deciding. you basically get your doctor to write a comprehensive letter of medical necessity citing statements by professional bodies on its efficacy and such
03:20 <sophiag> (can you tell i have numerous medical issues? lol)
03:20 <geekosaur> heh. know thta one, but aside from the sinuses most of mine are neurological
03:20 CurryWurst joined
03:20 <sophiag> ah me too
03:20 <sophiag> Chronic Migraine disorder
03:21 <sophiag> i just had botox injected in 31 spots of my face, head and neck
03:21 <sophiag> nearly passed out in the middle...
03:21 <Welkin> o.o
03:21 MitchellSalad joined
03:21 <sophiag> i tell people chronic pain is why i switched to functional programming. i don't have enough working memory to manage state ;)
03:22 <sophiag> anyway, i have to run home and get some sleep. thanks for the help!
03:22 <geekosaur> no problem
03:24 <Gurkenglas_> okra_, feels like it should end up looking sorta like this http://lpaste.net/354088#a354090
03:25 peterbec` joined
03:25 <okra_> Gurkenglas_: that's quite nice; I'll think about that for a bit -- thanks!
03:26 robotroll joined
03:26 MitchellSalad joined
03:27 <Welkin> sitting in a chair all day doesn't help keep you healthy either
03:28 <Welkin> I've been sitting too much lately, especially slouched over, debugging javascript
03:29 FreeBirdLjj joined
03:31 JeanCarloMachado joined
03:32 safe joined
03:33 felixsch__ joined
03:35 CurryWurst joined
03:35 np356 joined
03:35 midrya joined
03:37 CurryWurst joined
03:37 dan_f joined
03:39 JeanCarloMachado joined
03:40 mazeinmaze_ joined
03:43 fakenerd joined
03:43 mazeinmaze_ joined
03:46 xall joined
03:46 MitchellSalad joined
03:46 CurryWurst joined
03:49 electrostat joined
03:51 jmcarthur joined
03:53 WhiskyRyan joined
03:54 JoshS joined
03:55 justicefries joined
03:58 mizu_no_oto joined
03:58 justan0theruser joined
04:06 Sh4rPEYE joined
04:06 eazar001 joined
04:07 splanch joined
04:08 CurryWurst joined
04:08 Blkt joined
04:09 haasn joined
04:11 takle joined
04:12 Unhammer joined
04:15 JoshS joined
04:19 animated joined
04:19 lifter joined
04:20 cyborg-one joined
04:20 <lifter> Are Emacs (not Spacemacs) users typically using Intero?
04:20 <lifter> Sounds like it's the easiest way to get up and running...
04:21 ali_bush joined
04:21 ali_bush joined
04:23 <lifter> (for those using Stack, that is...|
04:23 safe joined
04:23 peterbec` joined
04:25 {emptyset} joined
04:25 eacameron joined
04:27 <jmcarthur> I use Spacemacs+Intero, but if I were to go to non-Spacemacs Emacs, I would also go with Intero.
04:28 Xanather joined
04:28 <* jao> uses intero with plain emacs
04:30 takle joined
04:30 <lifter> Nice.
04:31 sandstorm joined
04:33 CurryWurst joined
04:34 brynedwardz joined
04:36 np356 joined
04:36 bitemyapp joined
04:36 louispan joined
04:37 DigitalKiwi joined
04:37 bbcue joined
04:37 idupree joined
04:37 louisriesener joined
04:37 Ninja3047 joined
04:38 dustinm joined
04:40 raycoll joined
04:40 CurryWurst joined
04:43 dan_f joined
04:45 np356 joined
04:45 uwap joined
04:45 featherlessbiped joined
04:47 eklavya joined
04:47 takle joined
04:47 maerwald joined
04:49 FreeBirdLjj joined
04:50 event_null joined
04:50 isd joined
04:51 ubsan_ joined
04:54 osa1 joined
04:54 <cocreature> infandum: no, foldr requires an "Unbox" constraint
04:55 takle joined
04:55 CurryWurst joined
04:55 fakenerd joined
04:58 sanett joined
04:59 tempname11 joined
05:00 dsh joined
05:01 MP2E joined
05:01 Sh4rPEYE joined
05:01 <vaibhavsagar> what is the process for upgrading containers on Stackage?
05:01 <vaibhavsagar> It doesn't look like the maintainers are interested in doing this https://github.com/haskell/containers/issues/420
05:01 DataComputist joined
05:02 sanett joined
05:02 <kadoban> vaibhavsagar: I believe that every package on stackage is required to have a maintainer, I'd probably check who that is and how to contact them.
05:02 <kadoban> Though isn't containers something that comes with GHC? Or am I confused?
05:03 pwnz0r joined
05:05 <vaibhavsagar> kadoban: it is. Does that mean there's no way to upgrade it in a package set?
05:06 mmachenry joined
05:06 <kadoban> I ... don't really know. I'd think it'd have to be tied to the version of GHC that a resolver uses?
05:07 sleffy joined
05:08 <vaibhavsagar> how come NixOS gets the latest version without also using GHC 8.2?
05:08 Ferdirand joined
05:08 eklavya joined
05:09 zcourts joined
05:09 dec0n joined
05:09 sanett joined
05:11 Micamo joined
05:12 sanett joined
05:13 acowley_away joined
05:13 sanett joined
05:14 dfeuer_ joined
05:15 kefin_ joined
05:15 sanett joined
05:15 vlatkoB joined
05:16 Morgawr joined
05:16 sanett joined
05:17 staticfox joined
05:17 mmachenry1 joined
05:20 takle joined
05:20 sportanova joined
05:22 sanett joined
05:23 <cocreature> vaibhavsagar: stackage should upgrade containers automatically once no other packages have restrictive bounds
05:24 <cocreature> ah no I think kadoban mentioned the important point: containers comes with GHC and iirc stackage does not upgrade these packages without upgrading GHC
05:24 <cocreature> despite this being possible for some packages, e.g., containers
05:25 meandi_2 joined
05:25 modal joined
05:25 <kadoban> vaibhavsagar: If nothing else you could try upgrading it yourself as an extra-dep, I guess.
05:25 Swizec joined
05:26 <kadoban> You can refer to a git repo or whatever, it's pretty painless once you find the weird syntax.
05:26 zcourts_ joined
05:26 <cocreature> you can also just refer to the hackage release
05:33 xtsee joined
05:33 ChaiTRex joined
05:33 jw358 joined
05:33 zcourts joined
05:33 <kadoban> Oh, right, also that. Much easier.
05:33 pelegreno_ joined
05:33 DanZimm joined
05:33 kennyp joined
05:33 shapr joined
05:33 benzrf joined
05:34 Koterpillar joined
05:35 stvc joined
05:36 splanch joined
05:36 jud^ joined
05:36 ichor joined
05:37 bbcue joined
05:37 <vaibhavsagar> I tried this, worked great :)
05:38 takle joined
05:38 zcourts joined
05:39 Sh4rPEYE joined
05:41 vtomole joined
05:42 sanett joined
05:43 takle joined
05:44 edsko joined
05:45 np356 joined
05:46 watom- joined
05:46 danvet joined
05:46 fakenerd joined
05:47 zcourts joined
05:48 yellowj joined
05:50 xtreak joined
05:50 sanett joined
05:50 ftop joined
05:52 Dmas joined
05:53 fred-fri joined
05:53 xtreak joined
05:54 darjeeling_ joined
05:55 <fred-fri> how do i shove a function that accepts a String into IO [String]?
05:55 modal joined
05:57 <kadoban> :t \f -> fmap (map f)
05:57 <lambdabot> Functor f => (a -> b) -> f [a] -> f [b]
05:58 <kadoban> fred-fri: That ^
05:58 splanch joined
05:58 takle joined
05:58 freusque joined
05:59 np356 joined
06:01 uglyfigurine joined
06:01 juhp joined
06:02 zcourts_ joined
06:03 ogrady joined
06:05 takle joined
06:05 augur joined
06:06 <pavonia> Similar question, is there already a function :: Monad m => m [a] -> (a -> m b) -> m [b]?
06:06 <c_wraith> :t forM
06:06 <c_wraith> :t forM
06:06 <lambdabot> (Monad m, Traversable t) => t a -> (a -> m b) -> m (t b)
06:06 <c_wraith> darned spacebar
06:07 <pavonia> That's close but not close enough
06:07 <c_wraith> in what way?
06:07 <pavonia> :t join . forM
06:07 <lambdabot> error:
06:07 <lambdabot> • Occurs check: cannot construct the infinite type:
06:07 <lambdabot> m ~ (->) (a -> m b)
06:08 <pavonia> c_wraith: The first argument should be in m too
06:08 <c_wraith> ah, missed that
06:08 <cocreature> :t fmap fmap fmap join forM
06:08 <lambdabot> (Traversable m, Monad m) => m a1 -> (a1 -> m a) -> m a
06:08 peterbec` joined
06:09 <cocreature> but it does incur an additional constraint
06:09 <c_wraith> that's not quite the same, because you can't use it with m other than []
06:10 raichoo joined
06:10 <cocreature> c_wraith: you can use it with anything that’s Traversable, not only [], right?
06:10 <c_wraith> cocreature: actually, it doesn't work at all. you can't pass an m [a] to that
06:10 <cocreature> oh right, silly me
06:11 <c_wraith> well, not to get the intended result, anyway
06:11 <c_wraith> I mean..
06:11 <c_wraith> :t \x y -> mapM y =<< x
06:11 <lambdabot> (Traversable t, Monad m) => m (t a) -> (a -> m b) -> m (t b)
06:11 <c_wraith> it's not quite a single function anymore
06:12 <fred-fri> kadoban, cheers. i'm afraid i'm to dumb to figure it out despite your reply. https://pastebin.com/Hkr62f5i
06:13 <kadoban> fred-fri: Ah, so "lines" should actually be type [String] there, if that helps (and if I'm not massively confused somehow)
06:13 takle joined
06:13 <pavonia> @pl \x y -> mapM y =<< x
06:13 <lambdabot> (. mapM) . (>>=)
06:13 sanett joined
06:13 <kadoban> fred-fri: So you'd probably jsut do uhm let foo = map someFunc lines
06:13 <pavonia> I guess the pointed version is fine too, thanks!
06:14 conal joined
06:15 Koterpillar joined
06:15 <kadoban> fred-fri: Or if you want to do it in one go, that's possible, but not really preferable I'd say. (lines <- map someFunc <$> replicateM noOfLines getLine) probably
06:15 jhrcek joined
06:15 <jle`> what can i do to get a MonadIO instance for Proxy into the next release of base
06:15 <fred-fri> kadoban, oh, my mistake was actually doing foo <- map parse lines instead of just let foo = map parse lines
06:16 <fred-fri> where parse is the function that accepts a string
06:16 <kadoban> Ah, yep
06:16 <fred-fri> in any case, thanks
06:17 <kadoban> Anytime
06:17 sanett_ joined
06:17 <c_wraith> jle`: email the libraries mailing list. Include a convincing argument that it's a good idea. :)
06:17 <jle`> it's not only a good idea, it's the best idea
06:17 <c_wraith> jle`: though it's probably too late to get into the next release if it's controversial at all.
06:18 <jle`> thanks :)
06:18 Frankablu joined
06:19 <c_wraith> I guess it trivially obeys the laws
06:19 <jle`> i consider it the quintessential platonic MonadIO instance
06:20 <jle`> that's going to be my pitch, at least
06:20 augur joined
06:21 <c_wraith> most people have some expectation that it in addition to obeying the laws, it doesn't discard the IO actions though. :)
06:21 <jle`> maybe it can be considered a terminal object in some sense
06:21 quchen joined
06:22 dfeuer joined
06:22 <cocreature> jle`: do you have any useful applications for that instance?
06:22 sanett joined
06:22 augur_ joined
06:23 <jle`> it can be used in the case where you want to suppress IO, maybe
06:23 <jle`> if you had a polymorphic `MonadIO m => m a` value
06:23 <jle`> you can instantiante m as IO, if you want the effects
06:23 <jle`> or m as Proxy, if you don't
06:23 <cocreature> you can just not execute the action if you don’t care about the effects :)
06:24 augur_ joined
06:24 <jle`> hm
06:24 <jle`> oh, you can use it as the start of a chain of monad transformers
06:24 <cocreature> I’m not saying that the instance shouldn’t exist but I kind of doubt it’s ever going to be useful
06:25 <jle`> instead of IO
06:25 <jle`> to give the stack a MonadIO instance
06:25 <jle`> but have it not exeute any IO effects in the process of computation
06:26 <jle`> (this one i'm just joking on)
06:26 <jle`> `StateT s Proxy` -- it's MonadIO, but suppresses IO effects!
06:26 <jle`> ha ha
06:26 <cocreature> heh
06:27 <jle`> still though >_>
06:27 jvliwanag joined
06:27 <c_wraith> add ProxyT while you're at it!
06:27 takle joined
06:27 SpinTensor joined
06:27 <cocreature> now I’m disappointed that ProxyT is not a thing
06:27 xtreak joined
06:27 <jle`> type ProxyT = Tagged ..?
06:27 <c_wraith> nah, Tagged actually carries a value
06:28 <c_wraith> ProxyT should have *two* phantom type variables
06:28 <c_wraith> If one is good, two is clearly twice as good.
06:28 <jle`> instance MonadTrans ProxyT
06:28 <cocreature> you don’t even need the Monad instance on the inner monad to provide a Monad instance for ProxyT!
06:29 <glguy> StateT s Proxy a suppresses more than the IO effects
06:29 <jle`> it'd have a very nice MFunctor instance
06:29 raduom joined
06:30 jsgrant joined
06:30 <jle`> maybe in a sense we can think of Proxy as a Zero/absorber for composition of monads/functors/applicatives
06:30 <raduom> Hi. Is there a package that provides the Free monads, algebras things (including interpreters and algebras composition) for haskell?
06:30 <jle`> such that for all x, x*0 = 0
06:30 <raduom> I know there is a free package, but it lacks the compositional aspects.
06:31 <jle`> raduom: the free package is the canonical source of that
06:31 <Conjecture> The multiplicative property of zero
06:31 arquebus joined
06:31 <jle`> raduom: but composition tools are already in base
06:31 <jle`> raduom: base gives you functor products, functor sums, and functor composition
06:31 <Conjecture> The multiplicative property of 1 is: for all x, x *1 = x
06:31 anachrome joined
06:31 <jle`> Conjecture: yes, so in this case, Identity is 1, and Proxy is 0
06:31 CoconutCrab joined
06:31 <raduom> ok. thanks.
06:32 <jle`> so Proxy needs a MonadIO instance to continue this metaphor
06:32 <jle`> and there should be a ProxyT too, of course
06:32 <jle`> adding ProxyT anywhere along your monad transformer stack should kill all effects, up and down stream
06:32 <Conjecture> jle`, Were you explaining the compiler optimizer or something?
06:32 dfeuer joined
06:32 <jle`> Conjecture: i'm talking about the role of Proxy in the composition of functors
06:33 pushp0p joined
06:33 <Conjecture> ok
06:33 ego joined
06:33 <jle`> Proxy acts as a zero in the sense that x*y*Proxy*z*k = Proxy, and Identity is a one in the sense that x*y*Identity*z*k = x*y*z*k
06:33 louispan joined
06:34 yinn joined
06:34 mbuf joined
06:34 alfredo joined
06:34 <jle`> the MonadIO instance for Proxy can be thought of an instance for MonadIO m => ProxyT m
06:34 <jle`> so it's perfectly sound
06:35 <jle`> or i mean, it's extremely significant
06:35 <jle`> in the theory of functor composition. so it should be in base.
06:35 <jle`> ok there's my pitch, thanks for helping me hash it out
06:35 t0by joined
06:36 <nathyong> OK, I've isolated that bug that I had regarding Tasty's timeouts
06:36 <nathyong> https://gist.github.com/anonymous/84e8dee1a0cae6bc4257f58ccba33d43
06:36 <nathyong> main = timeout 1000000 (putStrLn (infinite "Hi")) >> return ()
06:36 <nathyong> where infinite x = infinite x
06:36 locallycompact joined
06:36 BalterNotz joined
06:36 <nathyong> ^ or rather, that
06:36 <nathyong> this has been reported to run on Linux, but not on OSX, when compiled
06:37 <c_wraith> yeah, I've had issues with that on OS X for a long time
06:38 <nathyong> any solutions? This seems like it'd break a lot of stuff
06:38 <c_wraith> it seems to have something to do with threadDelay being given a large number as input
06:38 dawehner joined
06:38 <c_wraith> and timeout is implemented in terms of threadDelay
06:39 <c_wraith> I worked around it poorly, by figuring out how to give it smaller numbers
06:40 <nathyong> ugh, that's not what I wanted to hear... but all right
06:40 razi1 joined
06:41 henriksod joined
06:41 <c_wraith> hmm. apparently the thing I ran into was fixed.
06:41 <nathyong> Yeah, in 8.2
06:41 <nathyong> https://ghc.haskell.org/trac/ghc/ticket/7325
06:41 <nathyong> c_wraith: thanks for your help with that though, I'm glad I was able to track it down
06:41 <nathyong> it was driving me nuts all afternoon
06:41 Sose joined
06:41 <Cale> Does it have anything to do with allocation or lack thereof?
06:43 <nathyong> Cale: if I change the function to a more 'interesting' function (say, infinite x = infinite (x-1)) then it'll be a little more reliable
06:43 <Cale> A little more reliably buggy, or it will always timeout correctly?
06:43 <pavonia> Is there a way to re-export an imported function without giving a full export list for that module?
06:44 unK_ joined
06:44 takle joined
06:44 <nathyong> it will timeout correctly, unless the `infinite` function is imported from another module
06:45 <nathyong> Cale: ^
06:45 <Cale> Interesting.
06:45 <Cale> The thing is, timeout presumably kills the action you give it by forking a thread for it to run in, and then throwing an exception at it with killThread
06:45 <nathyong> I feel like it's a slightly different bug to the one I linked, though
06:46 <Cale> Threads can only receive an asynchronous exception like that when they allocate memory
06:46 <nathyong> runtime issue?
06:46 <Cale> Well, that's just how the runtime works.
06:47 dfeuer joined
06:47 <nathyong> Fair enough, then
06:48 oish joined
06:48 <Cale> When you put the function in another module... I'm not really sure why that would make a difference, but if it were compiled differently, I can imagine in some cases that might still result in a loop which doesn't do allocation.
06:50 <nathyong> Yeah I was going to inspect the code, but I've got no idea why that would be the case
06:50 refold joined
06:50 <Cale> Yeah, maybe try having a look at the output of -ddump-simpl
06:50 <Cale> and see what the simplifier has done with your function :)
06:50 <nathyong> I'll come back to this after some foo
06:50 <nathyong> d
06:52 takle joined
06:52 thc202 joined
06:52 takuan joined
06:53 smiiley joined
06:53 <Cale> nathyong: Ah, yeah, it's clever, it eliminates the number argument altogether, realising that it's dead.
06:53 KarboniteKream joined
06:54 Xlaech joined
06:55 xtreak joined
06:56 Mysterious joined
06:57 free_beard joined
06:57 np356 joined
06:59 louispan joined
07:01 Maxdamantus joined
07:02 ventonegro joined
07:03 aib joined
07:03 unK_ joined
07:03 raichoo joined
07:03 guiben joined
07:04 przembot joined
07:04 buoto joined
07:07 cur8or joined
07:09 kritzcreek_ joined
07:09 juhp joined
07:09 vlatkoB_ joined
07:10 albertid joined
07:10 eacameron joined
07:10 for{} joined
07:11 <for{}> hi, guys. does anyone here use vscode?
07:11 Itkovian joined
07:11 CurryWurst joined
07:11 sanett joined
07:11 tromp joined
07:14 mattyw joined
07:14 mszczygiel joined
07:14 <nathyong> Cale: ah, that's enlightening. Thanks for your help
07:14 <for{}> what editor/ide do you use to code in haskell?
07:14 przembot joined
07:14 <nathyong> vim mostly
07:15 buoto joined
07:15 <nathyong> IntelliJ with the "HaskForce" plugin is all right too
07:15 <for{}> did you try vscode?
07:15 <nathyong> I've used it for python and C++, never for Haskell though
07:15 <nathyong> Is there something about the Haskell language plugin that you wanted to know?
07:15 <for{}> nathyong, whats the best haskell extension for vscode?
07:16 <for{}> in your opinion, of course
07:16 eacameron joined
07:16 <nathyong> for{}: the ghc-mod plugin probably does what you want (syntax checking, autocompletion if you're lucky)
07:17 <nathyong> Don't know about that "Haskelly" plugin though
07:17 <nathyong> Ah, it runs Intero, which should be a good experience too
07:17 <for{}> nathyong, other extensions youd recommend?
07:18 <nathyong> for{}: but yeah, basically anything that builds on top of ghc-mod or intero should provide the IDE-ish features that you might be looking for, and anything else is just pretty colours really
07:18 <for{}> nathyong, thanks
07:19 marr joined
07:19 laserpants joined
07:21 alx741 joined
07:24 raichoo joined
07:25 jgertm joined
07:26 mauke joined
07:26 JoshS joined
07:27 danvet joined
07:28 takle joined
07:28 rfabbri[m] joined
07:28 DataComputist joined
07:29 modal joined
07:30 orbifx joined
07:30 DataComputist joined
07:31 mjo joined
07:31 mjo joined
07:32 balor joined
07:33 xtreak joined
07:33 DataComputist joined
07:33 DataComputist joined
07:34 DataComputist joined
07:35 takle joined
07:35 ragepandemic joined
07:38 ertes joined
07:40 ogrady joined
07:40 ubsan_ joined
07:41 DataComputist joined
07:41 laz joined
07:41 sanett joined
07:43 hurkan joined
07:43 BartAdv joined
07:44 modal joined
07:44 DataComputist joined
07:44 rcat joined
07:45 takle joined
07:47 rcat joined
07:48 MarcelineVQ joined
07:48 YongJoon joined
07:49 DataComputist joined
07:49 DataComputist joined
07:49 DataComputist joined
07:50 MoALTz joined
07:50 tsahyt joined
07:52 eacameron joined
07:53 Sampuka joined
07:53 gregman_ joined
07:53 biglama joined
07:53 grayjoc joined
07:53 DataComputist joined
07:54 DataComputist joined
07:56 takle joined
07:58 Booba joined
07:58 np356 joined
07:59 Itkovian joined
08:02 zeroed joined
08:02 zeroed joined
08:02 Morgawr joined
08:02 _ashbreeze_ joined
08:02 prophile joined
08:03 puregreen joined
08:06 Swizec joined
08:07 peterbec` joined
08:08 lep-delete joined
08:09 juhp joined
08:09 <eatman> Hi. I tried to hask it on #hakyll but there are only few, idle, people there. Any clue on this problem : https://www.reddit.com/r/haskell/comments/62clhs/hakyll_and_pdf_generation/ ? Thanks a lot in advance!
08:09 sanett joined
08:10 zero_byte joined
08:11 OnkelTem joined
08:13 louispan joined
08:16 conal joined
08:16 louispan joined
08:20 merijn joined
08:21 xtreak joined
08:21 tomphp joined
08:22 <brynedwards> eatman: The example here is using "-" as an argument to pipe stdin. Does rubber need to do the same?
08:22 <brynedwards> https://jaspervdj.be/hakyll/reference/Hakyll-Core-UnixFilter.html
08:22 <brynedwards> or read from stdin, whatever
08:22 Netwolf joined
08:23 <brynedwards> http://manpages.ubuntu.com/manpages/precise/man1/rubber.1.html
08:23 <brynedwards> this manpage says rubber-pipe reads from stdin, maybe try that?
08:23 <dmj`> is there type level (&&) somewhere convenient
08:24 louispan joined
08:25 <jle`> dmj`: && in what way
08:25 <jle`> Bool -> Bool -> Bool ?
08:26 <jle`> singletons has one, :&&
08:27 sdrodge joined
08:29 tempname11 joined
08:32 MindlessDrone joined
08:33 <eatman> brynedwards: http://ix.io/ppV/hs using rubber-pipe gives me non-empty but broken pdf.
08:33 mmn80 joined
08:34 korayal[m] joined
08:34 locallycompact joined
08:34 <brynedwards> But `cat file.tex | rubber-pipe -d` is fine?
08:36 eklavya joined
08:36 <merijn> brynedwards: Congratulations on your Useless Use of Cat award :)
08:37 <brynedwards> :(
08:37 bbcue joined
08:37 ragepanda joined
08:37 <Athas> Beautiful use of cat.
08:38 <Athas> Processes are cheap!
08:39 enitiz joined
08:39 <eatman> Athas && merijn : what would you guys do?
08:39 <brynedwards> I assume `rubber-pipe -d < file.tex`
08:39 <Athas> I would use cat.
08:40 <Athas> I find that it reads nicer.
08:40 <Athas> It also makes it easier to modify and, to me, conceptually simpler.
08:40 <eatman> Yeah but can't realy do it in a Hakyll process...
08:40 <brynedwards> I don't do shell much, I'm trying to help debug his thing
08:40 <merijn> eatman: If rubber-pipe supports just passing filenames, like most commands "rubber-pipe -d file.tex", otherwise you do "rubber-pipe -d <file.text" in the shell ;)
08:40 Maxdamantus joined
08:40 Maxdamantus joined
08:41 oish joined
08:41 <merijn> Actually, you *can* do that with Hakyll, well last I remembered anyway
08:41 <eatman> Thing is, it works fine in a shell, not during the Hakyll compilation.
08:41 <Athas> eatman: what about using 'sh -c' and then an arbitrary shell pipeline?
08:41 <merijn> Where does unixFilter come from?
08:42 <brynedwards> merijn: https://jaspervdj.be/hakyll/reference/Hakyll-Core-UnixFilter.html
08:42 <Athas> I use Hakyll with a Unix pipeline for my own website. See the bottommost code section here: http://sigkill.dk/programs/sigkill.html
08:42 Wizek_ joined
08:42 CoconutCrab left
08:42 <merijn> And what is rubber-pipe?
08:42 <brynedwards> eatman: Does your `latexExampleRaw` change the output in any way? like `curl -o file2.text <URL>` is the same as file.tex?
08:43 <brynedwards> http://manpages.ubuntu.com/manpages/precise/man1/rubber.1.html
08:43 <merijn> Like, does rubber-pipe output result to stdout?
08:43 JoshS joined
08:43 <eatman> merijn: Yes.
08:43 <eatman> And I then have to > it to a pdf file.
08:44 <merijn> eatman: And your PDF is broken, right? Not empty
08:44 xtreak joined
08:44 <eatman> From shell it works, not from the Hakyll compile process.
08:44 permagreen joined
08:44 <eatman> brynedwards: no change.
08:44 <merijn> eatman: Yeah, but you get broken data in Hakyll, yes? Not no data
08:45 <eatman> Broken.
08:45 <eatman> I mean, no data using rubber and broken with rubber-pipe.
08:45 <Athas> Hm, maybe unixFilter cannot handle zero bytes?
08:45 <merijn> I bet $20 on "locale is fucked" with a side-remark off "don't use String"
08:45 <Athas> PDFs can contain NUL bytes, rights?
08:45 <merijn> unixFilter is converting String based on locale
08:45 <merijn> PDF is binary data, so of course it's all fucked
08:45 <merijn> You need unixFilterLBS
08:46 <brynedwards> You used unixFilterLBS in your first example, can you use it again?
08:46 <merijn> Also, what does your machine print when you run "locale" in your shell?
08:46 <eatman> http://ix.io/ppR/hs I went back to it.
08:46 silver joined
08:47 poundbear joined
08:47 <eatman> Locale : http://ix.io/ppX
08:47 MindlessDrone joined
08:47 <merijn> Probably want to set LC_ALL to the same value in your .profile
08:48 poundbear left
08:48 <merijn> So what happens with unixFilterLBS?
08:49 jgertm joined
08:49 Welkin joined
08:50 <eatman> merijn: done for the .profile; With uniFilterLBS I've the empty file.
08:50 <brynedwards> unixFilterLBS and rubber-pipe gives you an empty file?
08:50 <eatman> Line 56 to 62 on http://ix.io/ppR/hs
08:50 <eatman> Ho, both... didn't try that yet.
08:50 takle joined
08:51 <eatman> Give me a second.
08:51 balor joined
08:51 tsahyt left
08:51 <brynedwards> the rubber-pipe command is taking input from stdin, I'm not sure what rubber is doing, maybe just printing to stderr
08:51 <brynedwards> Because it's missing a file argument
08:51 <merijn> Unrelated: I need naming tips: I have a type Foo which does one action (potentially returning an error), and one that does multiple Foo actions (potentially returning multiple errors). Suggestions on naming?
08:52 jophish joined
08:52 ragepanda joined
08:53 <merijn> Foo and FooMany? Seems awkward, but I don't have anything better atm...
08:53 poundbear joined
08:54 <eatman> http://ix.io/pq0/hs Appears to work perfectly fine. I'll try with some more complex documents but sounds good to me right now.
08:56 fizruk joined
08:57 ThomasLocke joined
08:58 louispan joined
08:59 <eatman> Well, it works fine for modernCV docs.
08:59 <eatman> Thanks a lot!
08:59 slacker joined
08:59 np356 joined
09:01 oisdk joined
09:01 Jimmy_ joined
09:02 oish joined
09:02 <Jimmy_> @type map
09:02 <lambdabot> (a -> b) -> [a] -> [b]
09:02 <Athas> merijn: Foo and [Foo].
09:02 arpl joined
09:03 <Jimmy_> @list
09:03 <lambdabot> What module? Try @listmodules for some ideas.
09:03 <Jimmy_> @listmodules
09:03 <lambdabot> activity base bf check compose dice dict djinn dummy elite eval filter free fresh haddock help hoogle instances irc karma localtime metar more oeis offlineRC pl pointful poll pretty quote search
09:03 <lambdabot> slap source spell system tell ticker todo topic type undo unlambda unmtl version where
09:03 <Jimmy_> @source (fmap)
09:03 <lambdabot> Unknown command, try @list
09:03 <Jimmy_> @list
09:03 <lambdabot> What module? Try @listmodules for some ideas.
09:03 <Jimmy_> @help
09:03 <lambdabot> help <command>. Ask for help for <command>. Try 'list' for all commands
09:03 <Jimmy_> list
09:04 <Jimmy_> @list
09:04 <lambdabot> What module? Try @listmodules for some ideas.
09:04 <Jimmy_> @listmodules
09:04 <lambdabot> activity base bf check compose dice dict djinn dummy elite eval filter free fresh haddock help hoogle instances irc karma localtime metar more oeis offlineRC pl pointful poll pretty quote search
09:04 <lambdabot> slap source spell system tell ticker todo topic type undo unlambda unmtl version where
09:04 <Jimmy_> @help type
09:04 <lambdabot> type <expr>. Return the type of a value
09:04 <merijn> Athas: No, it's a transformer stack
09:04 <merijn> Athas: With a slightly different base
09:04 <Jimmy_> @help src
09:04 <lambdabot> src <id>. Display the implementation of a standard function
09:05 <Jimmy_> @src ($)
09:05 <lambdabot> f $ x = f x
09:05 <Jimmy_> @src (<$>)
09:05 <lambdabot> f <$> a = fmap f a
09:05 <jle`> Jimmy_: btw, you can also use lambdabot in private chat :)
09:05 <jle`> using `/q lambdabot ...'
09:05 <brynedwards> >:|
09:07 ub joined
09:08 peterbec` joined
09:09 Claudius1aximus joined
09:09 <Booba> ertes: Hi again! Mind if I ask a couple more questions about http://community.haskell.org/~ertes/hangman/ ?
09:10 Yuras joined
09:10 <Booba> ertes: you were saying that upsides of the approach that it is compositional and composable.
09:10 hrehf joined
09:10 <Booba> ertes: I can see that. But also I noticed that `move` function is a Kleisli function (of type a -> m a)
09:11 MindlessDrone joined
09:11 KarboniteKream joined
09:11 thepreacher joined
09:11 sanett joined
09:11 <Booba> ertes: and Kleisli function, Kleisle arrow (<=<) and `return` form a category
09:12 <Booba> ertes: And category is THE thing that describes compositionality
09:12 yogsototh joined
09:12 <Booba> ertes: I am trying to say that monadic interface seems like a good option for the api to me
09:12 <Booba> ertes: inspired by http://www.haskellforall.com/2012/08/the-category-design-pattern.html
09:13 locallycompact joined
09:13 CurryWurst joined
09:14 ebzzry joined
09:16 rjg_ joined
09:17 yinn joined
09:18 mazeinmaze_ joined
09:20 louispan joined
09:20 <Jimmy_> ?q
09:20 <lambdabot> Maybe you meant: queue-topic quit quote v @ ? .
09:21 Majiir joined
09:22 splanch joined
09:23 marr joined
09:23 Gloomy joined
09:24 yoneda joined
09:26 fred-fri joined
09:27 Jimmy_ joined
09:27 Aidan[m] joined
09:27 Rainb joined
09:28 <ph88> can anyone recommend a hash function and library? I want a fingerprint of a file, i was thinking of sha256, but maybe others are better
09:29 uncertainty joined
09:29 vaibhavsagar joined
09:29 <merijn> ph88: What's the purpose of the fingerprint?
09:29 <ertes> Booba: there are no monads involved there
09:30 <ertes> Booba: and a monoid is a category
09:30 <ph88> merijn, not sure yet, i thought it would come in handy, maybe to check if the file is already in the database
09:30 <Booba> ertes: oh, it is, you're right
09:30 <merijn> ph88: The intended use is kinda crucial for the choice between a cryptographic hash or a non-crypto one :)
09:32 <Booba> ertes: ok, is there a way (a rule of thumb) to pick a category to describe my solution for an exact problem in?
09:32 <ph88> merijn, no intent yet .. just thought it would be useful information to store in the database might need it later
09:33 <merijn> ph88: MurmurHash3 is a nice fast non-crypto one, else you're probably looking at sha256 or sha3 or whatever
09:33 <tdammers> ph88: YAGNI
09:33 <ph88> merijn, besides that (on another topic) i also need to generate UUID, i was thinking to generate it off the file content + size, do you think this is a good idea ?
09:34 <ph88> https://hackage.haskell.org/package/uuid-1.3.13/docs/Data-UUID-V5.html#v:generateNamed
09:34 wictory[m] joined
09:34 closures999[m] joined
09:34 bb010g joined
09:34 davidar_ joined
09:34 alaradia[m] joined
09:34 Naughtmare[m] joined
09:34 iffsid[m] joined
09:34 nick2000 joined
09:34 riaqn joined
09:34 davidar joined
09:34 jyp[m] joined
09:34 roadrunner168[m] joined
09:34 herzmeister[m] joined
09:34 M-BostonEnginerd joined
09:34 travisr joined
09:34 elwan7[m] joined
09:34 karroffel joined
09:34 curry[m] joined
09:34 m4lvin[m] joined
09:34 seequ_ joined
09:34 monomon[m] joined
09:34 unclechu joined
09:34 miviotros[m] joined
09:34 jmnoz[m] joined
09:34 korayal[m] joined
09:34 sudoreboot[m] joined
09:34 zaphar_ps[m] joined
09:34 MatrixTraveler[m joined
09:34 Magnap joined
09:34 M-berdario joined
09:34 M-Illandan joined
09:34 hendrik[m] joined
09:34 M-schmittlauch joined
09:34 hiq[m] joined
09:34 TheWizardTower joined
09:34 corintho[m] joined
09:34 srenatus[m] joined
09:34 rdesfo[m] joined
09:34 M-Quora joined
09:34 cbHXBY1D[m] joined
09:34 TylerCecil[m] joined
09:34 hakan[m] joined
09:34 bobjason[m] joined
09:34 M-krsiehl joined
09:34 unknownln joined
09:34 Soif[m] joined
09:34 goodboy[m] joined
09:34 FederalRick[m] joined
09:34 mmmrrr[m] joined
09:34 jacqueline[m] joined
09:34 <ertes> Booba: you need to work with many algebraic patterns, and at some point you develop a sense for it… but i generally start by generalising my problem
09:34 colton[m] joined
09:34 moonarch joined
09:34 jascot[m] joined
09:34 tomkerk[m] joined
09:34 tester668[m] joined
09:34 gentam[m] joined
09:34 rakete joined
09:34 ProofTechnique[m joined
09:34 noraesae joined
09:34 sirius[m] joined
09:34 aspiwack[m] joined
09:34 <ph88> i put file + size there as object to make uuid ?
09:34 chef_excellence[ joined
09:34 drasich[m] joined
09:34 Guest91110[m] joined
09:34 M92854[m] joined
09:34 NopeMarker[m] joined
09:34 gkaplan[m] joined
09:34 Yves[m] joined
09:34 tfc[m] joined
09:34 rfabbri[m] joined
09:34 <cocreature> ph88: adding the size seems kind of redundant
09:35 Croniamental joined
09:35 <ertes> Booba: i have a problem, i write a DSL for it, then i generalise the DSL as much as possible such that it's still expressive enough for my problem… very often it turns out to be an algebraic structure that i know
09:35 <ph88> i don't think i like this V5 it uses sha1 only 128 bits
09:35 <tdammers> also, if you use the content to generate an ID, then it is basically a hash, and you're building a content-addressable system
09:35 <tdammers> if that's what you want, go for it
09:35 <tdammers> otherwise, using random IDs is easier, faster, and probably good enough
09:35 <ph88> what's that a content-addressable system ?
09:36 <ertes> Booba: the Hangman type in the repo is not the way i would have written it… i would have abstracted over what is currently hard-coded as [] to be any Alternative
09:36 fractalsea joined
09:36 <ocharles> The documentation for `allocaBytes` states: "The memory is freed when f terminates (either normally or via an exception), so the pointer passed to f must not be used after this.". Yet reading the source of `allocaBytes`, I don't actually see a call to `free` anywhere - so is this strictly true? It seems more that the memory is freed when f terminates *and*
09:36 <ocharles> the garbage collector has ran
09:36 <ertes> Booba: and perhaps even to any Plus (from the semigroupoids package), such that it can even be Map
09:36 <tdammers> ph88: addresses of content items are derived from the content itself (and nothing else)
09:37 <Booba> ertes: I see. Thanks! I guess this is what I was looking for in course of these couple of days: a general guide on how to desin solutions to problems haskell way (algebraic way, as you call it)
09:37 <ocharles> In particular, I'm building a ForeignPtr on a Ptr built with allocaBytes, and surprised that reading from it outside `allocaBytes` works just as I'd expect... though what I'd really expect is for that memory to be free'd and a seg fault!
09:37 mohsen_1 joined
09:37 <ph88> tdammers, that might be a good thing if someone wants to add a document to the database and generate a uuid it's an easy way to check if the document was already in the database, no ?
09:37 zariuq joined
09:37 <tdammers> ph88: yes. git, for example, is essentially a content-addressable database (and then some)
09:37 <Booba> ertes: I could say that it is similar to imperative or object oriented way: I design an exactl solution and generalize it in next iterations.
09:37 fractalsea joined
09:38 <Booba> ertes: its just the way to generalize is different
09:38 <tdammers> ph88: git uses commit hashes to determine whether two given commits are the same
09:38 uglyfigurine joined
09:38 <ertes> Booba: yeah, i generalise right away mainly for two reasons: to see structures more clearly, and to make implementation easier, because parametricity guides me to the correct solution
09:39 <ertes> Booba: example: f :: Integer -> Integer
09:39 <ertes> infinitely many functions
09:39 <ertes> but as soon as i generalise, there is only one function left:
09:39 <ertes> id :: a -> a
09:39 arawack joined
09:39 <merijn> ocharles: alloca generally allocates on the stack in C, so I have to look up exactly what GHC is doing
09:39 <cocreature> ocharles: I don’t think you’re guaranteed to get a segfault even if the memory was freed. but you seem to be right that allocaBytes doesn’t explictely free
09:39 <merijn> ocharles: Also, why would you ever expect a segfault?
09:39 <ocharles> merijn: I thought reading from free'd memory would seg fault
09:39 muzzle joined
09:39 <merijn> ocharles: segfaults happen when reading from/writing to unmapped memory
09:39 <cocreature> merijn: we’ve had this discussion before but GHC calls things "alloca" that have nothing to do with Cs alloca
09:40 <merijn> ocharles: Hah, I wish
09:40 <ocharles> oh :)
09:40 <muzzle> hi, I have a question about software licensing. Is this off topic here?
09:40 <ocharles> yea, GHC alloca is about pinned bytearrays, more
09:40 <cocreature> muzzle: yep, this channel is about the Haskell programming language
09:40 <ph88> is a uuid only ever 128 bits ?
09:40 <ocharles> ok. So I just need to be more careful when I write this code. It "just happening to work in the repl" is not sufficient
09:40 <ertes> Booba: note that this isn't quite the same kind of generalisation: you're generalising *solutions*, i'm generalising the *language*
09:40 Rainb joined
09:40 <merijn> ocharles: If the memory is still in the processes memory space (likely, since I don't think GHC ever returns address space) you will happily read garbage data with no way to tell
09:40 <muzzle> when I publish a haskell package under LGPL, no non-LGPL/GPL haskell package can use it, right?
09:41 <merijn> ocharles: And writing to it will happily corrupt all the rest of your program
09:41 <merijn> muzzle: That's not true
09:41 <merijn> muzzle: They just can't statically link it
09:41 tsahyt_ joined
09:41 <ocharles> Next question... if I have one Ptr and create two ForeignPtrs, both with finalizeFree... that could lead to a double free. Right?
09:41 <merijn> ocharles: Yes
09:41 <ocharles> one Ptr created with mallocBytes, that is
09:41 <ocharles> ok
09:41 tsahyt left
09:41 <muzzle> merijn, but isn't static linking what stack/cabal do by default?
09:41 <ertes> muzzle: don't ask legal questions on IRC… the FSF has extensive documentation and a comprehensive FAQ
09:42 <merijn> muzzle: Yes, but that doesn't stop anyone from performing dynamic linking
09:42 <cocreature> ocharles: welcome to the mess that is manual memory management :)
09:42 <ocharles> I'm having fun trying to write a Quake 3 BSP parser that does as much mapping of the file buffer directly to Haskell memory without copying. Because why not :)
09:42 <ocharles> cocreature: haha, indeed
09:42 <merijn> cocreature: This is why I manage all my memory via stack and mmap in C++ ;)
09:43 _sg joined
09:43 <cocreature> merijn: I just throw unique_ptr and shared_ptr on everything and hope that I never need to worry about performance problems of shared_ptr
09:43 <merijn> shared_ptr all the things ;)
09:43 Welkin joined
09:43 <ocharles> I wonder why bytestring doesn't export any functions to build bytestrings from foreignptrs
09:43 <merijn> hmmm
09:43 tsahyt joined
09:43 <merijn> I seem to be really good at panicing GHC...
09:43 <ocharles> or am I just blind?
09:44 <ocharles> merijn: I have been making GHC panic a lot more recently :(
09:44 <merijn> ocharles: You're just blind :)
09:44 Jimmy_ joined
09:44 <cocreature> ocharles: the internal module exports the constructor iirc
09:44 <merijn> ocharles: Data.ByteString.Unsafe
09:44 <ocharles> cocreature: right, but that seems really really really unsafe. I don't get why it's not in Unsafe
09:44 <ocharles> merijn: that is Ptr not ForeignPtr
09:44 <ertes> muzzle: https://www.gnu.org/licenses/gpl-faq.html#LGPLStaticVsDynamic
09:45 fizruk joined
09:45 <merijn> ocharles: Oh, yes...but you can't sensibly build one from a ForeignPtr (since you have to convert ForeignPtr to Ptr before using)
09:45 <ocharles> I don't understand. ByteString *is* a wrapper over ForeignPtr
09:45 <ocharles> as cocreature said, that's literally the constructor
09:45 <merijn> Maybe the constructor is indeed exporte
09:45 <ocharles> it is, in Internal
09:45 <cocreature> ocharles: well exposing a function that constructs based on ForeignPtr would make it really hard to change the internals
09:45 <ph88> what does this first argument "UUID namespace" mean ? https://hackage.haskell.org/package/uuid-1.3.13/docs/Data-UUID-V5.html#v:generateNamed
09:45 <int-e> ocharles: I think Internal implies Unsafe and potential volatility of the interface
09:46 <ocharles> cocreature: ah
09:46 <cocreature> so I don’t think it’s that unreasonable to require that you use the constructor
09:46 <ocharles> that's a fair point
09:46 <ph88> the namespaces below it do not match the purpose i had in mind
09:46 <cocreature> ocharles: also at this point it’s probably really unlikely that the internal representation of ByteString changes, so you should be relatively safe :)
09:46 <ocharles> :)
09:47 xtreak joined
09:47 <cocreature> that reminds me, I still need to submit a bunch of PRs to bytestring to make ShortByteString actually usable
09:47 <ph88> hhmm i will read this http://stackoverflow.com/a/15395191
09:47 <merijn> ocharles: I'm making GHC panic at -O0 with no discernible reason >.>
09:48 <merijn> Well, it seems to be caused by enabling -fdefer-typed-holes, but I don't understand why :(
09:48 Maxdamantus joined
09:48 <ocharles> merijn: oh, I reported a panic just like that
09:50 <merijn> ocharles: Goddammit
09:50 <merijn> The regression I reported ages ago is still here :(
09:50 mpsag joined
09:50 <merijn> That's the issue
09:50 <ocharles> bah, looks like I didn't report it, just commented on an existing report. But trac search is so bad
09:50 louispan joined
09:50 <merijn> It's now treating any identifier not in scope as a typed hole
09:51 <merijn> So I wasn't seeing the error with -fno-warn-typed-holes
09:53 <merijn> ocharles: Do you know if I can search trac based on what tickets I've commented on?
09:53 <ocharles> no, that's what I was trying to do
09:53 <ocharles> I couldn't find a way
09:53 rabbi1 joined
09:54 <rabbi1> hi all, trying to learn haskell from MVC way, any suggestions ?
09:54 martisj joined
09:54 <srhb> rabbi1: "don't" ?
09:55 <rabbi1> srhb: ??
09:55 <merijn> @(&(%&(&% now I remember why I didn't update to 8 earlier
09:55 <lambdabot> Unknown command, try @list
09:55 <merijn> This is completely unacceptable >.<
09:55 petermw joined
09:55 <srhb> rabbi1: I personally don't think the traditional MVC pattern fits most Haskell programs very well, so I advise against it.
09:56 <srhb> But that's just my personal recommendation :-)
09:57 <merijn> ocharles: Even worse, I was right, my issue was fixed in 8.0.2, I just don't have that as the website only has a 8.0.1 binary for OSX >.<
09:57 <rabbi1> srhb: i am looking as haskell after pretty long time, too many frameworks already. adding to my confusion :(
09:57 <riaqn> Hi, I may have asked a similar question yesterday. But what's a more efficient version of (State (IArray i e) a)? the length of the array is fixed.
09:58 jophish joined
09:58 louispan joined
10:00 poundbear joined
10:00 bennofs joined
10:01 watom- left
10:01 Maxdamantus joined
10:02 <jle`> riaqn: efficient with respect to what operations?
10:02 <riaqn> ahh, random write.
10:02 ClaudiusMaximus joined
10:02 petermw joined
10:03 <dmj`> riaqn: MVector in ST or IO would be more efficient
10:03 stephAne joined
10:04 JagaJaga joined
10:05 oish joined
10:06 <riaqn> dmj`: maybe I'm wrong. But from what I saw, ST allows create new Array?
10:06 <riaqn> while I want to make sure that it's just some modification to a single fixed-length array.
10:07 <stephAne> hi. It's the first time I use Data.Binary. I had a simple serialization mechanism based on show and read, and now I use Data.Binary encode and decode. When writing over the network I was using System.IO hPutStrLn which awaits a [Char]. Now that my code has change the compiler complains that Lazy.Interal.ByteString is not a [Char]. My problem is that I don't find a System.IO function that takes Lazy.Internal.ByteString as input.
10:07 <riaqn> something like [(Int, a)], a list of keys to update.
10:07 ClaudiusMaximus joined
10:07 <dmj`> riaqn: it allows for mutability
10:07 <stephAne> I mean, the most common way to write Lazy.Internal.ByteString to a hand ?
10:07 <stephAne> handle
10:08 <dmj`> stephAne: I’d watch out for hPutStrLn some use cases make a single system call per character, really inefficient on the kernel.
10:08 <phadej> stephAne: there is hPutStr for bytestring
10:08 <phadej> s
10:09 <brynedwards> stephAne: https://www.stackage.org/haddock/lts-8.6/bytestring-0.10.8.1/Data-ByteString-Lazy.html#g:28
10:09 fizruk joined
10:09 <dmj`> riaqn: a [] in haskell is a linked list, different rep. Most efficient use of a vector is probably and unboxed mutable one, but that requires your type to have an Unbox constraint
10:09 <rabbi1> srhb: any book suggestion
10:09 <phadej> but there aren't hPutStrLn as "new line charcter" is something which (could) depend on encoding
10:09 fred-fri joined
10:10 peterbec` joined
10:10 <stephAne> no pb, I will rely on hPutStr, seems really nice
10:10 Guest40279 joined
10:10 <riaqn> dmj`: well I think box/unbox 's difference is negliable compared to mutable/immutable.
10:11 _sras_ joined
10:11 <riaqn> I honestly just want a faster (State (Array i e) a)..
10:11 <dmj`> riaqn: why use a State?
10:11 <dmj`> how is the state related to the Array I guess
10:11 <_sras_> Is there a way to insert an html string that I trust into a lucid template?
10:12 <riaqn> I'm just illustrating the idea.
10:12 <jle`> riaqn: you can do `ReaderT (STArray s i e) (ST s)` instead, maybe
10:12 Claudius1aximus joined
10:12 <riaqn> jle`: yeah, but still no restriction on the ST monad.
10:12 <jle`> what restriction do you mean
10:12 <riaqn> user can still (lift $ newSTArray)
10:13 <jle`> sure, but that doesn't affect the state
10:13 <jle`> that just makes a new array
10:13 tromp joined
10:13 ggVGc joined
10:13 <jle`> it doesn't modify the (STArray s i e) that is your state
10:13 <riaqn> yeah you are right. let me think.
10:14 <ertes> riaqn: why do you use State at all there?
10:14 <ertes> (or rather StateT)
10:14 <riaqn> ertes: just illustrating the idea.
10:15 <riaqn> that, "this is what I want, now what's the real approach?
10:15 <ertes> riaqn: create an array in ST, the modify it
10:15 <ertes> *then
10:17 <riaqn> jle`: I think it's doable. Thanks
10:17 ClaudiusMaximus joined
10:17 <ertes> ReaderT is just going to be an awkward version of the same thing
10:18 <stephAne> in Data.ByteString.Lazy, hGetContents :: Handle -> IO ByteString will close the handle when the content has been read... unfortunately, I use Network.Socket sockets, and I was using the same handle for answering to the client. Do you think I am doing things wrong ? I'm keep on searching, but I'd just like your point of view.
10:18 <ertes> stephAne: yes, don't use lazy input
10:18 bennofs joined
10:19 np356 joined
10:19 <ertes> stephAne: the proper low-level way to do this is to use regular blockwise reading and processing, the high-level way is to use a streaming abstraction like pipes
10:20 tempname11 joined
10:20 <stephAne> okay, I'm going to search about that. Pipes looks more entincing, judging by the name.
10:20 coot joined
10:21 <ertes> stephAne: with pipes you would typically use these libraries: https://hackage.haskell.org/package/pipes, https://hackage.haskell.org/package/pipes-bytestring, https://hackage.haskell.org/package/pipes-network
10:21 bollu joined
10:21 ragepandemic joined
10:21 <bollu> cocreature: ping
10:21 <ertes> stephAne: the pipes package has a Pipes.Tutorial module that explains the basics
10:21 <bollu> cocreature: are the docs for llvm-hs built anywhere?
10:21 <riaqn> there are like what, maybe 50 pipes library in haskell?
10:21 <stephAne> ertes: great, many thanks
10:22 <riaqn> all incompatible to each other.
10:22 <stephAne> :-)
10:22 <ertes> riaqn: some of them are compatible… for example pipes and conduit
10:22 ClaudiusMaximus joined
10:24 JagaJaga joined
10:26 yinn joined
10:28 jophish joined
10:28 marvin2 joined
10:28 <cocreature> bollu: the 4.0.0.0 docs are on hackage. I had to push a bugfix update earlier and didn’t get around to uploading the docs for that yet but the API is the same
10:28 marvin2 left
10:29 <bollu> cocreature: I see. https://hackage.haskell.org/package/llvm-hs The docs are not linked for me on the webpage, are they for you?
10:29 netheranthem joined
10:29 <cocreature> bollu: you need to click on the 4.0.0.0 version https://hackage.haskell.org/package/llvm-hs-4.0.0.0
10:30 marvin2 joined
10:30 Gurkenglas_ joined
10:30 <bollu> cocreature: ah, thanks!
10:30 refold joined
10:30 <bollu> what is the "mtl versus Free" debate? I understand how Free works and what mtl does, but I do not see how they can be related
10:31 <bollu> Free tries to build an AST and then evaluate it
10:31 <bollu> mtl allows you to layer effects
10:31 <bollu> where is the connection?
10:31 <jle`> Free also lets you compose effects as well
10:31 <bollu> jle`: quick example?
10:31 jaspervdj joined
10:31 juhp joined
10:32 <bollu> jle`: and I do not understand why people say that Free is slower than MTL (?)
10:32 <tdammers> they are both abstractions that help you compose EDSLs
10:32 <jle`> `Free (f :*: g)` gives you the effects of both f and g
10:32 <bollu> jle`: what is (:*:) ?
10:32 <bollu> :t (:*:)
10:32 <lambdabot> error: Data constructor not in scope: :*:
10:32 <jle`> data (f :*: g) a = f a :*: g a
10:33 <jle`> functor product
10:33 Booba joined
10:33 <bollu> hm
10:33 <bollu> interesting
10:33 <jle`> @import GHC.Generics ((:*:)(..))
10:33 <lambdabot> Unknown command, try @list
10:33 <bollu> jle`: so, the debate is "which is better to compose effects"?
10:33 <jle`> @let import GHC.Generics ((:*:)(..))
10:33 <lambdabot> Defined.
10:34 <jle`> :t (Left 'a') :*: "hello"
10:34 <lambdabot> (:*:) (Either Char) [] Char
10:34 <jle`> er
10:34 <jle`> :t (Left 'a') :*: [1,2,3]
10:34 <lambdabot> Num p => (:*:) (Either Char) [] p
10:34 <bollu> interesting
10:34 <jle`> (Either Char :*: []) Int
10:35 <jle`> and there's (:+:), which lets you use 'commands' from either functor
10:35 <jle`> so if you had Free (f :+: g), each 'layer' could be an action from the f Functor, or an action from the g Functor
10:35 <bollu> I see
10:36 <bollu> where is this from? :*: and :+:?
10:36 <jle`> so if f was AST1, and g was AST2, then Free (f :+: g) would have elemenents of both ast 1 and ast 2
10:36 <jle`> :*:/:+: are awkwardly from GHC.Generics
10:36 <jle`> but they have non-operator equivalents too, Product and Sum
10:36 <jle`> in Data.Functor.*
10:37 Welkin joined
10:38 <bollu> OK
10:38 <jle`> this method is called the 'data types a la carte' style
10:38 <bollu> so, what about things like non-commutative effects and stuff? and repeated layers of the same effect?
10:39 <bollu> from what I understand, mtl has no solution to #2
10:39 <bollu> also, one other question: why is Free considered slower than mtl?
10:40 <jle`> well, mtl doesn't actually export any data types
10:40 <jle`> so i don't think it's a fair comparison
10:40 <jle`> er, i mean, it doesn't define any data types.
10:40 <jle`> mtl is just a bunch of typeclasses
10:40 <jle`> the instances you have for those typeclasses can be as efficient or inefficient as you wnat
10:41 <mniip> it does instantiate the typeclasses
10:41 <mniip> for types in transformers
10:41 bennofs joined
10:41 <bollu> hm
10:41 <bollu> but, will Free be slower *by definition* or something?
10:41 <jle`> it does do that, but you aren't required to use those types as your instances
10:42 <bollu> when comparing say the fastest Free implementation to the fastest mtl impementatin?
10:42 <jle`> most of the times i use mtl typeclasses is with types that aren't from transformers
10:42 <jle`> i don't know enough to give a meaningful answer to your actual question, sorry, so i'll duck out here :)
10:43 <bollu> OK :)
10:45 ebzzry joined
10:46 coot joined
10:46 ludat joined
10:46 <maerwald> the only performance comparison I know of is in olegs paper
10:47 <maerwald> http://okmij.org/ftp/Haskell/extensible/more.pdf page 7
10:48 louispan joined
10:56 benl23 joined
10:57 fractalsea joined
10:59 Gloomy joined
11:00 tlaxkit joined
11:01 nighty- joined
11:01 JeanCarloMachado joined
11:01 <ski> @type Data.Array.ST.runSTArray -- riaqn, perhaps
11:01 <lambdabot> (forall s. ST s (GHC.Arr.STArray s i e)) -> Array i e
11:02 Prutheus joined
11:02 <riaqn> ski: I don't know... it's an imperative program that returns an array..
11:02 <riaqn> externally just a pure function returning an array..
11:03 <riaqn> anyway.. I will try all approaches and see if I can make my question more specific..
11:04 merijn joined
11:04 bjz joined
11:05 fmapE joined
11:06 bollu joined
11:07 uncertainty joined
11:10 peterbec` joined
11:12 FjordPrefect joined
11:12 calincru joined
11:12 refold joined
11:13 <ph88> how do i go from lazy bytestring to text?
11:13 FreeBirdLjj joined
11:14 <cocreature> ph88: Data.Text.Lazy.Encoding
11:14 mmhat joined
11:14 <cocreature> obviously decoding functions are in the module called Encoding
11:14 <ph88> thx
11:15 fizruk joined
11:15 <ski> (and then encoding functions are in `Decoding' ?)
11:15 <cocreature> ski: nah they are actually in the same module :)
11:16 <* ski> was fearing so
11:17 bollu joined
11:18 sdothum joined
11:19 poundbear joined
11:20 np356 joined
11:20 MindlessDrone joined
11:20 jophish joined
11:21 systadmin joined
11:26 mbuf joined
11:27 Nicnux joined
11:28 phaji joined
11:29 <tobiasBora> Hello,
11:30 <cocreature> hey tobiasBora
11:31 <tobiasBora> I'm having a problem with a program that needs to open a big file (136M), and for each lines it perform some operations on it, and write the result in a given file. And my program uses multicore and multithreads (using Parallel.IO)
11:31 fractalsea joined
11:31 <tobiasBora> The thing is that my program runs out of memory
11:31 <tobiasBora> (it crashs my computer)
11:32 Booba_ joined
11:32 <cocreature> tobiasBora: how do you read the file?
11:32 MindlessDrone joined
11:32 <tobiasBora> cocreature: I'm using "parseInputFile" from Parsec.
11:32 bollu joined
11:33 <tobiasBora> I think that this is not lazy?
11:34 <cocreature> tobiasBora: for a file that large you might want to consider switching to "attoparsec"
11:34 <tobiasBora> And by the way, is it possible to use the parallel functions on a lazy list, or do I need to eval it before?
11:34 <tobiasBora> cocreature: Ok I'll try.
11:34 <* tobiasBora> must leave now, but comes back later, will read the answers, and annoy you again
11:34 mfukar joined
11:35 anton__ joined
11:35 <msl09> hello again
11:35 <msl09> I'm confused about this line of code "map print [1,2,3,4]"
11:36 <cocreature> msl09: confused how?
11:36 <msl09> when I input it to ghci I get an error
11:36 <msl09> No instance for (Show (IO ())) arising from a use of ‘print’
11:36 <cocreature> msl09: you probably want mapM_ print [1,2,3,4]
11:36 <cocreature> :t map print [1,2,3,4]
11:36 <lambdabot> [IO ()]
11:36 <cocreature> :t mapM_ print [1,2,3,4]
11:36 <lambdabot> IO ()
11:36 <msl09> right
11:37 <msl09> isn't the default behaviour of ghci to "put a print" at the end of every statement evaluated
11:37 <msl09> :t print
11:37 <lambdabot> Show a => a -> IO ()
11:38 <mniip> right
11:38 <cocreature> msl09: that’s exactly what’s happening here
11:38 <mniip> but [IO ()] is not Show
11:38 <cocreature> so it’s calling print (map print [1,2,3,4])
11:38 <cocreature> which requires a Show instance on [IO ()]
11:38 <cocreature> which requires a Show instance on IO ()
11:38 <cocreature> and that’s the error you’re seeing
11:39 <brynedwards> I guess leaving out the print would be "map id [1,2,3,4]"
11:39 <brynedwards> ...or just [1,2,3,4]
11:40 <msl09> ah I see now
11:40 <Axman6> :t map print [1,2,3,4]
11:40 <lambdabot> [IO ()]
11:40 <msl09> now that I read it in that light the error was very clear
11:40 <Axman6> bleh, that was already said. late aagin to the party!
11:43 fakenerd joined
11:44 bennofs joined
11:46 bollu joined
11:47 inad922 joined
11:50 HoierM joined
11:52 fractalsea joined
11:53 JeanCarloMachado joined
11:53 <ph88> if i want to parse all characters that are not double quote, should i use lookAhead ?
11:54 sepp2k joined
11:55 <ph88> i want to parse "pdf:PDFVersion","1.4"
11:56 <riaqn> Hi is there some cooperative threading library? I hope it can be escaped (like ST). That is, inside there are many thread running, but I can escape it and the whole function behaves as pure.
11:56 <riaqn> This can be done by Cont monad, but I also need some signal between thread.
11:57 <ph88> oh i can use someTill
11:59 mmn80 joined
11:59 jgertm- joined
12:00 WizJin joined
12:01 eacameron joined
12:01 takle joined
12:02 wahrsagevogel joined
12:07 mmachenry joined
12:08 geekosaur joined
12:11 daniel-s joined
12:11 peterbec` joined
12:11 danthemyth joined
12:13 danthemyth joined
12:13 numee joined
12:13 danthemyth joined
12:15 cliodne joined
12:15 rgc joined
12:15 ziocroc joined
12:15 jdnavarro joined
12:15 asmyers joined
12:15 fizruk joined
12:16 <cliodne> Hi, a beginner here. Can someone take a look at my thread, thank you. https://www.reddit.com/r/haskell/comments/62dkby/eli5_function_composition/
12:18 CMCDragonkai joined
12:18 ichor joined
12:18 <ski> "follow the types"
12:18 <ph88> i try to use https://hackage.haskell.org/package/megaparsec-5.2.0/docs/Text-Megaparsec-ByteString-Lazy.html but i still have to input String into the parse function .. i don't understand https://hackage.haskell.org/package/megaparsec-5.2.0/docs/Text-Megaparsec.html#v:parse
12:18 <ski> cliodne : you have
12:18 <ski> act :: (a -> d -> c) -> (b -> a) -> ((a -> a) -> b -> d) -> b -> c
12:18 <ski> act = ?
12:19 <ski> you can see immediately from the type signature that `act' will be a function that takes four arguments, one after another, so
12:19 <ski> act f g h x = ?
12:19 <ski> where we know
12:19 <ski> f :: a -> d -> c
12:19 <ski> g :: b -> a
12:20 <ski> h :: (a -> a) -> b -> d
12:20 <ski> x :: b
12:20 <ski> and we want to construct the result
12:20 <ski> ? :: c
12:20 <ski> cliodne : makes sense, so far ?
12:20 <cliodne> yes
12:21 <ski> now, the only way we can get a `c' here (which is an *unknown* type, from our point of view) is by calling `f' on two arguments
12:21 <ski> you see that ?
12:21 cur8or joined
12:21 <cliodne> a and d?
12:21 <ski> yes, so now we have
12:21 <ski> act f g h x = f ?0 ?1
12:22 <ski> where we now want to solve the goals / plug the holes :
12:22 <ski> ?0 :: a
12:22 <ski> ?1 :: d
12:22 np356 joined
12:22 <ski> if we decide to look at `?0', then we notice that the only way we can get hold of an `a' is by calling `g', so let's do that
12:23 JeanCarloMachado joined
12:23 <ski> act f g h x = f (g ?2) ?1
12:23 <ski> where now
12:23 <ski> ?2 :: b
12:23 <ski> cliodne, ok ?
12:23 asthasr joined
12:23 <cliodne> ok
12:23 <ski> now, do you see where we could get a `b' from ?
12:24 <cliodne> x?
12:24 <ski> yes
12:24 <ski> in fact, that's the only way we can get a `b', even
12:24 <ski> so
12:24 <ski> act f g h x = f (g x) ?1
12:24 <ski> and we're now left with satisfying the goal
12:24 <ski> ?1 :: d
12:25 <ski> will you do the next step here ?
12:25 <cliodne> so h?
12:25 <ski> applied to how many new goals/holes ?
12:25 <cliodne> one?
12:25 <ski> sorry, nope
12:26 <ski> `h ?3' would have type `b -> d', not `d' (if `?3' has type `a -> a')
12:26 Welkin joined
12:26 <ski> we want `?1' to have type `d', so we have to replace that hole with an expression of that type
12:27 <ski> try again ?
12:27 <cliodne> ok, give me a sec. I'll go through everything once more. (english is not my first language sorry)
12:27 bollu joined
12:27 <ski> no worry, take your time
12:28 tempname11 joined
12:29 <lyxia> ph88: Do you mean "Name of source file"?
12:30 merijn joined
12:30 biglama joined
12:30 <ph88> lyxia, i think i actually forgot to supply the parser function -____-
12:31 bennofs joined
12:32 yogsototh joined
12:35 Claudius1aximus joined
12:35 alienbot joined
12:35 <tobiasBora> So I'm back
12:35 <cliodne> ski: so we have two new holes?
12:35 eacameron joined
12:35 <ph88> lyxia, i supplied the parser function but the error remains
12:36 <ski> cliodne : yes, because we need to apply `h' to two arguments, in order to get a result of type `d' (which is what needs to fill the `?1' hole)
12:36 <tobiasBora> Let's imagine I use Attoparsec now, to parse a file containing on each list basically three elements separated by comas
12:36 <ski> cliodne : so
12:36 <ski> act f g h x = f (g x) (h ?3 ?4)
12:36 <ski> where the goals now are
12:36 grayjoc joined
12:36 <ski> ?3 :: a -> a
12:36 <ski> ?4 :: b
12:37 <ski> cliodne : any idea how to satisfy the goal `?3' here ?
12:37 <tobiasBora> If Attoparsec gives me a list, first, would it be a lazy list ? So that when I then run parallelE from Parallel.IO, it never stores the whole file?
12:37 <lyxia> ph88: paste your code
12:37 <cliodne> not at first
12:38 bollu joined
12:38 <ph88> lyxia, i keep messing up arguments and stuff .. got it to compile now
12:38 <ski> cliodne : well, this situation is unlike what we had before (except at the very start, though you probably didn't notice that) ..
12:38 <ski> cliodne : .. `?3', the first argument to `h', should itself be a function. so we have to construct a function here
12:39 <bollu> what is the status of data parallel haskell?
12:39 nomicflux joined
12:39 <ski> cliodne : there could be many ways to construct a function, but the most direct way is to use a "lambda expression", aka a "function abstraction" or sometimes an "anonymous function" -- are you familiar with that ?
12:40 <cliodne> somewhat
12:40 <lyxia> tobiasBora: it won't be lazy
12:40 <lyxia> tobiasBora: it's going to parse the whole file before giving you a result
12:40 <stephAne> Just a reminder for me: I think I saw it once, but I don't remember the meaning of | m -> e in this : class (Monad m) => MonadError e m | m -> e where ... I try to interpret it as a guard but it doesnt sparkle anything in my mind.
12:41 <lyxia> stephAne: It's called functional dependencies
12:41 <ski> cliodne : an expression `\t -> t^2' is a value, a *function* value, describing "the function that, given an input, call it `t', returns `t^2'"
12:41 <ski> cliodne : in our case, we can invent a function `\y -> ?5', like so :
12:41 <bollu> stephAne: It means that given an "m", an "e" can be determined uniquely
12:41 ExpHP joined
12:41 <bollu> stephAne: AFAIK, all FunDeps can be expressed as type families
12:42 <ski> act f g h x = f (g x) (h (\y -> ?5) ?4)
12:42 <ski> where the goals now are
12:42 <tobiasBora> lyxia: Hum... So how could I proceed? By the way, can parallel.IO work with lazy lists?
12:42 <ski> ?5 :: a
12:42 <ski> ?4 :: b
12:42 <ski> and we now have a *new* assumption/resource :
12:42 yinn joined
12:42 <ski> y :: a
12:42 <ski> that's available for possible use in `?5' (but not in `?4')
12:42 <ski> cliodne : ok ?
12:42 fizruk joined
12:43 <cliodne> ?4 would be x?
12:43 <lambdabot> Maybe you meant: v @ ? .
12:43 <merijn> hmmm, can I somehow avoid the pattern match here? http://lpaste.net/354095
12:43 <merijn> I can't seem to think of how
12:43 <ski> cliodne : yes, you can plug `?4' with `x' already :)
12:44 <ski> act f g h x = f (g x) (h (\y -> ?5) x)
12:44 <ski> leaving
12:44 <ski> ?5 :: a
12:44 <ski> where the available resources now are
12:44 <cliodne> ok, thank you so much ski
12:44 <ski> f :: a -> d -> c
12:44 <ski> g :: b -> a
12:44 <ski> h :: (a -> a) -> b -> d
12:44 <lyxia> tobiasBora: AFAICT parallel-io is going to force the spine of the list first. Why are you using parallel-io?
12:44 <ski> x :: b
12:44 <ski> y :: a
12:44 <ski> cliodne : so there's one more hole to plug, `?5', of type `a'
12:44 <cliodne> I think I understand. going to c/p this conv to my notepad and go through it again
12:44 <ski> cliodne : can you see how to satisfy this goal ?
12:45 <lyxia> merijn: runReaderT ?
12:45 <ski> (cliodne : there's in fact more than one way to satisfy this goal ..)
12:45 <tobiasBora> lyxia: Because I'd like to share the computation (IO computation) between lot's of threads... What else could I use?
12:46 DexterLB joined
12:46 naldoco joined
12:46 <ski> cliodne : i think it helps to think of it as a kind of game, with set rules for how to "move" in each of the currently "open" goal/hole positions. the task is to satisfy all the individual goals
12:47 splanch joined
12:47 <ski> in each position, there are some resources, that one can use to satisfy the demand/goal. in some positions, (such as `?5' here), there may be more, additional, resources available
12:47 <lyxia> tobiasBora: okay, somehow I was disturbed by the juxtaposition of attoparsec and parallel-io.
12:48 <ski> cliodne : i hope this helps to understand what i meant by "follow the types". i have to leave now. good luck
12:48 <cliodne> thank you!
12:48 cpennington joined
12:49 eacameron joined
12:49 jmaki joined
12:49 <lyxia> merijn: mapReaderT
12:49 <ski> (do try to see if you can figure out all the possible ways to plug `?5', btw)
12:50 <merijn> lyxia: Ah! That's the magic I missed!
12:51 tromp joined
12:51 <tobiasBora> lyxia: Yes, it's attoparsec --> string list --> parallel-io. But if parallel-io forces me to evaluate the list, I will never be able to lazilly read my file... Is there a better program that parallel-io that do not force evaluation of the list?
12:52 skeuomorf joined
12:53 balor joined
12:53 jhrcek joined
12:54 sanett joined
12:55 systadmin joined
12:57 <lyxia> tobiasBora: doesn't attoparsec have to read the whole contents before giving you a result?
12:57 fuzzy-id joined
12:57 rabbi1 joined
12:58 eklavya joined
12:58 merijn joined
12:58 <tobiasBora> lyxia: Well it's line by line that it can parse it
12:59 coot joined
13:02 nobodyyy joined
13:03 nobodyyy left
13:05 FreeBirdLjj joined
13:06 u7brentt joined
13:08 sanett joined
13:08 <lyxia> tobiasBora: I can't find anything, but there's still the option of setting up your own concurrency scheme with stm.
13:12 peterbec` joined
13:12 deepfire joined
13:13 uglyfigurine joined
13:14 Boomerang joined
13:14 kamog joined
13:14 eacameron joined
13:14 <ph88> how can i turn this Digest a into a normal scalar type? https://hackage.haskell.org/package/cryptonite-0.22/docs/Crypto-Hash.html#v:hash
13:16 <tobiasBora> lyxia: I wanted to avoid that, but if it's the only solution... Just, even if I use `endBy` parser it won't be a lazy string that will be procuced?
13:16 eacameron joined
13:17 <mutsig> ph88: doesn't `show` do what you want? I'm not familiar with that stuff tho...
13:17 <tobiasBora> Hum... it makes sens indeed because it returns Either...
13:17 <tobiasBora> so he first need to know if he can parse it.
13:17 <ph88> mutsig, i thought show was only supposed to be used for debugging
13:17 sanett joined
13:18 cpennington joined
13:18 Deaddy joined
13:18 <mutsig> ph88: you might be confused with "traceShow"?
13:18 <Gurkenglas_> No, ph88's got that right
13:19 <Gurkenglas_> But some libraries ignore that and the closest thing we've got to a Show law that show should produce strings that can be pasted into code to recover values
13:19 <merijn> mutsig: show is also not really for "real" use either
13:19 <ph88> yeah that method exist show :: SHA3_512 -> String but should i use it ?
13:19 conal joined
13:20 <mutsig> merijn: why is that? You meen show in general? or for crypto stuff=
13:20 <mutsig> ?*
13:20 <lambdabot> Maybe you meant: v @ ? .
13:20 <merijn> mutsig: show in general
13:20 <merijn> mutsig: Because it's supposed to print "valid Haskell" and thus not really suitable for user output
13:20 Welkin joined
13:20 <merijn> Better of using some pretty printing library in most cases
13:20 Boomerang joined
13:21 <lpaste_> msl09 pasted “test stream” at http://lpaste.net/354096
13:21 <msl09> ok I have another question
13:21 <mutsig> merijn: ok, good to know. However, I haven't had a problem with it so far, and I use it...
13:21 <msl09> the code I just pasted
13:22 <msl09> as I understand takes a stream of characters and puts it to the stdout
13:22 <msl09> lazily
13:22 <merijn> mutsig: It's ok if you're writing quick throwaway programs and small prototypes, but not really good for "real world" code. Even things like "printing a number", you probably want some locale aware representation, rather than just
13:22 <merijn> > show 123456789
13:23 <lambdabot> "123456789"
13:23 <merijn> Often you'd want to print it as, e.g. "123,456,789" instead
13:23 <ph88> anyone here used cryptonite with hash function ?
13:23 <merijn> Or dots as thousand separator
13:23 <msl09> my optmistic belief were that the characters would be spit out as they were being read
13:23 <msl09> but that's not what happened
13:23 <Boomerang> ms109: That looks right, but it is line buffered by default
13:24 xtreak joined
13:24 <msl09> I know that becase I used a 200mb file
13:24 <msl09> and the code simply hang
13:24 <merijn> msl09: getContents is also pretty awful for a 200mb file :)
13:25 <merijn> msl09: You should probably use Data.Text.Lazy.getContents and their uppercase function :)
13:26 <ph88> i think i'm supposed to use the ByteArrayAccess instance of Digest
13:26 snowalpaca joined
13:27 nilg joined
13:27 <msl09> how do I know that?
13:27 <merijn> msl09: How do you know what? :)
13:28 <msl09> get contents from prelude shows the following documentation:
13:28 <msl09> The getContents operation returns all user input as a single string, which is read lazily as it is needed (same as hGetContents stdin).
13:28 <msl09> while text.lazy:
13:28 <msl09> Lazily read all user input on stdin as a single string.
13:28 <msl09> am I missing something?
13:29 <merijn> msl09: Prelude returns String, Text.Lazy returns Text, which is much better for doing textual IO
13:29 HarveyPwca joined
13:29 <ph88> how do i go from something that has ByteArrayAccess to Text ?
13:29 gtifbv joined
13:30 HarveyPwca joined
13:30 FreeBirdLjj joined
13:30 rabbi1 joined
13:32 mda1 joined
13:34 chlong joined
13:34 jsgrant-_ joined
13:36 ebzzry joined
13:37 Xanather joined
13:37 ystael joined
13:38 <lyxia> ph88: http://hackage.haskell.org/package/text-1.2.2.1/docs/Data-Text-Foreign.html
13:38 fractalsea joined
13:38 <lyxia> hmm that does not do decoding
13:38 <ph88> oi FFI
13:39 <ph88> sha3 :: B.ByteString -> Text
13:39 <ph88> sha3 = decodeLatin1 $ Data.ByteArray.convert hash
13:39 <ph88> i try this at the moment
13:39 henriksod joined
13:39 <lyxia> why are you turning a digest to text
13:40 fotonzade joined
13:40 <lyxia> if you're going to print it I guess a hex encoding would be better.
13:40 beerdrop joined
13:42 <ph88> lyxia, i will use the hash as primary key in my database
13:42 sea_wulf joined
13:42 burtons joined
13:43 <ph88> lyxia, the DocId constructor takes Text https://hackage.haskell.org/package/bloodhound-0.13.0.0/docs/Database-V5-Bloodhound-Types.html#t:DocId
13:43 <msl09> merijn: ok so Prelude.getContents returns lazily but putStr needs to consume the hole string, is that correct?
13:43 <ph88> should i use Text with hexidecimal representation ?
13:43 leshow joined
13:44 buoto joined
13:44 <leshow> :t mapM
13:44 <lambdabot> (Monad m, Traversable t) => (a -> m b) -> t a -> m (t b)
13:44 sepp2k joined
13:44 <leshow> :t traverse
13:44 <lambdabot> (Applicative f, Traversable t) => (a -> f b) -> t a -> f (t b)
13:44 <brynedwards> Maybe base16-bytestring for hex
13:45 <leshow> can I still use do notation inside the function passed to traverse?
13:45 <leshow> when would i want to use mapM over traverse
13:45 cpup joined
13:45 <msl09> otherwise I don't understand why the program hangs without printing anything
13:46 <lyxia> leshow: traverse (\x -> do { stuff; stuff })
13:48 <lyxia> leshow: mapM might be more convenient in older versions of base, when Applicative was not a superclass of Monad.
13:48 mekeor joined
13:48 <leshow> lyxia, right so applicative is a superclass of monad
13:48 <leshow> cool
13:48 fmapE left
13:51 umib0zu joined
13:52 meba joined
13:52 mizu_no_oto_work joined
13:55 mfukar joined
13:55 <phz_> hey: hunit or quickcheck?
13:55 <phz_> I’m struggling to pick one
13:56 eschnett joined
13:56 mmachenry joined
13:57 <fuzzy-id> phz_: what do you want to test?
13:57 <phz_> unit testing for now
13:57 <lyxia> they're not mutually exclusive...
13:57 <phz_> properties and monadic results
13:57 <phz_> lyxia: in which terms?
13:57 <lyxia> you can have some tests using one framework, and some more using the other
13:57 gabe4k joined
13:58 <phz_> why would I do that?
13:58 <phz_> I want unification
13:58 <fuzzy-id> because they test different aspects of your code
13:58 <phz_> which ones?
14:00 <fuzzy-id> you got me at this one :)
14:00 <lyxia> unit testing makes it easy to specify edge cases
14:01 <lyxia> and you can say exactly the expected result on some inputs
14:01 <oherrala> phz_: pick something like Tasty for testing framework. then you can combine multiple testing methods under same tool
14:01 <lyxia> this is not always possible to do with property based testing
14:02 ChristopherBurg joined
14:02 <fuzzy-id> wrapping my head around property-testing/quickcheck was a really interesting experience
14:03 <fuzzy-id> reading about it I was able to grasp what it is about
14:03 <fuzzy-id> but understanding came with implementing a few properties
14:03 <fuzzy-id> phz_: try it and you will see that neither of them is a swiss army knife…
14:03 `^_^v joined
14:04 shapr joined
14:04 <fuzzy-id> use a meta-testing framework like tasty and see how far you get…
14:05 jathan joined
14:05 Welkin joined
14:06 noxd joined
14:08 snowalpaca joined
14:08 Rodenbach joined
14:09 ClaudiusMaximus joined
14:11 harfangk joined
14:11 tromp joined
14:12 HarveyPwca joined
14:13 James123 joined
14:13 peterbec` joined
14:13 <James123> Can someone possibly explain what is the difference between '$' and '$!' operators?
14:14 <Welkin> :t ($!)
14:14 <lambdabot> (a -> b) -> a -> b
14:14 <Welkin> lol
14:14 simukis_ joined
14:14 <Welkin> I think it is strict in evaluation
14:15 <lyxia> it is
14:15 <brynedwards> https://wiki.haskell.org/Performance/Strictness#Evaluating_expressions_strictly
14:16 <tobiasBora> lyxia: Indeed, I tried to run parallel_ $ map (\n -> putStrLn $ show n) [1..], and it never starts to display anothing, so Parallel.IO is not Lazy... Does anyone knows if there is a version which is lazy?
14:19 the_2nd joined
14:20 <the_2nd> Can I define a where clause which is visible for all definitions of the function? When there's multiple implementations for the function depending on the passed types
14:20 cdg joined
14:21 <the_2nd> f (Foo x) =
14:21 <the_2nd> f (Bar x) =
14:21 <the_2nd> where both have access to the local definition
14:21 <Boomerang> the_2nd: you can use a case statement instead of pattern match
14:22 <Boomerang> the_2nd: But you can't access x in your where clause
14:22 Claudius1aximus joined
14:23 <stephAne> I'm reading a paper introducing Monad Transformers, https://page.mi.fu-berlin.de/scravy/realworldhaskell/materialien/monad-transformers-step-by-step.pdf, at page 7, I have extracted the little code I don't understand: http://lpaste.net/354098. In short, how does the Maybe monad knows how to return inside the Eval2 monad of this example ?
14:23 earldouglas joined
14:24 <Boomerang> the_2nd: So it would be: f fooBar = case fooBar of Foo x -> ...; Bar x -> ...; where ...
14:24 <merijn> stephAne: What's the type of Map.lookup?
14:24 <merijn> stephAne: Or is it just the one from Data.Map?
14:24 cdg joined
14:24 <merijn> stephAne: Also, how is Eval2 defined?
14:25 <stephAne> ithe type of Map.lookup is Maybe a
14:25 <the_2nd> Boomerang, I guess I could define a local function within the where
14:25 <stephAne> return type
14:25 <the_2nd> which is pattern matched
14:25 <merijn> stephAne: Honestly, depending on what Eval2 is, that looks like a typo/bug to me
14:25 <stephAne> type Eval2 α = ErrorT String Identity α
14:25 <Boomerang> the_2nd: Yeah exactly, and if you need you can have sub-where clause in each branch of the case statement
14:26 <stephAne> with the function: runEval2 :: Eval2 α → Either String α
14:26 <merijn> stephAne: Right, that simply looks like a bug to me :)
14:26 <stephAne> okay, there's no magic between Maybe and ErrorT ?
14:26 <merijn> stephAne: Nope
14:26 Fairy joined
14:26 <the_2nd> Boomerang, I mean f xs foobar = where f' (Bar b) = f' (Foo x) = ....
14:27 <stephAne> cool :-)
14:27 <merijn> stephAne: Are you familiar with the State monad?
14:27 <Boomerang> Oh yeah sure :)
14:27 <stephAne> I played with 3 or 4 times, but always back to the start when dealing with StateT
14:28 mada joined
14:28 <merijn> stephAne: Right, my usual advice for understanding transformers is: Implement State from scratch, then generalise it to StateT by hand: https://gist.github.com/merijn/098106abd45c940dab09
14:28 carlomagno joined
14:28 <stephAne> going to dive in this right now, thanx
14:29 crobbins joined
14:29 mohsen_ joined
14:30 <shapr> This is a fun read: http://teh.id.au/posts/2017/03/29/these-align-crosswalk/index.html
14:30 <the_2nd> Boomerang, http://lpaste.net/354099
14:30 <the_2nd> Boomerang, this way I dont have to pass nps to all helpers
14:33 oberix joined
14:35 tdfirth joined
14:36 <lpaste_> Boomerang annotated “No title” with “the_2nd” at http://lpaste.net/354099#a354100
14:36 <Boomerang> the_2nd: Your version is completely fine :) Here's another way
14:37 <lpaste_> Boomerang revised “the_2nd”: “the_2nd” at http://lpaste.net/354100
14:39 xtreak joined
14:40 dsh joined
14:41 FreeBirdLjj joined
14:41 thunderrd joined
14:41 theelous3 joined
14:42 brynedwards joined
14:42 Sh4rPEYE joined
14:42 sophiag joined
14:43 coltfred joined
14:43 ystael joined
14:43 <naldoco> @help
14:43 <lambdabot> help <command>. Ask for help for <command>. Try 'list' for all commands
14:43 <naldoco> @help list
14:43 <lambdabot> list [module|command]. Show commands for [module] or the module providing [command].
14:44 <naldoco> @list
14:44 <lambdabot> What module? Try @listmodules for some ideas.
14:46 Gurkenglas_ joined
14:46 <Booba_> ertes: Sorry for still not letting you go, but I have another question about Hangman game. I was trying to extend the game and add an attempt counter and I have a feeling that this breaks the monoidal nature of the proposed solution.
14:47 oberstein joined
14:49 CurryWurst joined
14:49 <Booba_> ertes: I was thinking about adding the counter to games state as a tuple: Guess ([Maybe a], Int) (a -> Hangman a b) and so on
14:49 ragepandemic joined
14:50 <Booba_> ertes: but this doesn't make sense to have a counter for individual singleton game. The counter belongs semantically to the "whole" game
14:51 <Welkin> Boomerang: create your own data type
14:51 Jimmy_ joined
14:51 <Boomerang> Welkin, Booba_ maybe? :)
14:52 <Welkin> Boomerang: yes, sorry
14:52 <Welkin> data GameState = GameState { attempts :: Int, state :: <whatever> }
14:53 Kreest__ joined
14:53 <Welkin> data GameState = GameState { attempts :: Int, board :: [String], guesses :: [String] }
14:53 <Welkin> or something similar
14:54 jao joined
14:55 <Booba_> Welkin: I'm trying to learn to design solutions in haskell mindset, so to speak. And ertes proposed his http://community.haskell.org/~ertes/hangman/ as an example of hpw one might design using algebraic approaches
14:56 eklavya joined
14:56 dylukes joined
14:56 marsam joined
14:56 Gloomy joined
14:56 melop joined
14:56 <Booba_> While I can understand the solution to original problem, I was thinking about how do I reuse this in my attempts to add a feature to the game: add a possibility to lose after a number of failed attempts
14:56 <ph88> i start to read this tutorial https://www.spock.li/tutorial/ it says The conn type parameter describes what are database connection looks like (() for no database) i would like to work with 2 databases, is that possible ?
14:57 vicfred joined
14:57 <brynedwards> ph88: Not with the database helper
14:57 <ph88> :/
14:57 <Booba_> and while designing the game state as a superposition of singleton games looks nice, I can't see it being flexible enough to easily add an attempt limit feature. Am I missing something?
14:58 <ph88> brynedwards, what should i do? try another framework ?
14:58 <brynedwards> You could store two or more connection pools in the AppState
14:58 <ertes> Booba_: the current type does not easily expose whether the last guess was a miss or not… that's the missing piece
14:59 <ertes> Booba_: Guess [Maybe b] (a -> Maybe (Hangman a b)) -- only return a new game, if the guess was a hit
15:00 <brynedwards> I think that's what Spock does for the database helper, but it only stores one connection pool
15:00 <Booba_> ertes: so I modify singleton function to represent this, right?
15:00 <ertes> Booba_: and mappend and hangmanStdio
15:00 Lord_of_Life joined
15:01 <ertes> Booba_: then the hit/miss counter is an extension: data GuessLimit a b = LGuess Integer (Hangman a b) | Lost (Hangman a b)
15:01 <Booba_> ertes: naturally, yes. And what about attempt count? Isn't it a part of games state now?
15:01 <ertes> Booba_: no, it doesn't change the game logic, it only extends it
15:01 ubsan_ joined
15:02 hybrid joined
15:02 jgertm joined
15:02 melop left
15:02 <ertes> Booba_: there is one caveat: when you lose the game, the phrase will not be exposed
15:02 <ertes> if you want that, then you need to change Hangman itself to count
15:03 enitiz joined
15:03 cdg joined
15:03 JuanDaugherty joined
15:03 Salih joined
15:03 <ertes> you can preserve the monoidal structure though
15:03 Denthir joined
15:04 <Booba_> ertes: lets focus on one thiing at a time. If I do not expose the phrase if I lose, I don't have to mess with the Hangman type, correct?
15:04 <ertes> correct
15:04 argent0 joined
15:05 <Booba_> ertes: I still can't see where the GuessLimit should reside? In what function? In hangmanStdio?
15:05 afldcr joined
15:06 romeoh joined
15:06 uncertainty joined
15:07 <Booba_> ertes: oh, or GuessLimit is the new extended game?
15:08 sleffy joined
15:08 takle joined
15:08 xtreak joined
15:08 cpennington joined
15:08 romeoh left
15:09 <ertes> yes
15:09 <Booba_> ertes: if it is so, it has its own stdio
15:10 <Booba_> ertes: that reuses hangmanStdio
15:10 <ertes> of course, because it's a different game
15:10 <ertes> it probably can't reuse hangmanStdio either
15:10 <ertes> because that one is a closed loop
15:10 <Booba_> ertes: oh, I see what extention via composition means now!
15:11 <ertes> but you can factor out parts of hangmanStdio and reuse those
15:11 <Booba_> ertes: like, limited hangman is a function of whatever hangman game you might want
15:11 okra_ joined
15:12 thc202 joined
15:12 <Booba_> ertes: thank you for your patience and insights, AGAIN!
15:12 FjordPrefect_ joined
15:13 Unhammer joined
15:13 katychuang_ joined
15:14 <Booba_> ertes: theoretically, I can push it further, like, introduce a Game typeclass that has a move function. And have a LimitedGame typeclass that decrements a counter once a move has been called!
15:14 <ph88> i'm just wondering when i use functions like this https://hackage.haskell.org/package/req-0.2.0/docs/Network-HTTP-Req.html#v:req haskell doesn't force me to check the response, shouldn't it ?
15:14 hackebeilchen joined
15:15 oberstein joined
15:15 peterbec` joined
15:15 <Geekingfrog> why would you be forced to check the response ?
15:15 dawehner joined
15:16 <Cale> Booba_: You shouldn't need a type class, you just need a constructor which represents the games which have already been lost.
15:16 <Cale> Booba_: Well, and you may wish to let the player know how many moves are left in the Scenario
15:16 <Cale> (but that is separate)
15:16 cur8or joined
15:17 fizruk joined
15:18 <ph88> Geekingfrog, cuz it can be 200 OK, or 500 ERROR, which is significant
15:18 <Cale> Booba_: You can define a function limit :: Int -> Hangman -> Hangman which will cause the player to lose in any case where they haven't won after a given number of moves.
15:19 <Cale> (Or you could count the number of times that the scenario didn't improve)
15:19 sleffy joined
15:19 <Geekingfrog> ph88: iirc this lib will throw an exception if the status code is >= 400
15:19 <ph88> oh
15:21 raycoll joined
15:21 <Booba_> Cale: the idea of designing a new game as a function over the old one makes more sense to it. I see I could add features this way: every new feature makes a new game out of oexisting one.
15:21 conal joined
15:21 <okra_> are there any clever ways of creating an N x N matrix of the numbers [1..N^2] using List's applicative or monad properties?
15:22 <Booba_> and in some time I imagine I return to this and, probably, refactor it to be a single game, if I see that this is better (more readable, easier to compose)
15:22 <dolio> How would Haskell force you to check the response if the library isn't designed that way, anyway?
15:23 tempname11 joined
15:24 splanch joined
15:25 Rickvespa joined
15:25 trism joined
15:28 sleffy joined
15:29 sanett joined
15:29 <Geekingfrog> dolio: if the library isn't designed this way you'll have to make a wrapper more to your liking.
15:30 deepfire joined
15:30 <Geekingfrog> btw ph88 I just double checked and yes, you'll get an exception if the status code is not 2xx (didn't try too many redirect though)
15:31 sz0 joined
15:31 <ph88> alright ^^
15:32 <lyxia> okra_: [[k * n + i | i <- [1 .. n]] | k <- [0 .. n-1]] is this clever
15:33 Luke joined
15:34 <okra_> lyxia: if that's what a real haskeller would do then i'm satisfied :)
15:35 hucksy joined
15:36 <okra_> relatedly, https://en.wikibooks.org/wiki/Haskell/Traversable gives an instance of Traversable for [] as `sequenceA [] = pure []', but in ghci `sequenceA []' gives [], where `pure [] :: [[a]]' gives `[[]]'
15:36 <Ferdirand> i think there is the idiomatic: group n = map (take n) . takeWhile (not.null) . iterate (drop n)
15:36 <Ferdirand> then you can have group n [1..n*n]
15:37 Khisanth joined
15:37 <okra_> yeah, I considered that too
15:38 <Geekingfrog> Data.List.Split.chunksOf 4 [1..n*n] if you don't mind reaching for libraries outside the prelude
15:38 augur joined
15:38 <Geekingfrog> s/4/k
15:39 xall joined
15:39 <lyxia> > sequenceA [] :: [[()]]
15:39 <lambdabot> [[]]
15:40 <lyxia> okra_: in ghci it's defaulting to sequenceA [] :: IO [a]
15:40 yinn joined
15:41 Itkovian joined
15:41 <okra_> lyxia: got it, thanks!
15:43 Denthir joined
15:43 Frojoe1 joined
15:44 grayjoc joined
15:45 SimpleL joined
15:46 MindlessDrone joined
15:47 Lord_of_Life joined
15:48 SimpleL left
15:50 oberstein joined
15:51 Boomerang joined
15:51 sanett_ joined
15:51 ragepandemic joined
15:54 uglyfigurine joined
15:54 tom7942 joined
15:55 Shatnerz0 joined
15:55 xanadu_ joined
15:56 conal joined
15:57 splanch joined
15:57 eazar001 joined
15:59 oberix left
16:00 urodna joined
16:01 switte joined
16:02 dawehner joined
16:03 mda1 joined
16:05 tom7942 joined
16:05 Amadiro joined
16:05 Sonolin joined
16:07 hrehf joined
16:07 uncertainty joined
16:08 Denthir joined
16:09 cmsmcq_ joined
16:09 ludat joined
16:11 Itkovian joined
16:11 KarboniteKream joined
16:12 balor joined
16:14 cheater joined
16:14 fractalsea joined
16:14 Denthir joined
16:14 coot joined
16:15 xall joined
16:15 al-damiri joined
16:16 MindlessDrone joined
16:16 peterbec` joined
16:18 Apocalisp joined
16:21 mejja joined
16:23 eklavya joined
16:23 vhscrb joined
16:23 rjg_ joined
16:24 Jesin joined
16:25 rejagr joined
16:25 Lord_of_Life joined
16:27 rejagr joined
16:29 magneticduck joined
16:32 mizu_no_oto_work joined
16:32 plutoniix joined
16:32 beckyconning joined
16:33 Salih joined
16:34 tom7942 joined
16:35 buglebudabey joined
16:36 boombanana joined
16:37 xanadu_ joined
16:37 argent0 joined
16:39 sanett joined
16:42 Denthir joined
16:42 tomphp joined
16:43 FreeBirdLjj joined
16:43 Edith joined
16:44 splanch joined
16:45 mizu_no_oto_work joined
16:46 <rejagr> are there any good tutorials on working with Trees in haskell? For example how to traverse them or which operations are supported on them
16:48 <rejagr> or the mathematical concepts you should know to understand them
16:48 Swizec joined
16:48 augur joined
16:48 bollu joined
16:49 <bollu> cocreature: ping
16:49 <cocreature> bollu: pong
16:49 <bollu> cocreature: The fields of Function in llvm-hs-general are not visible externally
16:49 <bollu> https://hackage.haskell.org/package/llvm-hs-pure-4.0.0.0/docs/LLVM-AST.html#t:Global
16:49 <bollu> that's weird
16:49 <bollu> am I misusing the API?
16:49 <cocreature> bollu: I don’t understand the question. what is not visible?
16:50 <bollu> cocreature: I'm not able to construct Function by referring to it's fields as a record
16:50 <cocreature> bollu: have you tried doing that? I think haddock is just being stupid here
16:50 <bollu> cocreature: yep, I did. It tells me the fields are not visible
16:50 ziocroc joined
16:50 <sm> rejagr: there's https://en.wikibooks.org/wiki/Haskell/Other_data_structures#Trees
16:50 <cocreature> bollu: which module did you import?
16:51 KarboniteKream joined
16:51 raynold joined
16:51 oberstein joined
16:51 <rejagr> thanks
16:51 Luke joined
16:51 <cocreature> bollu: LLVM.AST.Global doesn’t even have an explicit export list so it can’t really hide the fields
16:51 <lpaste_> bollu pasted “freejit.hjs” at http://lpaste.net/354106
16:51 <bollu> cocreature: http://lpaste.net/354106#line83
16:51 <cocreature> bollu: import LLVM.AST.Global
16:52 <cocreature> you might need to import it qualified. there are some name collisions
16:52 <bollu> ah, I see
16:52 coot_ joined
16:52 <cocreature> but it’s weird that haddock doesn’t show the record names
16:53 <cocreature> bollu: also you might want to use OrcJIT instead of the old one
16:53 <bollu> cocreature: will do :)
16:56 <Sornaensis> is pointfree coding in haskell helpful for generation more efficient machine code
16:56 <Sornaensis> or is it just for rep and glory
16:56 mejja left
16:56 <lpaste_> bollu revised “freejit.hjs”: “freejit.hjs” at http://lpaste.net/354106
16:56 <glguy> Sornaensis: neither
16:56 <bollu> cocreature: still doesn't work
16:57 <bollu> cocreature: could you check the lpaste out for me?
16:58 Amadiro joined
17:00 <Sornaensis> glguy: pretty sure people brag about writing all their code in pointfree style
17:00 <glguy> It's a phase
17:00 <Sornaensis> just curious if it was helpful for optimization
17:01 alfredo_ joined
17:01 <glguy> No, the compiler still adds all the variables back in
17:02 <augur> after doing stack build, how does one run the resulting executable?
17:05 <sm> stack exec -- EXE ...
17:06 <bollu> cocreature: it's giving me errors in terms of "14th argument" etc.
17:06 jgertm joined
17:06 splanch joined
17:07 <lpaste_> bollu pasted “weird-errors-llvm-hs” at http://lpaste.net/354110
17:08 <bollu> @tell cocreature "I'm leaving now, but check out the lpaste link: http://lpaste.net/354110. Why is it not exposing the record fields? weird"
17:08 <lambdabot> Consider it noted.
17:08 psniper joined
17:11 Itkovian joined
17:11 phyrex1an joined
17:11 yellowj joined
17:12 edsko joined
17:12 xall joined
17:12 Apocalisp joined
17:13 peterbec` joined
17:16 isd joined
17:17 <geekosaur> bollu, I don't think the error in that paste has anything to do with exposed record fields?
17:17 grayjoc joined
17:17 ner0x652 joined
17:17 mekeor joined
17:17 <ExpHP> :t Data.Map.Strict.lookupMin
17:17 <lambdabot> error:
17:17 <lambdabot> Not in scope: ‘Data.Map.Strict.lookupMin’
17:17 <lambdabot> No module named ‘Data.Map.Strict’ is imported.
17:17 <ExpHP> @index lookupMin
17:17 <lambdabot> bzzt
17:18 <geekosaur> the errors say (a) you are missing two arguments to the constructor (b) some String-s got changed to something more typesafe
17:18 <ExpHP> I swear this function exists
17:18 <ExpHP> but intero claims it doesnt >_>
17:19 <ExpHP> with 99% probability I am doing something very stupid...
17:20 <geekosaur> I don't see lookupMin. did you mean findMin?
17:20 buglebudabey joined
17:20 asmyers joined
17:20 <ExpHP> https://hackage.haskell.org/package/containers-0.5.10.1/docs/Data-Map-Strict.html#v:lookupMin
17:20 <geekosaur> also, do make sure that you are looking for documentation for the same version of containers that you are using, since things do sometimes change
17:21 <cocreature> looks like this was added in 0.5.9.1
17:21 <ExpHP> ohgeez
17:21 pera joined
17:21 <ExpHP> okay so according to stack I'm using containers 0.5.7
17:21 <geekosaur> I just checkedc containers-0.5.7.1 which is what comes with ghc 8.0.2
17:22 <cocreature> ExpHP: you should be able to add a newer version to extra-deps
17:22 <ExpHP> wtf how is this function on the bleeding edge
17:22 <cocreature> probably because nobody added it before :)
17:23 <ExpHP> I guess it's like the minimumOnKey that will be added to Data.List in 2025
17:23 <cocreature> what is minimumOnKey supposed to do?
17:23 <cocreature> that sounds like minimumBy which already exists
17:23 <geekosaur> ExpHP, containers was maintenance-only for some rears but recently development restarted
17:23 <geekosaur> *years
17:23 <ExpHP> cocreature: (Ord b) => (a -> b) -> [a] -> a
17:24 <ExpHP> i.e. 90% of use cases of minimumBy, other than to implement maximumBy
17:24 coot joined
17:24 <cocreature> ah yeah I’ve wanted this in the past
17:25 Swizec joined
17:25 <ExpHP> I mean okay I guess there's (comparing `on` f) but iirc you need two imports for that
17:25 <ExpHP> and a third for Data.list
17:25 <ExpHP> that's whack
17:25 <shapr> oh neat, I really wanted this last month: https://hackage.haskell.org/package/ghc-prof-flamegraph
17:25 ziocroc joined
17:26 <shapr> but I thought it didn't exist...
17:29 <ExpHP> (erm ok actually you don't need `on` for that; I'm just spouting nonsense from a dodgy memory)
17:29 dfeuer joined
17:29 ludat joined
17:30 latro`a joined
17:32 replay joined
17:33 tomphp joined
17:33 infandum` joined
17:33 Swizec joined
17:34 <infandum`> Is there an easy way to have Map.insertWith but have a default function when the key is not already in the map? So a Map.insertWithWith?
17:35 <infandum`> insertWith f g k v, where f is f newValue oldValue and g is g newValue
17:36 gibran joined
17:37 <infandum`> Nevermind, I see it required (a -> a -> a) anyway
17:37 splanch joined
17:37 Wizek_ joined
17:38 <sophiag> i'm a bit confused about how constraints work with existential quantification. something like "data OpT = forall a. (Num a, Fractional a) => NumOp (a -> a -> a)" works fine (in fact it seems almost as if i don't even need the constaints?) whereas "data OpT = forall a. (Eq a) => EqOp (a -> a -> Bool)" throws an error "Ambiguous type variable ‘a0’ arising from a use of ‘EqOp’ prevents the constraint ‘(Eq a0)’ from being solved." can
17:38 <sophiag> anyone explain how this works? i've tried reading a bit on the wiki, but am still confused by the conflicting cases
17:39 dn1987p joined
17:39 <geekosaur> first off, the constraints tell you what you can do with the existential. once it's hidden behind a forall, the constraints are all that anything can know about it
17:39 <geekosaur> in particular, you can't find out that a is, say, Integer (unless you have Typeable as one of the constraints)
17:40 Luke_ joined
17:40 <sophiag> i understand that part
17:40 magneticduck joined
17:40 aib joined
17:41 <sophiag> are you saying that explains why it can't resolve Eq? because ghc doesn't know the type of a as it's hidden inside the forall?
17:41 <geekosaur> not fully, it seems, because you're expecting that a to unify with another a somewhere else
17:41 <geekosaur> and it won't
17:41 <geekosaur> which is why it hauls in an a0
17:41 <geekosaur> exactly
17:41 <sophiag> how come Num and Fractional get past the type checker then?
17:42 <gibran> Hello, anyone knows of a Firebird SQL connectivity library like Sqlite-simple and PostgreSQL-simple?
17:42 <geekosaur> the constraints inside the forall mean, in effect, "include a record of functions that know how to access the hidden value via Num and Fractional". which adds those to the things it knows how to do
17:42 <geekosaur> but knowing Num a does not mean knowing a
17:43 <geekosaur> it means precisely that you can use methods of Num on the unknowable a
17:43 <sophiag> right...which is what i expected to occur with Eq as well
17:44 <geekosaur> no, you did something when using OpT that needed to know more than Eq a, it needed to know a
17:44 <cocreature> sophiag: could you show the code fragment that actually causes the error? simply defining this type works just fine for me
17:44 <geekosaur> it doesn't and can't know a, so it called the type a0 instead
17:44 serendependy joined
17:44 <sophiag> hmm. perhaps it's the signature itself? a -> a -> Bool vs. a -> a -> a ?
17:45 <geekosaur> to indicate that the a can never unify with another type, because a can never be known
17:45 <cocreature> sophiag: it’s not about the type definition. it’s about how you use it
17:45 <sophiag> i'm using it in exactly the same way
17:46 <geekosaur> existentials are often considered an antipattern precisely because of this confusion
17:46 <cocreature> could you show us the code you’re using?
17:46 <sophiag> the only difference is in operators i'm matching
17:46 <sophiag> cocreature: yup i'll paste it now
17:48 troydm joined
17:48 <sophiag> cocreature and geekosaur: http://lpaste.net/354112
17:49 <cocreature> sophiag: which line is line 121 supposed to be in that example?
17:49 bbee joined
17:49 bbee joined
17:49 <sophiag> line 32 in the paste
17:52 coot joined
17:53 mpickering_ joined
17:54 sanjoyd_ joined
17:54 Scorchin_ joined
17:54 stig_ joined
17:54 etrepum_ joined
17:54 g4k_ joined
17:54 cmdv_ joined
17:54 xplat|work_ joined
17:54 <cocreature> sophiag: ah the reason why this works for Num is that GHC defaults Num instances to Integer
17:55 <cocreature> sophiag: it doesn’t default Eq instances
17:55 si14_ joined
17:55 dawehner joined
17:55 ocharles_ joined
17:55 <sophiag> ah ok. that makes sense
17:55 <sophiag> and that's fine for my use case
17:55 houli_ joined
17:56 aristid_ joined
17:56 zmanian__ joined
17:56 buglebudabey joined
17:56 <cocreature> sophiag: if you compile with -Wall you’ll get a warning even if you disable the EqOp stuff
17:56 rstone_ joined
17:56 nbouscal_ joined
17:56 troydm joined
17:56 s4kashya4 joined
17:56 kriton_ joined
17:56 numberte1 joined
17:56 kaol_ joined
17:56 hyPiRion_ joined
17:57 cynick_ joined
17:57 pleiosau1 joined
17:57 kipd_ joined
17:57 phz__ joined
17:57 <sophiag> is there a way to make ghc trust me to only use arguments of the same type with EqOp? possible with RankNTypes?
17:58 raichoo joined
17:58 strmpnk_ joined
17:58 erisco joined
17:58 <erisco> is it possible to have arrays of arrays in SBV?
17:58 _6a68_ joined
17:59 eschnett joined
17:59 eL_Bart0- joined
17:59 grayhatter joined
17:59 grayhatter joined
17:59 noplamodo joined
18:00 shiona joined
18:00 jameseb joined
18:00 tekacs joined
18:00 MejGun joined
18:00 TheWizardTower joined
18:00 Taneb joined
18:00 Soif[m] joined
18:00 cnr joined
18:00 voidrays joined
18:00 domenkozar joined
18:00 QuantumLogic joined
18:00 unknownln joined
18:00 djanatyn joined
18:01 odamn joined
18:01 jdt_ joined
18:01 ReinH_ joined
18:01 Amadiro joined
18:02 davean joined
18:02 monty joined
18:02 chlong joined
18:02 colton[m] joined
18:02 pinkmuffinere joined
18:03 Yuras joined
18:03 vydd joined
18:03 <erisco> the types don't work, but maybe there is another approach
18:04 <erisco> I am sunk if I can't make it work
18:04 Tharbakim joined
18:04 Tharbakim joined
18:04 fizbin joined
18:05 magneticduck joined
18:07 <erisco> based on comments here an approach is to concatenate bit vectors http://stackoverflow.com/questions/13443259/support-for-multi-dimensional-arrays-in-qf-aufbv
18:07 <erisco> makes sense but is a tad painful
18:08 uglyfigurine joined
18:11 ziocroc joined
18:11 cpup joined
18:12 heinrich5991 joined
18:12 skeuomorf joined
18:12 ertesx joined
18:13 Discovery joined
18:14 BlueRavenGT joined
18:14 dfeuer joined
18:16 ystael joined
18:18 simendsjo joined
18:18 arctictern joined
18:19 patbecich joined
18:20 <infandum`> What is this function: (a, m b) -> m (a, b)
18:20 Rodya_ joined
18:20 <johnw> infandum`: strength, I believe
18:20 <johnw> https://hackage.haskell.org/package/category-extras-0.53.5/docs/Control-Functor-Strong.html
18:20 <cocreature> infandum`: sequence
18:21 <cocreature> :t sequence :: Monad m => (a, m b) -> m (a, b)
18:21 <lambdabot> Monad m => (a, m b) -> m (a, b)
18:21 <johnw> and that too :)
18:21 <infandum`> great, thanks
18:21 <infandum`> oh, sequence works for that too? wow
18:21 CurryWurst joined
18:21 <shapr> infandum`: do you have hoogle installed?
18:21 <infandum`> I thought it would be (m a, m b)
18:21 <cocreature> infandum`: that won’t work with sequence :)
18:21 <infandum`> shapr: It didn't return that
18:21 <johnw> it's sequence for (,) a
18:22 <infandum`> cocreature: Yeah I tried that first and noticed it only did the snd
18:22 <infandum`> so I assumed it wouldn't work overall for tuple
18:22 <shapr> infandum`: yeah I just tried hoogle and I see what you mean.
18:23 <infandum`> :t sequence
18:23 <lambdabot> (Monad m, Traversable t) => t (m a) -> m (t a)
18:23 <infandum`> ok yeah, I see why it's fine
18:23 <infandum`> But what about (m a, b) -> m (a, b)
18:24 uncertainty joined
18:25 <cocreature> :t fmap swap . sequence . swap
18:25 <lambdabot> Monad f => (f b, a) -> f (b, a)
18:25 <infandum`> coy
18:25 <infandum`> What prelude is lambdabot using?
18:25 <infandum`> Data.Tuple normally isn't imported
18:26 JagaJaga joined
18:26 <Sornaensis> he's using mueval
18:26 <Sornaensis> with a bunch of imports
18:26 <Sornaensis> > L.nub [1,1,2,2,3,4,5]
18:26 <lambdabot> error:
18:26 <lambdabot> Not in scope: ‘L.nub’
18:26 <lambdabot> No module named ‘L’ is imported.
18:26 <Sornaensis> > nub [1,1,2,2,3,4,5]
18:26 <lambdabot> [1,2,3,4,5]
18:27 Wizek joined
18:27 <geekosaur> @where L.hs
18:27 <lambdabot> what lambdabot has in scope is at http://silicon.int-e.eu/lambdabot/State/Pristine.hs
18:28 dfeuer joined
18:30 baldrick1 joined
18:30 deepfire joined
18:31 <tobiasBora> I try again, nobody knows a way to use something like parallel-io but with lazy string?
18:34 <tobiasBora> lazy list*
18:35 mac10688 joined
18:35 dsh joined
18:36 marsam joined
18:37 dhil joined
18:37 twopoint718 joined
18:44 rejagr joined
18:44 esph joined
18:44 <MitchellSalad> is each version of GHC pinned to specific versions of all the boot packages?
18:44 earldouglas joined
18:46 colton[m] joined
18:46 _sg joined
18:48 tomphp joined
18:48 deepfire joined
18:48 unK_ joined
18:49 ramatevish left
18:50 twanvl joined
18:50 cyborg-one joined
18:50 meoblast001 joined
18:50 <geekosaur> even more specifically to the packages that came with it, because compilation leaks internals into the interface file and then they can be inlined elsewhere
18:51 <geekosaur> (this is, I think, finally fixed in the upcoming 8.2.1)
18:51 <geekosaur> generated internal symbols, that is
18:51 mikecaruso joined
18:52 kav joined
18:52 AndreasK joined
18:54 ystael joined
18:54 mstruebing joined
18:55 <MitchellSalad> are you replying to me, geekosaur?
18:55 <geekosaur> yes
18:55 <MitchellSalad> ah
18:55 <MitchellSalad> I'm a little confused about something, then, maybe you can explain it...
18:56 itachi joined
18:56 <MitchellSalad> using stack, peeking at the global package database associated w/ ghc 8.0.2, i see it pinned to process-1.3.0.0
18:56 ExpHP_ joined
18:56 <MitchellSalad> sorry, directory-1.3.0.0
18:56 Maxdamantus[M] joined
18:57 <MitchellSalad> however, when trying to build hackage-server with cabal, I was warned about a destructive reinstall, because it depends on directory < 1.3
18:57 <MitchellSalad> althoug its cabal file claims it was tested on ghc 8.0.2
18:57 reiddraper joined
18:58 Maxdamantus[M] joined
18:58 <MitchellSalad> so, I'm confused how the "directory < 1.3" constraint made its way into hackage-server's cabal file, if indeed ghc-8.0.2 implies directory-1.3.0.0
18:59 <geekosaur> you can use different versions of boot libraries as long as you don't depend on anything that comes with ghc and is linked to that version. so, for example, containers comes with ghc but you can substitute a different version as long as you're not using ghc-api or template haskell, both of which require the same containers library ghc was built against
18:59 t7 joined
18:59 <geekosaur> directory is likely even looser in that regard; I suspect it only matters for ghc-api
19:00 chlong joined
19:01 <geekosaur> but "destructive reinstall" implies cabal wants to rebuild other dependencies that use the different version. here you want either a cabal sandbox or cabal new-build
19:01 <geekosaur> rather than letting it rebuild half of your user package database and break the other half
19:01 <MitchellSalad> oh, that makes sense... but I *was* using a cabal sandbox
19:02 ahlias joined
19:02 <geekosaur> hm.
19:03 <MitchellSalad> my setup might be messing something up. I don't have any global GHC installed, so I'm simply prefacing everything with PATH=<path-to-ghc-8.0.2>:$PATH
19:03 argent0 joined
19:04 Itkovian joined
19:04 <geekosaur> maybe it thinks it has to install an overriding version of a global package and then needs to reinstall other global packages (locally to the sandbox) with tht version, and it's being a bit overcautious because it doesn;t consider things in the sandbox can't break stuff outside that sandbox
19:04 albertus1 joined
19:04 angerman joined
19:04 bob_ joined
19:04 <geekosaur> but then this is part of why new-build exists (suggest you use a very recent cabal in that case)
19:04 buglebudabey joined
19:05 <geekosaur> dependencies are hard, especially when ghc cross-module inlining (and internal symbol leakage) gets involved :/
19:05 <MitchellSalad> here's the exact error: lpaste.net/6154004758626566144
19:05 <MitchellSalad> that's after a cabal sandbox init
19:06 peterbec` joined
19:06 <* geekosaur> wonders if one of those depends on ghc-api
19:06 <geekosaur> because that would lead to this message and be a problem in general
19:07 <MitchellSalad> edited to show the output of "ghc-pkg list" as well
19:07 <MitchellSalad> ah, gotcha... hrm
19:07 Itkovian joined
19:08 <MitchellSalad> well I'm annoyed =D
19:08 spaceships joined
19:08 <MitchellSalad> so much for setting up a private hackage in an afternoon
19:08 <geekosaur> sigh, the rev deps list excludes the ghc package so I can't check that way :/
19:08 <MitchellSalad> well, one fix is to just bump the bound on directory and fix any incompatibility bugs
19:08 latro`a joined
19:09 <geekosaur> you probably want to ask in #hackage, I have a vague recollection this is a known issue
19:09 <MitchellSalad> ok
19:09 electrostat joined
19:09 <geekosaur> and yes --allow-newer=directory might well be the quick workaround
19:09 emmanuel_erc joined
19:10 yinn joined
19:10 AndreasPK joined
19:11 DustyDin1o joined
19:12 robotroll joined
19:12 tapirus joined
19:12 vtomole joined
19:12 <MitchellSalad> cool, thanks!
19:12 pera joined
19:13 raduom joined
19:13 Acerific joined
19:14 lol__ joined
19:14 Acerific left
19:15 eschnett joined
19:17 <MitchellSalad> are alex/happy versions also tied to GHC?
19:17 initiumdoeslinux joined
19:17 lol__ joined
19:17 <MitchellSalad> hackage-server depends on alex < 3.2, yet the version of alex stack has installed alongside ghc 8.0.1 is 3.2.1
19:19 <itachi> Hi I wanted to convert a list of int [1, 2, 3] to Data.Semigroup data type [Max 1, Max 2, Max 3] How do I do that?
19:20 <MitchellSalad> itachi: map Max
19:20 <MitchellSalad> or coerce!
19:21 mstruebing joined
19:21 <itachi> Thanks MitchellSalad
19:22 hackebeilchen joined
19:22 <shapr> Has anyone installed TidalCycles here?
19:23 <shapr> I guess I should ask how to install supercollider plugins on that IRC channel
19:24 <itachi> I am trying to find max in a list of ints using foldMap
19:24 <itachi> foldMap <> $ map Max [1,2,3]
19:24 fizruk joined
19:24 <itachi> I tried foldMap <> $ map Max [1,2,3]
19:24 <MitchellSalad> itachi: \ints -> getMax (foldMap Max ints)
19:25 ystael joined
19:26 Luke joined
19:27 <itachi> so if list of ints is [1,3,4,2] I should use getMax (foldMap Max [1,3,4,2]) ?
19:27 rcat joined
19:29 orbifx joined
19:31 <sdrodge> getMax . foldMap Max $ [1,3,4,2]
19:31 <sdrodge> would be just as good
19:31 <sdrodge> but yes
19:33 fractalsea joined
19:33 <johnw> orion: ping
19:33 <sdrodge> itachi: In case you don't know, there's a function in Prelude called maximum.
19:34 oisdk joined
19:34 <sdrodge> It does roughly the same thing, with the exception that it explodes on empty list instead of returning minBound
19:34 <itachi> sdrodge I know that. I was solving some questions :)
19:35 np356 joined
19:35 <sdrodge> Makes sense.
19:36 crobbins joined
19:36 <itachi> any Idea on how to solve the problem?
19:37 <sdrodge> Which problem?
19:37 <itachi> oh did not see your earlier reply sorry
19:38 lol__ joined
19:38 deepfire joined
19:40 <itachi> getMax . foldMap Max $ [1,3,4,2] gives me http://lpaste.net/354115
19:40 <sdrodge> The type inference needs a little help
19:40 <sdrodge> just append :: Int
19:40 <sdrodge> getMax . foldMap Max $ [1,3,4,2] :: Int
19:41 <itachi> It worked thank you very much sdrodge and MitchellSalad
19:44 <itachi> so here what does " foldMap Max $ [1,2,3,4] "do ?
19:46 <sdrodge> Well, for the record the composition happens "first"
19:46 <sdrodge> Like, we're talking getMax composed with foldMap Max and applying it to that list.
19:46 <sdrodge> (that's what the dot operator does)
19:46 <sdrodge> (function composition)
19:47 aib joined
19:47 <mizu_no_oto_work> itachi: are you confused about `.` and `$` ?
19:47 <mizu_no_oto_work> Or about foldMap, Max, and getMax?
19:48 suppi joined
19:48 <itachi> Ya a little bit
19:48 suppi joined
19:48 <sdrodge> Which one?
19:48 <sdrodge> Or both?
19:48 gcross joined
19:48 <mizu_no_oto_work> > ala Max foldMap [1,2,3,4]
19:48 <itachi> I am trying to find out how getMax . foldMap Max $ worked
19:48 <lambdabot> error:
19:48 <lambdabot> • Data constructor not in scope: Max :: Unwrapped s -> s
19:48 <lambdabot> • Perhaps you meant variable ‘max’ (imported from Data.Ord)
19:49 grayjoc joined
19:49 <mizu_no_oto_work> itachi: do you understand '$' and '.'?
19:49 <sdrodge> itachi: do you understand how getMax (foldMap Max [1,3,4,2]) works, or would you have the same question with that formulation?
19:50 <itachi> I will have the same question with that too :(
19:50 buglebudabey joined
19:50 <itachi> I have just started reading on monoids
19:51 <sdrodge> okay, why don't you describe in your own words what a monoid is, so we can get a better idea of what you're struggling with?
19:52 bjz joined
19:53 splanch joined
19:53 Limona joined
19:53 <Limona> hi, can someone just quickly explain something
19:53 <ExpHP_> :t something
19:53 <Limona> if i have type => t a -> a
19:53 <lambdabot> error: Variable not in scope: something
19:53 <Limona> how come t a can be treated as [a]
19:53 <sdrodge> uh
19:53 <Limona> what's the difference between t a and [a]
19:53 <itachi> From what I understand monoids is typeclass which follows a set of rules
19:54 <sdrodge> Limona: Are you sure there wasn't a class constraint on t where you saw this come up?
19:54 <ExpHP_> Limona: Is it (Foldable t)=> t a -> a?
19:55 <ExpHP_> Limona: "(Foldable t)=>" generally means t is a type that can be turned into a list
19:55 runeks joined
19:55 sa1 joined
19:55 <Limona> oh yeah it was foldable
19:55 <mizu_no_oto_work> Limona: "Foo t => t a" means that this works for any type 't' that implements the Foo typeclass
19:55 <Limona> so what does t a mean then
19:55 <Limona> i understand the Foo t => t
19:55 <Limona> part
19:56 <Limona> but what does t a -> a mean
19:56 <ExpHP_> Limona: Here's a hint: the type "[a]" can also be written as "[] a"
19:56 <Limona> ahh
19:56 <sdrodge> Limona: It means that t is a type constructor which yields a concrete type when passes another type as a variable.
19:56 <sdrodge> e.g.
19:56 <sdrodge> Maybe Int
19:56 fotonzade joined
19:56 <sdrodge> or as ExpHP_ points out [Int]
19:57 <mizu_no_oto_work> Limona: also, 'r -> a' can be rewritten as '(->) r a'
19:58 Rodya_ joined
19:58 <sdrodge> Limona: Foldable basically means that the values in the structure can be combined into one value.
19:58 <mizu_no_oto_work> and (a, b) can be rewritten as '(,) a b'
19:58 <sdrodge> lists have a Foldable instance, but so do most other containers.
19:59 <mizu_no_oto_work> Which is important when reading typeclass instances for [], (->) or (,)
19:59 <ExpHP_> Or (,,,,,,,,)
20:00 <sdrodge> itachi: So far so good. What are those rules? Or put another way, what does being a Monoid mean a type can do?
20:00 <ExpHP_> instance Functor (無) a b c d where
20:01 <Limona> thanks
20:01 <itachi> So a monoid type has function mappend mconcat
20:02 Itkovian joined
20:02 <mizu_no_oto_work> itachi: importantly, it also has mempty
20:02 marsam joined
20:02 jgertm joined
20:03 arctictern joined
20:03 <mizu_no_oto_work> itachi: <>, from Data.Semigroup, is a commonly used operator that's identical to mappend
20:04 <itachi> Yup that helps it to minBound in place of error like maximum in getMax . foldMap Max $ [] :: Int ?
20:04 tsahyt left
20:04 tsahyt joined
20:04 <itachi> I mean defination of mempty help it **
20:04 osa1 joined
20:04 <itachi> *deffinition
20:04 <sdrodge> itachi: yep
20:05 <mizu_no_oto_work> The important thing about Monoids is that forall a, b and c, (a <> b) <> c == a <> (b <> c), and a <> mempty == a == mempty <> a
20:05 <itachi> k
20:05 <mizu_no_oto_work> so it's "associative" (you can rewrite the parenthesis) and mempty works as an identity element
20:06 kuribas joined
20:06 <sdrodge> so basically, what foldMap :: (Monoid m, Foldable t) => (a -> m) -> t a -> m does is takes a function that injects values into a monoid, and a container of those values, then it injects them all, and combines all the results using the monoid's binary operation.
20:06 <itachi> I lot you there what I get for
20:06 <sdrodge> Hopefully nobody decides to get on my ass for saying that Foldable t implies t is a container.
20:07 <itachi> I lost you there what I get from foldMap :: Monoid m => (a -> m) -> Max a -> m is
20:07 <sdrodge> itachi: Ah, that's the wrong substitution
20:07 <johnw> sdrodge: explain then how t ~ Const a is a container :)
20:07 <c_wraith> hopefully, the mappend association is done in a way that's efficient for that specific Traversable
20:07 <sdrodge> johnw: I refuse.
20:07 <mizu_no_oto_work> to explain that a bit more, "foldMap Max [1,3,4,2] == Max 1 <> Max 2 <> Max 3 <> Max 4"
20:08 <johnw> sdrodge: simpler: t ~ (->) a
20:08 <sdrodge> johnw: yes yes, I'm well aware. I think calling it a container when first teaching it helps give intuition, though.
20:08 <itachi> so why are we using $ [1,3,4,2] ?
20:09 <johnw> not if the person is used to thinking operationally, in terms of memory cells and things on the heap. Then they lose the computational intuition. Happened to me.
20:09 <sdrodge> itachi: So in this case, t is [] and m is Max Int
20:09 Limona left
20:09 <mizu_no_oto_work> Well, "Max 1 <> Max 2 <> Max 3 <> Max 4 <> mempty'
20:10 <itachi> @ sdrodge what did you mean by that is a wrong substitution?
20:10 <sdrodge> itachi: so substituting that into foldMap we get foldMap :: (Int -> Max Int) -> [Int] -> Max Int
20:10 <sdrodge> Does that answer your question?
20:10 marcopullo joined
20:11 <mizu_no_oto_work> itachi: as another matter, do you know why we're messing around with the Max constructor?
20:11 <itachi> no
20:11 <sdrodge> It's to get the correct monoid behavior for what we're trying to do
20:11 <mizu_no_oto_work> Part of typeclasses is that there's only one implementation per type, right?
20:12 <mizu_no_oto_work> That means that you could only have one unique instance for Monoid Int, for example.
20:12 {emptyset} joined
20:12 <itachi> @ sdrodge so it should have been foldMap :: Monoid m => (a -> m) -> t a -> m is ?
20:12 Sh4rPEYE joined
20:12 <itachi> Yup
20:12 <mizu_no_oto_work> That's good for some cases, where there's only one sensible implementation
20:13 <mizu_no_oto_work> For example, Lists form a monoid under concatenation, and I think that's the only one
20:13 <Sh4rPEYE> Hello. Could somebody please explain what does this funcion do? Or, better put, how does it do it? I get only the fmap part, but I'm lost when it comes to Applicative
20:13 <itachi> k
20:13 <Sh4rPEYE> combinations a b c = (,,) <$> a <*> b <*> c
20:13 <mizu_no_oto_work> But Int forms a monoid with + and 0, * and 1, max and minbound, min and maxbound, and probably a few others besides.
20:14 <itachi> hmm
20:14 <erisco> lol, well I have finally got my problem encoded for SMT but it is insanely slow
20:14 <ExpHP_> :t \a b c -> (,,) <$> a <*> b <*> c
20:14 <lambdabot> Applicative f => f a2 -> f a1 -> f a -> f (a2, a1, a)
20:14 <zv> did i just hear the word smt solver
20:14 <erisco> I can't seem to win on this
20:14 falafel joined
20:14 <ExpHP_> ^ Sh4rPEYE looking at the type might help
20:15 <zv> let me guess, you used the z3 api
20:15 <erisco> no, SBV
20:15 <zv> even worse
20:15 <erisco> has nothing to do with the speed
20:15 <mizu_no_oto_work> itachi: The standard hack around that restriction is to make 'newtype Foo = Foo TypeIWantMultipleTypeclassInstancesFor', then create 'instance Monoid Foo', then wrap the values in the right newtype constructor
20:15 gillesmajor joined
20:15 <sdrodge> Sh4rPEYE: I think it would be unhelpful to explain what it does before you read up on Applicatives and understand it more completely.
20:15 <erisco> it just takes an eon to solve
20:15 <zv> erisco: wheather you encode it into SMTLIB2 or use an API?
20:15 bus000 joined
20:16 <zv> I assure you, it has everything and more to do with speed. 2-3 orders of magnitude difference.
20:16 <erisco> SBV does write SMTLIB2 files
20:16 <mizu_no_oto_work> itachi: so instead of creating monoid instances for Int, Int isn't a monoid and we have the monoid instances on Sum, Product, Min and Max instead.
20:16 <zv> erisco: Datalog, either/or
20:16 <erisco> well, that's not the problem I have
20:16 <sdrodge> Sh4rPEYE: but the basic idea is that when you're applying a regular function of multiple arguments to multiple applicative-wrapped values, you use <$> followed by some <*>'s.
20:16 thc202 joined
20:16 <zv> ok
20:16 <mizu_no_oto_work> So 1 <> 2 doesn't work, but Sum 1 <> Sum 2 works
20:17 <itachi> wa makes sense
20:17 <itachi> Ya*
20:17 <Sh4rPEYE> sdrodge: Actually, it came up when I was reading about them.
20:17 <erisco> it seems when you combine arrays, bit vector concatenation, and universal quantification, times explode
20:17 cdg joined
20:17 <zv> erisco: what is you exact problem?
20:17 <itachi> so the what was the order in which " getMax . foldMap Max $ [1,3,4,1] :: Int " took place?
20:17 <sdrodge> Sh4rPEYE: Yeah. It's a nice motivating example, imo. To better understand it, consider the different between using (+1) on one Maybe Int vs using (+) ont two Maybe IntS.
20:18 <itachi> first getMap . foldMap ?
20:18 <sdrodge> Sh4rPEYE: Try as hard as you might, you can't do it with only Functor.
20:18 gothos joined
20:18 <zv> erisco:an SMT solver is already NxN boolean literal comparisons, even for addition.
20:18 <erisco> zv, would take some time to explain, but it doesn't matter, I'm just moaning about it
20:18 <mizu_no_oto_work> itachi: edwardk gave a good talk a couple years ago about why that restriction (of one instance per type) isn't really a bad thing - https://www.reddit.com/r/haskell/comments/2w4ctt/boston_haskell_edward_kmett_type_classes_vs_the/
20:18 <itachi> * getMax.foldMap
20:18 <zv> There are clever ways to reduce it
20:19 <itachi> k I will look at it
20:19 <zv> Conflict-driven literal satisfaction brings you down to log(N^2) comparisons.
20:19 <mizu_no_oto_work> itachi: g . f $ x == (g . f) x == g (f x)
20:20 <mizu_no_oto_work> . is the function composition operator
20:20 xfix joined
20:20 <zv> and, not to belabor the point here, but if you encode your problem into SMTLIB2 rather than Datalog/Dimacs or API generated SMTLIB
20:20 <zv> it can be hundreds of times faster
20:20 tdfirth joined
20:20 <mizu_no_oto_work> where (g . f) x == g (f x)
20:20 <erisco> hm, and cvc4 doesn't understand it, okay
20:20 <itachi> k I am getting it now
20:21 <itachi> Thanks guys you realy helped me alot
20:21 <zv> erisco: cvc4 absolutely does understand smtlib2
20:21 <zv> I wrote the interaction major-mode.
20:21 <erisco> as I told you, it already writes in that format
20:21 <zv> You misunderstand, it's not about what *format* it's in
20:21 <erisco> so I don't understand what difference you're describing
20:21 <zv> it's about the *structure* of the format
20:22 <erisco> so you're suggesting I can hand write it better?
20:22 <zv> yes
20:22 <zv> exactly
20:22 <erisco> that isn't applicable to my problem
20:22 <zv> fair enough
20:22 <erisco> automation is the point of it, otherwise I wouldn't have bothered with SBV frankly
20:23 <erisco> yes but I may be touching on features outside of the standard, I am not sure, haven't read it
20:24 <erisco> or there is just a bug in SBV's CVC4 driver
20:24 <Sh4rPEYE> sdrodge: I see I can't... But why? I use the fmap to partially apply (,,), so I get a function 'b -> c -> (a, b, c)
20:24 sirreal joined
20:24 <Sh4rPEYE> sdrodge: Why can't I fmap this function again on b?
20:24 uglyfigurine joined
20:25 meandi joined
20:25 <sdrodge> Sh4rPEYE: let's consider (+) restricted to Int for a moment just to make it simpler.
20:25 <zv> erisco: the tricky thing is that you could spend years tracking down a SMT performance error, particularly in generated code.
20:25 <sdrodge> (+) :: Int -> Int -> Int
20:25 <sdrodge> fmap (+) :: f Int -> f (Int -> Int)
20:25 <sdrodge> How do we use a f (Int -> Int) in the general case?
20:25 Sh4rPEYE_ joined
20:25 <sdrodge> what if f doesn't provide an unwrapper?
20:25 <erisco> I think it just sucks how I needed to encode the problem
20:26 NeverDie joined
20:26 sirreal joined
20:26 <erisco> I need an array of arrays which I am emulating with bit vector concatenation to form the indices
20:26 <erisco> but my problem is finding those indices
20:26 <geppettodivacin> sdrodge: Usually I see it used with Applicative.
20:26 fractalsea joined
20:26 <geppettodivacin> :t (<*>)
20:26 <lambdabot> Applicative f => f (a -> b) -> f a -> f b
20:26 <erisco> so I am concatenating existentials and also existentials with universals
20:27 norotartagen joined
20:27 mekeor joined
20:27 <sdrodge> geppettodivacin: Yep, that's exactly what I'm explaining/motivating right now :)
20:27 chrzyki joined
20:27 <erisco> and I can't imagine that is so friendly, but it could just be the universals alone causing the issue
20:27 <erisco> particularly when I ask for all models
20:27 <geppettodivacin> Oh, sorry. I jumped in mid-conversation. :P
20:27 subttle joined
20:27 <zv> erisco: yeah, that will do it
20:28 <dmiles> zv: when will what erisco is doing not be asking too much?
20:28 <Sh4rPEYE> sdrodge: Thanks. I somehow missed the function after fmaping is in the structure.
20:28 <zv> in principle things like DPLL and CDCL are great because you can simply not explore the vast space of possibilties. One half of that is unification/not exploring 'contradictions', the other is that you can simply abandon the search upon first satisfying literals :)
20:29 oish joined
20:29 <erisco> the problem is, roughly explained, that I am searching for possible rules to add to a puzzle which reduce the number of solutions
20:29 ragepanda joined
20:29 Nicmavr joined
20:29 ftop joined
20:29 buglebudabey joined
20:29 <Sh4rPEYE> Can I thing of ap as just taking a function from the structure and fmaping it over something?
20:29 <zv> dmiles: who knows
20:30 <erisco> so the problem is "find a rule R which fits solution A but not solution B", and thus I can repeat this process to iteratively reduce the solutions of any solvable puzzle to one
20:30 <sdrodge> sh4rpeye: Not quite. But close.
20:30 <zv> The average SMT problem is "SAT^2", even for basic arithmetic. SAT *itself* is already hard.
20:31 g0d355__ joined
20:31 louispan joined
20:31 <zv> The average SAT/SMT engine just encodes, say, uint32 arithmetic into 32^32 boolean clauses
20:31 <erisco> the solutions are known (this is easy to solve) and so the variables are just in R
20:31 <sdrodge> sh4rpeye: Keep in mind that f (a -> b) does not imply exactly one function "inside" f
20:31 <sdrodge> Might be zero functions, might be more than one function.
20:32 <sdrodge> [(+1), (+2)] <*> [3, 4]
20:32 coot joined
20:32 <sdrodge> for example.
20:32 <zv> So basically, just like with computer programming languages, there are many, many strength reductions that can make an SMT problem zoom by, but you need to express that in a high-enough level form that the solver can grasp what you are looking for.
20:32 <Sh4rPEYE> sdrodge: In that situation it applies every argument to every function on the left. Right?
20:33 <sdrodge> sh4rpeye: yep, that's what the list applicative instance does.
20:33 <zv> so, as erisco has found, the solver is going on a roundabout path to solving something because there is not enough 'problem information'
20:34 <zv> so it could be years before erisco is not 'asking too much'
20:34 LeCamarade joined
20:34 <erisco> I am not sure if the question I am asking is even avoidably complex
20:34 <zv> erisco: Yeah, I agree. It probably isn't
20:34 <dmiles> one neat property (if done right) the more data/information given to the solver the faster it will run :)
20:34 fractalsea joined
20:35 <Sh4rPEYE> sdrodge: Oh, of course, that's what I meant.
20:35 <erisco> I threw it at an SMT solver because it certainly wasn't obvious to me how to make it fast :P
20:35 <zv> but unfortunately the way that SMT-api generators work is terrible
20:35 Boomerang joined
20:35 <Sh4rPEYE> sdrodge: I'll read more abut it, but now I have a general idea at least. Thank you :-)
20:35 bollu joined
20:35 <bollu> cocreature: ping :)
20:35 <sdrodge> sh4rpeye: No problem!
20:36 <erisco> but I might come up with some clever ways to simplify the problem, because I do have wiggle room
20:36 <bollu> @tell cocreature "ah, thanks for spotting that. I was in a hurry!"
20:36 <lambdabot> Consider it noted.
20:36 <zv> but of course there's chicken-n-egg for things like erisco's problem: "Encode the problems 'true' tree/horn-logic/whatever structure <-> Find the structure by solving the problem"
20:37 chlong joined
20:38 <zv> also, add in the typical "graduate student deathmarch" that most SMT-solver's code is made of, and you've got *loads* of difficult SMT problems
20:38 <dmiles> I am developing a Conflict learning system that works for full FOL .. it works to produces conflict producing horn clauses(HC) heads (as well as normally what is derived from HCs) of cource if i tried to ground the Conflists it produce exponeticals so what i do is enure all conflicts can be found by backchaining at a depth of three
20:38 <dmiles> ensure all conflicts can be reached*
20:39 <dmiles> the idea is to give a narrower window to what is allowed to be searched
20:39 sirreal joined
20:40 <zv> that is cool
20:40 hybrid joined
20:41 <zv> I tried writing a CDCL solver from scratch awhile ago and didn't get very far. There are a lot of tricky issues that present themselves in the core logic, especially if you aren't an experienced Prolog programmer for example.
20:41 <dmiles> if some rule causes crazy chaining that is it produces equal or more consequnets .. that rule is backward chained (otherwise forward chained)
20:42 <dmiles> i started out with a guys code who created CDCL in 1983
20:42 mmachenry joined
20:42 AndreasK joined
20:42 Sh4rPEYE joined
20:43 <dmiles> (Mark Stickels PTTP .. for every p(X,Y).. he produced not_p(_X,_Y).
20:43 <dmiles> )
20:43 <Sh4rPEYE> sdrodge: Actually, one more question, sorry. Where is the 'monoidal' bit in all of this? I've read Applicatives are Monoidal functors
20:43 <zv> yep, thats the strategy :)
20:43 <dmiles> not_p/2 is a solver that proves what is a conflict
20:43 <benzrf> Sh4rPEYE: it has to do with this function:
20:44 <zv> Donald Knuth actually just recently released his most recent fascicle of 'The Art of Computer Programming' and it's on SAT solvers
20:44 mekeor joined
20:44 <benzrf> a ** b = (\a' b' -> (a', b')) <$> a <*> b
20:44 <zv> He's got the most comprehensive description of every strategy in SAT solving I know of.
20:44 <dmiles> so before searching into p/2 .. you when/2-ify the free vars of it to check not_p/2
20:44 <benzrf> Sh4rPEYE: which has the type (**) :: Applicative f => f a -> f b -> f (a, b)
20:44 peterbec` joined
20:44 <zv> 2-ify meaning convert to 2SAT?
20:44 <benzrf> essentially, this forms something analogous to a monoid if you swap out some parts of the definition of "monoid"
20:45 bollu joined
20:45 <dmiles> when/2-ify = when bound enough, call not_p (that can be set up in prlog with when/2)
20:45 <Sh4rPEYE> benzrf: It looks like a weird version of tuple append
20:45 superphunthyme joined
20:46 <benzrf> tuple append?
20:46 Luke joined
20:46 <dmiles> when/2 is the way a person sets up coroutines (that react on variables changing states
20:46 <AndreasK> Is there a pretty print lib thats polymorphic over the string type?
20:46 malthe joined
20:46 <monochrom> Wait, Knuth does SAT solvers now?!
20:47 <Sh4rPEYE> Pardon my imprecise wording... Rather, well... Actually, tuples cannot be appended to. Sorry.
20:47 <zv> monochrom: Volume 4 Fasc. 6
20:47 <monochrom> Well I guess it is a computational combinatorics interest too.
20:47 <dmiles> which is what some most CSP(?) systems use.. it sets up a lazy "onBind" trigger)
20:47 ongy joined
20:47 peterbec` joined
20:48 <sdrodge> Sh4rPEYE: I'm not confident enough in my understanding of that aspect of it to explain adequately, sorry.
20:48 <Sh4rPEYE> Anyway, it doesn't really merge a and b together, it just makes tuple of them.
20:48 <dmiles> The Art of Computer Programming, Volume 4, Fascicle 6: Satisfiability
20:49 <monochrom> I should maybe actually buy this fascicle.
20:49 <monochrom> (Normally I am not interested in combinatorics.)
20:49 <Sh4rPEYE> I've seen that apply for tuple works like this (<*>) (a, f) (b, c) = (a <> b, f c). Nowhere did I find why it should behave like this.
20:49 conal joined
20:49 oish joined
20:50 <Sh4rPEYE> It could shed some light on the 'monoidal' part of it, though.
20:50 <dmiles> zf: though i am doing nonmonotonic logic.. but i cheat by using tricks found in many SAT solvers
20:50 <monochrom> oh w00t it has Kindle edition too
20:51 <AndreasK> Is it a proper kindle version or just a scan?
20:51 yogsototh joined
20:51 <sdrodge> Sh4rPEYE: The Applicative instance for Const m also depends on m being monoidal.
20:52 <Sh4rPEYE> sdrodge: Yes. It just seems weird to me, though. I guess it'll come with time. I'll stick to the function lifting analogy for now.
20:52 lok joined
20:53 <tobiasBora> Hello,
20:53 <dmiles> The Art of Computer Programming, Volume 4A: Combinatorial Algorithms, Part 1
20:54 <dmiles> to monochrom
20:54 <monochrom> Ah, Knuth says don't go for the Kindle edition, there is a better choice on his home page.
20:54 <tobiasBora> I tried to create lot's of threads, by using forkIO, but the problem is that the program quit very quickly, so I suppose that the main thread close, and so it closes also the threads in the thread list. How could I wait that all the threads in a given list are stoped?
20:56 <geekosaur> tobiasBora, you need to keep track of them somehow. often this is done with a list of MVar-s. or see if the async package has something prepackaged for it
20:56 <monochrom> Haha, Knuth plans to teach us parsing again by 2025.
20:57 <tobiasBora> geekosaur: Well I've a list
20:57 <tobiasBora> I do
20:57 <geekosaur> (it's normal that exiting the main thread kills all subthreads, most thread systems work that way)
20:57 <tobiasBora> forM [1..nbThreads] $ \_ -> do forkIO $ oneThread sharedData
20:57 <geekosaur> yes, but you don't save the ThreadId-s
20:57 abrar joined
20:57 <geekosaur> so you have no idea what happens after starting them
20:57 <tobiasBora> well I could save them
20:58 <tobiasBora> listId <- forM [1..nbThreads] $ \_ -> do forkIO $ oneThread sharedData
20:58 mikecaruso1 joined
20:58 <tobiasBora> but then what can I do with this list?
20:58 <tobiasBora> (actually, I want to wait that all the threads finish just after this list)
20:58 <tobiasBora> *this line
20:59 <tobiasBora> So I think that I don't even need a mvar, since the number of threads is fix, and in this list
20:59 <geekosaur> anyway it's not really enough to do even that, you create an MVar for each thread, pass each thread its MVar, and then each thread does putMVar before exiting and your main thread does tryTakeMVar on all of them until it's succeeded
20:59 <tobiasBora> geekosaur: oh like this...
21:00 <geekosaur> but there's edge cases where a thread can be killed in various ways and will therefore never putMVar
21:00 <tobiasBora> I though there would be some nice function to handle that. And when I've lot's of threads, I do like an infinite loop that always check for the result?
21:00 umib0zu left
21:00 <geekosaur> I pointed you at async for a reason
21:00 <geekosaur> @hackage async
21:00 <lambdabot> http://hackage.haskell.org/package/async
21:01 <geekosaur> the standard ghc thread api is very low level; async provides a higher level abstraction
21:01 <geekosaur> and there's some add-on packages to do fancier stuff
21:01 mikecaruso joined
21:02 <Sornaensis> :t const
21:02 <lambdabot> a -> b -> a
21:02 <Sornaensis> :t flip const
21:02 <lambdabot> b -> c -> c
21:04 JeanCarloMachado joined
21:04 aarvar joined
21:04 <geekosaur> oh, sorry, I had thoguht about ,entioning async bu then ended up respinding to somehting else you said instead :/
21:04 <geekosaur> anyway you want the async package, it;s a much saner way to deal with threads than messing with the low level API
21:04 <tobiasBora> geekosaur: Hum I miss your message where you talked about async, sorry. This one sounds great!
21:04 <tobiasBora> ahah ok
21:05 lol__ joined
21:06 KarboniteKream joined
21:06 Maxdamantus joined
21:06 conal joined
21:06 lol__ joined
21:07 lol__ joined
21:08 <tobiasBora> geekosaur: It's definitely what I need, thank you very much!
21:08 lol__ joined
21:09 norotartagen joined
21:09 grayjoc joined
21:10 splanch joined
21:13 Koterpillar joined
21:15 gregoire joined
21:15 tdfirth joined
21:15 Gentilhomme joined
21:15 norotartagen joined
21:16 rootmos joined
21:16 <hexagoxel> :t [flip const, const id]
21:16 <lambdabot> [b -> c -> c]
21:16 danthemy_ joined
21:18 fizbin joined
21:19 tdfirth joined
21:21 lapinot joined
21:21 <lapinot> hello there
21:22 <lapinot> i'm trying to implement Show on a GADT but deriving doesn't work.. does anyone have a hint on how I should tackle this?
21:22 <lyxia> hello
21:22 <lyxia> I think you can sometimes do this with standalone deriving
21:22 <lapinot> i also tried that :(
21:23 Denthir joined
21:23 <lyxia> @lpaste lapinot
21:23 <lambdabot> Haskell pastebin: http://lpaste.net/
21:23 <lyxia> What's your GADT?
21:24 <maerwald> lyxia: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#generalised-algebraic-data-types-gadts
21:27 <ExpHP_> hmm, how come transformers doesn't have more type classes like MonadIO for its other transformers?
21:28 <ExpHP_> Like, is "MonadState s" not possible or just *not there*?
21:28 t0by joined
21:28 <lyxia> transformers only exposes the transformers, the type classes are in mtl
21:28 <ExpHP_> erp, answered my own question already, there's one in mtl
21:29 <ExpHP_> wait
21:29 <ExpHP_> MonadState s m | m -> s
21:29 <ExpHP_> I don't see why it specifies functional depencies, that means you can only have one instance
21:31 <lyxia> If you don't, then you lose a lot of type inference.
21:31 TallerGhostWalt joined
21:32 <ExpHP_> lyxia: I'd rather newtype all the things than have to stick them all in the same StateT
21:32 brent80_plow joined
21:33 arpl left
21:33 <lyxia> I don't understand what that solves
21:33 JeanCarloMachado joined
21:33 <lapinot> lyxia: https://ptpb.pw/T2Zz
21:34 <lyxia> lapinot: you have a function in there
21:34 sypwex joined
21:34 sypwex left
21:34 <lyxia> There is no Show for function, hence you can't derive Show.
21:34 <lapinot> oh that's sad
21:35 <ExpHP_> right now if I write any functions for my monad stack which are parameterized over the type class, then they'll break if I add another layer that happens to be another StateT
21:35 <ExpHP_> or happens to contain one, for that matter
21:35 grayjoc joined
21:35 <lyxia> Okay, so what does newtype bring you here?
21:36 epsilonhalbe joined
21:37 <sm> hvr, all: did you find any good ways to avoid running out of memory when doing a big build on travis with nothing cached ?
21:37 <ExpHP_> They're just to make inference tractable for generic types
21:37 cur8or joined
21:37 <Koterpillar> sm: build a base docker image
21:38 <lapinot> if i can't show a function is it possible to show a type? (i'm relatively new to haskell, coming from strong ocaml background, so this question may sound stupid)
21:38 <Koterpillar> sm: https://github.com/koterpillar/tianbar/blob/master/Dockerfile.base
21:38 <sm> Koterpillar: aha.. I do not speak docker, but that's interesting
21:38 <sm> thanks
21:39 <Koterpillar> sm: it's a hack, but it works
21:39 <lyxia> lapinot: in your case you can write a function by hand to convert an Expr to a String.
21:39 bjz joined
21:40 <lapinot> lyxia: mhh wouldn't i need some kind of pattern on functions (which doesn't have any sense)?
21:40 <lapinot> s/pattern/pattern matching/
21:40 castlelore joined
21:40 castlelore joined
21:41 <lyxia> lapinot: What do you mean exactly by "show a type"? For debugging purposes?
21:41 implementation joined
21:41 implementation joined
21:42 rejagr joined
21:42 <lyxia> lapinot: Since you're doing HOAS you can just apply the functions to fresh variables to get a meaningful result that you can print
21:42 lok joined
21:43 <lapinot> yeah, some kind of... this code is part of the interpretation of a small language so i would have liked to implement a REPL providing some kind of output (at least type, some representation of what it does would be awesome)
21:43 <lyxia> Ah, I read too fast, you're going to have trouble with values.
21:44 <lapinot> i would need to represent the type of an expression (should be doable somehow with another `Type` GADT) and then be able to generate a dummy value for an arbitrary type
21:44 <lyxia> But what I said applies to Expr.
21:45 crippleye joined
21:45 <lyxia> lapinot: you might use the Typeable type class for this.
21:45 <lyxia> lapinot: I mean, to print the type of an expression/value
21:46 KarboniteKream joined
21:47 <lyxia> lapinot: import Data.Typeable ; showTypeOf :: Typeable a => Expr a -> String ; showTypeOf = show . typeRep
21:47 tput joined
21:47 coltfred joined
21:50 marsam joined
21:51 cur8or_ joined
21:51 <lapinot> lyxia: cool, i'm gonna try that (Typeable is an awesome feature btw... haskell does definitely have a lot of funny features compared to ocaml)
21:51 silver joined
21:52 hiratara joined
21:53 <lapinot> (the only downside is that haskell folks useWeirdCase instead_of_normal_ones :P)
21:55 <lyxia> (it is indeed quite ugly sometimes)
21:56 <jle`> camels for life
21:57 chico_28_ joined
21:58 <kadoban> This_Looks_Pretty_Bad <-- so there's not a ton of choice, IMO. You have to be able to start with capital letters, and This_looks_just_weird as well.
21:58 sleffy joined
21:58 jgertm joined
22:00 epsilonhalbe left
22:00 <lapinot> kadoban: types in CamelCase and function in lower_case is just fine for me (i do like python's pep8 a lot actually).. but i'm also very maniac when it comes to following conventions so i'll stick to writing haskell likeThis
22:01 <kadoban> lapinot: That would bother me, but ya I guess that'd be the most acceptable other alternative, IMO.
22:01 <tobiasBora> I've a question: I'm using stack, and I enabled the library profiling in my cabal/stack project. However, when I disabled it, my program are much slower than before to run, so I wonder if it's possible that stack is still using the profiling version of the library
22:01 JeanCarloMachado joined
22:02 <jle`> it is possible
22:02 <jle`> i usually stack clean if i notice anything fishy
22:03 takle joined
22:04 <sm> strange, stack is usually recompilation-happy
22:06 bollu joined
22:06 <bollu> cocreature: ping
22:06 darkSeid_ joined
22:07 <tobiasBora> jle`: stack clean do not change anything
22:07 <bollu> anyone here who has used the LLVM API? I'm using llvm-hs. I was wondering if there a way to "reinterpret" a JITed LLVM value back as a Haskell value
22:07 <bollu> @tell cocreate I was wondering if there a way to "reinterpret" a JITed LLVM value back as a Haskell value. If you could point me to the API if it exists, it would help a lot :)
22:07 <lambdabot> Consider it noted.
22:08 takle joined
22:08 noxd joined
22:09 cheater joined
22:09 curious_ joined
22:09 <curious_> hello guys
22:09 <curious_> can you help me with some functional js code
22:09 <curious_> https://pastebin.com/ZVri3jMP
22:09 <davean> his is a Haskell channel, not a JS channel I'm afraid
22:10 mmachenry joined
22:10 <curious_> I know but the question is functional about functional programming
22:10 <davean> Ok?
22:10 <bollu> curious_: #haskell-overflow maybe willing to help
22:10 <curious_> ok I'll ask there
22:10 <bollu> curious_: what is the question?
22:10 <curious_> the
22:10 <curious_> the most inner function
22:11 SoupEvil joined
22:11 <curious_> is supposed to get string and match as parameters
22:11 JeanCarloMachado joined
22:11 <curious_> but it gets match and offset
22:11 <darkSeid_> Hi, does anyone here have a recommended intro to haskell? There's so many different resources so I thought people here might have some solid suggestions :) I've never touched any functional programming before so it would need to start from 0
22:11 <jle`> a lot of people recommend haskell from first principles these days ...
22:11 <hpc> @where learnhaskell
22:11 <lambdabot> https://github.com/bitemyapp/learnhaskell
22:11 <jle`> @where haskellbook
22:11 <lambdabot> http://haskellbook.com
22:11 <darkSeid_> and I have no idea why randomly every 'so; is highlighted
22:11 <jle`> darkSeid_: it's because there's a user named 'so' in this channel
22:11 <darkSeid_> oh damn, thats unfortunate
22:11 <curious_> the documentation for the function states that the callback function can be passed several arguments in which I'm not interested in, I'm interested only in those two
22:12 <jle`> and your client probably highlights usernames :)
22:12 <hpc> @where lyah -- if you don't need exercises
22:12 <lambdabot> http://www.learnyouahaskell.com/
22:12 <darkSeid_> aye, textual is awesome
22:12 <glguy> bollu, curious_: No, as mentioned, that is offtopic here
22:12 <hpc> @where rwh -- has a good second half that covers common libraries
22:12 <lambdabot> http://www.realworldhaskell.org/blog/ http://book.realworldhaskell.org/read/
22:12 <curious_> ok
22:12 <darkSeid_> awesome, ty for the links :)
22:12 <bollu> curious_: come over to #haskell-overflow
22:12 <jle`> i am a graduate of lyah for what it's worth; it was what taught me originally, but i understand that it's not for everyone
22:12 tromp joined
22:12 <curious_> going
22:12 gibransr joined
22:13 mda1 joined
22:13 <glguy> darkSeid_: Graham Hutton's "Programming in Haskell" was updated recently and is worth looking at
22:13 diminishedprime joined
22:14 <darkSeid_> jle`, when you say first principles, you mean like category theory?
22:14 <lapinot> i'm sorry, i'm really beginning with haskell (and starting right with GADTs!) so i'm having trouble with Typeable... deriving Typeable Expr works but Typeable (Expr t) doesn't so i can't use showTypeOf
22:14 <jle`> darkSeid_: no, i mean literally the book "Haskell from First Principles"
22:14 <darkSeid_> oh haha
22:14 Fairy joined
22:14 <darkSeid_> thank god
22:14 <jle`> and learning haskell doesn't involve category theory at all :)
22:14 <jle`> in fact, haskell itself has nothing to do with category theory
22:14 <jle`> it's just that a lot of haskell programmers are hobby category theorists so we talk about it a lot for some reason
22:14 kgadek joined
22:15 <jle`> so i guess that's how the misconception got spread around
22:15 lpaste joined
22:15 <jle`> but it's just that the haskell fandom and CT fandom have some awkward overlap in members. like star trek and star wars, maybe.
22:15 <lyxia> lapinot: you're not supposed to derive Typeable, it's already derived
22:15 <darkSeid_> isn;t functional programming based on category theory at all?
22:15 <jle`> not really, heh
22:15 cur8or joined
22:15 <jle`> by not really i mean 'not at all'
22:16 <jle`> there is no relationship between functional programming and category theory
22:16 jayshua joined
22:16 <bollu> darkSeid_: on some level, I would recommend coming to IRC and asking stuff
22:16 <jle`> at least not in the sense that one can be said to be based on the other
22:16 <bollu> darkSeid_: stackoverflow + google + IRC got me this far :)
22:16 <darkSeid_> bollu, thats why im here :)
22:16 <bollu> darkSeid_: LYAH as well
22:16 <lapinot> lyxia: i started with that (suspecting that Typeable would indeed be magic) but then I get a "No instance for (Typeable b0) arising from a use of ‘showTypeOf’"
22:16 <jle`> there are some things they have in common, of course. (1) they are both studied by human beings
22:16 <jle`> (2) their names are two words long
22:16 <jle`> etc.
22:17 <darkSeid_> hmm
22:17 <sdrodge> darkSeid_: Category theory turns out to be really useful as a mathematical description of the semantics of programming languages.
22:17 <Cale> jle`: Well, there's definitely *some* relationship
22:17 <Koterpillar> lapinot: you do need to add deriving (Typeable), compiler will do it for you but only if you specify it so
22:17 <jle`> there are shallow relationships
22:18 <bollu> jle`: I disagree
22:18 <darkSeid_> I'm quite glad that it's not so important to understand category theory, as I attemted some number theory in uni and couldn't do _any_ of it
22:18 <bollu> jle`: CCC ~= lambda calculus is not shallow
22:18 <Cale> There's the Curry-Howard-Lambek correspondence between lambda calculi, logics, and various sorts of categories
22:18 <sdrodge> darkSeid_: Its influence happens to be strongly felt in the design of Haskell libraries, but it's not any more inherent to Haskell than any other language.
22:19 <jle`> ok, i'll admit that there are interesting links :)
22:19 <sdrodge> You can definitely understand and deal with all the important typeclasses without learning a lick of category theory.
22:19 <lapinot> Koterpillar: i get the same error using that
22:19 <darkSeid_> so the sterotype of all haskell programmers being maths phd's is... nonsense?
22:19 cheater joined
22:19 <bollu> sdrodge: It helps to understand "monad is monoid is endofunctors" though
22:19 <bollu> darkSeid_: sample size of 1: am not PhD :P
22:19 <jle`> darkSeid_: pretty much nonsense
22:19 <Cale> Yeah, the thing is, you can be a totally competent, even an excellent Haskell programmer, without knowing any category theory at all.
22:19 <jle`> darkSeid_: haskell's ideal audience is the un-smart
22:19 anuxivm joined
22:19 <darkSeid_> oh man
22:19 <jle`> haskell is for people who aren't smart enough to program in C++ or java
22:19 <darkSeid_> hellooooo haskell
22:19 <Cale> But to deny that there's a correspondence there would be a lie :)
22:20 <sdrodge> bollu: I agree that you obtain a deeper understanding by knowing the math, but our point is that it's not necessary.
22:20 <darkSeid_> I suppose you gain a deeper understanding of every programming language if you understand the math behind it
22:20 <lapinot> more generally, functional programing is much more widespread in academics
22:20 <jle`> i'm convinced that only geniuses can program effectively in C++, and even then, not even well
22:20 <Koterpillar> lapinot: you need to derive Typeable throughout all your types
22:20 <sdrodge> darkSeid_: Exactly.
22:20 <bollu> sdrodge: beyond a point, when you enter the space of "libraries motivated by category theory ideas" it starts becoming imporant
22:21 <Koterpillar> lapinot: show what you have, I must have missed it
22:21 <jle`> almost every day some memory exploit or state management error comes out
22:21 <Cale> The main reason to learn the category theory is to be able to apply it *not* to Haskell, but to other things -- Haskell and functional programming can be a good motivating jumping off point to getting into all sorts of other mathematics, or other applications of category theory to computer science.
22:21 <sdrodge> bollu: Agree to disagree.
22:21 <jle`> keeping track of memory and implicit state in C++/Java is extremely difficult
22:21 <lyxia> lapinot: your error comes from your usage of showTypeOf
22:21 <lapinot> Koterpillar: https://ptpb.pw/g9d2 :)
22:21 <lapinot> lyxia: yes
22:21 splanch joined
22:21 sigmundv_ joined
22:21 <jle`> in haskell, your programs pretty much write themselves, and you have to keep track of much less in your head
22:21 <sdrodge> jle`: Just declare everything const! \s
22:22 <darkSeid_> you really are making it sound awesome
22:22 <lyxia> lapinot: what version of GHC are you using
22:22 <bollu> sdrodge: sure :)
22:22 <lapinot> lyxia: 7.8.4
22:22 <bollu> > let powerset = filterM (const [True, False]) in powerset [1, 2, 3]
22:22 <lambdabot> [[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[]]
22:23 <sdrodge> He's overselling a little bit. Learning to think the Haskell way takes a lot of time, and there are other things that are harder to reason about in Haskell programs than programs written in other languages (like space complexity).
22:23 <bollu> darkSeid_: ^ powerset as a one-liner :3
22:23 <sdrodge> But yes, it is pretty great, and I find a lot of things more natural and beautiful to express in Haskell.
22:23 <bollu> let fibs = 1:2:zipWith (+) fibs (tail fibs) in take 10 fibs
22:23 <bollu> > let fibs = 1:2:zipWith (+) fibs (tail fibs) in take 10 fibs
22:23 <lambdabot> [1,2,3,5,8,13,21,34,55,89]
22:23 <bollu> darkSeid_: one liner fibonacci sequence in Haskell
22:23 <darkSeid_> well, i always found functions easier to use than objects, so that has to be a start
22:23 <Cale> sdrodge: On average in practice, I would say Haskell programs are much easier to reason about than things written in other languages, even once you account for the time spent worrying about space complexity though :)
22:24 <darkSeid_> bollu, thats awesome =)
22:24 <sdrodge> Cale: I would tend to agree.
22:24 <jle`> learning haskell is indeed a large up-front investment
22:24 <bollu> Cale: now explain tardis monad ;)
22:24 <bollu> Cale: (I'm half serious)
22:25 <jle`> but the power of haskell is definitely in the long-term
22:25 <jle`> i used to dread maintaining and refactoring old projects
22:25 <Cale> bollu: You mean the state monad with the state wired up in reverse?
22:25 <jle`> but in haskell, it's a joy :)
22:25 <bollu> Cale: yeah
22:25 <darkSeid_> you think it'll grow significantly in popularity?
22:25 <bollu> Cale: bidirectional actually
22:25 <jle`> i can refactor without fear ~
22:25 <bollu> darkSeid_: haskell's mission was to be unpopular
22:25 <Squarism> +1
22:25 <bollu> darkSeid_: it failed
22:25 <Cale> oh, well, start with just one way
22:25 <Sonolin> lol nice one
22:25 <jle`> i don't know if haskell will ever grow significantly in popularity, but i know that the concepts that are tried and tested in haskell eventually spill over into other languages
22:25 <Cale> If you can do each way, doing both is no harder
22:26 <Sonolin> I think its definitely relatively popular compared to other pure functional languages
22:26 <darkSeid_> yeah, lots of people are now practising functional JS
22:26 <Sonolin> well I haven't seen any *pure functional JS, although I'm sure its out there ;)
22:26 <sdrodge> Also some more basic everyday ideas have flowed over.
22:26 <jle`> honestly, to me (and i'm sure many others), the benefit of haskell isn't the fact that it's functional, but it's the type system
22:26 <sdrodge> Notice how everybody is adding and optional types to their languages these days?
22:27 <bollu> Cale: I see, interesting
22:27 <sdrodge> std::optional in C++17, and Option<T> in Rust.
22:27 fuzzy-id joined
22:27 <jle`> functional programming is cute but without an expressive type system it can get just as messy
22:27 <Sonolin> oh yea definitely, the type system in haskell is my favorite I wish more languages were as expressive
22:27 <jle`> see: any large codebase in lisp or scheme
22:27 <Cale> bollu: Are you familiar with how State works ordinarily?
22:27 <bollu> Cale: yeah
22:27 <jle`> but hsakell's type system is indeed spilling over too
22:27 <bollu> Cale: I'd never considered wiring it backwards :P
22:27 <Cale> So recall that you perhaps have something like:
22:27 <lapinot> jle`: indeed, rust (<3 btw) has a lot of haskell influence (actually i think type-classes are the quintessence of object oriented programming (python style, not smalltalk style))
22:27 <jle`> there's swift, scala, flow-js, etc.
22:28 <bollu> lapinot: rust <3 high five
22:28 <jle`> the most overrated thing about haskell to me is the cute one-liners
22:28 <Cale> x >>= f = State (\s -> let (v,s') = runState x s; (w, s'') = runState (f v) s' in (w, s''))
22:28 <Cale> bollu: right?
22:28 louispan joined
22:28 <jle`> they're nice but they can't communicate the real benefits of haskell, in maintainability and safety
22:28 <bollu> Cale: yes
22:29 <Cale> bollu: Of course, there's nothing stopping us from just wiring the s parameters through in the opposite direction:
22:29 <Squarism> the other day i had this significant refactoring - had to generify all messaging (really make specific messages generic up until a certain handler). That was both database-, thread-channels-, remoting- messages. Took me 3 days to do it. Once it compiled, i had just 2 easy to fix / obvious bug.
22:29 <jle`> :D
22:29 <darkSeid_> jle`, how does haskell help you in refactoring and maintaining old projects?
22:29 <Cale> x >>= f = State (\s -> let (v,s'') = runState x s'; (w, s') = runState (f v) s in (w, s''))
22:29 <darkSeid_> i mean, why is it much easier than in other languages
22:29 <jle`> darkSeid_: the type system is expressive enough that it can describe behavior as well as just structure
22:30 <jle`> so if you want to change behavior, you start with changing the types
22:30 <lapinot> Cale: the problem behind one-liners is that haskell devs can't help defining functions as symbols (and thus helping people writing in point free programming)
22:30 <jle`> and the compiler makes sure everything is still correct
22:30 <sdrodge> darkSeid_: The type system holds your hand the entire way, and it also demands a certain level of decoupling from the get-go so it's harder to write an unmaintainable mess in the first place.
22:30 <Cale> lapinot: hm?
22:30 <jle`> and, if you want to change something while keeping the behavior invariant, you can make changes to code and be confident that the behavior won't change, and there aren't any regressions
22:30 <lyxia> lapinot: okay it seems that Typeable is automatically derived for all types only since 8.0.1
22:30 <jle`> because the compiler ensures that the behavior matches the expectations that the types set out
22:30 sigmundv_ joined
22:31 <sdrodge> lapinot: There's nothing inherently evil about point-free.
22:31 <jle`> refactoring/maintaining in other languages requires you to keep the entire 'system' in your mind
22:31 <jle`> and knowledge of all of the intricate parts and state of all the objects and how they all fit together fragilly
22:31 <lyxia> lapinot: I don't see any error here though. You didn't show the part where you're using showTypeOf
22:31 <Cale> lapinot: Infix operators often work a bit against points-free programming actually
22:31 hiratara joined
22:31 <jle`> in haskell, you often don't even have to understand the program's implementation as long as you understand the types
22:31 <bollu> Cale: fuck, i'd never considered that
22:31 coot joined
22:31 <bollu> Cale: that is awesome :O
22:31 <darkSeid_> btw this channel is already > 99% of irc
22:32 <bollu> darkSeid_: naw, ##math sees heavy traffic too
22:32 <jle`> the compiler basically keeps track of the program's architecture for you so that you don't have to worry about breaking anything
22:32 <darkSeid_> i didn't get laughed out for asking a beginner question, which was a shock to the system
22:32 <Cale> bollu: So then any get will obtain the value set by the *following* put, which, if you're not careful, might depend on the value thus obtained
22:32 <bollu> Cale: right
22:32 <lapinot> lyxia: yeah, i was typing `showTypeOf identity` in ghci
22:32 <lapinot> lyxia: gonna update right now
22:32 <Cale> bollu: So you can write stuff like: do xs <- get; put (1:xs); return xs
22:33 <Cale> bollu: and that'll compute an infinite list of 1's :)
22:33 <bollu> Cale: WTF :P
22:33 <bollu> Cale: as usual, I get mind-bent by haskell
22:33 <lyxia> lapinot: Typeable is only going to show non-parametric types.
22:33 <sdrodge> I was actually doing a hackerrank problem in python the other day that was absolutely perfect for the Tardis monad. You could use it for practice/understanding if you want, bollu: https://www.hackerrank.com/challenges/candies
22:33 <bollu> sdrodge: haskell doesn't TLE?
22:34 <bollu> sdrodge: I've never been able to get haskell to perform as well as I want it to
22:34 <sdrodge> bollu: You'll learn. Don't worry.
22:34 <lyxia> lapinot: in ghci you can do :t identity
22:34 <kadoban> Naw, I've done a bunch of hackerrank with haskell and it's fine.
22:34 coot joined
22:34 <monochrom> bollu: If x and f are non-strict in the "state" parameter, they can accomplish something.
22:34 <sdrodge> bollu: Also, they give you a generous amount of time for Haskell on hackerrank.
22:34 <bollu> sdrodge: I've been trying for a year now, around. I could never get things to work on codeforces
22:35 <bollu> s/codeforces/codechef
22:35 <kadoban> 5s on hackerrank for haskell, yeah, compared to 2s for C++
22:35 <monochrom> For example maybe the state is a list, and x and f just prepend things to the list state.
22:35 <Cale> It takes some time to build up a sense of what's going to perform well.
22:35 <bollu> monochrom: right
22:35 <monochrom> Oh, Cale already showed that.
22:35 <kadoban> I've done codechef as well, it works okay. I can't recall if you get extra time there.
22:35 vi0 joined
22:35 <bollu> Cale: I actually went to the effort of implementing a small functional interpreter to understand laziness
22:36 <bollu> Cale: I have a much better sense of it now
22:36 <bollu> Cale: WHNF
22:36 <bollu> Cale: learning that helped a lot
22:36 <Cale> yeah
22:36 <sdrodge> bollu: If you're getting destroyed on time in these contests, using ByteString for I/O would likely fix it.
22:36 <monochrom> And also everytime you try to evaluate "expr1 expr2", work on expr1 first, afterward you may find that you don't even care about expr2.
22:37 <bollu> sdrodge: ah, I've never tried that
22:37 zipper joined
22:37 <bollu> sdrodge: will keep that in mind
22:37 <Cale> The thing which helped me a lot early on was watching programs reduce in this graphical functional language called HOPS http://www.cas.mcmaster.ca/~kahl/HOPS/ which sadly isn't available, but you can watch some animated gifs there anyway
22:37 <monochrom> which is why if-then-else can be a user-defined function in Haskell, but must be a built-in in eager languages.
22:37 <kadoban> Usually Text is enough, but for most problems it doesn't even matter. It starts to matter when you have huge inputs.
22:38 <sdrodge> Well, you don't get Text in a lot of these environments.
22:38 <Cale> Once you have that idea in your head, that evaluation at runtime is this process of editing an expression graph, and that space usage is at least roughly proportional to the size of that graph
22:38 <kadoban> Really? I think it's in all of hackerrank/codeforces/codechef at least
22:38 <sdrodge> The bytestring package comes with GHC, so it's always available.
22:38 <Cale> A lot of stuff gradually starts becoming more obvious
22:38 oish joined
22:38 <sdrodge> kadoban: I couldn't swear by it, but I think it's not available on hackerrank.
22:38 <bollu> Cale: interesting
22:38 <bollu> Cale: I wrote some programs on this: http://github.com/bollu/timi
22:38 <lapinot> lyxia: oh, i hadn't this in mind...
22:39 <bollu> Cale: since I understood the whole system, it helped immensely
22:39 tromp joined
22:39 darjeeling_ joined
22:39 <kadoban> sdrodge: It's definitely in there, just tried.
22:40 <kadoban> Not that it really matters, I think *all* of these problems are ASCII only, so there's not a big problem using BS.Char8, fugly as it feels.
22:40 <Cale> bollu: yeah, definitely something like that helps
22:41 <sdrodge> kadoban: Good to know.
22:41 <Cale> bollu: Actually, to be honest, most of the time, I don't even think too hard about the graphs, and just think about expressions being rewritten (with the thought in the back of my head that some repeated bits of expressions can be the same stuff in memory if they came from binding the same variable)
22:43 <Sonolin> I haven't had much experience with reducing haskell memory usage
22:43 <Cale> Thunks are just the implementation of expressions at runtime :)
22:43 <Sonolin> but the GHC profiler is a godsend
22:44 <Sonolin> I reduced the speed of my game loop from a noticible ~1-2 second to some unnoticible millisecond amount in about 30 minutes
22:44 <Cale> Yeah, usually you have a look at some space profile graphs, and you see "oh, there's a lot of things of such and such type", and you often pretty quickly have some idea of where they're coming from.
22:44 <sdrodge> milliseconds? That's an eternity to a computer :P
22:45 anuxivm joined
22:45 curious_ left
22:45 <bollu> Cale: I see
22:46 <Cale> Well, it depends on what kind of program you're writing
22:46 JeanCarloMachado joined
22:46 thimoteus joined
22:46 <bollu> Cale: what I find hard to predict is what the compiled code will look like. I have a feeling that close to every function call leads to a cache miss since thunk evaluation leads to an indirect jump?
22:46 <tobiasBora> Does anyone knows why my haskell programs uses 150 real memory, but 1.0T of virtual memory? (I don't really understand what is virtual memory)
22:47 <Cale> Oh, I've never actually worried about anything at that level
22:47 <bollu> Cale: xD
22:48 Itkovian joined
22:48 <geekosaur> tobiasBora, the virtual memory thing is some top programs understand it even less well than you do :)
22:48 mmachenry joined
22:49 argent0 joined
22:49 <Cale> How does that happen? Memory mapped files?
22:50 <tobiasBora> geekosaur: Ahah ^^
22:50 <geekosaur> http://downloads.haskell.org/~ghc/8.0.1/docs/html/users_guide/8.0.1-notes.html#runtime-system
22:50 <bollu> geekosaur: `top programs` as in CLI or `top program(ers)`? :P
22:50 <tobiasBora> Cale: I know, but I'm curious!
22:50 <bollu> geekosaur: was that for me?
22:50 <geekosaur> a program called "top" which shows the top processes consuming some resource (you usually cna select the resource to monitor)
22:50 <bollu> geekosaur: ah, OK
22:51 <monochrom> Don't look at VIRT. Look at RES.
22:51 <geekosaur> Cale, it preallocates page table entries but not actual pages
22:51 featherlessbiped joined
22:51 <Cale> ohh
22:51 <Cale> right
22:51 <geekosaur> so it looks like 1Tb reserved process memory, but very little of it is actually allocated
22:51 <geekosaur> 1TB
22:52 <Cale> Does it handle the case where your program needs >1TB of physical memory? :D
22:52 meiji11 joined
22:52 <Sonolin> sdrodge yea its a turned based game, so not exactly a deal breaker :)
22:52 <geekosaur> I have no idea. want to send me a system with 1TB memory to test with? :p
22:53 <Sonolin> I could probably improve it some more but its more of just an experiment
22:53 <geekosaur> (well, actually it;s virtual memory so you really just need >1TB swap and that the kernel lets user processes have address spaces >1TB...)
22:53 fadeway__ joined
22:54 <Cale> I wonder how nicely it would work to allocate an entire 2TB SSD to swap :D
22:55 <* geekosaur> doesn't even know if a kernel swap map can get that big, for that matter...
22:55 <Cale> "Here you go programs, you're free now."
22:55 <koala_man> Cale: with xpoint/optane, that's basically what's happening
22:55 <monochrom> To be fair, I don't have a >=1TB disk partition yet.
22:56 canta joined
22:56 <Squarism> Im curious on how people do logging? Dont write programs that need it? Are you using and happy with hslogger? Do you use some writer monad instead of having IO functions all over to accomodate logging? Havent found so much info on this on the webz
22:57 <jle`> i usually use monad-logger
22:57 <Cale> Squarism: I just pass a suitable logging function around. If my application already has some sort of configuration environment which is being passed around, I put it in there.
22:57 <sdrodge> Isn't the Writer monad a leaky mess?
22:57 <sdrodge> Or is that fixed somehow now?
22:58 MP2E joined
22:58 <Cale> I don't bother with monad transformers for logging, it's silly.
22:58 Prutheus joined
22:58 superphunthyme joined
22:58 skeuomorf joined
22:58 <Squarism> jle`, Cale - thanks
22:59 <koala_man> geekosaur: I would be really surprised if you couldn't have 1PB swap. It's the https://xkcd.com/619/ kind of thing
22:59 <Cale> Especially if you don't already have a transformed IO monad throughout most of your application
22:59 <Cale> I wouldn't incur one just for logging
23:00 <koala_man> so many HPC and big data projects pushing all the limits
23:00 <Cale> Squarism: At the top level, if your application is concurrent, you'll want to fork a thread to read from a Chan of messages and write the actual log file
23:00 JuanDaugherty joined
23:00 <Cale> Squarism: Just so that the messages don't get interleaved and stuff
23:01 <Cale> Squarism: and then your logging function that gets passed around just writes to the Chan
23:01 <Cale> If your app isn't concurrent yet, you don't have to do that, you can just open the log and pass around some thin wrapper for hPutStrLn
23:01 <Cale> (and maybe a flush just to be safe)
23:01 JuanDaugherty left
23:01 <Squarism> it would be for a concurrent app yes
23:02 lambda-11235 joined
23:02 <fadeway__> http://lpaste.net/8291769260707938304 seems to me like it´s crying about x being a list, but why would x be a list?
23:02 <Cale> This stuff is sort of easy enough to do, and slightly different enough each time I want to do it, that I've never really felt a great need to have a library for it.
23:03 <Cale> fadeway__: Because it's the second argument to Node
23:03 <Cale> fadeway__: Perhaps you meant Node t (x:xs)
23:03 <Squarism> Cale, well for me - doing everything "first time" in haskell im keen on not doing things ill regret
23:03 <Sonolin> "pass around some thin wrapper for hPutStrLn" how to do that if the function doesn't have access to IO, though?
23:03 <Squarism> ill DONT regret
23:04 <Cale> Sonolin: It will.
23:04 fadeway_ joined
23:04 <Sonolin> ah, so you mean either use a channel, or expose IO
23:04 <fadeway_> oops, dc
23:04 <geekosaur> Squarism, you were right the first time actually :)
23:04 <Cale> Anything which is doing something worth logging is usually going to have access to IO at some level.
23:04 <jle`> monad-logger is nice just because of the formatting and TH that formats the output for you, but yeah, i suppose that functionality can be implemented without adding an extra monad transformer
23:04 buoto joined
23:04 <Squarism> geekosaur, ops.. =D
23:04 <fadeway_> <Cale> fadeway__: Because it's the second argument to Node
23:04 przembot joined
23:05 cmsmcq_ joined
23:05 <geekosaur> although more common is '...I won't regret'
23:05 <Squarism> (thumbup)
23:05 <Cale> fadeway_: The most important rule of precedence in Haskell (which isn't actually a rule of precedence) is that function application (whitespace) binds more tightly than any infix operator
23:05 <fadeway_> yeah, but if I´m writing a list as head:tail, isn´t head an element?
23:05 <Cale> fadeway_: So when you write Node t x:xs, it means (Node t x):xs
23:06 <fadeway_> ahh
23:06 <fadeway_> thanks
23:07 tempname11 joined
23:08 tathougies joined
23:08 safe joined
23:10 OnkelTem joined
23:10 Koterpillar joined
23:11 dolio joined
23:11 louispan joined
23:12 soLucien joined
23:12 unbalancedparen joined
23:15 zcourts joined
23:16 jsgrant left
23:17 gugah joined
23:17 zcourts_ joined
23:18 cmsmcq__ joined
23:18 jmcarthur joined
23:21 eacameron joined
23:22 MindlessDrone joined
23:22 theDon_ joined
23:23 diminishedprime left
23:23 ludat joined
23:26 markus1189 joined
23:26 markus1199 joined
23:26 nakal joined
23:26 jathan joined
23:27 eacameron joined
23:28 anuxivm left
23:29 ebzzry joined
23:29 matt1 joined
23:29 benl23 joined
23:32 arawack joined
23:32 bollu joined
23:35 coot joined
23:38 conal joined
23:40 splanch joined
23:43 valdyn joined
23:43 albel727 joined
23:44 Guest91589 joined
23:45 <monochrom> I would meta-regret that I didn't do some experiments and exploring that would cause regrets.
23:45 SAL9000 joined
23:46 Denthir joined
23:46 MindlessDrone joined
23:49 arawack joined
23:50 vektorweg1 joined
23:52 YongJoon joined
23:54 animated joined
23:57 freeside joined
23:59 sigmundv joined