<    April 2017    >
Su Mo Tu We Th Fr Sa  
 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  
00:00 hc_ joined
00:00 atk joined
00:00 infinity0 joined
00:00 bydo joined
00:03 newbie64 joined
00:03 infinity0 joined
00:05 newhoggy_ joined
00:05 <lolisa> Hi, I need a list of *, and I need to fold on it to get a function on * -> *, can anyone give me some pointer?
00:06 infinity0 joined
00:08 <pacak> O_o
00:09 infinity0 joined
00:09 shafox joined
00:09 <mniip> fold what
00:10 kylepotts joined
00:11 ab9rf joined
00:11 biglambda joined
00:11 abhiroop joined
00:11 <lolisa> fold the list of * (the fold function parameter is fixed)
00:11 jmcarthur joined
00:11 infinity0 joined
00:12 eacameron joined
00:12 <mniip> something here doesn't check out
00:12 <mniip> could you rephrase a bit perhaps?
00:13 <ab9rf> lsit of *?
00:13 <lolisa> Sure. So I have a * -> * function, let's call it D.
00:13 <mniip> so far I'm getting the impression that you're trying to fold over a list of kinds at the type level with -XTypeInType
00:13 <lolisa> Yes, I think I need something similar
00:13 <monochrom> If not for TypeInType you would be one level above kind-level programming.
00:13 <lolisa> D is represented as a open type familiy
00:14 dfordivam joined
00:14 <mniip> ok
00:14 infinity0 joined
00:14 <lolisa> now, I need to represent D a (D b (D c ....))), (with the nest as long as I like)
00:14 <lolisa> so, it seems like I need a fold on D
00:14 <mniip> you have to write a dedicated type family
00:14 <mniip> as you can't pass type families to type families
00:15 <mniip> no higher order functions in type families
00:15 <lolisa> Yes, isnt a problem, but I am not very familiar with singleton, I just couldnt figure out how to do the list of * part
00:16 newhoggy joined
00:16 eacameron joined
00:16 <mniip> also
00:16 <mniip> that would make D :: * -> * -> *
00:16 Natch joined
00:16 <mniip> not * -> *
00:17 <lolisa> yes, sorry my fault, it is indeed * -> * -> *
00:18 <lolisa> do i, like, just replicate the stucture of Nat singleton, but with an extra type param floating?
00:19 <mniip> are you looking for something like
00:19 <mniip> @let type family D a b where D a b = (a, b)
00:19 <lambdabot> Defined.
00:19 <mniip> @let type family FoldD z xs where FoldD z '[] = z; FoldD z (x ': xs) = D x (FoldD z xs)
00:19 <lambdabot> Defined.
00:19 <mniip> :t undefined :: FoldD () '[Int, String, Char]
00:19 <lambdabot> (Int, ([Char], (Char, ())))
00:19 <lolisa> Oh yes! Why does this work?
00:20 <mniip> why not
00:20 Wuzzy joined
00:20 <lolisa> I mean, what should I read to understand this
00:21 <mniip> I'm not sure
00:21 prophile joined
00:22 eacameron joined
00:22 <mniip> lolisa, ghc commentary should suffice?
00:22 <mniip> assuming you have a good grasp of regular haskell
00:22 conal joined
00:22 <ab9rf> is there is a good reason why you can't have higher order functions for type families
00:24 bertschneider joined
00:24 <lolisa> Thx. Off to reading :) As a side note, cant we have higher order function by representing them as AST?
00:25 butterthebuddha joined
00:27 samu_ joined
00:27 eacameron joined
00:28 <mniip> ab9rf, undecidable equality
00:28 wroathe joined
00:29 <mniip> @let type family F f where F Maybe = []
00:29 <lambdabot> Defined.
00:29 <mniip> :t undefined :: F Maybe Int
00:29 <lambdabot> [Int]
00:30 <Guest65324> Hello, trying to learn Servant. I am a bit confused about types like this: data ReqBody (contentTypes :: [*]) a I believed earlier that you had to specify at least one value constructor for a data type. Am I to understand that this type (containing the *) creates a new type constructor instead. And if so where would the value constructors for those types come from?
00:30 <mniip> ab9rf, there is an obvious workaround: assigning non-arrow kinds to type families
00:30 <mniip> which is already done in ghc core, but
00:31 <mniip> well, it's too late for me to be able to comprehend the complications of that
00:32 <sgronblo> Also, am I remembering correctly that the '[] is a type level list?
00:32 <lyxia> sgronblo: it's an empty type, it doesn't have any value
00:32 <geekosaur> sgronblo, welcome to type level programming. contentTypes has kind [*] (a kind is the "type" of a type)
00:32 <geekosaur> so yes, it's a type level list, and at value level it is not inhabited since it does not have kind *
00:33 zachary joined
00:34 <sgronblo> What about the data type that doesnt have any value constructors?
00:34 <lyxia> sgronblo: it's an extension https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#data-types-with-no-constructors
00:34 eacameron joined
00:34 doomlord joined
00:34 <monochrom> Do you mean Void?
00:34 nighty-- joined
00:35 <sgronblo> I'll re-ask the question: Hello, trying to learn Servant. I am a bit confused about types like this: data ReqBody (contentTypes :: [*]) a I believed earlier that you had to specify at least one value constructor for a data type. Am I to understand that this type (containing
00:35 <sgronblo> the *) creates a new type constructor instead. And if so where would the value constructors for those types come from?
00:35 blender1 joined
00:35 <geekosaur> there are no value constructors
00:35 ExpHP joined
00:35 <geekosaur> in standard Haskell, which does not have type level programming, all types must have values
00:35 cpennington joined
00:36 <geekosaur> ghc has been extended for type level programming
00:36 sleffy joined
00:36 <geekosaur> in this case, you can have types which act as type level tags, and which can be accumulated into type level lists like (contentTypes :: [*])
00:36 newhoggy joined
00:37 nighty-- joined
00:37 <sgronblo> Hmm, but surely some code must access this as a value at some point?
00:38 <lyxia> no
00:38 Maerten joined
00:38 <geekosaur> are you familiar with phantom types?
00:39 andyhuzhill joined
00:39 shafox joined
00:40 <geekosaur> data Foo e a = Foo a -- e is phantom, only takes part in type checking, never has an associated value, and can be used as a tag to separate different Foo-s.
00:41 <geekosaur> this is a more advanced form of that
00:42 <geekosaur> for a simpler example, Either String Int, Right 5 -- the Right 5 still has a String associated at type level but not at value level; if you are given a Right 5 :: Either String Int, it will not typecheck when used as (say) Either Bool Int
00:43 conal joined
00:43 <sgronblo> Ok, that makes sense.
00:43 eacameron joined
00:43 <sgronblo> But now I need to figure out how to get back from a simple example like that to the grandness of type-level programming.
00:44 <geekosaur> its like that data Foo e a I mentioned, where e is always phantom --- but here, it's not merely phantom, it's a *list* of phantom types
00:45 <geekosaur> which is what the :: [*] is saying
00:45 Karma-Five-Ohm joined
00:45 <geekosaur> (implicitly it would be :: * otherwise, a "normal" type like Int or String)
00:45 <sgronblo> Are you aware of any beginner-friendly articles about the topic?
00:45 dmwit joined
00:46 <geekosaur> not really. I'm not actually much farther along in this than what I've said, so I could do with one myself >.>
00:47 <sgronblo> Ok :)
00:47 <MarcelineVQ> https://arow.info/blog/posts/2015-07-10-servant-intro.html
00:47 eacamero_ joined
00:49 <sgronblo> Oh, it's by Dennis
00:50 blym joined
00:50 frankpf joined
00:51 <fXl> http://lpaste.net/354872, i am getting this error, Expected type: Parser Info, Actual type: Parser (Command -> Info). Can anybody help?
00:51 eacameron joined
00:52 <sgronblo> fXl: My guess is that you forgot to apply a command argument to one of your functions
00:52 zachary joined
00:52 baldrick joined
00:53 <lyxia> sgronblo: Stephanie Weirich gave a cool talk about type-level programming at POPL this year
00:54 <fXl> sgronblo, i didnt understand what u meant
00:54 <sophiag> i've never used F#, but i just came across this: http://fsprojects.github.io/FSharp.Quotations.Evaluator/
00:55 aplund joined
00:55 <sophiag> it allows you to transform their ASTs at compile time, seemingly similar to macros in Lisps
00:55 <lyxia> fXl: where is that error
00:55 newhoggy joined
00:55 eacamero_ joined
00:56 <fXl> lyxia, line 10
00:56 <sophiag> i'm wondering if there's anything similar for Haskell? for quoting and evaluating Haskell ASTs? i'm essentially trying to DIY that myself right now and it's _really_ painful
00:56 newhoggy joined
00:56 <geekosaur> sophiag, that'd be Template Haskell
00:56 <Koterpillar> sophiag: other than TH?
00:56 <geekosaur> but it is specifically compile time
00:56 <Koterpillar> ...yeah
00:57 <sophiag> yes, i mean _other_ than TH
00:57 <sophiag> at least that seems like what this F# thing does
00:57 <lyxia> fXl: "data Info = Info {" I'm not sure how you can even get a type error here
00:57 SadoqueTD joined
00:58 <lyxia> fXl: BTW the code you pasted is not even syntactically correct
00:59 <fXl> lyxia, Couldn't match type ‘Command -> Info’ ,with ‘Info’
00:59 <sophiag> i've been parsing simple lambdas using haskell-src-exts to store in records, basically like quoting them in a Lisp to apply later, but making the types work was incredibly difficult and i still have a last bug i'm tried forever to figur out
00:59 <fXl> why incorrect ?
00:59 wroathe joined
01:00 shafox joined
01:00 <lyxia> fXl: there's an extra comma line 2 and line 7 has a trailing operator
01:00 vaibhavsagar joined
01:00 <lyxia> fXl: so the code you are compiling is not the code you have shown us
01:00 <fXl> i simplified it yeap
01:01 eacameron joined
01:01 <monochrom> Simplification is OK but there is a different between lossless simplification and lossy simplification.
01:01 <geekosaur> that's not helpful unless the code compiles and shows the error
01:01 ublubu joined
01:01 Lthere joined
01:02 arpl left
01:02 <monochrom> Incidentally it is also equivalent to the skill of good abstraction vs the skill of broken abstraction.
01:02 <AfC> Why would stack be bugging me about modules not in exposed-modules or other-modules for a *test suite*? Those modules from from the library under test, not the test suite (and in any case, da fu?)
01:03 <sophiag> geekosaur: perhaps i should actually be using template haskell? tbh i assumed that'd be like using C++ templates so figured it was a bad way to go if i had any other options. otoh, i feel like i've mostly figured out how to actually parse lambda ASTs to store as data although I may be fooling myself about the complexity i've created :/
01:04 noddy joined
01:04 <lyxia> AfC: the files that do not appear in your configuration will not be packaged up, so you end up with an incomplete package when you release it
01:04 <fXl> you are right
01:04 <fXl> lyxia, can i pm you ?
01:05 <geekosaur> sophiag, language-haskell-exts pretty much is the runtime version; there is a wrapper to make the types match up with TH but that won't help you. it's in any case going to be equally difficult with either one
01:05 <lyxia> fXl: as you wish
01:06 danthemyth joined
01:06 <lyxia> AfC: is your test directory the same as the one of your library
01:06 des joined
01:07 eacameron joined
01:07 <sophiag> geekosaur: haskell-src-exts only parses Haskell expressions from my command line repl into ASTs. it doesn't allow me to quote them and then apply later. in between i need to parse the ASTs into a form i can store as data and then apply to what i want with the types all matching up. _that_ is the part that's adding all the complexity
01:08 mac10688 joined
01:08 <geekosaur> sounds like you are writing a typechecking compiler. guess what? it's hard.
01:09 <sophiag> ha
01:09 <geekosaur> and no, it's not generally "canned" because there's no single type environment that works for everyone\
01:09 <monochrom> Oh, type checking is already the easy one. Type inference is the harder one.
01:09 HoierM joined
01:09 AaronFriel joined
01:09 <sophiag> that's true. most of the difficulty is in mixing types in the expressions
01:09 <geekosaur> and while ghc exposes parts of its guts, they're not necessarily the right parts for you to reuse here
01:10 <sophiag> if i just said they all have to be of one type and didn't use ADTs it would be a whole lot simpler
01:10 shafox joined
01:10 <sophiag> but to be clear, i'm not actually typechecking them. as of where i'm at now it's still possible to use the DSL to apply the lambdas to data of the wrong type and crash the repl
01:11 Stanley00 joined
01:12 <AaronFriel> Why does the newtype Kleisli have the role annotation `type role Control.Arrow.Kleisli representational representational nominal`, shouldn't that last parameter be representational? `newtype Kleisli m a b = Kleisli { runKleisli :: a -> m b }`. Shouldn't that be coercible?
01:13 <byorgey> AaronFriel: probably because the m can be instantiated with anything, and it might use its type argument in a nominal way
01:13 <sophiag> geekosaur: i was just thinking, regardless of types, it would so much easier if i could skip parsing the ASTs and just quote them and call eval on them later as in Lisps. as it stands my bug is largely due to the way i have to recursively parse the lambds to allow for nested expressions on the rhs, which leave me with two maybes to unwrap as well as the ADT compromising all the types. plus it's so hard to debug since there's no show
01:13 <sophiag> instance for them and any errors i'd have to propogate all the way through from low level parsing functions to the REPL i'm running in IO
01:13 justanotheruser joined
01:13 <byorgey> AaronFriel: so you have to assign b a nominal role to be safe
01:13 <AaronFriel> @byorgey: Is there a way to construct a type like Kleisli with role representational in its output?
01:13 <lambdabot> Unknown command, try @list
01:14 <byorgey> AaronFriel: good question, I don't know.
01:15 <byorgey> AaronFriel: I suppose you would want a way to abstract over m whose type argument is representational, but I don't know if there's a way to express that
01:15 <byorgey> i.e. role-polymorphism
01:15 <AaronFriel> Anyone else have any idea? I am struggling with my research and I have hit and overcome a number of walls based on my understanding of GHC's typesystem, but it is getting harder ;_;
01:15 eacameron joined
01:16 <byorgey> AaronFriel: this seems related, perhaps? https://ghc.haskell.org/trac/ghc/ticket/9123
01:17 <byorgey> AaronFriel: you should ask Richard Eisenberg
01:17 <byorgey> or just send an email to the haskell-cafe mailing list, he will probably respond
01:17 <AaronFriel> Indeed, he seems to be the person whose name keeps showing up in discussions on type features I'm trying to (ab)use.
01:18 <AaronFriel> byorgey: thanks for that tip! I will pursue that.
01:19 sleffy joined
01:21 vaibhavsagar_ joined
01:21 LnL joined
01:23 sproingie joined
01:24 uiop__ joined
01:24 raynold joined
01:26 mada joined
01:26 <ExpHP> I am having huge trouble with parsing a yaml file in a memory efficient fashion. see here: https://github.com/ExpHP/haskell-memory-halp
01:27 blym joined
01:27 <ab9rf> ugh
01:27 <ExpHP> my current issue is summarized under "Status" in the readme, but long story short I have no idea what I'm doing with conduit
01:27 <ab9rf> yaml shouldn't be that piggy to parse
01:28 <ExpHP> ab9rf: piggy?
01:28 <sophiag> geekosaur: actually this looks very similar to what i've been doing with haskell-src-exts: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#template-haskell-quasi-quotation
01:28 <* ExpHP> @(O_O)
01:29 <ab9rf> the issue is at what point can the runtime determine that it no longer needs data
01:29 <ab9rf> otherwise it's forced to instnatiate the entire in-memory representatikon of the document you're parsing
01:29 bkboggy joined
01:30 shafox joined
01:32 <ExpHP> ab9rf in Attempt2 I tried using an implementation which only extracts the data I want, but it still seems to construct the full value in memory profiles https://github.com/ExpHP/haskell-memory-halp/blob/master/app/Attempt2.hs
01:32 <lyxia> as you already noticed fromJSON is not streaming
01:33 <ab9rf> it's likelyu that fromJSON is stricter than you'd like
01:33 <* ExpHP> ticks off a checkmark on his list of "possibly true conclusions I've come to"
01:34 abhiroop joined
01:34 Supersonic112_ joined
01:35 blender1 joined
01:36 mmachenry joined
01:36 <lyxia> I don't understand how Libyaml works
01:37 <ab9rf> just becuase haskell allows laziness doesn't mean the library you're fiddling with is lazy
01:41 blym_ joined
01:41 shafox joined
01:42 <ExpHP> lyxia: It produces a stream of Events (like e.g. SequenceStart), which follow a certain structure that can be described with a grammar. Text.Libyaml provides a Conduit of these events.
01:42 arctictern joined
01:42 <ExpHP> ConduitParser isn't part of that API, but rather, I've chosen (perhaps poorly) to use ConduitParser to "parse" according to this grammar
01:43 <ExpHP> My big trouble right now is a limitation of ConduitParser, but I don't know if this limitation is a fundamental limitation, or an incidental one...
01:44 <ab9rf> hm, that's likely to force parsing the entire docuemnt
01:44 <ab9rf> if you're only interested in a tiny bit of it you probably need a different approach
01:45 <ab9rf> i'm not sure you can really lazy out of parsing most of a yaml document though
01:45 vektorweg1 joined
01:45 <ab9rf> you can probalby avoid calling deserializers for specific values yu don't care about but other than that it has to scan over the whole document
01:45 <ExpHP> ab9rf: My approach is that 90% of the file is only validated with "skipping" parsers that read the corresponding production, but only produce ()
01:45 des joined
01:46 <ExpHP> This is necessary to handle nested structures correctly, but has a flat memory profile
01:47 YongJoon joined
01:47 <ExpHP> Meanwhile I have a function that e.g. takes the event stream for a mapping (associative array), and reduces it to just those events for the one value I care about
01:48 <ExpHP> (The trouble is how to write something which forwards only those events into a parser)
01:48 mjora7 joined
01:50 <ExpHP> https://github.com/ExpHP/haskell-memory-halp/blob/master/app/Attempt4.hs#L258-L267
01:51 baldrick joined
01:51 blym_ joined
01:52 sgronblo joined
01:55 vaibhavsagar joined
02:00 hucksy joined
02:00 blym_ joined
02:00 butterthebuddha joined
02:01 shafox joined
02:02 <pacak> How would I go about replacing one of the libraries used by stack project by locally patched version?
02:03 <Koterpillar> pacak: https://docs.haskellstack.org/en/stable/yaml_configuration/#local-dependency-packages-extra-dep
02:04 <pacak> Koterpillar: Thanks
02:06 <lyxia> ExpHP: memory remains bounded if you just run the libyaml event parser and let them through, right?
02:06 biglambda joined
02:07 blym_ joined
02:07 <ExpHP> lyxia: Yep. Stays under 100K. In fact I believe that's what the current 'main' does of Attempt4
02:10 peterhil joined
02:11 biglambda joined
02:11 <mjora7> Hey, could someone give me some insight on what the preferred style to use between these three solutions is? https://gist.github.com/aryaforghani/bc9fe7b78c000ff8cb1b0ad7ca2bc992#file-fib-hs
02:12 <mjora7> I'm leaning towards the first one (parameter pattern matching) because it seems the simplest to parse visually.
02:12 <monochrom> Yes.
02:14 abhiroop joined
02:14 <mjora7> Yay!
02:16 blender1 joined
02:19 cyborg-one joined
02:21 wroathe joined
02:24 <ExpHP> added an image of the pure-Libyaml memory profile. This is why I think something along my current strategy is viable goo.gl/1h2q3a
02:25 <ExpHP> contrast with https://goo.gl/tLdaJy for trivial use of fromJSON
02:26 beerdrop joined
02:26 eacameron joined
02:27 augur joined
02:29 blym joined
02:31 eyck joined
02:31 andyhuzhill joined
02:32 wroathe joined
02:34 eacameron joined
02:34 vaibhavsagar_ joined
02:37 YongJoon joined
02:39 NyanPasu left
02:39 e14 joined
02:40 eacameron joined
02:41 geekosaur joined
02:42 <rotaerk> hmm is there some way to display the type of a caught exception
02:42 wroathe joined
02:42 <rotaerk> I'd like to be more specific about which type I catch, but I don't know what its type is
02:42 <rotaerk> so for the moment I'm just catching SomeException
02:43 eacamero_ joined
02:45 m0cesta joined
02:45 butterthebuddha joined
02:46 <ExpHP> rotaerk: SomeException is Show, right? Does that Show instance give what you need?
02:46 <rotaerk> nope, it just shows the message of the exception
02:46 blym_ joined
02:46 <m0cesta> Hi all. How to run leksah IDE? :)
02:47 <Koterpillar> rotaerk: it's Typeable, which will help you
02:47 <Koterpillar> hmm... maybe not
02:47 <m0cesta> Every time I run leksah IDE building starts again
02:48 <m0cesta> /leksah.sh file
02:48 systemfault joined
02:49 <rotaerk> Koterpillar, yea I saw that it was Typeable, but didn't see a way to get the runtime type information
02:49 <ExpHP> yeah looks like you really can't since Proxy# has "no runtime representation"
02:50 des joined
02:50 exferenceBot joined
02:50 <Koterpillar> typeOf?
02:50 <rotaerk> oh wait, there's that
02:50 <rotaerk> yea
02:50 sword865 joined
02:51 eacameron joined
02:51 <rotaerk> ugh, it just gave me SomeException
02:52 <ExpHP> rotaerk can you catch the type "(Exception e)=> e" instead?
02:52 brynedwardz joined
02:52 <ExpHP> (I don't use catching very often...)
02:52 wroathe joined
02:54 <rotaerk> nope
02:54 hexagoxel joined
02:55 <ExpHP> oh, rotaerk, you should deconstruct the SomeExtension
02:55 <ExpHP> rotaerk: http://stackoverflow.com/questions/9799734
02:55 <ExpHP> *SomeException
02:55 dbmikus_ joined
02:55 <rotaerk> .. interesting
02:55 <rotaerk> thanks
02:57 jer1 joined
02:57 <rotaerk> yep, that did it :)
02:58 eacameron joined
02:58 <* ExpHP> scratches his head at how Haskell's runtime works...
02:59 <pacak> ExpHP: https://media.giphy.com/media/12NUbkX6p4xOO4/giphy.gif
03:01 hybrid joined
03:02 sgronblo joined
03:03 ubsan_ joined
03:03 blym joined
03:05 abhiroop joined
03:05 eacameron joined
03:05 Argue_ joined
03:06 iqubic joined
03:06 <iqubic> Anyone have a guide for emacs haskell-mode?
03:07 dbmikus_ joined
03:07 danthemyth joined
03:08 xall joined
03:12 arctictern joined
03:12 wroathe joined
03:13 benl23 joined
03:13 {emptyset} joined
03:13 blym_ joined
03:14 butterthebuddha joined
03:17 unK_ joined
03:17 MisterEcho joined
03:17 SrPx joined
03:17 ebsen joined
03:17 <MisterEcho> Hai
03:17 blender1 joined
03:18 <SrPx> Why is "not A" defined as ∀ (C : *) . (A => C)? Something is not true if it implies everything? What
03:18 MisterEcho joined
03:18 tripped joined
03:19 <iqubic> Can't you just use pattern matching to do not?
03:19 <iqubic> not True = False
03:19 <iqubic> not False = True
03:19 <SrPx> I mean logically not
03:19 <iqubic> What is that?
03:20 <SrPx> I mean the negation of a proposition
03:21 aarvar joined
03:21 <rotaerk> :t liftA not
03:21 <lambdabot> Applicative f => f Bool -> f Bool
03:22 Natch joined
03:23 <ExpHP> SrPx: The False proposition is the one that can prove anything, i.e. forall a. a
03:23 codesoup joined
03:23 <ExpHP> SrPx: Then "not a" is just a -> False
03:23 wroathe joined
03:24 felixsch_ joined
03:24 <thimoteus> note that if A is true, then A -> False is false, and if A is false, then A -> True is true
03:24 <thimoteus> err, A -> False is true
03:25 <ExpHP> in fact both are true,
03:26 <ExpHP> that's kind of the issue with False :)
03:26 tommd joined
03:27 Eucliffe joined
03:27 <Eucliffe> Hi
03:27 robotroll joined
03:28 <lambdabot> Hello.
03:28 <SrPx> ExpHP: shouldn't `not A`, then, be `∀ (x : A) => ∀ (P : *) => P`?
03:28 <jle`> hi Eucliffe
03:28 <Eucliffe> What's up :D
03:29 butterthebuddha joined
03:29 <Eucliffe> It2 a lot of people in this channel
03:30 <glguy> Eucliffe: This channel is specifically about the Haskell programming language. Did you come to chat about Haskell?
03:31 diphuser joined
03:31 <rotaerk> hmm... I need a: [a -> Bool] -> a -> Bool
03:31 <jle`> rotaerk: looks like 'sequence'
03:32 <jle`> oh wait, sequence :: [a -> Bool] -> a -> [Bool]
03:32 <jle`> how do you want to combine the Bool's?
03:32 <rotaerk> &&, in this case
03:32 <iqubic> That's just all
03:32 <iqubic> :t all
03:32 <lambdabot> Foldable t => (a -> Bool) -> t a -> Bool
03:32 <jle`> :t \fs x -> all ($ x)
03:32 <rotaerk> not exactly
03:32 <lambdabot> Foldable t => t1 -> a -> t (a -> Bool) -> Bool
03:32 <jle`> er
03:32 <jle`> :t \fs x -> all ($ x) fs
03:33 <lambdabot> Foldable t => t (a -> Bool) -> a -> Bool
03:33 Eucliffe left
03:33 wroathe joined
03:33 <iqubic> Nope. Note the dangling t at front
03:33 <biglambda> What is required for a package to be fully indexed by Hackage?
03:33 <jle`> iqubic: t can be []
03:33 <iqubic> Right.
03:33 <jle`> [] is an instance of Foldable
03:33 <iqubic> I feel stupid
03:33 <biglambda> I’m interested in helping get this package working: https://hackage.haskell.org/package/qtah-qt5
03:33 <jle`> not stupid :)
03:34 <rotaerk> hmm thanks
03:34 <jle`> :t \fs -> and . sequence fs
03:34 <lambdabot> Traversable t => t (a -> Bool) -> a -> Bool
03:35 <iqubic> That works too in this case
03:35 <ExpHP> SrPx: I'm not sure what your notation means then. I read "A => B" as "a witness to A admits a witness to B". So with that, I'm not sure what the (x : A) accomplishes
03:35 <MarcelineVQ> that's quite nice
03:35 <jle`> sequence :: [a -> b] -> (a -> [b]), but you have to and-up the result
03:35 <jle`> all ($ x) is definitely more readable
03:35 sleffy joined
03:35 <iqubic> Yeah.
03:36 <iqubic> Isn't there a monoid we can use to make this simpler?
03:36 <iqubic> :t all
03:36 <lambdabot> Foldable t => (a -> Bool) -> t a -> Bool
03:36 hamishmack joined
03:36 <iqubic> I think that using the all monoid could and up all the values.
03:36 <jle`> i doubt you can make it simpler, but you can implement it using monoid-polymorphic functions
03:36 <ExpHP> SrPx: and between "A => forall (B : *). B" or "forall (B : *). A => B", I think both of which should be equivalent
03:37 <ExpHP> s/of which//
03:37 <jle`> :t \fs -> getAll . foldMap (All .) fs
03:37 <lambdabot> Foldable t => t (a -> Bool) -> a -> Bool
03:37 <iqubic> That's not any simpler.
03:38 <jle`> that's my point :)
03:38 <iqubic> I like the ($ all)
03:40 <rotaerk> catchIf (\(ex :: IOException) -> all ($ ex) [...])
03:40 _sras_ joined
03:41 <SrPx> ExpHP: I get it thanks
03:42 <SrPx> ExpHP: not sure I get why those should be equivalent, though. I mean, logically it is obvious, but I can't just move foralls like that everytime I guess
03:43 wroathe joined
03:45 <ExpHP> SrPx: foralls are like lambdas for types. forall (B : *) . A => B is like a function that takes a type B and produces a witness to (A => B)
03:45 abhiroop joined
03:46 <ExpHP> SrPx then one can use this function to construct the function `forall (B: *) B` from a witness of A
03:46 <ExpHP> and vice versa
03:47 <ExpHP> SrPx: Actually don't take anything I say here too literally since my experience with dependent types is limited to about one week playing around with Lean :P
03:48 butterthebuddha joined
03:49 Cathy joined
03:50 northfurr joined
03:52 magicman joined
03:52 fakenerd joined
03:53 wroathe joined
03:54 <SrPx> but you can't move lambdas like that too
03:54 <SrPx> I think I got confused with the syntax though
03:54 <SrPx> the question is:
03:54 <SrPx> why we call the "or" type Either
03:54 <SrPx> but we don't call the "and" type Both?
03:55 <Sornaensis> :info Or
03:55 <SrPx> sleep with that, good night
03:55 <Sornaensis> @info Or
03:55 <lambdabot> Or
03:55 <Sornaensis> @info And
03:55 <lambdabot> And
03:55 <ExpHP> Because we like (,,,,,,,)
03:55 <Koterpillar> SrPx: https://twitter.com/antiselfdual/status/855995687900561408
03:55 <Sornaensis> because And and Or are boolean monoids
03:55 <SrPx> ExpHP: :P
03:55 <rotaerk> :t \comb preds a -> comb ($ a) preds
03:55 <Sornaensis> and Either is differnt
03:55 <lambdabot> (((a -> b) -> b) -> t1 -> t) -> t1 -> a -> t
03:55 <jle`> SrPx: we do sometimes, but in haskell, it's just (,)
03:56 <SrPx> Koterpillar: that works? Even better if we could use "|" and "&", so they look like they look on JSDocs stuff so we make JS devs less afraid
03:57 <jle`> heh, we already have :*: and :+:
03:57 <jle`> maybe we can have :|: and :&: too
03:57 eacameron joined
03:57 <rotaerk> :t \preds a -> all ($ a) preds
03:57 <lambdabot> Foldable t => t (a -> Bool) -> a -> Bool
03:58 <SrPx> jle`: fair enough (:
03:58 <rotaerk> seems like a function like that might be useful to have around...
03:58 <jle`> rotaerk: feels a little too specialized
03:58 <jle`> fairnbarn threshold stuff
03:58 <rotaerk> catchIf (allPred [predicate1, predicate2])
03:58 <jle`> @let data a :|: b = Or1 a | Or2 b
03:58 <lambdabot> Defined.
03:59 <jle`> @let data a :&: b = a :&: b
03:59 <lambdabot> Defined.
03:59 <jle`> yay
03:59 <SrPx> @let data a || b = Or1 a | Or1 b
03:59 <lambdabot> .L.hs:174:15: error:
03:59 <lambdabot> Multiple declarations of ‘Or1’
03:59 <lambdabot> Declared at: .L.hs:169:16
03:59 <SrPx> @let data a || b = Or1 a | Or2 b
03:59 <lambdabot> .L.hs:174:15: error:
03:59 <lambdabot> Multiple declarations of ‘Or1’
03:59 <lambdabot> Declared at: .L.hs:169:16
03:59 <SrPx> uh
03:59 <jle`> @undefine
03:59 <lambdabot> Undefined.
03:59 <SrPx> @let data a || b = OrA a | OrB b
03:59 <lambdabot> Defined.
03:59 <SrPx> yay
03:59 <jle`> @let data a && b = a :&: b
03:59 <lambdabot> Defined.
04:00 <jle`> neat
04:00 <SrPx> ok, hold on,
04:00 <SrPx> @undefine
04:00 <lambdabot> Undefined.
04:00 northfurr joined
04:00 <SrPx> @let data a || b = OrA a | OrB b
04:00 <lambdabot> Defined.
04:01 nepiktaz joined
04:01 forgottenone joined
04:03 nepiktaz joined
04:03 sleffy joined
04:03 wroathe joined
04:04 sgronblo joined
04:05 <SrPx> @let f :: Int -> (Bool || String); f 0 = OrA True; f x = OrB "aaaa"
04:05 <lambdabot> Defined.
04:05 northfurr joined
04:05 northfurr joined
04:05 <SrPx> @show (f 0, f 1)
04:05 <lambdabot> "(f 0, f 1)"
04:05 mjora7 joined
04:05 <SrPx> thanks, lambdabot
04:05 kody joined
04:06 snowalpaca joined
04:06 eklavya joined
04:09 windsing joined
04:09 <lpaste> ExpHP pasted “No title” at http://lpaste.net/8281982473349365760
04:09 isenmann joined
04:09 <ExpHP> ^ SrPx: Interestingly, ghc even unifies these types
04:09 danthemyth joined
04:09 <ExpHP> lpaste: I thought I clicked "Private"!
04:12 <iqubic> What does that sysntax even mean??
04:13 <iqubic> Int -> (Bool || String)
04:13 <jle`> ExpHP: (A -> forall b. b) is the same as forall b. A -> b
04:13 <iqubic> What return type does that have?
04:13 <jle`> iqubic: the return type is Bool || String
04:13 <jle`> (||) is jsut a normal type constructor
04:13 justan0theruser joined
04:13 <jle`> it was defined earlier
04:13 <jle`> about 14 minutes ago
04:13 <iqubic> Ah. I see that now.
04:14 <iqubic> What does forall mean???
04:14 <SrPx> "unifies"? ExpHP
04:14 <Xe> iqubic: it's explicitly saying that it can be literally any type with no constraints
04:14 plutoniix joined
04:14 <jle`> iqubic: it "scopes" a type variable
04:14 <ExpHP> SrPx it considers the two types to be equal
04:14 <iqubic> So why not just omit the forall?
04:14 <jle`> it brings a type variable into scope
04:14 <SrPx> ExpHP: how do you know?
04:14 <jle`> iqubic: usually forall is implicit
04:15 <jle`> but ghc lets you provide it explicitly
04:15 <Xe> iqubic: -XExistensialQuantification needs you to do it for one
04:15 <SrPx> ExpHP oh I see
04:15 <ExpHP> SrPx because the program I posted compiles
04:15 plutoniix joined
04:15 <jle`> for example, sort :: Ord a => [a] -> [a] is "actually" sort :: forall a. Ord a => [a] -> [a]
04:15 <iqubic> Why do you use a . after the forall declaration?
04:15 <jle`> that's just the syntax choice
04:15 <Xe> iqubic: that's the syntax
04:15 <iqubic> why forall a. and not forall a, Ord a?
04:15 <jle`> arbitrary decision
04:16 <iqubic> Why a period instead of a comma? Is that what people decided?
04:16 <jle`> from the people who made the syntax
04:16 <SrPx> ExpHP: wait LOL your program has crashed my mind
04:16 <jle`> yes, that's just the syntax in the spec
04:16 <iqubic> That's odd.
04:16 <Xe> makes reading for it easy
04:16 <jle`> iqubic: it borrows from math, actually
04:16 <iqubic> Yeah, I understand.
04:17 <iqubic> jle`: What do you mean?
04:17 <iqubic> "borrows from math"?
04:17 <jle`> from math notaiton
04:17 plutoniix joined
04:17 <SrPx> iqubic: he means math uses a "." too, ∀ a . b
04:18 m0cesta joined
04:18 <iqubic> SrPx: I'm not familiar with that construct.
04:19 blender1 joined
04:19 sproingie joined
04:19 sproingie joined
04:19 <iqubic> Note: I haven't taken any pre-calc or beyond yet.
04:19 <SrPx> so wait, you can type any program that way
04:19 <iqubic> What way?
04:19 <jle`> people aren't really expected to be familiar with it, for the most part
04:19 <jle`> you can just assume it to be an arbitrary syntax choice
04:19 <ExpHP> Actually I almost never see that. In physics they tend to write "blah blah blah (∀ x Real)"
04:19 <jle`> like how we use \ for lambdas
04:19 <SrPx> like, `x, y : forall a . a; x = y; y = x;`
04:20 <SrPx> does that compile? I'm not with GHC on this machine
04:20 <ExpHP> > x, y : forall a . a; x = y; y = x;
04:20 <lambdabot> <hint>:1:2: error: parse error on input ‘,’
04:20 <ExpHP> le gasp
04:20 <jle`> haskell is ::, anyway :o
04:21 <SrPx> > x : forall a . a; x = y; y : forall a . a; y = x
04:21 <ExpHP> > x, y :: forall a . a; x = y; y = x;
04:21 <lambdabot> <hint>:1:17: error: parse error on input ‘;’
04:21 <lambdabot> <hint>:1:2: error: parse error on input ‘,’
04:21 <SrPx> woops
04:21 <ExpHP> hehe
04:21 <jle`> another arbitrary syntax choice that we all sffer from even today
04:21 <SrPx> > x :: forall a . a; x = y; y :: forall a . a; y = x
04:21 <lambdabot> <hint>:1:18: error: parse error on input ‘;’
04:21 <ExpHP> SrPx just tested on ghc and it does compile...
04:21 <jle`> lambdabot only evaluates expressions
04:21 <iqubic> What the heck is wrong with lambdabot then?
04:22 <SrPx> how did you come up with that idea? we just proved false, right?
04:22 <jle`> SrPx didn't type in an expression
04:22 <jle`> it was a declaration
04:22 <iqubic> Try using the @let
04:22 alpin joined
04:22 <m0cesta> stack with default latest lts can't build haskelldb package. I got error when change resolve. Can anyone help me with this?
04:22 <jle`> SrPx: you can prove false in haskell
04:22 <ExpHP> SrPx proving false is easy in a language that isn't total.
04:22 <SrPx> also is that why a type system with recursion is always inconsistent?
04:22 <jle`> that's why haskell is called inconsistent
04:22 <iqubic> @let x :: forall a . a; x = y; y :: forall a . a; y = x
04:23 <lambdabot> .L.hs:165:5: error:
04:23 <lambdabot> Ambiguous occurrence ‘y’
04:23 <lambdabot> It could refer to either ‘Debug.SimpleReflect.y’,
04:23 <SrPx> jle`: among other reasons, right? Not only recursive bindings
04:23 <alpin> hi
04:23 <ExpHP> here's an easier proof of false:
04:23 <ExpHP> > undefined
04:23 <lambdabot> *Exception: Prelude.undefined
04:23 <jle`> well, the fact that you can prove False is a necessary and sufficient condition for something being inconsistent
04:23 eklavya_ joined
04:23 <iqubic> What are we trying to prove here?
04:24 <SrPx> I'm really glad for that actually, I was thinking a lot about this
04:24 wroathe joined
04:24 <ExpHP> > let x :: forall a.a = x in x
04:24 <lambdabot> error:
04:24 <lambdabot> • Cannot instantiate unification variable ‘a0’
04:24 <lambdabot> with a type involving foralls: forall a1. a1
04:24 <ExpHP> > let x :: a = x in x
04:24 <lambdabot> error:
04:24 <lambdabot> • You cannot bind scoped type variable ‘a’
04:24 <lambdabot> in a pattern binding signature
04:24 <ExpHP> > let x = x in x
04:24 <lambdabot> mueval-core: Time limit exceeded
04:24 <SrPx> so, if we extend the calculus of constructions with type-level recursion (i.e., the type of `fix x` is *), is that enough to make it inconsistent? I don't think you can do that trick we did here with that
04:25 <iqubic> > fix (false &&)
04:25 <lambdabot> error:
04:25 <lambdabot> • Variable not in scope: false :: Bool
04:25 <lambdabot> • Perhaps you meant data constructor ‘False’ (imported from Data.Bool)
04:25 <iqubic> > fix (False &&)
04:25 <lambdabot> False
04:25 <iqubic> > fix (True ||)
04:25 <lambdabot> True
04:26 <SrPx> iqubic: I was just surprised how easy it was to make an element of type `forall a . a`
04:26 <iqubic> How did you do it?
04:26 <jle`> 'let x = x in x', or even 'undefined', etc.
04:26 <iqubic> Right.
04:27 <m0cesta> stack with default latest lts can't build haskelldb package. I can't change lts with --resolve because of building error. Can anyone help me with this?
04:27 <iqubic> :t let x = x in x
04:27 <ExpHP> funny how "let x = x in x" doesn't get hit by the monomorphism restriction
04:27 <lambdabot> t
04:27 <ExpHP> or ambiguous type errors
04:27 <iqubic> What restriction is that?
04:27 <jle`> ExpHP: there's defaulting
04:27 <SrPx> well ExpHP did it I guess, he used `x = y` where y was declared to have type `forall a . a`, then said `y = x`, which also was declared to have type `forall a . a`, so like, both terms are defined in term of each-other, they are never really defined, but it kinda tricks the compiler into accepting it
04:27 <jle`> it would be affected by it when it's on
04:27 <iqubic> What is defaulting?
04:27 <jle`> @where DMR
04:27 <lambdabot> http://www.haskell.org/haskellwiki/Monomorphism_restriction
04:28 <iqubic> Why is it DMR? What does that stand for?
04:28 <jle`> look at the link :)
04:29 <jle`> ExpHP: `let x = x in x` should be affected by the dmr just as much as anything else
04:29 <iqubic> except what value could the compiler assume for x
04:29 <glguy> jle`: I wouldn't expect so, there's no typeclass constraints on x
04:30 <iqubic> How do you make x less polymorphic in that case?
04:30 <ExpHP> SrPx actually though the only point of that program was to show that notA could be defined in terms of notA' and vice versa :P
04:30 markus1189 joined
04:31 <iqubic> Haskell is a weird programing language.
04:31 markus1199 joined
04:31 <iqubic> I like the theory behind it, but who thinks *this* much when writing a program?
04:31 <glguy> ExpHP: It doesn't get hit by the monomorphism restriction because its inferred type has no typeclass constraints
04:32 <jle`> iqubic: the advantage of haskell is that you don't have to think when writing your program
04:32 <jle`> iqubic: the compiler thinks for you, so the actual coding is something you can do on autopilot
04:32 <iqubic> And it's infered type can't have any typeclass constraints. What reasonable constraint can you give "let x = x in x"?
04:33 <ExpHP> seems to me that an awful lot of thinking is required to "debug" most type errors...
04:33 <Koterpillar> sometimes the compiler forces you to think. Usually about edge cases
04:34 <iqubic> Like what Koterpillar?
04:34 wroathe joined
04:34 <Koterpillar> if something gives you a Maybe String and you want to give it to another function that expects a String, you have to think about the case of Nothing
04:34 gingerling joined
04:35 <iqubic> Yes, but that's simple.
04:35 <iqubic> It's like passing Either a b into a function requires you to think about left a and right b
04:35 <ExpHP> what I mean is how type inference tends to take a mistake somewhere on line 135 and make it manifest as a very misleading/confusing type error on line 132
04:36 <ExpHP> "But IT IS a Maybe! I don't understand!"
04:36 xtreak joined
04:36 <* ExpHP> starts inserting (id :: () -> ()) everywhere
04:37 <iqubic> Ah, yeah. That's why you should always use type signatures to aid the compiling proccess along.
04:37 <opqdonut> ExpHP: that's why it's common practice to add type signatures to all toplevel definitions
04:37 Xanather joined
04:37 <opqdonut> limits how far type inference can propagate errors :)
04:37 <iqubic> That's talked about in the DRM article.
04:38 <iqubic> f1 x = show x
04:38 <iqubic> f2 = show
04:38 <iqubic> f3 = \x -> show x
04:38 <iqubic> f4 = \x -> show
04:38 <iqubic> Are all different because of DRM
04:38 freusque joined
04:39 event_null joined
04:39 <iqubic> however, all of the functions can be prefaced by: show a => a -> String
04:39 mmachenry1 joined
04:40 northfurr joined
04:41 <Koterpillar> f4 is the wrong type
04:41 mjora7 joined
04:42 xcin joined
04:42 eklavya joined
04:44 BartAdv joined
04:44 wroathe joined
04:44 fakenerd joined
04:45 windsing joined
04:45 <m0cesta> heeeey, guys, help me with haskell stack
04:46 <SrPx> ExpHP: I know, I understood that, just caught my attention and now I'm reading about type level recursion
04:46 abhiroop joined
04:46 Jafet left
04:47 jhrcek joined
04:48 <iqubic> SrPx: you mean like Tree a = Leaf | Node (Tree l) a (Tree r)
04:48 <iqubic> Would that be type level recursion?
04:49 <pacak> Tree a b = Leaf | Node b a b?
04:49 <iqubic> pacak: What is that?
04:50 <iqubic> Usually a tree has plenty of branches.
04:50 <iqubic> Not seeing the branching structure in your code
04:50 <iqubic> Usually the branch of a tree is a tree itself. Not seeing that.
04:50 featherlessbiped joined
04:50 <pacak> Hmm... Actually Tree b a = Leaf | Tree b a b
04:50 <Koterpillar> m0cesta: ask the actual question
04:50 <pacak> :t Fix
04:50 <lambdabot> error:
04:50 <lambdabot> • Data constructor not in scope: Fix
04:50 <lambdabot> • Perhaps you meant one of these:
04:50 <jle`> iqubic: then you just need Tree a (Tree a b) :)
04:51 <iqubic> jle` How the heck does that work?
04:51 <pacak> Hmm... newtype Fix f = Fix (f (Fix f))
04:51 <jle`> iqubic: why wouldn't it work
04:51 <pacak> and Fix Tree a
04:51 <iqubic> pacak: That looks a lot like the free monad.
04:51 <pacak> Recursion schemes all the way!
04:51 <glguy> Fix (Tree a)
04:52 eklavya_ joined
04:52 <pacak> glguy: Right.
04:52 <pacak> iqubic: IT
04:52 <jle`> iqubic: you really want Tree a (Tree a (Tree a (Tree a ... forever ...))
04:52 <pacak> It's turtles all the way down.
04:52 <iqubic> Yeah, you do.
04:52 sleffy joined
04:52 <iqubic> That's what you want.
04:52 <jle`> so, data TreeForever a = TreeForever (Tree a (TreeForever a))
04:52 <pacak> Easily achievable with Fix
04:53 <jle`> Fix is just TreeForever, parameterized by arbitrary constructor
04:53 <iqubic> Can't you use a free monad instead
04:53 <jle`> free monad is different
04:53 <johnw> the Free monad is just a specialization of Fix
04:53 <iqubic> It is?
04:53 <jle`> but do you see why TreeForever works ?
04:53 <iqubic> Yeah. I do>
04:53 <jle`> Fix is what happens when you parameterize TreeForever by Tree
04:53 <iqubic> Right, I see.
04:53 <iqubic> Fix is a generic form of TreeForever.
04:54 <jle`> TreeForever a = TreeForever (Tree a (TreeForever a))
04:54 <iqubic> How is the free monad different.
04:54 <nshepperd> newtype Fix f = Fix (f (Fix f))
04:54 <iqubic> What does newtype free look like?
04:54 <nshepperd> data Free f a = Pure a | Free (f (Free f a))
04:54 <jle`> Free has an extra constructor
04:54 wroathe joined
04:55 <iqubic> Oh, right.
04:55 <jle`> that lets you terminate the recursion, so to speak
04:55 <nshepperd> Free has the option of terminating the recursion with a value
04:55 <iqubic> Yeah.
04:55 <jle`> it's like List, vs. Stream
04:55 <iqubic> Right. I got you.
04:55 <jle`> data Stream a = SCons a (Stream a)
04:55 <jle`> data List a = LCons a (List a) | Nil a
04:55 <jle`> er, | Nil
04:55 <jle`> list is like a stream you can terminate
04:56 <iqubic> Yeah, I get it.
04:59 flatmap13 joined
05:00 sleffy joined
05:02 ditadi joined
05:03 govg joined
05:04 <athan> Is there a common system of... concurrent continuations? Where I might `await` from multiple sources?
05:04 <athan> or some kind of indexed `await`, which could identify the data source or something? :s
05:05 <athan> muh programming paradigms
05:05 sanitypassing joined
05:05 Gurkenglas joined
05:05 <systemfault> Something like await Promise.all([promise1, promise2, promiseN]); ?
05:06 <athan> something like that, yeah
05:06 abhiroop joined
05:06 <athan> or really, say I have some other thread going on, and it would like to `yeild` data `awaited` in my current one
05:06 <athan> is that just STM?
05:07 <athan> like a queue or something :s
05:07 <peddie> athan: can you use Control.Concurrent.Async.waitAny or waitAnySTM or something like that?
05:08 <athan> well the trick is the thread is already running
05:08 <athan> or the source thread's invocation is unknown
05:08 <athan> I think a queue or whichever might work :)
05:08 <athan> thanks everyone!
05:08 <systemfault> Oh damn, wow... Thought I was on the javascript channel for a second. My bad.
05:09 <mjora7> GHCi says that the type signature of a function is "(Ord t1, Num t1) => t1 -> [t] -> [t]", what does 't' (without the 1) refer to
05:10 <mjora7> And why is there a 1 to begin with
05:10 <glguy> t and t1 are just two different, unrelated variable names
05:10 freusque joined
05:11 torgdor joined
05:11 darlan joined
05:11 <mjora7> Ok. Why didn't they use two different letters?
05:12 <glguy> Because it doesn't
05:13 <iqubic> I like lambdabot's way of just using a, b, c, ...
05:13 <iqubic> That's what I do in my type signatures all the time.
05:13 alpin left
05:13 <mjora7> Yeah a, b, c make a lot more sense, unless there is a reason GHCi does it that I'm not seeing
05:13 Sh4rPEYE joined
05:13 <iqubic> mjora7: No. GHCi is just weird
05:14 <Sh4rPEYE> Hello. How do I update my stack snapshot? Also, on stackage the latest hlint version is 1.9, while on hackage it is already at 2.0. Is there any way to use the new one if I use stack for managing packages?
05:15 <Koterpillar> Sh4rPEYE: to answer the second question, put it in extra-deps: as, i.e. hlint-2.0
05:16 vaibhavsagar_ joined
05:16 moet joined
05:17 <Sh4rPEYE> Koterpillar: I don't have a stack project, though, because I only work with small scripts and individual files. I use stack mainly for package management, not project setup. How do I specify these extra deps globally?
05:18 <Koterpillar> then it's in .stack/global-project, I think
05:18 northfurr joined
05:18 <Koterpillar> and that's the same place where you update the snapshot
05:18 <mjora7> iqubic: So "(Ord a, Num a) => a -> [b] -> [b]" is the more readable equivalent?
05:18 <moet> what does `withMVar` mean in "However, it is only atomic if there are no other producers for this MVar."? ... if an mvar is held, then observers will block.. when the mvar is released, an observer will resume.. the operation will appear attomic to observers, right?
05:18 <Sh4rPEYE> Ok, I'll try to throw in the "resolver" and extra deps to stack.yaml in global-project
05:18 sanitypassing joined
05:19 sproingie joined
05:19 blender1 joined
05:20 rblaze joined
05:21 <cocreature> moet: withMVar can take the mvar but then another producer can put it back in
05:22 rblaze joined
05:24 <moet> cocreature: ah.. thank you.. i was thinking of it purely as a lock, not as a container
05:24 <moet> if all users of the MVar use withMVar, then it should act pretty much like a lock, correct?
05:24 <cocreature> yep
05:25 wroathe joined
05:26 insitu joined
05:28 <cocreature> moet: if you use an mvar as a lock you should consider wrapping it an a newtype and only exposing a withLock operation to prevent accidental use of putMVar, i.e., releasing a lock that you didn’t acquire. https://hackage.haskell.org/package/extra-1.5.2/docs/Control-Concurrent-Extra.html#t:Lock is just that if you’re fine with a dependency
05:35 fakenerd joined
05:35 wroathe joined
05:35 sproingie joined
05:37 <moet> cocreature: yeah, i might do that.. the mvar is hidden in my library atm, with an access function which saves me a bunch of extra typing so i always use it
05:37 SeMas joined
05:38 <moet> the issue might actually be a crash, whose error is swallowed by the mvar checker.. i've had that issue before
05:39 cyanobacteria joined
05:40 <cocreature> mvar checker?
05:40 <cocreature> the deadlock detection?
05:41 forgottenone joined
05:42 Levex joined
05:42 mbuf joined
05:44 _sg joined
05:46 xtreak joined
05:46 MarcelineVQ joined
05:50 magthe joined
05:51 sproingie joined
05:52 osa1 joined
05:52 osa1 joined
05:53 besenwesen joined
05:53 ThomasLocke joined
05:55 wroathe joined
05:56 freusque joined
05:59 mjora7 joined
06:00 fizruk joined
06:00 eklavya joined
06:02 fizruk joined
06:02 juhp joined
06:03 NikolajK joined
06:04 NikolajK left
06:04 quchen joined
06:05 ogrady joined
06:07 xall joined
06:08 raichoo joined
06:09 osa1 joined
06:10 boj joined
06:10 andrei left
06:11 hurkan joined
06:12 MoALTz joined
06:16 abhiroop joined
06:16 wroathe joined
06:17 takuan joined
06:17 <athan> Is there such a thing as a STM-backed map-queue? where `lookupTake :: k -> MapQueue k a -> STM a` blocks until a value is `insertPut :: a -> MapQueue k a -> STM ()`'d?
06:18 <athan> er... wait... I could probably just store the queue refs in a map. Duyyyyy sorry yall
06:18 oish joined
06:20 xall_ joined
06:20 blender1 joined
06:20 <ExpHP> @tell SrPx proofs of "not A" in idris: http://lpaste.net/7530348284422914048
06:20 <lambdabot> Consider it noted.
06:21 <ExpHP> @tell SrPx by which I mean proofs INVOLVING "not A", not proofs OF "not A"
06:21 <lambdabot> Consider it noted.
06:21 <ExpHP> dang right lambdabot
06:22 thatguy joined
06:22 thunderrd joined
06:22 baldrick joined
06:23 fakenerd joined
06:23 <quchen> ExpHP: forall A. (A ∨ ¬ A) → (¬ ¬ A → A) <- This is maybe a simpler example
06:24 <quchen> Or A → ¬¬A even
06:24 bertschneider joined
06:25 boj joined
06:25 shauryab98 joined
06:27 wroathe joined
06:27 abinr joined
06:27 <shauryab98> I was thinking of building something similar to Lichess ( https://github.com/ornicar/lila ) in haskell. Can someone please give me a general idea of how this could be done?
06:27 fakenerd_ joined
06:28 Argue__ joined
06:30 osa1 joined
06:33 kritzcreek joined
06:33 <quchen> shauryab98: Same way as in any other language. You need a server that takes in clients and manages messages between them.
06:35 fakenerd joined
06:35 <shauryab98> @quchen, how would I exchange information between the haskell game server and the front end?
06:35 <lambdabot> Unknown command, try @list
06:35 osa1_ joined
06:37 <shauryab98> how would I exchange information between the haskell game server and the front end?
06:37 wroathe joined
06:37 <quchen> Websocket or standard server call. The crux is that both have to share the same data format to be able to talk to each other.
06:37 featherlessbiped joined
06:38 zeroed joined
06:39 <shauryab98> Thanks.
06:39 <quchen> shauryab98: https://jaspervdj.be/websockets/
06:40 vlatkoB joined
06:41 Mortomes|Work joined
06:41 detrumi joined
06:41 arctictern joined
06:41 freusque joined
06:44 ubsan_ joined
06:45 abinr joined
06:47 guiben joined
06:48 tommd joined
06:52 ventonegro joined
06:54 buttbutter joined
06:54 armyriad joined
06:56 wroathe joined
06:57 sgronblo joined
06:57 Itkovian joined
06:57 edsko joined
06:59 eklavya joined
07:02 insitu joined
07:02 biglambda joined
07:02 epsilonhalbe joined
07:04 ludat joined
07:05 connrs joined
07:05 Maxou joined
07:07 uiop joined
07:07 wroathe joined
07:09 CurryWurst joined
07:10 matrium joined
07:11 mounty joined
07:11 mattyw joined
07:12 osa1 joined
07:12 vlatkoB_ joined
07:12 n1 joined
07:13 <matrium> hi, a library exports an "newtype PrefixMappings = PrefixMappings (Map T.Text T.Text) deriving (Eq, Ord,NFData, Generic)". Is it possible for me to use functions on an instance of the newtype that take the generic Map as a parameter?
07:14 <quchen> You mean whether you can e.g. use »Map.insert« on a PrefixMappings directly? No.
07:15 nicknovi1 joined
07:17 mstruebing joined
07:17 abinr joined
07:21 alex-v` joined
07:23 eacameron joined
07:23 albertid joined
07:23 xtreak joined
07:24 abhiroop joined
07:27 orhan89 joined
07:27 wroathe joined
07:28 blender1 joined
07:29 Maxou joined
07:31 mounty joined
07:31 Maxou joined
07:31 laplacian joined
07:31 abhiroop joined
07:31 bollu joined
07:33 marr joined
07:34 xtreak joined
07:34 jer1 joined
07:34 thc202 joined
07:35 srbaker_ joined
07:36 pacak joined
07:36 cordawyn joined
07:37 connrs joined
07:37 wroathe joined
07:38 simukis_ joined
07:38 mounty joined
07:38 sirreal joined
07:38 augur joined
07:40 <matrium> quchen: ok, thanks. So I have to entirely rely on the functions for the newtype, exported by the module?
07:41 ccomb joined
07:41 blym joined
07:43 CoderPuppy joined
07:44 oish joined
07:44 yellowj joined
07:46 newhoggy_ joined
07:48 wroathe joined
07:48 merijn joined
07:49 connrs joined
07:49 <quchen> matrium: »rely«?
07:49 oish joined
07:49 mjora7 joined
07:49 <quchen> You’ll have to unpack it every time to gain access to the Map, if that’s what you mean
07:50 ragepandemic joined
07:50 bvad joined
07:50 <quchen> Or write a function »PrefixMappings -> (Map k v -> Map k v) -> PrefixMappings« and use that like »withPrefixMapping foobar (\containedMap -> insert key value containedMap)«
07:50 newhoggy joined
07:51 cordawyn joined
07:51 bjz joined
07:52 <[exa]> quchen: offtopic just out of curiosity, what keyboard shortcut do you have for these »quotes« ?
07:53 rockfordal joined
07:53 Maxou joined
07:53 Maxou joined
07:54 mohsen_ joined
07:54 <quchen> [exa]: Shift-4 » Shift-5 « I type QWERTZ with the 3rd layer taken from Neo http://www.neo-layout.org/
07:54 <quchen> Can recommend it fully without any drawbacks. (Works equally well with QWERTY.)
07:55 <[exa]> quchen: cool thanks
07:56 <quchen> Time to reach speed parity with before was just a few days, none of which were painful. (Going full neo *is* painful and takes much longer, but special characters are straightforward.)
07:56 mounty joined
07:57 nickolay joined
07:57 wroathe joined
07:58 mjora7 joined
07:59 freusque joined
07:59 richi235 joined
08:01 augur joined
08:01 seveg joined
08:02 fakenerd joined
08:04 slomo joined
08:04 slomo joined
08:05 bollu joined
08:06 yellowj joined
08:06 sproingie joined
08:06 sproingie joined
08:06 f1refly joined
08:08 blender1 joined
08:08 orhan89_ joined
08:08 iomonad joined
08:10 <quchen> I now type special characters pretty much as fast as capital letters, including combinations.
08:10 <quchen> >>= is iio
08:10 biglama joined
08:10 <quchen> -> is li
08:11 <quchen> :-) is ölk (roll your right hand over the keyboard)
08:11 <quchen> <+> is uni
08:11 <quchen> … you get the idea
08:11 <quchen> … is on Q on the 3rd layer by the way :-)
08:13 crave joined
08:14 Yuras joined
08:14 tomphp joined
08:14 newhoggy joined
08:14 <akr[m]> quchen: seems interesting, but it's for German only?
08:15 <quchen> Not really, no.
08:15 <quchen> I mean *Neo* is made for German, but there’s not much to it that makes it »German only«.
08:16 <quchen> On the US layout you’d have to use the key above return as your right-hand 3rd layer modifier.
08:16 <akr[m]> I meant that the layout is constructed for the German language
08:16 <quchen> But that’s it.
08:16 benjamin2 joined
08:16 <quchen> Full Neo? Yes. But it works well for English as well.
08:16 fakenerd joined
08:16 tomphp joined
08:17 <quchen> The only issue is that German has »sch« instead of »sh«, and »sh« is typed via the QWERTY-»hu«.
08:17 <quchen> So that’s two times the same finger, which is otherwise very rare.
08:18 <akr[m]> ah, ok
08:18 somewone joined
08:18 <quchen> And since lots of crappy programs assume QWERTY or something not too far from it, going full Neo can be a bit of work. Examples: Games.
08:18 wroathe joined
08:18 <quchen> WASD is all over the place in Neo.
08:18 mohsen_ joined
08:18 <quchen> Can’t reconfigure the game? You’re screwed.
08:18 <quchen> Vim? You’re screwed.
08:18 biglama joined
08:19 hastell joined
08:19 <akr[m]> well ideally they would also provide a vim mapping on the website :)
08:19 <quchen> hjkl is u/ze.
08:19 jer1 joined
08:19 <hastell> Does anyone know if there are functions available to traverse graphs in https://github.com/snowleopard/alga ?
08:19 <quchen> Sure, but you don’t want to worry about this every time you start a new program. But I know people that use Neo and love it.
08:20 <quchen> Anyway, this is OT so now that there’s a Haskell question I’ll stop :-)
08:20 Beetny joined
08:21 Aruro joined
08:22 Maxou joined
08:23 lep-delete joined
08:25 Maxou joined
08:25 abhiroop joined
08:26 nut joined
08:27 xtreak joined
08:27 castlelore joined
08:28 <akr[m]> anyone using the `has` library?
08:28 <akr[m]> I'm having trouble building it https://github.com/nonowarn/has/issues/2
08:29 jmnoz joined
08:29 jmnoz_ joined
08:29 <akr[m]> also, stack-related question: if I'm using a non-lts resolver, can I expect my project to compile in the future as is or not really?
08:30 <quchen> akr[m]: I didn’t experience many breaking issues with Stackage so far, so I’d say when it builds with LTS it likely builds with most things
08:31 <akr[m]> but I'm not / can't use LTS
08:32 <akr[m]> hmm, or, at least don't know how - one of my dependencies conflicts with a package in the lts
08:32 SlashLife joined
08:33 <quchen> You can override the LTS choices in your stack.yaml
08:33 biglama joined
08:33 <quchen> So you can just add whatever lib you want instead
08:33 <akr[m]> ah okay I should try that
08:33 <quchen> https://github.com/quchen/stgi/blob/wl-pprint-dependency-rewritten/stack.yaml
08:33 aarvar joined
08:34 <quchen> Here I’m using my own fork of wl-pprint instead of the Hackage-provided one
08:34 <akr[m]> I see, thank you
08:36 mohsen_1 joined
08:37 Fairy joined
08:37 xtreak joined
08:38 wroathe joined
08:39 binaryplease joined
08:39 abhiroop joined
08:41 xificurC joined
08:41 xall_ joined
08:43 uuplusu joined
08:46 augur joined
08:46 bollu joined
08:47 LHoT joined
08:49 tommd joined
08:49 kuribas joined
08:49 wroathe joined
08:51 abhiroop joined
08:51 biglama joined
08:52 redeemed joined
08:53 xtreak joined
08:56 tomboy64 joined
08:56 abhiroop joined
08:58 fizruk joined
08:59 wroathe joined
08:59 juhp joined
09:00 mmn80 joined
09:00 eatman joined
09:00 kuribas` joined
09:01 balor joined
09:02 laz joined
09:02 _sg joined
09:04 SadoqueTD joined
09:04 jmnoz joined
09:04 jmnoz_ joined
09:05 fakenerd_ joined
09:06 alfredo joined
09:08 coot__ joined
09:09 wroathe joined
09:11 Fairy joined
09:12 obadz joined
09:12 fakenerd joined
09:13 twanvl joined
09:14 oish joined
09:16 xtreak joined
09:16 Naga31 joined
09:16 ali_bush joined
09:16 ali_bush joined
09:16 fakenerd joined
09:17 refold joined
09:18 <Naga31> Hello everyone. I'm puzzled by a task i'm given and would really appreciate if someone quickly looked over it. I summed it up in a structured pastebin: https://pastebin.com/CY8TVBpf
09:20 unlmtd[m] joined
09:20 thunderrd joined
09:21 xall joined
09:22 yinn joined
09:22 <quchen> What kind of terrorist asks his students a straightforward problem and excludes the obvious straightforward solution?!
09:22 beanbagula joined
09:22 fakenerd_ joined
09:23 iulian joined
09:23 <quchen> The only way to solve this is by using the same semantics that lists give you, but since you’re not allowed to use lists or their semantics, you’ll have to obfuscate the solution enough for it not to be recognizable.
09:23 <Naga31> I dont know. We just started with Haskell, so even if he allowed lists - i'd have to look it up. Hes expecting us to solve it without them, though. :-(
09:24 locallycompact joined
09:24 mjora7 joined
09:24 <Naga31> I was thinking about a somewhat complicated recursion, with 2 help-functions
09:24 <Naga31> one iterating through x values and one through y
09:24 <quchen> With lists, there’s an elegant and easy to understand solution. Without lists, you have to write the recursion yourself.
09:24 <Naga31> but that doesnt seem very elegant to me.
09:24 eacameron joined
09:24 <unlmtd[m]> its quite obscure how to contribute to packages on hackage. any guidelines?
09:24 bennofs joined
09:24 <quchen> unlmtd[m]: Step 1, make an account
09:25 <unlmtd[m]> I mean, do they use git? I dont see any git trees there, just a raw text source page
09:26 <merijn> unlmtd[m]: Hackage pages should have a link to the repository
09:26 <merijn> unlmtd[m]: Hackage is package hosting, not development hosting
09:26 LordBrain joined
09:26 insitu joined
09:26 <merijn> unlmtd[m]: People use whatever they want as version control separate from Hackage
09:27 <merijn> git, darcs, mercurial, fossil, SVN, CVS (for the true masochist), whatever
09:28 <unlmtd[m]> im guessing the packages im interested in dont have a public repo
09:28 <merijn> unlmtd[m]: Like?
09:28 <unlmtd[m]> dont forget pijul. tried it lately and I was very impressed
09:28 <quchen> Naga31: Something like this? http://lpaste.net/354879
09:29 <unlmtd[m]> wait I just had a 'slap in the face' moment
09:29 <quchen> Naga31: I haven’t tested it, but the idea is manually enumerating all the matrix entries and counting how often the predicate holds.
09:29 mjora7 joined
09:29 wroathe joined
09:29 vaibhavsagar__ joined
09:30 biglambda left
09:30 <unlmtd[m]> I was in a sub-section of a bigger module, lol
09:30 <merijn> unlmtd[m]: Yeah, the repo links are listed on the "Contents" main page for packages :)
09:31 osa1 joined
09:33 fakenerd joined
09:33 heurist joined
09:33 vaibhavsagar joined
09:34 tomphp joined
09:35 <unlmtd[m]> anyone who uses yi?
09:36 kuribas` joined
09:36 <merijn> Probably not many, I'd say it's about 1/3rd vim, 1/3rd emacs, 1/3rd "other" in here :)
09:36 kuribas joined
09:37 <LordBrain> i made a contribution to yi way back when it was mostly don stewart working on it
09:37 <unlmtd[m]> may be cool to build HS interface for xi, which is supposed to be very fast
09:38 <LordBrain> did you mean yi, or is xi another one?
09:38 xtreak joined
09:38 <unlmtd[m]> https://github.com/google/xi-editor
09:38 <LordBrain> i'd like an improved version of vim really, nothing creative, just something incredibly compatible
09:38 <unlmtd[m]> very cool theory behind it
09:39 <unlmtd[m]> vim has shown some anoying limitations in term of remapping keys
09:39 <merijn> Really? What kinda remapping are you trying to make?
09:40 <LordBrain> try #vim first, maybe some expert can tell ya how to do it
09:40 <unlmtd[m]> I want a much more modular approach to the keyboard. I need a lower level access, something like langmap but deeper and covering everything
09:40 <LordBrain> i've noticed glitchiness in vim tho, actual bugs
09:40 seveg_ joined
09:40 <unlmtd[m]> I think iv covered the options already
09:40 <merijn> LordBrain: Well, how old is your vim? :p
09:41 <LordBrain> well, vim 7 from debian stable
09:41 <merijn> LordBrain: Some systems have nearly decades old vim versions because no one ever updated :p
09:41 <unlmtd[m]> well im on nvim for the record
09:41 <LordBrain> yeah merijn but.. it should have been bug free a decade ago
09:41 <merijn> LordBrain: Have you ever looked at the vim codebase? It's a wonder it works at all :p
09:41 <LordBrain> well "bug free" you know what i mean
09:42 <merijn> I guess it depends on what you do, I've never really ran into any issue
09:42 <unlmtd[m]> the acidic dreamy-plans I had about the keyboard actually involved a system-wide system to handle the input which can be interacted with by individual applications, like vim. inputs in general are quite broken
09:42 newhoggy joined
09:42 <LordBrain> i mean it was surprising to me, the bugs, because it had a good reputation for being solid before i noticed them
09:42 <kuribas> I'd like to write a purescript frontend for emacs, and then improve haskell-mode...
09:43 <LordBrain> it may be some kind of bitrot, like something about the system changed that vim relied upon
09:43 <unlmtd[m]> probably the legacy of trying to run algorithms in 512bits of ram
09:43 <unlmtd[m]> or memory whatever
09:44 <LordBrain> no
09:44 <LordBrain> they didnt show up that long ago
09:44 <merijn> unlmtd[m]: Depends on your OS, OSX lets you do pretty fancy things with keyboard input
09:44 sgronblo joined
09:44 <LordBrain> i mean, long for now, but there was a period during hte gigabyte era, where vim was working fine for me
09:44 <LordBrain> it got seemingly more buggy like a couple of years ago only
09:45 <LordBrain> i actually did download the source and take a peek
09:45 SadoqueTD joined
09:46 <xintron> I'm using necoghc-vim + ghc-mod for autocompletion in vim but every time I add a new dependency to my project I need to restart vim to get autocompletion working for the new module. Does anyone know how to work around this?
09:46 <LordBrain> maybe they've fixed the bugs tho, and i didnt notice, its been fine lately
09:47 <unlmtd[m]> merijn: not at all on the level im thinking
09:47 <merijn> xintron: Sounds like it's only inspecting your cabal setup when you launch vim and never after. Not sure if that's easily fixable
09:48 <merijn> unlmtd[m]: Really? I've been able to do some incredibly fancy things with minimal effort. LaTeX to unicode mapping, arbitrarily complex keyboard layouts and remappings, applications specific mappings, etc.
09:48 Jinxit joined
09:48 <xintron> matrium, My understanding is that every completion calls ghc-mod so I don't see why the cache should have any affect here (and if the cache is vim-specific or not)
09:49 <unlmtd[m]> merijn: more like having a general concept, like "opening" or "spawning a new instance", and those can be assigned to a certain input, then every program can refer to the system-wide configuration to associate its own "opening" and "spawning new instance" to the keys configured as such. No more configuring shortcuts in every applications
09:49 <unlmtd[m]> install a new program and start using your muscle memory with it instantly
09:49 xtreak joined
09:50 wroathe joined
09:50 <LordBrain> hmm
09:50 <LordBrain> you could do that tho, no? i mean if the programs wanted to do that they could provide vim files
09:50 govg joined
09:51 <LordBrain> to get everyone to participate, you need something to become standard, one fancy editor using it wouldnt be good enough
09:52 <LordBrain> and that has a benefit for the consumer, but then the standard whatever it is, its going to end up being a common denominator
09:52 ozgura joined
09:52 oish_ joined
09:53 <LordBrain> and the new thing would take a while for adoption, we'd have the old things around for legacy, and so there is the meantime complexity cost
09:54 oisdk joined
09:54 <LordBrain> most likely the legacy wouldnt go away, because hey it supports this or that that the new thing doesnt
09:55 <LordBrain> so i guess, you need a scalable standard
09:55 <LordBrain> something that has a core of features supported everywhere, detectability of new features, kind of like html for key binding.
09:56 <LordBrain> the libm17n package has a key-binding language, lisp-like
09:56 _ashbreeze_ joined
09:56 <LordBrain> you could mess around with that right now, it will work in your editor if you install ibus-m17n, it works everywhere.
09:57 zachary12 joined
09:58 <LordBrain> i use it to get all those digraphs when i'm not in vim... so i can make symbols the vim way here in xchat, etc
09:58 <LordBrain> so e' becomes é
09:59 epsilonhalbe joined
09:59 <LordBrain> i once even set it up to use ctrl-k as the trigger, just like vim does, but i lost my work
09:59 <LordBrain> also i dont think ctrl-k is ideal anyway
10:00 wroathe joined
10:00 fakenerd_ joined
10:00 sz0 joined
10:01 dcoutts joined
10:02 xtreak joined
10:03 balor joined
10:04 <unlmtd[m]> thanks
10:05 <unlmtd[m]> input is going to change tremendously in the coming years
10:05 <unlmtd[m]> so wel
10:06 <LordBrain> we can offload some of the editor functions to the operating system instead
10:06 <unlmtd[m]> well need a common interface for all those new way of giving inputs to interract with our system
10:06 <unlmtd[m]> thats why I like xi, its built very modularly
10:06 <LordBrain> but we cant have wars, so we have to support both moded editing vim style and emacs style editing
10:06 dfordivam joined
10:06 oish_ joined
10:06 sproingie joined
10:06 sproingie joined
10:06 <unlmtd[m]> think about voice, eye movement as inputs, maybe a new kind of hand input factor
10:07 <unlmtd[m]> so keyboard gets refactored in the process
10:07 <LordBrain> oh definitely
10:07 <LordBrain> i was looking a bit at implementing robot computer vision
10:07 <unlmtd[m]> I dont think vim is ready for that
10:07 <LordBrain> without lidar
10:08 <LordBrain> well, a vim-sub-system is what we need
10:08 <LordBrain> as in
10:08 javjarfer joined
10:08 fizruk joined
10:08 <unlmtd[m]> xi
10:08 <LordBrain> its not vim, and its not even an editor, its an editor support layer built into the system
10:09 <unlmtd[m]> right, so its on open field, which means lots of work
10:09 <javjarfer> hi everyone, there is any difference between this two kind signatures? T :: forall k. (k -> *) -> *, T :: (* -> *) -> * -> *
10:10 <javjarfer> okay sorry the first one is "T :: forall k. (k -> *) -> k -> *"
10:11 <pacak> First one is more general
10:11 <javjarfer> I see... in the second one the second parameter type is not fixed by the former function parameter
10:11 sepp2k joined
10:11 <unlmtd[m]> looks like google is designing our next kernel
10:11 <pacak> That as well
10:13 fakenerd joined
10:13 <javjarfer> pacak, thanks I only needed to say it louder xD
10:14 danthemyth joined
10:17 uuplusu_ joined
10:17 mjora7 joined
10:18 dshk_ joined
10:19 vaibhavsagar joined
10:20 <NickHu> Is there a neater way of doing x = record (lens ^. a) (lens ^. b) ... (lens ^. z)?
10:20 wroathe joined
10:20 fakenerd_ joined
10:21 a3Dman joined
10:22 govg joined
10:24 HoierM joined
10:24 _sg joined
10:25 tamasgal joined
10:29 sgflt joined
10:29 SlashLife joined
10:29 jaspervdj joined
10:32 zero_byte joined
10:37 Sampuka joined
10:37 detrumi joined
10:39 Sampuka joined
10:39 dm3 joined
10:41 wroathe joined
10:41 Maxou joined
10:42 mivael joined
10:43 netheranthem joined
10:43 mivael joined
10:46 moet joined
10:46 hucksy joined
10:48 mivael joined
10:49 insitu joined
10:49 tommd joined
10:49 abhiroop joined
10:51 Maxou joined
10:51 wroathe joined
10:53 mohsen_ joined
10:53 <tomboy64> record $ map (lens ^.) [a..z] ?
10:53 <tomboy64> if that even works
10:53 <tomboy64> :D
10:54 insitu joined
10:54 abhiroop joined
10:54 SadoqueTD joined
10:54 <pacak> :t record
10:54 <lambdabot> error:
10:54 <lambdabot> • Variable not in scope: record
10:54 <lambdabot> • Perhaps you meant ‘second’ (imported from Control.Arrow)
10:54 oish__ joined
10:54 <pacak> NickHu: Record? O_o
10:55 <mivael> tomboy64, this does not look like equivalent of the original expression
10:56 seveg joined
10:57 mbazs joined
10:57 jeltsch joined
10:58 ziocroc joined
10:59 dm3_ joined
11:00 michielb joined
11:01 wroathe joined
11:02 Snircle joined
11:03 cloudhead joined
11:04 nighty-- joined
11:04 osa1_ joined
11:06 xall joined
11:06 newhoggy joined
11:07 __paul0 joined
11:08 seveg joined
11:09 albertid joined
11:09 Maxou joined
11:10 hamishmack joined
11:10 dcoutts_ joined
11:11 freusque joined
11:11 abhiroop joined
11:14 sgronblo joined
11:15 eacameron joined
11:15 <ph88_> how can i convert a Double to bytestring ascii ?
11:16 <ph88_> 1.23 -> "1.23"
11:17 <liste> @hackage bytestring-show
11:17 <lambdabot> http://hackage.haskell.org/package/bytestring-show
11:19 Wuzzy joined
11:19 cpennington joined
11:19 <ph88_> liste, that looks nice .. i'm surprised though that i would need a package of this .. isn't there something in base or more primitive libraries ?
11:20 petermw joined
11:21 abinr joined
11:22 infy joined
11:22 abhiroop joined
11:23 infy joined
11:23 hastell joined
11:23 alexbiehl joined
11:24 xtreak joined
11:24 infy joined
11:28 Maxou joined
11:28 petermw joined
11:31 wroathe joined
11:32 Raddamu joined
11:32 theelous3 joined
11:33 okuu joined
11:36 benl23 joined
11:37 Yuras joined
11:37 prophile joined
11:37 pgiarrusso joined
11:40 exferenceBot joined
11:41 nut joined
11:41 hucksy_ joined
11:42 abhiroop joined
11:42 wroathe joined
11:43 oisdk joined
11:44 codesoup joined
11:44 osa1_ joined
11:47 abhiroop joined
11:49 merlynfry joined
11:49 gawen joined
11:50 unyu joined
11:50 justin3 joined
11:50 asmyers joined
11:50 <mivael> Hello! Could someone advise me on better ways of using ByteString (or maybe not ByteString)? I achieved faster input/output but now I do not like my source code :) Details are here: http://codepad.org/xJFmWwBf
11:51 oish joined
11:53 fizruk joined
11:54 Maxou joined
11:56 wroathe joined
11:59 <merijn> mivael: By using attoparsec to parse the bytestring
12:00 <mivael> merijn, thank you, I will look into it
12:01 wroathe joined
12:02 detrumi joined
12:02 <Axman6> yeah that definitely needs a proper parser library
12:02 NyanPasu joined
12:02 Luna-Is-Here joined
12:03 Maxou joined
12:04 fakenerd joined
12:04 fizbin joined
12:06 abhiroop joined
12:07 sproingie joined
12:07 sproingie joined
12:08 uuplusu joined
12:09 jason85 joined
12:10 sgflt joined
12:10 ragepandemic joined
12:10 abhiroop joined
12:10 xormor joined
12:10 ccomb joined
12:11 binaryplease joined
12:12 ecutuning joined
12:12 refold joined
12:13 abhiroop joined
12:14 balor joined
12:15 fotonzade joined
12:15 jeltsch joined
12:15 eacameron joined
12:15 ecutuning joined
12:16 fotonzade joined
12:16 danza joined
12:16 tomphp joined
12:17 kattak joined
12:17 noddy joined
12:17 bennofs joined
12:17 ecutunin_ joined
12:19 halogenandtoast joined
12:23 abhiroop joined
12:23 merlynfry left
12:24 mfukar joined
12:26 <mivael> Are there ready-to-use attoparsec+ByteString templates/examples you would recommend? Or, maybe, I'd be better just read attoparsec docs?
12:26 jophish_ joined
12:27 refold joined
12:28 <merijn> mivael: I'd recommend reading one of the Parsec tutorials/examples, since attoparsec has basically the same general idea
12:28 <merijn> In fact, most Parsec parser can be turned into attoparsec parsers by replacing 1 or 2 imports
12:31 mizu_no_oto_work joined
12:31 KingBuzzo joined
12:31 <ph88_> hi guys, i'm trying to write a conduit function that turns Double into ByteString .. the code i wrote requires an instance with Maybe https://bpaste.net/show/70ca475b1755 but i'm not sure why that Maybe is there and what i did wrong
12:32 <MarcelineVQ> what's the type of await
12:36 <cocreature> ph88_: MarcelineVQ already hinted you at the solution. await gives you a Maybe
12:36 insitu joined
12:38 <KingBuzzo> hey folks, I'm currently implementing a rather complicated algorithm for my master's thesis and the core element of the algorithm is a two-dimensional table. i've used the array type in haskell and both time and memory consumption literally explode even with a rather small table. any idea what the problem might be?
12:38 <kuribas> KingBuzzo: lazyness?
12:39 <kuribas> KingBuzzo: Hard to tell from the information you have given.
12:39 <KingBuzzo> i broke my code down to a very short expression to focus solely on the problem. can i just paste it in here?
12:40 <mizu_no_oto_work> KingBuzzo: http://lpaste.net/new/haskell
12:40 <kuribas> KingBuzzo: If possible use unboxed matrices: https://hackage.haskell.org/package/matrices
12:40 <merijn> Array is also not very good for matrices
12:40 <MarcelineVQ> lpaste sure is slow lately ehe
12:41 <merijn> Depending on your computation you might also just want hblas
12:41 <merijn> Which are haskell bindings for BLAS
12:41 oisdk joined
12:41 <kuribas> KingBuzzo: also, modifying immutable matrices is going to be very slow.
12:42 <kuribas> KingBuzzo: because you need to copy the whole matrix
12:42 jmnoz joined
12:42 jmnoz_ joined
12:42 <KingBuzzo> i don't need to modify anything. just need to have access to already computed entries when computing new ones
12:42 <kuribas> alternatively use lisppaste: http://paste.lisp.org/
12:43 <kuribas> KingBuzzo: dynamic programming?
12:43 <merijn> ok, so I'm updating my vim/haskell setup and I keep running into people using neocomplete, but as of yet I'm unsure what the hell neocomplete actually *does*, anyone that can explain?
12:43 <KingBuzzo> kuribas: yep!
12:44 <ph88_> how do i go from a conduit stream of Double to an unboxed vector ?
12:44 <kuribas> KingBuzzo: lazyness may work, but a mutable unboxed array is going to be faster.
12:45 <lpaste> KingBuZZo pasted “array problem” at http://lpaste.net/354882
12:45 rossberg joined
12:47 <cocreature> KingBuzzo: so what values are you using for width and height that cause the claim that “memory consumption explodes”? also how are you measuring this?
12:47 <kuribas> KingBuzzo: so you use an unboxed array of Integer?
12:48 <KingBuzzo> for width=height=2000, ghci already needs 3 seconds and 2 gig of space consumption
12:48 <ph88_> KingBuzzo, not related to your question of memory usage but maybe this package will be interesting for you too https://hackage.haskell.org/package/hmatrix
12:48 <KingBuzzo> and i need to deal with much bigger tables basically
12:48 <cocreature> KingBuzzo: how are you measuring the 2gig
12:49 sgronblo joined
12:49 <KingBuzzo> using the :set +s option in ghci, it tells me for width = height = 2000 the following (2,92 secs, 2.146.888.368 bytes)
12:50 <cocreature> that’s the memory allocated, not the max memory residency
12:50 <MarcelineVQ> ah, you're in luck, that's not max residency but total allocations
12:50 <kuribas> KingBuzzo: ghci isn't very efficient, try compiling
12:50 <KingBuzzo> it's much more than the two other algorithms dealing with this problem take
12:50 <KingBuzzo> which i already implemented successfully
12:50 clever joined
12:50 crobbins joined
12:50 <cocreature> also add explicit type signatures
12:51 Adios joined
12:51 <KingBuzzo> okay so from what i gathered, using a different data type for the table should solve the problem right? sorry if my questions are noobish
12:51 vaibhavsagar joined
12:52 <KingBuzzo> the table isn't filled with integers but a custom data type which itself consists of three Ints BTW
12:52 coot__ joined
12:52 <mizu_no_oto_work> KingBuzzo: before you rewrite it, how does it perform if you compile it with -O2?
12:53 <ph88_> does hmatrix have efficient memory usage ?
12:53 <KingBuzzo> what do you mean with -O2?
12:54 Silox| joined
12:54 <ph88_> KingBuzzo, O2 is the maximum optimization level of ghc
12:54 kmels joined
12:54 <mizu_no_oto_work> It's a compiler flag to optimize your code
12:54 <ph88_> there are also other optimizations you can turn on (i don't know them of the top of my head though)
12:54 <KingBuzzo> gimme a second i'll try
12:54 <kuribas> ph88_: probably, since it uses the ffi
12:54 dbmikus_ joined
12:55 <ph88_> i was thinking maybe hmatrix can help KingBuzzo with his problem
12:55 <ph88_> 1027 commits on that package
12:55 smillmorel joined
12:55 <kuribas> I like the matrices package, because it's pure haskell.
12:55 bennofs joined
12:56 <ph88_> i'm sure you like speed too :P
12:56 bjz_ joined
12:56 <kuribas> matrices is based on Data.Vector
12:56 <ph88_> actually i don't know the speed of hmatrix or matrices :D
12:56 jer1 joined
12:56 yinn joined
12:57 <kuribas> KingBuzzo: if you are doing image manipulation have a look at repa and repa-devil
12:57 <cocreature> I don’t think either matrices or hmatrix are particularly useful for the kind of dynamic programming problem KingBuzzo is having
12:57 <cocreature> they’re more targeted at collective operations like matrix multiplication
12:58 <ph88_> what does he need ?
12:58 <cocreature> they pasted their code above
12:58 <ph88_> oh
12:58 abhiroop joined
12:58 ozgura joined
12:59 juhp_ joined
12:59 juhp_ joined
12:59 <KingBuzzo> the algorithm deals with comparing grammar-compressed words for equality. calculating the table entries is the sophisticated part, but that's not my problem, what i wrote works fine. in the end, all i need to do is read one particular table entry
13:00 oisdk joined
13:00 <merijn> Anyone have any pointers on how to get the hoogle commandline program to be useful? A lot of documentation on it seems horrifically out of date
13:01 <cocreature> merijn: use hoogle 5 which indexes all of stackage
13:01 JagaJaga joined
13:01 <merijn> cocreature: I want it setup so that it also indexes every locally installed package (and preferably sandboxes)
13:02 <merijn> I know cabal is Hoogle aware now, but I'm unsure how to fit things together
13:02 <cocreature> merijn: sry I only know how to do this with stack (it just includes a stack hoogle command)
13:02 <cocreature> I also would expect that cabal still uses the old format
13:03 <merijn> cocreature: Why? Cabal support was added only fairly recently afaik
13:04 <cocreature> merijn: it’s not that recent iirc while hoogle 5 is quite new
13:04 S1 joined
13:04 <cocreature> but I’m happy to be proven wrong
13:04 xenog joined
13:04 tsmish joined
13:05 baldrick joined
13:05 <cocreature> merijn: according to the Cabal changelog it’s supported since 2008 so maybe you are referring to something different
13:05 magneticduck joined
13:07 <merijn> hmmm
13:07 <merijn> Hoogle supposedly supports a textual interface (which cabal generates via haddock) and a binary one and you can convert the textual to the binary one
13:08 <merijn> At least, that's what the wiki says (which the package links to)
13:08 skeuomorf joined
13:09 <KingBuzzo> i'm gonna give hmatrix a try, thanks for your help!
13:09 Swizec joined
13:10 kadoban joined
13:10 <merijn> cocreature: Anyway, this is entirely my problem, there doesn't seem to be any comprehensive description of how to make things work :)
13:11 <ph88_> KingBuzzo, do you know how to check the max memory residency ?
13:12 <KingBuzzo> nope.
13:12 <cocreature> merijn: maybe "hoogle generate --local" works?
13:12 Kreest__ joined
13:13 <KingBuzzo> thing is that this algorithm should run faster than another one but doesn't. basically i just need an efficient datatype for the table that allows me to read already computed values when calculating a new one
13:13 <cocreature> merijn: I think https://github.com/ndmitchell/hoogle/blob/master/docs/Install.md is the document that you should consult
13:13 <ph88_> KingBuzzo, https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html#profiling-memory-usage
13:14 <cocreature> KingBuzzo: the "vector" package can often be master than "array", especially if you use unboxed vectors
13:14 razi1 joined
13:14 <ph88_> i think he means vector can be faster than array
13:15 <cocreature> eh yeah s/master/faster/
13:15 <cocreature> typing is hard
13:15 cpup joined
13:15 soniku joined
13:15 <ph88_> unboxed vectors
13:16 <KingBuzzo> alright then i'll try those out i guess. thanks!
13:17 insitu joined
13:17 danthemyth joined
13:18 Gentilhomme joined
13:18 eacameron joined
13:18 jer1 joined
13:18 oisdk joined
13:18 <merijn> cocreature: Somehow doing that ends up with 81 package missing databases, according to the commandline. I'll try again some other time...I mean, someone must've managed to get it working...
13:18 <cocreature> merijn: have you enabled the hoogle stuff in your cabal config?
13:18 <merijn> cocreature: Yeah
13:19 <KingBuzzo> the tables dimensions correspond with the number of production rules in the grammar i'm working with. the two other algorithms can deal with up to 1 million production rules and take less than one or two minutes for computations. in theory, the table should give me similar results
13:19 <cocreature> merijn: hm sorry I’m out of ideas
13:20 fizruk joined
13:21 arawack joined
13:21 <kuribas> cocreature: or matrices, which is just a wrapper around vector
13:21 pavonia joined
13:23 harfangk joined
13:23 oisdk joined
13:26 nuskin joined
13:27 ChristopherBurg joined
13:27 danthemyth joined
13:27 egis joined
13:28 igqg joined
13:28 xtreak joined
13:28 jathan joined
13:29 sproingie joined
13:30 abhiroop joined
13:30 ExpHP joined
13:32 splanch joined
13:32 <ExpHP> https://github.com/k0ral/conduit-parse/blob/master/Data/Conduit/Parser/Internal.hs#L44-L48 -- "tell me more master, is this why (<|>) unconditionally uses catchError, and try = id?"
13:33 eschnett joined
13:33 govg joined
13:33 oisdk joined
13:33 <* ExpHP> has had it up to here with O(n) memory "surprises"
13:33 fragamus joined
13:34 meba joined
13:34 <merijn> ExpHP: Well, the only alternative is randomly dropping an unknown number of items when a parse fails
13:35 <merijn> Which seems...undesirable
13:35 <ExpHP> merijn: which is perfect and has O(1) memory in the common case
13:35 rblaze joined
13:35 <merijn> ExpHP: How is that perfect if you rely on backtracking for parsing?
13:35 slomo joined
13:35 <ExpHP> merijn: I don't!
13:35 mizu_no_oto_work joined
13:35 <merijn> ExpHP: Well, don't use a stream parser then?
13:36 <merijn> ExpHP: That's whayt they're for....
13:36 <ExpHP> I can parse the entire file using only one token of lookahead, which conduit provides with peek
13:36 ystael joined
13:37 <ExpHP> merijn: any idea why the Parsing typeclass has a "try" method then?
13:37 <merijn> ExpHP: Because try is for backtracking parsing?
13:37 <ExpHP> (also, isn't "randomly losing x tokens" what Parsec does?)
13:38 arpl joined
13:38 MarioBranco joined
13:38 jer1 joined
13:38 <merijn> ExpHP: parsec requires explicit try to backtrack, but afaik most other parser combinator libraries don't
13:39 coot__ joined
13:39 <ExpHP> merijn if try is for backtracking parsing, that seems to imply there's a usecase for non-backtracking
13:39 <ExpHP> otherwise all Parsings would have implicit backtracking
13:39 xormor joined
13:40 <merijn> ExpHP: The parsing typeclass is a generic interface, not all instances actually support non-backtracking parsing. In fact, afaict only one instance actually does support that (i.e. Parsec)
13:41 <c_wraith> Parsec doesn't drop an unknown quantity of tokens on the floor then continue, by the way - it just fails to match at all.
13:41 <c_wraith> ie, once it matches the first token in a branch, it commits to that branch.
13:41 <ExpHP> c_wraith: even better
13:41 <merijn> ExpHP: I'm not quite sure where you're going with the entire argument?
13:42 eliasr joined
13:42 jangsutsr joined
13:42 <ExpHP> merijn not a damn clue :). I'm probably just trying to weasel out of having to write my own Conduit wrapper with an Alternative instance
13:42 <merijn> ParserConduit is a backtracking parser, so if you don't need/want a backtracking parser, then don't use it?
13:42 <nuskin> I'm trying to find is some function satisfies a given input over a range of inputs and return True if any are satisfied and False otherwise
13:43 xormor joined
13:43 <ExpHP> (though I guess I'd still have to write it even after arguing...)
13:43 <nuskin> I can think of how one would typically do this with a loop but on account of haskell not having any I'm quite stumped on how to proceed
13:43 <c_wraith> there was a release of attoparsec that *did* drop an unknown number of tokens on the floor then continue. That version got marked as broken very rapidly.
13:43 <ExpHP> merijn: thanks
13:43 <nuskin> I have a lists of lists where each list contained is the function input
13:44 <merijn> ExpHP: I suspect there's probably several other conduit parsers around somewhere, one of them might not backtrack
13:45 ozgura joined
13:46 <ExpHP> the tricky part is finding one with support for arbitrary input types (not just Text/ByteString). conduit-parse seems unique in this regard
13:46 Netwolf joined
13:46 <ExpHP> I'm dealing with an Event stream from Libyaml
13:46 mmhat joined
13:46 mmachenry joined
13:47 <c_wraith> There must be an integration between megaparsec and conduit somewhere.
13:47 <merijn> ExpHP: Well, if you only need a lookahead of 1 you could just write a loop that fetches 1 element, inspects it, branch based on that, continue?
13:47 al-damiri joined
13:47 <ExpHP> of course, I'm just currently busy being a whiny lazy bastard
13:48 <ExpHP> ...I should go implement that. >_>
13:48 xtreak joined
13:51 oisdk joined
13:52 `^_^v joined
13:56 whiteline joined
13:56 <ExpHP> stack new conduit-ll1 # >:D
13:57 dsh joined
13:57 ericsagnes joined
13:57 <ij> A javascript irc bot is eating less(25M) than my haskell bot(50M). Why could this be? ldd shows its been compiled dnyamically.
13:58 taksuyu joined
13:58 <ExpHP> ij try throwing unicode at it
13:58 crave joined
13:59 <dysfun> or you could have a space leak. they're fairly common
13:59 jer1 joined
13:59 mirpa joined
13:59 lampda joined
13:59 descender joined
13:59 prophile joined
13:59 <ij> I could try restarting it and see if the usage changes.
14:00 xenog joined
14:00 nicknovi1 joined
14:01 <ij> Dropped to 19M, could be a space leak.
14:02 <ph88_> how do i go from a conduit stream of Double to an unboxed vector ?
14:02 newhoggy joined
14:03 alfredo joined
14:04 seveg joined
14:04 pgiarrusso joined
14:04 Maxou joined
14:04 <cocreature> ph88_: convert it to a list and then use fromList?
14:04 pgiarrusso joined
14:06 Itkovian joined
14:06 sirreal joined
14:07 Aruro joined
14:07 Sigyn joined
14:08 <dysfun> hrm, vector is O(n) to snoc :/ what do we have that's cheaper?
14:08 <Axman6> https://hackage.haskell.org/package/vector-conduit- might be useful
14:08 BlueRavenGT joined
14:09 newhoggy joined
14:09 <Aruro> would u name ease of refactoring as haskell's strongest side?
14:09 <ExpHP> Is that really O(n) all the time, and not just O(n) armortized?
14:09 <dysfun> i don't know. it just says O(n)
14:09 <Axman6> (requires sepcifying the size of the vector up front, but this would probablt reduce the overhead you'd get with repeated snocs)
14:10 <Axman6> ExpHP: it's O(n) always, it must do a full copy in pretty much all situations (unless it fuses which repeated snocs probably won't)
14:10 <dysfun> i don't know how big it's supposed to be
14:10 <pgiarrusso> ExpHP: O(n) amortized would also be worse—maybe you're thinking of O(n) worst-case, O(1) amortized
14:10 <ExpHP> pgiarrusso: ah, lol, you're right :)
14:10 mthek joined
14:10 <byorgey> dysfun: Data.Sequence gives you O(1) cons and snoc
14:11 <dysfun> does it have cheap slices too?
14:11 jmnoz joined
14:11 jmnoz_ joined
14:11 <pgiarrusso> byorgey: that's implemented with finger trees right?
14:11 <byorgey> pgiarrusso: yes
14:11 <Axman6> dysfun: it has O(log n) slicing IIRC
14:12 <pgiarrusso> Axman6: yes
14:12 oisdk joined
14:13 <dysfun> aha, i can do it with viewl and viewr
14:13 Maxou joined
14:13 <dysfun> perfect, thanks!
14:14 Maxou joined
14:14 <pgiarrusso> Aruro: many do
14:14 starmix joined
14:14 <ph88_> cocreature, how do i go from a conduit to a list? i think it involves this package https://hackage.haskell.org/package/conduit-1.2.10/docs/Data-Conduit-List.html but i don't see a function that gives a list
14:15 <cocreature> ph88_: sourceToList should work
14:15 asmyers joined
14:16 ExpHP_ joined
14:16 guampa joined
14:16 tristanp joined
14:16 <dysfun> huh, so Seq uses fingertrees, but doesn't actually expose them?
14:16 <dysfun> i'm a bit surprised there isn't a fingertree implementation in containers if that's the case
14:16 <* dysfun> normally uses 'fingertrees'
14:17 soniku joined
14:18 acarrico joined
14:19 <Aruro> pgiarrusso: seems much better selling point than "purity"
14:19 burtons joined
14:20 <ph88_> thank you cocreature
14:20 jer1 joined
14:20 <dysfun> purity perhaps requires experience using it to appreciate
14:20 <pgiarrusso> Well, "ease of refactoring" is a consequence of purity
14:20 detrumi joined
14:20 <dysfun> i have recently been working on a research project in haskell, so things being torn up a lot. i felt confident i caught everything when refactoring. that's not the usual experience in other languages i've had
14:20 whiteline joined
14:21 <pgiarrusso> Aruro: see e.g. http://neilmitchell.blogspot.it/2015/02/refactoring-with-equational-reasoning.html https://www.fpcomplete.com/blog/2016/12/software-project-maintenance-is-where-haskell-shines
14:21 guiben joined
14:22 <quchen> dysfun: Sequences use finger trees internally.
14:22 <dysfun> yes and no. as someone who writes a lot of clojure (which emphasis immutableness, if not purity), the type system was the biggest thing for helping refactoring to me
14:22 <pgiarrusso> But I would not actually discuss too much on "what's the strongest advantage" since that's subjectively
14:22 <quchen> dysfun: The same way as Map uses binary trees internally.
14:22 <dysfun> but we have binary trees
14:22 <quchen> containers exposes no binary trees.
14:22 <dysfun> oh, again, not in containers :/
14:23 <quchen> It has rose trees.
14:23 laplacian joined
14:23 <quchen> Not sure why though, it doesn’t really fit.
14:23 <c_wraith> I'd rather go to cofree for rose trees anyway..
14:24 sentientsearch joined
14:24 <pgiarrusso> dysfun: you can use Data.Sequence.Internal if you want to expose how Seq is implemented...
14:24 <c_wraith> though.. that monad instance is wacky. Best to pretend it doesn't exist. :)
14:24 <c_wraith> It's valid! Just wacky.
14:24 <dysfun> "wacky"?
14:25 <c_wraith> You won't ever guess what it does.
14:25 <dysfun> heh
14:25 <quchen> My threshold for wackiness is the list monad
14:25 mirpa joined
14:25 <ph88_> cocreature, ghci infered the following type for me, but i don't understand why it infered the constraint. streamToVector :: VU.Unbox [Double] => Source [] Double -> VU.Vector [Double] streamToVector stream = VU.fromList $ sourceToList stream
14:26 <cocreature> ph88_: dou probably want fmap VU.fromList (sourceToList stream)
14:26 <c_wraith> https://hackage.haskell.org/package/free-4.12.4/docs/src/Control-Comonad-Cofree.html#line-159
14:26 <cocreature> *you
14:27 <pgiarrusso> dysfun: FWIW, try refactoring code using exceptions to see the relation between purity and refactoring—the type systems helps you only with effects tracked in types (of course), not with other ones :-)
14:27 <ph88_> thanks !
14:28 des joined
14:28 <quchen> c_wraith: Can you explain what it does? I think I understand the source but I can’t put it in a sentence.
14:28 carlomagno joined
14:28 <dysfun> pgiarrusso: i know from experience that purity does help with refactoring, but i naturally write 90% pure code in clojure anyway, so i guess it's just not as noticeable any more, compared to the type system, which very much is
14:29 <mirpa> Cabal "missing C library" is misleading error message. I had to run ghc itself in order to figure out that library itself isn't missing, but it needs additional symbols from other libraries.
14:30 xkapastel joined
14:30 <Aruro> pgiarrusso: ty
14:30 <pgiarrusso> mirpa: I'm guessing that happens because loading the library fails...
14:30 <pgiarrusso> mirpa: that sort of thing happens not just with Cabal... but I would still agree it's a bug
14:31 <Aruro> why most frequent (nonconflicting) ghc extensions are not on by default? speed?
14:31 <c_wraith> quchen: no. I can't explain what it does.
14:31 <dysfun> if you set your default language to Haskell2010, you get a few
14:31 <quchen> GHC tries to be a compiler for exactly Haskell.
14:31 <quchen> Language extensions are not Haskell.
14:31 <Aruro> we know that useless now
14:31 <Aruro> nobody does exactly Haskell
14:31 <Aruro> so that is out of the picture :)
14:32 <quchen> No, that’s exactly the answer to your question.
14:32 <Aruro> well, 100 percent of haskell community has to type thousands of lines
14:32 HarveyPwca joined
14:32 <Aruro> everyday, because somebody is stuck in 2010
14:32 bennofs joined
14:33 dmwit_ joined
14:33 <pgiarrusso> Aruro: that's an oversimplification
14:33 ludat joined
14:33 <quchen> GHC does a fairly good job at being Haskell. I can’t recount all the deviations, but I think it’s not much more than AMP, FTP and Num superclasses. And some quirks with section semantics.
14:33 balor joined
14:33 <Aruro> ok why not at least TURN ON EVERYTHING flag?
14:33 Levex joined
14:33 <dysfun> that would be a terrible idea
14:33 <ph88_> Aruro, when there will be a new language spec it will include some things that are now extensions ... so *work in progress*
14:33 <quchen> We had that, it was removed.
14:33 <c_wraith> Aruro: it exists. People don't use it.
14:33 xall joined
14:33 <quchen> -fglasgow-exts
14:33 <dysfun> you'd never understand the error messages
14:33 <pgiarrusso> Aruro: you can add extensions you like to your Cabal file
14:34 <c_wraith> Aruro: it's more useful to b e explicit.
14:34 <pgiarrusso> I can guarantee you that you don't want *all* extensions
14:34 <Axman6> oh man, I'd forgotten about the days of -fglasgow-exts. you've brought on a strange feeling of nostalgia quchen
14:34 <pgiarrusso> even some of the most sensible ones have downsides
14:34 igqg left
14:34 <quchen> Axman6: f (n+1) = n * f n -- here, have some more
14:34 <dysfun> i wasn't convinced for the longest time that OverloadedStrings was a bad default. then i changed my name
14:34 <Axman6> I never really liked n+k
14:34 <dysfun> s/name/mind/
14:35 <quchen> Booo
14:35 <cocreature> Axman6: heretic!
14:35 <pgiarrusso> dysfun: because of the extra constraints?
14:35 ubsan joined
14:35 <dysfun> because the error messages when it fails aren't helpful to beginners
14:35 <Aruro> yeah overloaded is good example, they are everywhere
14:36 <Axman6> it's a lovely thing to have if you're writing proofs, but it doesn't exactly bring a huge amount of benefit
14:36 <quchen> There should be a pragma that un-overloads strings to all be Text.
14:36 xenog joined
14:36 <dysfun> +1
14:36 <cocreature> quchen: yeah I’ve thought about making a proposal for that
14:36 <cocreature> but I’m lazy
14:36 <c_wraith> OverloadedStrings also makes a lot of things fail that wouldn't otherwise. IE, turning it on breaks valid Haskell programs.
14:36 <Axman6> -XOnlyTextStrings
14:36 <quchen> cocreature `seq` ()
14:36 <quchen> There you go
14:36 <Axman6> ()
14:36 <c_wraith> That sort of thing is why it's awkward to turn on all extensions
14:36 <cocreature> quchen: I’m not sure if whnf is sufficient
14:37 <cocreature> Axman6: you probably want the type it defaults to to be configurable
14:37 <quchen> cocreature: We’ll talk about this once you send me a link to the proposal
14:37 <cocreature> and that would lead you down a rabbit hole of parametrized extensions or something like this
14:37 <glguy> putting Text in the default declaration can help if extended defaulting is used
14:37 <pgiarrusso> could you use the existing defaulting mechanism for this?
14:37 balor_ joined
14:38 <Axman6> actually, I would love an extension which allowed you to write T"foo" as a Text string, B"foo" for bytestring, etc
14:38 <Axman6> does C++ have that these days?
14:38 <quchen> Yes. Proof: C++ has everything.
14:38 <quchen> (Okay I have no idea)
14:38 <pgiarrusso> Yes. Proof: C++ has this specific thing and people extend it with C++ macros
14:39 <cocreature> quchen: the only things missing are a sane syntax and sane semantics
14:39 <Axman6> http://en.cppreference.com/w/cpp/language/user_literal
14:39 <Jinxit> you can do it as "foo"_postfix
14:39 <Jinxit> and the _ is required
14:39 <glguy> Axman6: you can write t :: Text -> Text; t = id
14:39 <Axman6> I believe I've done that many times in the past :(
14:39 balor__ joined
14:40 <quchen> show t "hello world" -- glguy :-(
14:40 prophile joined
14:40 jer1 joined
14:40 <glguy> yeah, it's still going to need some () or$ of course
14:40 <dysfun> actually it's quite cool. you can use it to get type safety for unit maths
14:40 <Axman6> I was going to say that using ::Text isn't much more typing, but it also needs brackets most of the time
14:41 <tsani> id @Text ;)
14:41 <tsani> Really still not very good though.
14:41 <Axman6> :t "Foo"@Text
14:41 <lambdabot> error: parse error on input ‘@’
14:41 <quchen> LANGUAGE OverloadedStrings Text ← parameterized pragma would be cool, but that would be something entirely new
14:41 <tsani> yeah :(
14:41 <Axman6> :t "Foo" @Text
14:41 <lambdabot> error: parse error on input ‘@’
14:41 buttbutter joined
14:41 <Axman6> :(
14:41 <tsani> I wish literals could have type applications
14:41 <pgiarrusso> quchen: what about `default (Text.String)`
14:42 <pgiarrusso> that's already allowed by the language it seems
14:42 <pgiarrusso> > Haskell's defaulting mechanism is extended to cover string literals, when -XOverloadedStrings is specified.
14:42 <lambdabot> <hint>:1:68: error: parse error on input ‘,’
14:42 nut joined
14:42 dan_f joined
14:42 <cocreature> pgiarrusso: that’s not -Wall clean
14:42 <quchen> pgiarrusso: I think defaults can’t be orphans ..?
14:42 <glguy> defaults are per module
14:43 <glguy> nothing to do with orphans
14:43 <Axman6> jesus, reading that user defined literal stuff for C++, I am reminded just how insane C++ is. it's like people like making corner cases for the spec just so they can feel superior for knowing obscure facts about the spec >_<
14:43 <pgiarrusso> (source: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#overloaded-string-literals)
14:43 <quchen> I think nomeata proposed something like the un-specialization you mentioned, cocreature, now that I think of it. He used it for lists though if I recall correctly
14:43 nilof joined
14:44 <pgiarrusso> cocreature, glguy: OK, but do you want a *different* semantics for your extension?
14:44 eiriksfa joined
14:44 <Aruro> cabal has haskell 2010 and 25 language extensions, i can see now why haskell 2010 is important
14:45 <pgiarrusso> Aruro: half of those extensions either complicate the language *or* break working code *or* break guarantees *or* have other downsides
14:45 <pgiarrusso> Aruro: it's not like people haven't tried to extend the standard
14:45 <quchen> Or we don’t understand them (or their interaction, rather)
14:46 <Aruro> base is using 38 language extensions, i am Haskell2010 adept now
14:46 <pgiarrusso> I heard even standardizing MultiParamTypeClasses was too controversial, forget why
14:46 <Aruro> pgiarrusso: point is nobody write Haskell2010
14:47 <Aruro> so no guarantees anycase
14:47 <glguy> pgiarrusso: I haven't proposed a new extension
14:47 rasrajat joined
14:47 <pgiarrusso> glguy: ah, cocreature wanted to
14:47 <quchen> I write Haskell 2010 for the most part.
14:47 <glguy> Aruro: no, that's not true. many try to stick to Haskell 2010
14:47 <Axman6> what did 2010 add again?
14:48 <pgiarrusso> Aruro: you're welcome to volunteer help to standardize MultiParamTypeClasses: https://prime.haskell.org/wiki/MultiParamTypeClassesDilemma
14:48 <quchen> FFI, pattern guards
14:48 <rasrajat> i know object oriented concepts and java programming how or from where can i start data Science??
14:48 <quchen> ?quote elliott H2010
14:48 <lambdabot> elliott says: An interesting exercise is to try and imagine a language revision more conservative than H2010.
14:48 <Axman6> rasrajat: do you want to use Haskell?
14:49 _mu_ joined
14:50 <ph88_> what do i need to put these two streaming functions together? https://bpaste.net/show/fe33f4017ef3 i think at least the bind function, but also i need to deal with the state and probably give it the default state, should i use runState too ?
14:50 rasrajat left
14:51 balor__ joined
14:51 samir joined
14:52 ixxie joined
14:52 <Aruro> glguy: is it worth to stick to Haskell 2010?
14:53 <ph88_> Aruro, better use some extensions
14:53 <* shapr> hops excitedly
14:53 <ph88_> lol
14:53 <ph88_> what's up shapr
14:53 balor_ joined
14:53 <shapr> I've mostly figured out how to get clash-lang to go from Haskell to an ice40 FPGA!
14:54 <ph88_> sweet !
14:54 S1 joined
14:54 <shapr> ph88_: I spent a few hours this weekend figuring out how to install clash-lang from stack, and install yosys, icestorm, and arachne-pnr to get code loaded onto my ice40-hx8k breakout board!
14:54 S1 left
14:55 <ph88_> shapr, can you make a blog post about that ?
14:55 <Axman6> Aruro: it's not something I've ever had to think about, and I've been writing Haskell for about 9 years
14:55 <Axman6> shapr: nice!
14:56 <* Axman6> seconds the blog post request
14:56 <glguy> it's worth it to make the code as simple as you can
14:56 <glguy> easier to get right and understand
14:56 cdg joined
14:56 flatmap13 joined
14:57 <glguy> sometimes extensions pay for themselves, but it's not a given
14:57 <shapr> ph88_: yeah, once I get the last clash-lang problem solved, I'll put up a blog post on the haskell-embedded site
14:57 <Aruro> well, base is using extensions, how to write clean HAskell2010
14:57 <Axman6> why not use extensions?
14:58 <Aruro> Axman6: people here tried to argue Haskell2010 does exist
14:58 <Axman6> It was such a minor change that I guess it's just seen as the natural progression of the language
14:59 NikolajK joined
14:59 mthek joined
14:59 <Axman6> no one thinks about it
14:59 NikolajK left
14:59 NikolajK joined
14:59 <Axman6> it's just https://www.haskell.org/onlinereport/haskell2010/haskellli2.html#x3-5000
14:59 <pgiarrusso> Aruro: see https://mail.haskell.org/pipermail/haskell-prime/2006-February/000289.html for example downsides of extensions
15:00 <Axman6> (wow, we didn't have heirarchical module names before then?
15:00 asmyers joined
15:00 <pgiarrusso> people require extremely high quality (essentially perfection) before standardizing an extension
15:01 mbuf joined
15:01 jer1 joined
15:01 <Aruro> pgiarrusso: does it matter? code started to live its own life, people do use all of that mentioned in the email
15:01 <pgiarrusso> > I have another worry about MPTCs [...] The result is that missing instances get reported later than they do now.
15:01 <lambdabot> <hint>:1:38: error: parse error on input ‘]’
15:02 <pgiarrusso> Aruro: well, I don't use just Haskell 2010
15:02 <pgiarrusso> Aruro: you're the one complaining that more extensions aren't standardized
15:02 <Aruro> im complaining that they are not on by default
15:02 <Aruro> and i have to type
15:02 <Aruro> at least most major ones
15:03 <Aruro> and everybody types
15:03 windsing joined
15:03 <pgiarrusso> there's copy-paste, Cabal files, and even editor support for adding them if you use intero
15:04 <pgiarrusso> complaining in this channel won't change the "Haskell2010 by default" policy
15:04 <Aruro> who knows
15:04 zeroed joined
15:04 zeroed joined
15:05 <pgiarrusso> Well, who knows what happens if I drop an apple? We can make educated guesses on both, with similar confidence :-)
15:05 mohsen_ joined
15:05 <Aruro> pgiarrusso: come on, a lot of people read this channel
15:05 uglyfigurine joined
15:05 <pgiarrusso> I'd be less certain on a mailing list thread
15:06 <pgiarrusso> but there are reasons for the status quo
15:06 <Aruro> maybe spj does not read, but some of his coauthors certainly do read
15:06 <pgiarrusso> you can use `-fglasgow-exts` for now
15:06 <Aruro> pgiarrusso: ty
15:07 <pgiarrusso> as people mentioned
15:07 eklavya joined
15:08 <pgiarrusso> Aruro: well, the topic has been debated to death and some tradeoff has settled, that's the thing.
15:08 <Aruro> i understand, just saying that those debates lose meaning when de facto there is no haskell2010
15:09 <Aruro> in real life
15:09 sproingie joined
15:09 sproingie joined
15:10 sepp2k joined
15:11 seveg joined
15:12 <sproingie> silly question: what's the difference between -XGADTSyntax and -XGADTs?
15:12 nathiss joined
15:13 boombanana joined
15:13 netheranthem joined
15:13 <Aruro> one enables GADTS another just syntax
15:13 sepp2k joined
15:13 <Aruro> which can be used in data declarations
15:14 Itkovian joined
15:14 nathiss left
15:14 <Aruro> sproingie: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#generalised-algebraic-data-types-gadts
15:15 sepp2k joined
15:16 alexbiehl joined
15:16 <sproingie> "Notice that the return type of the constructors is not always Term a, as is the case with ordinary data types."
15:16 <sproingie> i take it that's the crucial distinction?
15:17 <sproingie> guess i could just switch the flags on some existing code and see
15:17 <dolio> GADTSyntax lets you write things in the 'data Foo where' style. GADTs lets you write actual GADTs.
15:17 <orion> dolio: What is an "actual" GADT?
15:18 raichoo joined
15:18 <orion> i.e. how is an actual GADT distinct from writing "data Foo where..."?
15:18 <sproingie> i assumed GADTs were mostly (very nice) syntax sugar for existentials
15:18 alexbiehl joined
15:18 Gurkenglas joined
15:18 beanbagu1 joined
15:19 sepp2k joined
15:19 <nshepper1> orion: Something where the return type of the constructor is not just Foo a, or with an equality constraint
15:19 <pgiarrusso> nshepper1: yes
15:20 oleo joined
15:20 oleo joined
15:20 sepp2k joined
15:22 jer1 joined
15:22 plutoniix joined
15:22 <dolio> orion: It's a data type that you wouldn't be able to write using normal data syntax (without using features that GADTs enables). :P
15:23 <dolio> And also not merely an existential type, I guess, because support for that predates GADTs.
15:23 plutoniix joined
15:23 <dolio> ls
15:23 <dolio> Whoops.
15:24 p0ff3 joined
15:24 stelleg_web joined
15:24 <orion> dolio: But GADTSyntax isn't normal data syntax.
15:25 <geekosaur> the description on that web page seems pretty clear to me
15:26 <geekosaur> orion, data Maybe a where Nothing :: Maybe a; Just :: a -> Maybe a -- is GADT syntax but a normal ADT (all constructors have the same result type)
15:27 <sproingie> it was the differing result type that i missed
15:27 <orion> Oh, I see now.
15:27 <geekosaur> and is identical in effect to the ADT syntax (but may be easier to understand)
15:27 <geekosaur> so, with actual GADTs, (a) the different constructors can have different types (b) those types come into scope when the constructor is pattern matched
15:28 <geekosaur> you can get (a) with an existential; GADTs add (b)
15:28 <geekosaur> and you can't get that any other way
15:28 <dolio> Eh?
15:28 <ski> (with an ordinary algebraic data type, the return type of each data constructor must be the type constructor being defined, applied to zero or more *distinct* type variables, and also the types of the data constructors must have no constraints)
15:28 pera_ joined
15:28 <dolio> The things that GADTs add over existentials is equality constraints.
15:29 <ski> (oh, and all (free) type variables in the argument types of the data constructors must occur also in the result type)
15:29 <dolio> Having non-uniform result types is the extra power of GADTs (which is equivalent to taking an equality argument).
15:30 <ski> (.. so it's not so much about "can have different types", but that it can differ from the format of tycon applied to distinct tyvars)
15:30 <dolio> Yeah.
15:31 forgottenone joined
15:32 newhoggy joined
15:35 conal joined
15:35 <orion> When you write "data Foo a = ..." is there an implicit (forall a.) added for every constructor?
15:35 trism joined
15:36 <geekosaur> yes
15:36 <dolio> Yeah, the result of every constructor is `Foo a`.
15:36 maarhart joined
15:37 ralu joined
15:40 newhoggy joined
15:40 <ph88_> i have little clue about how to use these functions together https://bpaste.net/show/fe33f4017ef3 i think i need at least bind and runState but i don't know in which order to apply them ..
15:41 <sproingie> with the evaluator example in the docs, i was able to get away with defining Term using just GADTSyntax and ExistentialQuantification
15:41 <sproingie> pattern matching however demanded full blown GADTs
15:42 <sproingie> i must say, seeing 'where' and specific types looks a lot more "existential" than the previous existential syntax
15:42 jer1 joined
15:42 Sh4rPEYE joined
15:43 <orion> Does anyone know of any other uses of GADTs that aren't the canonical evaluator example?
15:43 <ExpHP_> Boo yeah! Here's the memory profile of my new O(1)-memory-overhead streaming Yaml parser: https://goo.gl/5wHnz6
15:43 <sproingie> it's a pretty good example imho. beats Foo and Bar
15:44 <ph88_> ExpHP, what do we have to compare it to ?
15:44 <* ExpHP> starts furiously pressing up in his IRC client...
15:44 <sproingie> lot of complex datatypes are isomorphic to some evaluator anyway. i pulled that trick in lisp all the time.
15:44 <Sh4rPEYE> I want to have something like homebrew for hackage, so I can have the latest version of libraries and tools (hlint comes to mind). I don't build big projects, rather just individual files, so stack (I guess) doesn't really fit my needs. Is there something else?
15:45 <sproingie> Sh4rPEYE: that'd be stack
15:45 <ph88_> by the way ... how big is that yaml file that it needs 3 seconds to process
15:45 <ExpHP> ph88_: here: https://goo.gl/tLdaJy is the overhead of fromJSON :: Parser Value
15:45 <ExpHP> for a 4MB yaml file
15:45 <ph88_> attoparsec ?
15:45 <sproingie> stack is perfectly good for individual files too
15:46 <ExpHP> old one is yaml (aeson interface), new one is yaml (Libyaml interface) + conduit
15:46 <sproingie> tho in that case you're using it mostly like RVM
15:46 <ph88_> ExpHP, did you use those code annotations ? i don't remember what they are called .. but to define names in the memory profiling
15:46 sykora joined
15:46 ultalbot joined
15:46 <ph88_> ah you use ffi ?
15:47 <ExpHP> ph88_ I just throw a bunch of flags at GHC https://github.com/ExpHP/haskell-memory-halp/blob/master/makeit
15:47 <Sh4rPEYE> sproingie: It might be, I'm just a beginner. I though you have to use stack new/build and then it downloads specified libraries used by your project...
15:47 <ExpHP> ph88_ no ffi. (though I'm sure Text.Libyaml uses ffi under the hood)
15:47 <sproingie> Sh4rPEYE: put "#!/usr/bin/env stack" at the top of your file, then "-- stack runghc --package foo" as the second line (substituting foo for whatever package you're pulling in)
15:47 <glguy> orion: I don't know if this is different enough for you, but here's an example https://github.com/glguy/irc-core/blob/v2/src/Client/Commands/Arguments.hs#L24-L36
15:48 <sproingie> make it executable and pow, single file script that fetches all deps
15:48 Swizec joined
15:48 <ph88_> ExpHP, seems you use a lot less memory but it's twice as slow
15:48 <Sh4rPEYE> sproingie: Thanks
15:48 Swizec joined
15:49 <sproingie> Haskell is the best scripting language :)
15:49 <Sh4rPEYE> And if I want to have something like hlint always up-to-date systemwide?
15:49 Swizec joined
15:49 <sproingie> with stack there isn't so much a "systemwide" to think of anymore, though it does cache all the things
15:49 blym joined
15:50 <ExpHP> uh... well crud.
15:50 Swizec joined
15:50 <ExpHP> (though I think having a slow thing that runs is better than a fast thing that crashes)
15:50 cfricke joined
15:50 <ph88_> aeson crashes ?
15:50 beanbagula joined
15:50 <ExpHP> out of memory errors
15:51 <ph88_> oh
15:51 <ph88_> buy more memory :P
15:51 Swizec joined
15:51 <sproingie> Sh4rPEYE: though when you install a lot of deps with the default resolver, that version will end up accruing a lot of packages. you'll always have the latest curated stackage version though.
15:51 <ExpHP> I try to parse a 2GB file and it balloons to like 16GB RAM
15:51 <Sh4rPEYE> sproingie: That's the problem I had with it initially. So what would be the way there?
15:51 <sproingie> which isn't necessarily the bleeding edge version, but it's the one known to work
15:51 <ph88_> wow 2GB of yaml ?
15:51 skeet70 joined
15:51 <ExpHP> ph88_: blame the physicists
15:51 <ph88_> maybe yaml is the wrong format for that in the first place
15:52 <ph88_> lol
15:52 <ph88_> ok
15:52 <ph88_> ok they can wait longer :P
15:52 <sproingie> if you need specific versions, you may have to use different options in the stack comment. i'm not sure how, at that point it might be better to just start a stack project
15:52 <ph88_> ExpHP, ask them to export something that you can load directly into memory with mmap :P
15:52 <ph88_> ExpHP, then you don't need to parse it :D
15:52 <orion> glguy: Thanks.
15:52 <Sh4rPEYE> Well, I use hlint in VSCode, so the "systemwide" thing might be better
15:52 <ph88_> ExpHP, what do you do after parsing ?
15:53 ilyaigpetrov joined
15:53 mada joined
15:53 samir left
15:53 <ph88_> ExpHP, by the way .. could you take a look at my conduit question ? since you are using conduit yourself maybe you have an idea
15:53 dbeacham joined
15:53 <ExpHP> ph88_ I *cough* I write the vectors back out to binary files so I can read them faster later...
15:53 Levex joined
15:53 <ph88_> lol
15:53 <ExpHP> ph88_ then I do many many many dot products
15:53 <stelleg_web> anyone know how to access opaque constants in c2hs?
15:54 <glguy> orion: for context the 'ArgumentSpec' is used here where it's index is matched with an implementation. https://github.com/glguy/irc-core/blob/v2/src/Client/Commands.hs#L106-L115
15:54 <ExpHP> ph88_ possibly but I am also a complete noob at conduit :)
15:54 <ph88_> hi fellow noob !
15:54 <ExpHP> this will be the blind leading the blind
15:54 <ph88_> i have these two functions https://bpaste.net/show/fe33f4017ef3
15:54 <ph88_> no clue how to put them together
15:54 <ph88_> obviously not in the way on line 4
15:54 <ph88_> something with bind and runState i assume
15:55 <sproingie> IDE support stuff like hlint, might just install that globally if your IDE isn't otherwise stack-aware
15:56 coot__ joined
15:56 <sproingie> (intelliJ's stuff is stack-aware, dunno about VS)
15:56 robotroll joined
15:56 newhoggy joined
15:58 <sproingie> global install would of course be cabal-install
15:58 <ExpHP> ph88_ it looks like at the very least something needs to be made "impure". The StateT in the error message has Identity as its base so it can't support IO
15:58 <sproingie> tho hlint probably has standalone builds too
15:58 humboldt joined
15:58 sykora joined
15:59 windsing joined
16:00 ystael joined
16:00 Anyuta joined
16:00 <ExpHP> ph88_ in fact I'm not sure conduits with differnent base monads can be composed easily at all
16:00 <Sh4rPEYE> sproingie: I'll cabal-install that and use your method for the scripts.
16:00 <ph88_> ExpHP, ok ok thanks for trying :P
16:00 hastell joined
16:00 <ph88_> i also don't know
16:00 eazar001 joined
16:01 xenog joined
16:01 <eiriksfa> anyone here who can help me a bit? trying to learn haskell by 'converting' some of my old oo code, and I end up in a loop that I can't seem to solve (code: https://pastebin.com/0v9pUh0N, a bit messy, only the parts I consider relevant are added, can put up the rest if needed)
16:02 urodna joined
16:02 <ph88_> i need to find the smallest Double, so i like to start of with the biggest Double to compare to, how do i get the biggest Double in haskell ?
16:02 <ExpHP> ph88_ 1/0?
16:03 jer1 joined
16:03 Anyuta left
16:03 <ExpHP> > 1/0 :: Double
16:03 <prophile> ph88_: it's kind of disgusting, but I've done it as `read "Infinity" :: Double` before
16:03 <lambdabot> Infinity
16:03 <ExpHP> > Infinity
16:03 <ph88_> then i saw this comment and started to doubt https://stackoverflow.com/questions/2354707/in-haskell-is-there-infinity-num-a-a#comment2332197_2354766
16:03 <lambdabot> error:
16:03 <lambdabot> • Data constructor not in scope: Infinity
16:03 <lambdabot> • Perhaps you meant variable ‘infinity’ (imported from Data.Number.Natural)
16:03 <ph88_> > encodeFloat (floatRadix 0 - 1) (snd $ floatRange 0)
16:03 <lambdabot> Infinity
16:03 acertain joined
16:04 abhiroop joined
16:04 <ertes> err…
16:04 <ertes> https://www.haskell.org/onlinereport/haskell2010/
16:05 <ph88_> o/ ertes
16:05 <ertes> at the top it says "Copyright notice."
16:05 <ertes> i assume that's unintentional
16:05 newhoggy joined
16:06 Achylles joined
16:08 <sproingie> eiriksfa: you could move a lot of those guards to pattern matches in multiple definitions
16:08 Sonolin joined
16:08 <glguy> ertes: I think that that is intended to be read as the header for the following paragraph.
16:09 conal joined
16:09 <sproingie> the isNothing checks for instance. usually when you have a Maybe, you want to fmap over it, not check what it is
16:10 fizruk joined
16:12 <sproingie> also, if you find yourself doing a lot of \a -> (a, morestuff), then you have other functions that extract that a, you can get much cleaner looking code with do-notation in some monad
16:12 meandi_2 joined
16:12 <sproingie> but if you're not at that point, don't worry about it :)
16:12 simendsjo joined
16:13 newhoggy joined
16:14 <eiriksfa> any tips are appreciated, so thanks :)
16:14 osa1 joined
16:15 <eiriksfa> wrote them up, will look at them in order
16:15 <eiriksfa> but the issue of the code looping, is that a result of using 'Maybe' wrong?
16:17 soniku joined
16:17 <sproingie> hard to say without knowing where it's looping. infinite loops would be from either trying to consume infinite input, or forgetting a base case
16:18 cloudhead joined
16:18 <ph88_> I want to pipe a ConduitM BSC.ByteString Double IO () into a Conduit Double (State StreamState) Double but i don't know how to go from a ConduitM to a Conduit, anyone know ?
16:19 insitu joined
16:20 tomphp joined
16:21 newhoggy joined
16:21 baldrick joined
16:21 r1m4n joined
16:22 <cocreature> ph88_: Conduit is just a type synonym
16:22 <cocreature> and the only restriction is that the last argument of ConduitM is ()
16:22 <cocreature> so in your case there is nothing to do
16:22 <ertes> glguy: oh yeah, makes sense
16:23 jer1 joined
16:27 boombanana joined
16:28 refold joined
16:28 eatman joined
16:30 meoblast001 joined
16:31 HarveyPwca joined
16:32 eazar001 joined
16:33 rlaager1 joined
16:33 newhoggy joined
16:34 sleffy joined
16:35 abhiroop joined
16:36 ozgura joined
16:37 stevenxl joined
16:39 t7 joined
16:41 abhiroop joined
16:41 buttbutter joined
16:41 newhoggy joined
16:42 iomonad joined
16:43 `^_^v joined
16:44 afarmer joined
16:44 noteshui joined
16:44 jer1 joined
16:44 codesoup joined
16:46 insitu joined
16:46 mels joined
16:49 abhiroop joined
16:50 CurryWurst joined
16:50 newhoggy joined
16:53 conal joined
16:53 abhiroop joined
16:54 doomlord_ joined
16:55 richi235 joined
16:55 yinn joined
16:55 magneticduck joined
16:56 <ExpHP> think fast: using a function which is almost 90% guaranteed to already be in the dependency graph of any arbitrary haskell file...
16:56 <ExpHP> parse a float with possible failure
16:56 <ExpHP> (e.g. String -> Maybe Double)
16:57 <ExpHP> 0 points to whoever says fmap fst . find ((""==). snd) . reads because I'm currently doing that and it's extremely dumb
16:57 Maxou joined
16:57 abhiroop joined
16:58 simukis_ joined
16:58 <ski> > (\s0 -> listToMaybe [x | (x,s) <- (reads :: ReadS Double) s0,("","") <- lex s]) "12.3 "
16:58 <lambdabot> Just 12.3
16:59 connrs joined
17:00 <ExpHP> 0 points
17:00 <* ski> nods
17:01 y2 joined
17:02 <ReinH> At least readMaybe is in base
17:02 <ExpHP> :t readMaybe
17:02 <lambdabot> error: Variable not in scope: readMaybe
17:02 danthemyth joined
17:02 flatmap13 joined
17:02 <ReinH> (but not in Prelude)
17:02 newhoggy joined
17:03 <monochrom> Text.Read
17:03 <monochrom> @type fmap fst . find ((""==). snd) . reads
17:03 <lambdabot> Read b => String -> Maybe b
17:03 flatmap13 joined
17:04 twanvl joined
17:04 <ExpHP> @source readMaybe
17:04 <lambdabot> Unknown command, try @list
17:04 flatmap13 joined
17:04 jer1 joined
17:04 yellowj joined
17:05 <ExpHP> @src readMaybe
17:05 <lambdabot> readMaybe s = case readEither s of
17:05 <lambdabot> Left _ -> Nothing
17:05 <lambdabot> Right a -> Just a
17:05 <ExpHP> >_>
17:05 <ExpHP> @src readEither
17:05 <lambdabot> -- The old-style Read definition. The real one uses readPrec instead.
17:05 <lambdabot> readEither s =
17:05 <lambdabot> let s' = dropWhile isSpace s
17:05 <lambdabot> in case [x | (x, rest) <- reads s', all isSpace rest] of
17:05 <lambdabot> [x] -> Right x
17:05 <lambdabot> [] -> Left "Prelude.read: no parse"
17:05 <lambdabot> _ -> Left "Prelude.read: ambiguous parse"
17:05 <ExpHP> >_< why
17:06 <monochrom> What's wrong?
17:06 <ExpHP> how on earth is 'reads' the foundation of all fallible reading?
17:06 <ExpHP> (in base)
17:06 <monochrom> Haha
17:07 <monochrom> It was thought that it would be nice to accomodate ambiguous grammars so the result should be an arbitrary-length list rather than nailing to 0-or-1.
17:07 <ExpHP> @djinn ByteString -> Double
17:07 <lambdabot> Error: Undefined type ByteString
17:07 <ExpHP> @djinn String -> Double
17:07 <lambdabot> Error: Undefined type String
17:07 <ExpHP> @djinn [Char] -> Double
17:07 <lambdabot> Error: Undefined type []
17:07 <monochrom> Sure, 20 years later, we have found that no one actually uses the flexibility.
17:08 abhiroop joined
17:08 Cogitabundus joined
17:09 Cogitabundus joined
17:10 Achylles joined
17:10 <ski> > do b <- (do Just False `mplus` do Just True); guard b
17:10 <lambdabot> Nothing
17:10 rblaze joined
17:10 <ski> > (do b <- Just False; guard b) `mplus` (do b <- Just True; guard b)
17:10 <lambdabot> Just ()
17:10 sepp2k joined
17:10 <ski> > do b <- (do [False] `mplus` do [True]); guard b
17:10 <lambdabot> [()]
17:10 <ski> > (do b <- [False]; guard b) `mplus` (do b <- [True]; guard b)
17:10 <lambdabot> [()]
17:10 stelleg_web joined
17:11 Gurkenglas joined
17:11 Jinixt joined
17:12 wroathe joined
17:13 <qmm> what does the convention where an underscore is the last character in a variable name represent? e.g. let foo_ = ...
17:14 <ph88_> cocreature, could you give me a hint where i'm suppose to eval the state? i'm trying this (a :: ConduitM BSC.ByteString Double IO ()) .| (evalState (b :: Conduit Double (State StreamState) Double) startStreamState) but i think that does everything inside out (i get a type error here)
17:14 <ph88_> i think i'm first suppose to "unpack" the conduit before i eval the state
17:15 tommd joined
17:15 abhiroop joined
17:16 <ph88_> getting confused here
17:16 phyrex1an joined
17:18 Levex joined
17:18 soniku joined
17:18 noteshui joined
17:19 S1 joined
17:19 connrs joined
17:19 Herbstkind left
17:19 des_ joined
17:19 <ph88_> i see an example here with conduit and state https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/conduit-overview#lifting-operations but the first chain all conduits together before calling runState on it ... but when i chain all conduits together first it all goes wrong
17:19 NikolajK joined
17:19 NikolajK left
17:20 kattak joined
17:20 quobo joined
17:20 <ph88_> they do result = source $$ conduit =$ CL.consume runState result 5 i do a .| b and it goes wrong there already before i even have the chance to call evalState on the result of a .| b
17:20 mizu_no_oto_work joined
17:21 kosorith joined
17:21 magneticduck joined
17:21 newhoggy joined
17:21 abinr joined
17:22 <ph88_> maybe i need to fmap state over a first ?
17:23 <ph88_> fmap (x :: a -> State a) (y :: ConduitM BSC.ByteString Double IO ())
17:23 <ph88_> (i renamed a to y here)
17:23 pwnz0r joined
17:24 <* mivael> is trying to understand what exactly is "sequential" about the sequential application operator...
17:24 mmachenry1 joined
17:24 <ph88_> hmmm state should just be return when i'm in the state monad
17:24 <mivael> Why <*> is sequential application, whereas ($) is just "application"?
17:25 <mivael> Are there hints how to build an intuition about Applicative in a right way?
17:25 <mivael> I seem to understand mechanics of 'pure' and '<*> but I'm confused with this "sequential" thing about applicative functors.
17:25 danthemyth joined
17:25 jer1 joined
17:25 <ski> very roughly one could say that `Applicative' is about "static sequencing"
17:25 coot__ joined
17:25 bodisiw joined
17:26 afarmer joined
17:26 EvilMachine joined
17:26 <johnw> mivael: (<*>) can also be written liftA2 ($), if that helps
17:26 <Gurkenglas> mivael, "f <*> x :: State s b" will use the initial state to compute f and the resulting state to compute x
17:26 <ExpHP> mivael: Try writing a parser in attoparsec and it will become quite clear :)
17:26 <c_wraith> mivael, consider the case when both arguments to <*> are IO actions. they must happen in some order. that is the sequential it's talking about.
17:26 <ph88_> mivael, as i see it when you do add 2 $ 2 `add` 3 can still add 2 + 2 before adding 4 + 3
17:29 <ph88_> mivael, and how i see <*> is that it's a function to apply a function to a value inside a container. But if you have a containered type like a :: Maybe Foo Bar Bla Int then there is an order to which you must unwrap the stuff to get your Int ... so you have to use a lot of <$> there, but they will go in the sequence of first Maybe then Bar .. and so on
17:29 connrs joined
17:30 joehillen joined
17:31 prophile joined
17:31 <ski> mivael : with `fmap' (aka `(<$>)') you can "map over the contents" of a "container" (that's not always a very helpful analogy to think of it in terms of). but you can only map a "one-argument" function
17:31 <mivael> c_wraith, IO is a Monad, isn't it? (not just Applicative)
17:32 <ExpHP> ph88_ are you familiar with the 'mtl' library or 'transformers'?
17:33 <ski> mivael : with `(<*>)'/`liftA2', you can "map multiple-argument function", or in other words, *combine* several "values-in-context" to a resulting "value-in-context" (that's also not necessarily a very enlightening analogy)
17:33 cyborg-one joined
17:33 <ph88_> ExpHP, a little bit i think ... i vaguely remember including mtl in a project
17:33 <byorgey> mivael: yes
17:33 <ExpHP> ph88_ The main issue here is that the two conduits have a different base monad
17:33 <ExpHP> ph88_ you have
17:34 <ExpHP> ConduitM BSC.ByteString Double m ()
17:34 <ExpHP> ConduitM Double Double m Double
17:34 <ExpHP> oops, copied the wrong things
17:34 <ExpHP> ConduitM BSC.ByteString Double IO ()
17:34 <ExpHP> ConduitM Double Double (State StreamState) Double
17:34 <ExpHP> ^ that's what you have
17:35 <ski> mivael : when we combine several such "actions"/"containers"/"computations"/&c. the particular applicative functor we're using is *allowed* to depend on the *order* in which we combine them. thus `Applicative' *enables* (static) sequencing. this does not mean that every `Applicative' functor *actually* cares about the ordering, only that the interface `Applicative' *allows* it to depend on the "sequencing" ordering
17:35 <ExpHP> your first one can be generalized to (MonadIO m)=> ConduitM BSC.ByteString Double m () by putting liftIO in front
17:35 <ski> (which btw need, in general, have nothing to do with evaluation ordering)
17:35 <ph88_> mivael, no me Monad is Applicative (so wrapper-like stuff) with an extra dimension of values. The extra dimension it specific to the monad, for example if the Either monad fails it chooses to return the Left value i belief
17:35 <ExpHP> your second one can be generalized to (MonadState StreamState m)=> ConduitM Double Double m Double
17:36 <ExpHP> I think both of these signatures can be satisfied if your "core" is a StateT StreamState IO
17:37 <mivael> ski, Gurkenglas: in some sense, we do sequential computations without Applicative's, when composing functions: (*4) . (+7) $ 2 and (+7) . (*4) $ 2 ... form me it looks like sequencing
17:37 <ph88_> ExpHP, how to converge them ?
17:37 <ExpHP> ph88_ I will throw up a paste with some ideas
17:37 newhoggy joined
17:37 <ski> mivael : this is all a bit abstract, and hard to grasp, i realize. actual concrete `Applicative' functors (sometimes known as "idioms") do very different things, but have in commonality the "static sequencing" part i'm attempting to get at here
17:38 <mivael> Gurkenglas, I would say that (+7) $ 2 is a statof computation for (*4) . (+7) $ 2
17:38 <ReinH> mivael: (<*>) :: Applicative f => f (a -> b) -> f a -> f b is "f'y application", where what it means to be application depends on what it means to be "f'y". For IO, that means application sequences IO effects. For Maybe, that means application with a notion of failure. For Identity, it's the same as ($)
17:38 <ph88_> mivael, applicative is about container structures (to me), sequencing values with $ does not involve container
17:38 <ski> mivael : true. that is sequencing in data-flow
17:38 <ReinH> You can't talk about what <*> means generally except in generalities.
17:39 <ski> mivael : both `Functor',`Applicative' and `Monad' are about "contexts" or "containers", as ph88_ says
17:39 binaryplease joined
17:40 <ski> mivael : in the `Maybe' case, the "context" means that either we get an answer (the "default" or "pure" case), or (deviation from default) we get no answer (we get `Nothing')
17:41 <ReinH> For ((->) r), it means argument sharing (S combinator), [] is choice, ZipList is pointwise, etc, etc. In every case, the meaning of <*> depends on the structure of f.
17:41 <ski> mivael : in the `[]' (list type constructor) case, the pure case is to get (exactly) one answer. the deviation (or effect) is the possibility of getting no answer (empty list) or more than one answer (list with at least two elements)
17:41 <ph88_> Functor and Applicative is about the same to me (because i don't know enough yet)
17:41 mmachenry joined
17:42 sigmundv__ joined
17:42 <ski> `[]' is about possibly getting many potential answer (or no answer), and then continue computation by *trying them all* ! in all combinations
17:42 aglorei joined
17:42 <ski> > (+) <$> [100,200] <*> [3,4,5]
17:42 <lambdabot> [103,104,105,203,204,205]
17:43 <ski> > do x <- [100,200]; y <- [3,4,5]; return (x + y)
17:43 <lambdabot> [103,104,105,203,204,205]
17:43 <ski> > [x + y | x <- [100,200],y <- [3,4,5]]
17:43 <lambdabot> [103,104,105,203,204,205]
17:43 <ReinH> What they have in common are the types and the applicative laws, and that's all
17:44 <ski> in this case, "sequencing" means roughly "nesting loops trying all combinations of possibilities"
17:44 <ReinH> Honestly, I wish we wouldn't talk about <*> as sequencing except in cases where it makes sense, i.e., not as a general way to describe <*>
17:44 <ph88_> by the way how come i haven't run into MonadPlus yet ?
17:45 <ski> well, it *enables* sequencing. a particular idiom might not care about the sequencing order
17:45 <ExpHP> ph88_ MonadPlus is just alternative with some (very tenuous) rules
17:45 <ph88_> maybe not sequence of execution but sequence of wrapping containers
17:45 <ski> just like a monoid *enables* the combination operation to be non-commutative, but some monoids are in fact commutative
17:45 nschoe joined
17:45 <ExpHP> apparently most instances don't satisfy the "right zero" law
17:45 pwnz0r joined
17:46 <ph88_> ah ok ^^
17:46 jer1 joined
17:46 <ph88_> ExpHP, that monad of StateT StreamState IO sounded like a good idea
17:46 markus_ joined
17:46 <ph88_> i mean the type makes sense to me
17:46 replay joined
17:46 <ski> so the lack of a "commutative law" in the laws of `Applicative' means that it (in this sense) enables expressing sequencing
17:46 <mivael> ski, it seems I understood it!
17:46 unyu joined
17:47 <ReinH> If we want to be consistent, ($) has to be sequential application too, since it's isomorpohic to <*> of Identity
17:47 <ReinH> Which renders the term sequential meaningless as applied generally to <*>
17:47 <ski> i.e. the interface itself is related to being able to express sequencing. a particular instance of `Applicative' can well ignore this aspect of it, though
17:47 mmachenry joined
17:47 <ExpHP> ph88_ yeah but now that I'm trying to code up an example I'm not actually sure how to transform the IO conduit
17:48 <ski> (which leaves us then with a mere ability to express orderless "combination")
17:48 <markus_> was about to ask a question, but figured it out while writing.. #haskell -- also a rubber duck :)
17:48 <ReinH> if every type of application is sequential, what explanatory power does the word have?
17:48 <dolio> Identity is an example of a commutative Applicative.
17:48 <ExpHP> ph88_ since liftIO needs an IO to turn into something that isn't IO, and your IO is tucked away inside a conduit
17:48 <ExpHP> ph88_ however the state appears to be easy, because ConduitM implements MonadSTate when the core does
17:48 SlashLife joined
17:49 gienah_ joined
17:49 <mivael> While (+) is a symmetric operation, we can get different results depending on sequencing: (+) <$> [100,200] <*> [3,4,5] and (+) <$> [3,4,5] <*> [100,200] will result in different lists. This is what the sequencing is all about here. Right?
17:49 joehillen joined
17:49 <ph88_> ExpHP, you can reach io with liftIO from ConduitM i think because it's a monad transformer (honestly i don't know what i'm talking about but i've read something like that)
17:49 <ReinH> I guess if you're willing to try hard enough, you can make sequencing mean whatever you need
17:49 <ph88_> ExpHP, liftIO is on this page https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/conduit-overview
17:49 <mivael> ReinH :)
17:49 t7 joined
17:49 <lpaste> ExpHP pasted “idea for ph88_” at http://lpaste.net/7954594931899629568
17:49 <ski> mivael : anyway, you may perhaps wonder why i keep saying "*static* sequencing". well, using the same terminology, i'd say that `Monad' expresses "*dynamic* sequencing". of course that term requires explanation as well, in order to grasp what is meant by it
17:50 <ski> mivael : well ..
17:50 uuplusu joined
17:51 <ReinH> mivael: I don't think we need to invoke "sequential" just to point out that something isn't commutative.
17:51 <ski> mivael : you get different results there because `[]' isn't "commutative" (meaning : cares about ordering). if we imagine that we could have used sets instead of lists, then we'd have gotten identical results, though
17:51 <ReinH> (+) is commutative, liftA2 (+) is not (necessarily).
17:51 <ReinH> that is to say, not all Applicatives are commutative
17:52 abinr joined
17:52 <ReinH> as dolio pointed out above
17:52 <ski> mivael : .. have you grasped the `Monoid' type class, yet ?
17:52 <ReinH> commutativity can be a handy way to represent sequencing though, as in e.g. trace monoids, so I suppose the connection isn't all that tenuous
17:53 <ph88_> ExpHP, wow you making your own monad now ?? o_O
17:53 <ExpHP> ph88_ actually the thing with MonadIO is that a lot of times it is used to "section off" parts of a monad. e.g. to prevent the side-effects of one from leaking into another. (this is because IO itself is kind of a blank slate to start with, and it is the input to liftIO)
17:53 <mivael> ski, acquianted with it, I'd say :)
17:53 noteshui joined
17:54 newhoggy joined
17:54 exferenceBot joined
17:54 <ExpHP> ph88_ it isn't necessary for this small example but it can make it easier if you need to add more layers to the monad
17:55 <ph88_> ok
17:55 <ExpHP> I get the impression that it's generally a good idea to "hide" monad stacks when possible, since they don't always compose too well...
17:55 <ski> mivael : well, if we write `x <> y <> z', `x',`y',`z' all of some type `T', being an instance of `Monoid', then we have combined them in *sequence* into a new value of type `T'
17:56 <heath> i'm trying to recall a link and i'm not sure where i found it. the article was essentially a cheatsheet for common features between different languages: left/right function composition, left/right function application, etc.
17:56 SpinTensor joined
17:56 <heath> i think it was comparing f#, haskell, elm, and purescript
17:57 <ski> mivael : in `Sum 2 <> Sum 1 <> Sum 3', this given sequence of three values is actually immaterial, you'd get the same result (`Sum 6') with any other ordering of the three values (let's say the type is `Sum Integer' here, for concreteness)
17:57 <paf31> this one? https://hakonrossebo.github.io/functional-programming-babelfish/
17:57 <paf31> heath: ^
17:57 <ph88_> paf31 got triggered by purescript :P
17:58 <ski> mivael : in `Last (Just 2) <> Last (Just 1) <> Last (Just 3)' (of type `Last Integer'), the given sequencing actually matters
17:58 RegEchse joined
17:58 <mivael> ski, I understand
17:58 <heath> paf31: that's the one!
17:58 <tobiasBora> Hello,
17:59 <tobiasBora> I'd like to know, is there any class for "string-like" structures?
17:59 <ski> mivael : the same holds for combining "actions" with `(<*>)' beloning to `Applicative' -- whether the actual sequencing order matters or not depends on the particular type that's an instance of `Applicative' that's being used
17:59 hackebeilchen joined
17:59 chlong joined
17:59 <ph88_> tobiasBora, what's "string-like" ?
17:59 <tobiasBora> Because I'm tired of having to deal with Text, String, or Bytestring, and I'd like to write general code that could work with any of these types
17:59 <mivael> ski, I understand that
17:59 {emptyset} joined
18:00 <ph88_> ooh
18:00 orhan89 joined
18:01 <ski> mivael : however, in a sense, the "wiring" is fixed/static, with `Applicative', you can't have the "context" of a latter part in the sequence depend on the value computed in a former part -- hence "static". otoh, with `Monad', context of latter part *can* depend on value in former part -- hence "dynamic sequencing"
18:01 <mivael> ski, ...though the concept of static (as well as dynamic) sequencing seems still be hidden from me :) Maybe there is something I should read about that?
18:01 <MarcelineVQ> tobiasBora: https://github.com/haskell-backpack/backpack-str
18:02 <MarcelineVQ> idk if that's complete but backpack is about that sort of idea so it's worth looking at
18:02 <ski> mivael : "Applicative vs Monadic build systems" by ndm in 2014-07-23 at <http://neilmitchell.blogspot.se/2014/07/applicative-vs-monadic-build-systems.html> is about this distinction
18:02 mariusG` left
18:03 Itkovian joined
18:03 geekosaur joined
18:03 pwnz0r joined
18:04 <ReinH> ski: ugh are you convincing me to reevaluate my stance on "sequential"?
18:04 ChaiTRex joined
18:05 <mivael> ski, what you say about dependence of context seems enlightening... I will tink about it (and read the blog post as well). Thanks!
18:05 <ski> mivael : another example of this is parsing. with a monadic parser, you can first parse some text into some partial result (perhaps reading a token word, or reading a potentially more complex description of a format, or reading a packet (or whatever) length number), and then you decide which parser to continue parsing with, depending on the actual run-time value parsed just before
18:05 <tobiasBora> MarcelineVQ: It seems that backpack allow to change the whole code to go from one type to another, but it does not handle one code for all the types if I read it carefully...
18:06 <ReinH> mivael: you can see this in the types
18:06 <ski> mivael : with an applicative parser, this can't happen. you can't make part of the parser up at "run-time" (parser-time). you must fix it beforehand. this also means that applicative parsers can potentially be more efficient, since they can analyze the structure of the parser before any parsing has started
18:06 <ReinH> :t (<*>)
18:06 <lambdabot> Applicative f => f (a -> b) -> f a -> f b
18:06 <ReinH> :t (=<<)
18:06 <lambdabot> Monad m => (a -> m b) -> m a -> m b
18:06 sproingie joined
18:06 jer1 joined
18:06 <ski> ReinH : i'm not sure what your stance on "sequential" is
18:07 <ReinH> =<< (and >>=) lets your function make a choice of m, whereas <*> does not
18:07 mmachenry1 joined
18:07 <ReinH> ski: that talking about sequencing in general for applicatives isn't helpful. Once you relate it to commutativity of the underlying product it makes more sense.
18:08 <ReinH> in fact, =<< *requires* your function to make a choice of m, although one is always trivially available with pure.
18:09 <ski> "talking about sequencing in general for applicatives" is a bit vague. talking about it in general, for some individual (but more or less otherwise unspecified) instance of `Applicative' .. is probably not that much helpful
18:10 <ski> talking about it in terms of the "interface" `Applicative' itself, what it allows and does not allow .. may be more useful
18:10 <ski> if you know any group theory, i'd say the situation is a bit similar to e.g. categorical coproduct in there
18:11 mmachenry joined
18:11 newhoggy joined
18:11 <MarcelineVQ> tobiasBora: that sounds right, I guess it depends on your usecase, people sometimes use things like https://hackage.haskell.org/package/mono-traversable to write the same code over things like that, there may be more things like that
18:11 <ski> given two, say, abelian groups, what is the coproduct ?
18:11 <ski> well, it depends on whether you're after "coproduct of them as *groups*" or "coproduct of them as *abelian* groups"
18:11 <sproingie> everything i know about category theory i learned from Bartosz Milewski
18:11 mmachenry1 joined
18:12 <ski> so, it doesn't matter as much that the groups happen to be abelian in this case. what matters is whether you're taking that into account or not, when considering the coproduct
18:12 sheogorath joined
18:12 <ski> it's not a property of the groups themselves that you're concerned with. it's a property of the "context" in which you're considering the groups
18:15 <jaspervdj> If I do `mytool --version`, I'd like to see whether or not `mytool` was compiled using e.g. `-O2`. Is that info available anywhere at compile time?
18:15 windsing joined
18:15 <mivael> Thanks to you all! This was very helpful. Now I should take my time to think the whole thing all over again :)
18:15 <ski> i'm sorry if this is perhaps a not that elucidating attempt to try to make my point. i'm still trying to find better ways to get at what i mean
18:16 windsing joined
18:16 [exa] joined
18:16 <ph88_> ExpHP, i think i need to follow this answer http://stackoverflow.com/a/24528696 does that make sense to you ?
18:17 <mivael> ski, you mentioned several important points which triggered re-think process :) Thank you very much.
18:17 <ski> mivael : in any case, i emphasize again that the "sequencing" we're talking about here is a *conceptual* sequencing. it doesn't necessarily have anything to do with the order in which things are evaluated
18:17 <mivael> *my re-thinking process :)
18:17 <ski> (i mention this, because that seems to be a common misunderstanding about newbies to this)
18:18 <mivael> ski, okay, I will try to keep that in mind :)
18:18 Costar joined
18:18 <ski> what the "sequencing" actually *means*, depends on the particular type that's an instance of `Applicative' or `Monad'
18:18 kattak_ joined
18:18 flatmap13 joined
18:18 <sproingie> jaspervdj: at *compile* time, you have the flags because you're passing them. you could put them in a CPP macro and expand it somewhere in your source
18:19 <ph88_> what does this guy mean by "it's required to diagonalize by the monad laws" http://stackoverflow.com/a/31361060
18:19 <ski> (as i said, in the case of lists, the sequencing can be concretely be thought of as "nested looping, trying all alternatives/combinations". for other instances, it will mean something different, concretely)
18:19 roconnor joined
18:19 <jaspervdj> sproingie: Yeah I can put them in a CPP macro but was wondering if there's an existing macro or TH call I can use. I suppose not
18:20 kattak joined
18:20 newhoggy joined
18:20 caumeslasal joined
18:20 <sproingie> jaspervdj: nothing i know of. FSM knows i've wanted that feature in other languages too
18:20 <ski> ReinH : i believe that there's something to thinking about `Applicative' functors as relating to "sequencing". but that newbies get this confused in many ways, e.g. confused with order-of-evaluation, to mention one
18:20 <sproingie> you kinda get it for free in C with CFLAGS but that doesn't always match reality
18:21 coot__ joined
18:21 <ski> i'm attempting to grasp at that "something" .. perhaps not that successfully
18:21 <ReinH> ski: I think you're doing well, you're starting to convince me. :)
18:21 kattak__ joined
18:22 <ski> ok, ty
18:22 kattak___ joined
18:22 nilg joined
18:23 insitu joined
18:24 sigmundv joined
18:24 nitrix joined
18:25 ogkloo joined
18:25 <Gurkenglas> @tell merijn http://hackage.haskell.org/package/one-liner-0.8.1/docs/Generics-OneLiner.html#v:binaryOp should help with http://lpaste.net/354843
18:25 <lambdabot> Consider it noted.
18:25 ClaudiusMaximus joined
18:26 chaosmasttter joined
18:26 <ski> (if i were to be more complete, i'd possibly say "sequencing of combination", and not just "sequencing". since even in the case of instance of `Applicative' resp. `Monad' that are "commutative", we're still left with the conceptual "combination" aspect to interpret in each particular such cse)
18:27 jer1 joined
18:29 quobo joined
18:29 boombanana joined
18:29 mac10688 joined
18:29 kattak joined
18:29 piyush-k` joined
18:32 orhan89_ joined
18:33 govg joined
18:35 kamog joined
18:35 vague-cl joined
18:35 MarioBranco joined
18:36 locallycompact joined
18:37 nut joined
18:37 <nut> is this code a bug? map (flip addUTCTime now) [1..3]
18:37 <ph88_> how can i leave a message with lambdabot ?
18:37 <nut> where 'now' is UTCTime
18:38 orhan89_ joined
18:38 <nitrix> ph88_: @tell <name> <message>
18:38 benzrf joined
18:38 path[l] joined
18:38 <nut> map (flip addUTCTime now) [1..3] produces an infiite list. I don't get it
18:38 <sproingie> impossible
18:39 <sproingie> what's addUTCTime look like?
18:39 <nut> :t addUTCTime
18:39 <lambdabot> error: Variable not in scope: addUTCTime
18:39 <ReinH> map can't change the size of the list
18:39 sssilver joined
18:39 <ReinH> so something else is the problem
18:39 <nut> addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime
18:40 <monochrom> Is it an infinite list? Is it a really long finite list?
18:40 <ReinH> apparently it's [1..3]?
18:40 <ReinH> wait
18:40 <nut> try it in 'stack ghci'
18:40 ikke joined
18:40 <ReinH> the ..
18:40 <MarcelineVQ> nut: what is 'now' ?
18:40 <ReinH> what is [1..3] :: [NominalDiffTime] ?
18:40 <monochrom> Enum for NominalDiffTime may give you a lot of fractions between 1 and 3.
18:40 <ReinH> I bet it's infinite
18:40 <ReinH> or very long
18:41 <sproingie> how could it be more or less than 3 elements?
18:41 <ReinH> because .. depends on the Enum instance
18:41 <monochrom> It's finite but very fine-grained, it's one of the fixed point number types from Data.Fixed, probably the Pico one.
18:41 <nut> monochrom: ah...right
18:41 <ReinH> which can do whatever it wants
18:41 <nut> so what's the step for [1..3]
18:41 <ReinH> e.g., interpret 1 as hours and then succ by microseconds
18:41 <nut> i thought it is 1
18:41 <nitrix> monochrom: What determines the step size of Double vs. NominalDiffTime?
18:42 <monochrom> > 0 :: E1
18:42 <lambdabot> error:
18:42 <lambdabot> • No instance for (Num E1) arising from the literal ‘0’
18:42 <lambdabot> • In the expression: 0 :: E1
18:42 <ReinH> The implementation of Enum determines the step size.
18:42 <sproingie> oh indeed it's a very big list
18:42 <monochrom> Ah, I'm supposed to:
18:42 <monochrom> > [1..3] :: Deci
18:42 <lambdabot> error:
18:42 <lambdabot> • Couldn't match type ‘[Integer]’ with ‘Data.Fixed.Fixed E1’
18:42 <lambdabot> Expected type: Deci
18:43 <ReinH> try map (flip addUTCTime now . fromInteger) [1..3]
18:43 <ReinH> forcing [1..3] :: [Integer]
18:43 <nut> thanks you guys!
18:43 <ReinH> or just use [1,2,3]
18:43 <monochrom> Oh! List!
18:43 <monochrom> > [1..3] :: [Deci]
18:43 <lambdabot> [1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8...
18:43 <ReinH> heh
18:43 <monochrom> There.
18:43 <nitrix> That's very nice.
18:44 <monochrom> NominalDiffTime is only worse. (Pico, 10^-12)
18:44 <ReinH> haha it was even worse than I thought
18:44 <sproingie> i imagine [1..3] is an example. any range would be a problem
18:44 <nitrix> So, I suppose it's using Enum (Fixed Deci) ?
18:44 <nitrix> Which is implemented as steps of 0.1 ?
18:44 Levex joined
18:44 <ReinH> [n..m] is sugar for enumFromTo n m, which uses succ internally
18:45 <ReinH> and succ determines the step size
18:45 newhoggy joined
18:45 bor0 joined
18:45 <ReinH> Enum is kind of weird.
18:45 <nitrix> Does this means someone could implement a "theorically" finite list, as far as Haskell is concerned, when it's in reality infinite precision?
18:45 <nitrix> (e.g. some Integer-like float)
18:45 <monochrom> For Deci it is fairly uncontroversial to have step size 0.1 because that's what Deci does and it's a discrete number system.
18:45 <ReinH> nitrix: I could define succ for natural numbers as succ n = n
18:46 <ReinH> then any enumeration of these broken nats would be infinite
18:46 <nitrix> ReinH: but that's breaking some of the laws isn't it ?
18:46 <sproingie> thus the name Deci. Is there a Centi?
18:46 <ReinH> what laws?
18:46 <monochrom> Yes!
18:46 <monochrom> Check out Data.Fixed for much goodies.
18:46 ubsan_ joined
18:46 <MarcelineVQ> this is indeed much goodies
18:46 <monochrom> type Deci = Fixed E1
18:47 <* sproingie> usually works with Data.Broken
18:47 <nitrix> ReinH: I'd expect `succ x > succ`
18:47 <monochrom> Haha
18:47 <ReinH> nitrix: please point me to these Enum laws ;)
18:47 <nitrix> ReinH: I'd expect `succ x > x`
18:47 <ReinH> Ok, please point me to where that is specified.
18:47 <sproingie> :i Enum
18:47 <monochrom> I know the Enum laws. But they are still pretty much open-ended.
18:47 mmachenry joined
18:47 jer1 joined
18:47 <nitrix> ReinH: It's a throw in the dark. I see where you're going with this. That's very naughty.
18:48 <ReinH> Enum is lawless.
18:48 <ReinH> It is cats and dogs living together.
18:48 <monochrom> Even if you take into account the common laws, it's basically "try your best at an order isomorphism between your type and Integer or Natural"
18:48 <sproingie> i imagine one such law would be succ x < x
18:48 <sproingie> er >
18:49 TheLemonMan joined
18:49 <sproingie> greater, lesser ... pfft who cares ;)
18:49 <ReinH> monochrom: there are Enum suggestions.
18:49 <monochrom> And there is an order isomorphism between Integer and Fixed E1. It scales by 10.
18:49 <ReinH> > succ ()
18:49 <lambdabot> *Exception: Prelude.Enum.().succ: bad argument
18:49 <ReinH> how about those laws
18:49 <nitrix> Now that I think about it, `succ x /= x` would be the most important, otherwise you don't even have a successor, but I can't find that anywhere.
18:50 Sampuka joined
18:50 <nitrix> ReinH: Ah! Case in point. Nice example.
18:50 <sproingie> unsafety really succs
18:50 <ReinH> why must succ x /= x?
18:50 <ReinH> that's true for Peano numbers, but it's true axiomatically.
18:51 <ReinH> also let's not even get into the correct number of 'c's in suc
18:51 <nitrix> Because if you have only one element, there's no succession o.<
18:51 <ReinH> according to your definition of succession
18:51 <nitrix> Why would Enum () even exist.
18:51 <sproingie> but unit is still an Enum instance
18:51 <ReinH> why am I bound by your definition of succession?
18:51 <ReinH> > fromEnum ()
18:51 <lambdabot> 0
18:51 <ReinH> > toEnum 0 :: ()
18:51 <sproingie> nitrix: convenience, just in case you wanted another way to raise runtime errors
18:51 <lambdabot> ()
18:51 <ReinH> That's the entire reason it exists.
18:52 <ReinH> oh wait
18:52 <ReinH> > [() .. ()]
18:52 <lambdabot> [()]
18:52 <nitrix> Cute ascii robot :]
18:52 <ReinH> > [(),()..()]
18:52 <lambdabot> [(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),...
18:52 <ReinH> fun times
18:52 <sproingie> my god. it's full of units.
18:52 JonReed joined
18:52 SlashLife joined
18:53 connrs joined
18:54 <nitrix> That makes me think toEnum/fromEnum should be independent of `succ` somehow, but I'm sure I'm alone on that view.
18:54 <ReinH> The type [()] is a forgetful list, a.k.a. a natural number.
18:54 raichoo joined
18:54 <monochrom> I don't think it's useful to make a distinction between "law" with "suggestion".
18:54 <sproingie> the suggestion of gravity
18:54 <MarcelineVQ> you have to be able ot enforce laws
18:54 <ReinH> monochrom: Well, they are not laws in the conventional sense of being laws.
18:54 newhoggy joined
18:55 <ReinH> they aren't documented with the typeclass
18:55 <Tuplanolla> Can you not use laws in rewrite rules, monochrom?
18:55 <MarcelineVQ> "Enum, you betrayed the law"
18:55 <sproingie> Suggestion of Gravity would be a cool band name
18:55 <ReinH> maybe they are folk laws
18:55 <monochrom> Haskell 2010 section 6.3.4: "For any type that is an instance of class Bounded as well as Enum, the following should hold:" "The calls succ maxBound and pred minBound should result in a runtime error."
18:56 <ReinH> monochrom: yes, note the caveat
18:56 dm3 joined
18:56 <ReinH> those are laws for (Enum t, Bounded t)
18:56 <MarcelineVQ> playing tonight Suggestion of Gravity with opening set by Boson Bison
18:56 <monochrom> If you honour the "should" there, that clause applies to ().
18:56 <monochrom> It is not because nitrix likes it. It is because Haskell 2010 likes it.
18:56 orhan89 joined
18:56 insitu joined
18:56 <sproingie> sure would be nice if the prelude were safe
18:57 <ReinH> Again, that doesn't apply to Enum, it applies to Enum + Bounded
18:57 sophiag joined
18:57 orhan89` joined
18:57 noddy joined
18:57 Maxou joined
18:57 <monochrom> () is Enum + Bounded
18:57 <ReinH> Enum per se does not have laws
18:57 <ReinH> Yes, so?
18:57 <monochrom> > maxBound ()
18:57 <lambdabot> error:
18:57 <lambdabot> • Ambiguous type variable ‘a0’ arising from a use of ‘show_M140710939598...
18:57 <lambdabot> prevents the constraint ‘(Show a0)’ from being solved.
18:57 <monochrom> > maxBound :: ()
18:57 <lambdabot> ()
18:57 <monochrom> So succ () = bottom.
18:57 <cocreature> > succ (maxBound :: ())
18:57 <lambdabot> *Exception: Prelude.Enum.().succ: bad argument
18:57 <ReinH> Yes. That's true, but doesn't imply that Enum has laws.
18:57 <nitrix> See, to me `succ` should belong in Bounded.
18:58 alx741 joined
18:58 <ReinH> It just implies that Enum + Bounded has laws, which was the premise.
18:58 <cocreature> nitrix: that doesn’t make sense either
18:58 <cocreature> nitrix: why do you need something to be bounded to provide a successor function
18:58 <sproingie> Integer isn't bounded, that has succ
18:58 <nitrix> cocreature: Ah sorry, no you're right, this is still flawed.
18:59 <tobiasBora> MarcelineVQ: Thank you!
18:59 <Tuplanolla> :t suck -- We clearly need this too.
18:59 <lambdabot> Enum a => a -> Maybe a
18:59 <ReinH> If Enum had laws, they might be things like "succ should equal toEnum . succ . fromEnum when it is defined"
18:59 <tobiasBora> Another question,
18:59 <sproingie> Suckable a
18:59 <monochrom> Fine.
18:59 <tobiasBora> I'd like to return a type "IO (Either String String)"
19:00 ompaul joined
19:00 <ReinH> monochrom: some fast and loose laws of that nature might be useful
19:00 mkoenig joined
19:00 <ReinH> "if it's defined it must behave like so"
19:00 <monochrom> No, that is not my disagreement.
19:00 <tobiasBora> I've a function "myfunction :: Int -> Either String String"
19:01 <monochrom> "All prime numbers are odd" from your POV is a theorem about prime numbers not natural numbers. From my POV it is a theorem about natural numbers too.
19:01 <ski> tobiasBora : use `return' ?
19:01 <ReinH> it doesn't follow from "an instance of Enum has laws, which it gets by virtue of also being an instance of Bounded" that "Enum has laws".
19:01 Levex joined
19:01 <monochrom> Err, "all prime numbers above 2".
19:01 patientj joined
19:01 <sproingie> well, a subset of naturals. 4 is a natural number
19:02 <ReinH> it is properly a theorem about natural numbers which are also prime numbers
19:02 <tobiasBora> ski: The thing is that if "myfunction" returns "Right ...", I'd like to do others stuff
19:02 <ReinH> it says nothing about natural numbers which are not prime numbers
19:02 <sproingie> the theorems kind of define the subset in the first place
19:02 <ReinH> the same is the true for the Enum + Bounded laws
19:02 HarveyPwca joined
19:02 <cocreature> if you phrase it like "forall (n : nat), is_prime n -> is_odd n" it’s a statement about all natural numbers
19:02 <ReinH> monochrom: anyway, this isn't a particularly interesting thing to disagree on
19:03 <ski> tobiasBora : then do so ?
19:03 path[l] joined
19:03 newhoggy joined
19:03 <ski> tobiasBora : you can use `let result = myfunction myInt' as a command in a `do'-block
19:03 zeroed joined
19:03 zeroed joined
19:04 <ski> tobiasBora : then you could use `case' (or the function `either') on `result'
19:04 <ski> tobiasBora : an alternative, iiuc, would be to use `ExceptT String IO String' instead of `IO (Either String String)'
19:04 <Tuplanolla> Suddenly `forall (x : real), is_nat x -> is_prime (round x) -> is_odd (round x)` is a statement about all numbers, cocreature.
19:04 <ReinH> :t let myFunc = undefined :: Int -> Either String String in return . myFunc
19:04 <lambdabot> Monad m => Int -> m (Either String String)
19:05 doomlord_ joined
19:05 <cocreature> Tuplanolla: yep :)
19:05 <ski> (all that does is hide the extra plumbing of the `case', and not continuing in the case of `Left')
19:05 <monochrom> It is fundamental. Suppose you have two functions f,g and they satisfy "f . g = id". Is this a law about f? g? id?
19:05 <ReinH> cocreature: this is a boring disagreement about either definitions or logical connectives. ;)
19:05 <monochrom> My POV is that it is useless to rigidly put laws into bins like that.
19:05 <cocreature> ReinH: yeah, I’ll shut up now :)
19:06 <ski> tobiasBora : i.e. .. *if* indeed you're using the `Left' case as "failure detected, abort further processing", *then* a use of `ExceptT' here could be appropriate
19:07 <monochrom> But people who absuse the Curry Howard correspondence do precisely that. They want the type of f to fully specify the properties of f. Ah but you can't, it is the mutual interaction of f and g, even and id, that is the most important property.
19:07 e14 joined
19:07 <ReinH> monochrom: and mine is just that a proposition which holds forall A + B does not (necessarily) hold forall A. If all men are named Fred, that doesn't imply that all people are named Fred. See how boring this argument is? ;)
19:07 <monochrom> My POV is "X has laws" should be laxly interepreted as "there are laws involving Enum".
19:08 <cocreature> I don’t think you are going to agree here no matter how long you explain your povs :)
19:08 <ReinH> Ok, a disagreement about definitions then. :)
19:08 jer1 joined
19:08 <monochrom> I am explaining to other people.
19:08 <sproingie> "This is not 'nam, this is programming. There are rules!"
19:08 <ski> well, `forall x : A. exists y : B. R (x,y)' is equivalent to `exists f : A -> B. forall x : A. R (x,y)'. in the former case, the property is baked into the result of the operation. in the latter case, the property is stated separately
19:08 xinming joined
19:09 <ReinH> ski: Yes, as I said, it's a disgreement about either definitions or which connectives we're using. :D
19:09 <ExpHP> does adding an INLINABLE attribute toa function have any effect when its only uses are inside the same module?
19:09 <ReinH> *disagreement
19:09 <ski> (so it only applies to one way of using the CH)
19:09 <ski> ReinH :)
19:10 <MarcelineVQ> tobiasBora: there's a few options as you can see, so if you want a more specific answer for your question you'll need to show the code you're working on and what you intend for it to do
19:10 JoshS joined
19:10 <ReinH> ski: I don't think either of us are going to benefit from pursuing it, but I don't mind monochrom clarifying his point.
19:10 <ski> was someone claiming that there should be laws that apply when you have something that simultaneously an instance of `Enum' and `Bounded' (or `Read' and `Show', or ...) ? (i didn't follow the start of the conversation)
19:10 windsing joined
19:11 <monochrom> Yes. It's in Haskell 2010.
19:11 <ReinH> ski: The argument was that "there are laws for Enum" because "there are laws for Enums which are also Bounded"
19:11 <ReinH> And we disagree about which entailment we're using.
19:11 <ski> monochrom : *nod*. i believe that's a mistake
19:11 <ski> ReinH : mhm
19:12 hive-mind joined
19:12 fizruk joined
19:12 <ReinH> or which quantifier, or something
19:12 <ReinH> whatever :)
19:13 <monochrom> If you're commenting on that law itself, I am fine with either "succ maxBound = maxBound" or "succ maxBound = bottom". I am not OK with leave it open so some types do one thing and some other types do the other thing.
19:13 <Tuplanolla> It should not, unless you export it, ExpHP.
19:13 <sproingie> what would be Bounded and not Enum?
19:13 <ski> (.. or at least, it being a mistake, without there being some kind of "pushouty" machinery, if you'll allow that vague term, that determines the interaction. and in this case, there's presently no such machinery, i believe)
19:13 hylophile joined
19:14 darjeeling_ joined
19:15 <ski> sproingie : hm .. how about some partially, but not totally, ordered type, having a maximum and minimum element ?
19:15 <ReinH> ski: timey wimey pushouty wooshouty
19:15 <monochrom> I think (Enum t, Bounded t) is already the pushout?
19:15 <ski> > minBound :: (Bool,Bool)
19:15 <lambdabot> (False,False)
19:16 <ExpHP> thanks Tuplanolla
19:16 <ReinH> monochrom: btw did you see that idris removed constraint products and now curries them? so Enum t => Bounded t => ...
19:16 <ski> monochrom : yes, but then were does the law "attach" ? nowhere afaics
19:16 <ReinH> This makes me wonder if I've been confused about what => means this whole time
19:17 <ski> (er, s/were/where/)
19:17 kmels joined
19:17 coot__ joined
19:17 <tobiasBora> ski: Hum ExceptT may be usefull, I'm tired of using case everywhere
19:17 <monochrom> ski, if I have a law "f . g = id", do you attach it to id?
19:17 <* ski> smiles
19:18 <ski> i dunno. i suppose you could, if you really wanted to
19:18 MrWoohoo joined
19:18 <monochrom> The whole reason why I don't attach rigidly.
19:19 newhoggy joined
19:19 <ski> if person A makes `T' an instance of `Enum', and person B makes `T' an instance of `Bounded', then whose responsibility is it to check the additional laws ?
19:19 soniku joined
19:19 <sproingie> id being just a function, the context how you use it depends on the class. should be attached to, say, Functor
19:19 <sproingie> not that you can enforce it there either
19:20 <monochrom> Ah. I'll arbitrate it to the chronologically second person.
19:20 pera joined
19:21 <ReinH> ski: ah you want the cartesian product ;)
19:22 unyu joined
19:22 <ReinH> in the category of, I guess, mostly garbage sequences of mostly ASCII
19:22 <ski> if person A puts a group structure on a set `S', and person B puts a topological structure on `T', then whose responsibility is it to check that we have a topological group ?
19:22 <monochrom> I suppose you then say "we don't know who's chronologically second"
19:23 <ReinH> you want (Enum t, Bounded t) to exist somewhere in code once Enum t and Bounded t do separately
19:23 <ReinH> maybe it's a shame that we're working in mostly garbage sequences of mostly ASCII for this
19:24 <ski> (er, puts a topological structure on `S', not `T'. sorry)
19:24 <monochrom> Then by the law of Excluded Middle, this sofware is either corporately developed or open-sourcedly developed.
19:24 <ReinH> heh
19:24 <monochrom> If corporately developed, the project manager will do the arbitration.
19:24 pwnz0r joined
19:24 <sproingie> law, fallacy, whatev ¯\_(ツ)_/¯
19:24 <* ski> excludes middlemen
19:25 <monochrom> If open-sourcedly developed, the matter will be democratically resolved by loud yelling.
19:25 albertus1 joined
19:26 Levex joined
19:27 Durbley joined
19:27 <monochrom> Oh I guess that doesn't show the full beauty of excluded middle, eh?
19:27 bjz joined
19:27 newhoggy joined
19:28 <monochrom> In the corporate setting, a lout of loud yelling is also how the project manager (or God help us, a lot of project managers) arbitrates.
19:28 <* ski> thinks "excluded middle" (in the general), to the extent it's applicable, is basically `id'
19:28 <monochrom> So, excluded middle followed by disjunction elimination yields: loud yelling.
19:28 <ph88_> is there a last seen function on lambdabot ?
19:28 <monochrom> Not anymore.
19:29 halogenandtoast joined
19:29 jer1 joined
19:30 <monochrom> Next I show you the beautiful proof of why the set { n in Nat | the twin-prime conjecture is true } is decidable. :)
19:30 <ReinH> monochrom: once again why we must decisively smash the formalist clique
19:30 <sproingie> monochrom: won't fit in the margin, eh?
19:30 <monochrom> will fit
19:30 <monochrom> 3 lines
19:30 <ReinH> for sufficiently large sizes of margin
19:30 <ski> (iow, if you're proving `A or B' by assuming `not A' and proving `B', what you're doing is shirking the responsibility of refuting `A' to the "opponent". if and when they do that, you promise to then prove `B'. iow, instead of getting to the work of determining the alternative, you wait for the opponent to do some work)
19:30 <sproingie> becauseISaidSo :: a -> Bool
19:31 <monochrom> By excluded middle, the twin-prime conjecture is true or false.
19:31 <monochrom> If true, \x -> True decides that set. If false, \x -> False decides that set. Disjunction elimination => the set is decidable.
19:31 <ski> (.. so, it amounts to two different senses in which to take `or')
19:32 connrs joined
19:32 e14 joined
19:32 epsilonhalbe joined
19:33 joelthepirate joined
19:34 <ski> therefore, the proof above proceeds by using an introduction rule for one kind of disjunction, and then using an elimination rule for another kind of disjunction :)
19:34 <monochrom> I'm pretty sure both "or"s enjoy elimination.
19:35 <ski> indeed
19:35 `^_^v joined
19:35 sleffy joined
19:36 <* shapr> hops cheerfully
19:36 {emptyset} joined
19:37 <monochrom> That came out bizzare if anthropomorphized. "Both John and Johan enjoy elimination" Yikes.
19:37 Carisius joined
19:38 ChaiTRex joined
19:38 <sproingie> not eliminating at all tends to be unpleasant
19:38 agjacome joined
19:38 abinr joined
19:39 <* ski> idly ponders destructive logic
19:39 chrisdotcode joined
19:39 <cocreature> ski: hm, does that mean you’re only allowed to use elimination rules?
19:40 chrisdotcode left
19:40 <ski> (cf. Subtractive logic, Dual-intuitionistic logic. Rajeev Gore, Crolard, Igor Urbas, &c.)
19:40 m` joined
19:40 <monochrom> allow excluded middle, disallow absurdity ((p and not p) -> q)
19:40 Arbeiter joined
19:41 simukis_ joined
19:41 <ski> monochrom : hm. the last now reminds me of relevant/relevance logic
19:41 windsing joined
19:42 windsing joined
19:42 <monochrom> I don't know how to use this logic, but I love dualization.
19:44 <ski> cocreature : no. i think one way to look at it is to consider the primary judegment being "does not follow from". so to speak, everything is considered to be potentially true, until (and if) it has definitely been refuted
19:44 newhoggy joined
19:45 <ski> `exists a : A. forall b : B. R (a,b)' should be equivalent to `forall f : A -> B. exists a : A. R (a,b)'. cf. Kreisel's "no counter-example interpretation"
19:46 <monochrom> R(a, f a) in the second.
19:46 <ski> er, right
19:46 <ski> ty
19:47 <monochrom> Wait, forall f? exists f?
19:48 <ski> it's some kind of "backwards choice"
19:48 fotonzade joined
19:48 <monochrom> It's forall I guess.
19:48 ystael joined
19:49 <ski> pick `R (a,b)' as `not (S (a,b))', apply classical logic to arrive at choice
19:49 jer1 joined
19:50 nickager joined
19:50 blender1 joined
19:50 <monochrom> Ah yes. Beautiful.
19:51 shainer joined
19:51 newhoggy joined
19:52 <ski> to refute `exists a : A. forall b : B. R (a,b)', you should for any given `a : A' produce a `b : B' refuting `R (a,b)'. to refute `forall f : A -> B. exists a : A. R (a,f a)' you provide this transformation from `a : A' to `b : B', so that in the event of someone daring to put forward an `a : A', you can refute `R (a,f a)'
19:52 Swizec joined
19:53 blym joined
19:53 raichoo joined
19:54 chaosmasttter joined
19:55 patientj left
19:55 Eduard_Munteanu joined
19:56 <ski> <https://xorshammer.com/2008/08/13/kreisels-no-counterexample-interpretation/> has some info on Kreisel's no counterexample interpretation
19:56 <sproingie> great blog title
19:57 orhan89 joined
19:57 orhan89` joined
19:58 Arbeiter joined
19:58 nut joined
20:01 newhoggy joined
20:02 Levex joined
20:03 blym_ joined
20:03 takuan joined
20:06 bennofs joined
20:07 smillmorel joined
20:08 baldrick joined
20:09 newhoggy joined
20:09 a3Dman joined
20:10 danthemyth joined
20:10 jer1 joined
20:13 cdg joined
20:14 <ij> I can't find strict-io in stackage https://www.stackage.org/lts-7.17/hoogle?q=strict-io, but upon requiring it in stack.yaml, it finds it only to complain about incompatability with some package. How come?
20:14 blym_ joined
20:15 <ezyang> well... the incompatibilit yis probably why it isn't in stackage?
20:17 <ij> So it will try to use things that are out of the compatible pkg set?
20:17 woddy joined
20:17 <woddy> so I'm not into imperative programming
20:17 <shapr> but Haskell is the best imperative programming language :-(
20:17 <winmillwill> how do I find the package that requires another package that is causing the "indirectly depends on multiple packages" problem?
20:17 <woddy> question: has someone mapped Z notation to Haskell?
20:18 newhoggy joined
20:18 <woddy> as in you write Z notation and then you get haskell code?
20:18 <woddy> would that be something realistically achieveable?
20:18 <bennofs> winmillwill: ghc-pkg check may help
20:18 <bennofs> winmillwill: but I'm not sure if it detects that
20:19 <ezyang> ij: I'm not sure what you tried, but if you did the "how to add a non-stackage package to stackage yml", if the package is actually incompatible with the stackage snapshot, you're kind of out of luck, as far as stackage is concerned
20:19 <bennofs> winmillwill: also perhaps configure with -v2 gives some useful info?
20:19 <ezyang> you'll have to depsolve yourself into a solution
20:19 <winmillwill> k, do you know how I could do that in the context of a failing nix-build ?
20:19 <bennofs> winmillwill: so you have a shell.nix that fails to build?
20:20 <bennofs> winmillwill: i need to info about how your nix build looks like. did you autogenerate it with cabal2nix or is it something you wrote?
20:20 <winmillwill> autogenerated
20:20 <bennofs> winmillwill: ok so you cabal2nix'ed it, generated shell.nix and then probably edited it a little right?
20:20 <winmillwill> a default.nix, but yeah
20:21 <bennofs> winmillwill: hmm. then you can run nix-shell --pure to get a shell where the build would be run
20:21 {emptyset} joined
20:21 <bennofs> winmillwill: so you can do something like: nix-shell --pure and then type `cd /tmp` and then `genericBuild` which starts the build of the package as nix would do it
20:23 <winmillwill> ghc-pkg isn't even in the environment of nix-shell...
20:23 <winmillwill> it should be needed for the build to work, right?
20:23 safe joined
20:23 <bennofs> winmillwill: let me check. did you already run genericBuild?
20:23 <winmillwill> yeah
20:25 <bennofs> winmillwill: hmm no I think that is correct
20:25 <geekosaur> cabal and ghc use libraries to access the package database, and shouldn't need ghc-pkg itself
20:25 <winmillwill> k, so Setup might be able to tell me?
20:25 <geekosaur> I should say Cabal (i.e. the library, so stack should also be covered)
20:26 newhoggy joined
20:26 <winmillwill> I can get a failed build to hang around with nix-build -K, but then I'm not sure what I should be checking
20:27 <ij> Can you run ghc executables in alpine linux in docker? pthread_setname_np is missing, but based on googling ghc+alpine, it seems that someone has been able to run it.
20:27 <bennofs> winmillwill: in the shell, when you run genericBuild, it should show something like "building with /nix/store/.../ghc". you can copy that path to find where ghc-pkg ist
20:29 <bennofs> winmillwill: it appears that you should see what packages require which version from the output of the build
20:29 <bennofs> winmillwill: you may need to scroll a little
20:30 ragepandemic joined
20:30 <bennofs> winmillwill: the lines should look like "package foo-xxx requires bar-yyy"
20:31 jer1 joined
20:31 <winmillwill> well, I can see "package haskell-src-exts-simple- requires haskell-src-exts-1.19.1" but not what requires THAT
20:31 <winmillwill> so I don't know which cabal to override
20:31 oisdk joined
20:31 <bennofs> winmillwill: and other packages require other versions of haskell-src-exts? can you paste your default.nix somewhere?
20:32 <winmillwill> sure
20:32 Rodya_ joined
20:32 Meanirelli joined
20:33 <lpaste> winmillwill pasted “default.nix ” at http://lpaste.net/354886
20:33 PennyNeko joined
20:34 <winmillwill> dependencies.nix is just the output of cabal2nix
20:34 uuplusu joined
20:34 flatmap13 joined
20:34 flatmap13 joined
20:35 <winmillwill> state-plus.nix is me saying `doCheck = false` because it blew up wanting a specific version of QuickCheck
20:35 newhoggy joined
20:36 <bennofs> winmillwill: oh hmm this does look correct
20:36 <bennofs> winmillwill: is there also some package requiring a different version of haskell-src-exts?
20:36 mbazs joined
20:37 rblaze1 joined
20:37 <winmillwill> it's not even a top-level dep for me
20:37 <winmillwill> dependencies.cabal is just: build-depends: base < 5, apply-refact, codex, hasktags, hlint, hoogle, pointfree, pointful
20:39 ckubrak joined
20:39 <winmillwill> of course, the other thing that this is showing me is that although these are logically related by being "dev tools" there's no reason the actual executables need to use any of the same libs, so I should just back off and install them separately
20:40 e14 joined
20:40 <winmillwill> but of course now I'm curious about how to solve the incidental problem too
20:40 keri joined
20:41 <bennofs> unrelated to nix, is there a command to find out which package requires a given package when cabal configure fails?
20:41 <bennofs> (due to multiple conflicting options)
20:41 crave joined
20:41 <winmillwill> there's ghc-pkg dot but IIUC that only looks at what successfully got installed
20:41 keri joined
20:41 crave left
20:41 crave joined
20:41 <bennofs> winmillwill: it would show you which things depend on the wrong lib version though
20:42 Maxou joined
20:42 <winmillwill> how? nothing is getting installed
20:42 <winmillwill> we're dying in configure
20:42 <bennofs> winmillwill: all the dependencies are already installed at that point
20:43 <winmillwill> I'm not seeing any of them in the output
20:43 <winmillwill> of ghc-pkg dot
20:43 <bennofs> winmillwill: you need to run it inside the nix-shell
20:44 newhoggy joined
20:44 jeltsch joined
20:44 <bennofs> winmillwill: anyway, in this particular case, the reason for this can be found in configuration-common.nix in the nixpkgs repo. I agree that this is not very discoverable
20:45 keri joined
20:45 a3Dman joined
20:45 <bennofs> winmillwill: in particular, this causes the problem: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/configuration-common.nix#L696-L697
20:46 <winmillwill> heh
20:46 <winmillwill> did you just know to go check the top-level deps there?
20:46 <bennofs> winmillwill: yeah :/
20:46 tomphp joined
20:47 <winmillwill> at least I didn't miss something super obvious
20:47 keri joined
20:48 keri joined
20:49 sellout- joined
20:51 nschoe joined
20:51 <winmillwill> bennofs: is there a reference of things like genericBuild so I can try to step through things like this?
20:52 <bennofs> winmillwill: i don't think there is any in-depth reference of the haskell infrastructure. there's only http://nixos.org/nixpkgs/manual/#users-guide-to-the-haskell-infrastructure
20:53 <bennofs> winmillwill: `genericBuild` actually works for all nix packages, it just a helper function that executes all the phases of a nix build for you (as long as it uses stdenv, which all nix builds should)
20:53 ystael joined
20:53 <winmillwill> cool, thanks for the help
20:54 hoknamahn joined
20:54 ccomb joined
20:54 abinr joined
20:56 sproingie joined
20:56 sproingie joined
20:56 fragamus joined
20:58 ertesx joined
20:58 path[l] joined
21:00 a3Dman joined
21:00 newhoggy joined
21:00 dfeuer joined
21:03 raichoo joined
21:03 phillip joined
21:04 HoloIRCUser4 joined
21:05 e14 joined
21:05 grayjoc joined
21:05 mattyw joined
21:06 refold joined
21:07 oisdk_ joined
21:07 flatmap13 joined
21:07 EvilMachine joined
21:08 <AWizzArd> Impure function vs action. Both okay? I mean, every Haskeller will understand it when I call getLine a „function”. But should one still better call it an „action” instead?
21:08 <bennofs> AWizzArd: call it operation?
21:08 <AWizzArd> Yes, also doing that sometimes.
21:08 <Tuplanolla> :t getLine -- What's so function about this, AWizzArd?
21:08 <lambdabot> IO String
21:08 <Tuplanolla> There's no arrow to be seen.
21:09 <lyxia> Well it's a function in the C sense
21:09 <AWizzArd> Tuplanolla: I totally agree. What I mean is that there is context understanding.
21:09 <AWizzArd> A Haskeller will not be puzzled and totally confused what I am talking about. He won’t mistake this for a conversation about the moon landing.
21:09 <Tuplanolla> I always call C functions procedures instead, lyxia.
21:09 <AWizzArd> But: operation or action are preferrable?
21:10 yinn joined
21:10 <phillip> Hi, I have the following problem https://pastebin.com/raw/8GHQ8EJ4, thanks for your help!
21:10 <bennofs> AWizzArd: probably action is better as it is more common (i believe)
21:10 <AWizzArd> What is an impure function?
21:11 <AWizzArd> I saw this term used in the Haskell literature.
21:11 newhoggy joined
21:11 <Rembane> AWizzArd: A function that has side effects.
21:11 <AWizzArd> Rembane: but not necessarily IO?
21:11 <AWizzArd> Because, then it would be an action or operation.
21:11 augur joined
21:12 <Rembane> AWizzArd: Hm... yes. You can have side effects when using StateT for instance.
21:12 <Tuplanolla> Without any context my guess would be some `a -> m b`, AWizzArd.
21:13 <AWizzArd> Ah okay, so as a rule of thumb: a -> m b functions are potentially candidates to be impure.
21:13 wroathe joined
21:13 <AWizzArd> Good, thanks for your inputs guys.
21:13 <Sonolin> I don't think that's the general consensus, though
21:13 <Tuplanolla> If you consider Kleisli impure and disgusting...
21:14 codesoup joined
21:14 <AWizzArd> I am not even sure who Kleisli is.
21:14 <Tuplanolla> A mathematician, what else?
21:15 balor joined
21:17 fizruk joined
21:19 newhoggy joined
21:19 <monochrom> "Kleisli arrow" means "a -> M b" where M is a Monad.
21:19 <AWizzArd> Under „arrow” I could understand two things. There is a combination of two chars that visually looks like an arrow: ->
21:20 roconnor joined
21:20 <AWizzArd> But there is also an abstraction, which is a bit similar to Monads (but weaker).
21:20 cyborg-one joined
21:20 <Tuplanolla> Here it means a morphism.
21:20 <Tuplanolla> That in turn is a generalization of a function.
21:20 kattak joined
21:21 soniku joined
21:21 Levex joined
21:24 MarioBranco joined
21:27 ChaiTRex_ joined
21:27 zeroed joined
21:27 cschneid_ joined
21:28 tomphp joined
21:29 yinn joined
21:30 halogenandtoast joined
21:31 inkbottle joined
21:33 bennofs joined
21:34 <inkbottle> [noob]: When I get "Could not find module ‘Codec.Compression.GZip’ It is not a module in the current program, or in any known package." (stack ghci); Does that mean I have to use "stack install ..."?
21:34 <inkbottle> And how do I guess the name of the package to install?
21:35 <sproingie> if you're using stack, it means it has to be in your build dependencies. is this your own code or are you building some other package?
21:35 <tommd> It means you need to install a package, be it via stack, cabal or something else.
21:35 <glguy> inkbottle: Google's a good way to guess. I often search for "haskell" and the name of the module
21:35 <sproingie> if you're not using stack, you'd cabal-install it. as for finding the package name, hoogle is good for that
21:35 smillmorel joined
21:36 <tommd> And if you use `cabal install` or `stack install` then yes, what sproingie said. If you are using `ghci` or `cabal build` then you'll need to explicitly install it.
21:36 <sproingie> or just googling it which will usually point where hoogle does anyway
21:36 <tommd> inkbottle: hoogle also works (https://www.haskell.org/hoogle/?hoogle=Codec.Compression.GZip)
21:37 nschoe joined
21:37 <tommd> Not always, but for some set of packages.
21:37 <inkbottle> sproingie: own code; actually snippets from the web
21:37 uuplusu joined
21:37 <sproingie> how much of hackage does hoogle index, anyway?
21:38 _cyril_ joined
21:38 <tommd> Is ndm here these days?
21:38 HoloIRCUser joined
21:38 flatmap13 joined
21:38 <tommd> Nope
21:38 nicknovi1 joined
21:38 JagaJaga joined
21:39 <tommd> sproingie: From the manual "By default, searches look at the Haskell Platform and Haskell keywords."
21:39 <tommd> https://github.com/ndmitchell/hoogle/blob/master/README.md
21:39 tolt_ joined
21:40 flatmap13 joined
21:40 newhoggy joined
21:42 <inkbottle> sproingie: do you mean if I were not using "stack" but instead plain ghc, then it would install automatically?
21:42 tomphp joined
21:42 a3Dman joined
21:42 <tommd> inkbottle: The other way around. If you are installing a package via `stack install` or `cabal install` then it will automatically install dependencies and all you need to do is list the correct dependencies in the projects `*.cabal` file.
21:43 <sproingie> if you have a single-file project, you can do "stack runghc blahblah.hs --package zlib"
21:43 <phillip> Hi, I have the following problem https://pastebin.com/raw/8GHQ8EJ4. Why does reusing the given funktion "op" makes problem?
21:43 <tommd> inkbottle: But if you are running `ghc someFile.hs` then it will use whatever packages are already installed.
21:43 Netwolf joined
21:43 Netwolf joined
21:43 flatmap1_ joined
21:43 <sproingie> if you have a multi-file project, probably gonna need to do a proper stack project
21:43 <inkbottle> sproingie: tommd: Nice, thanks a lot
21:43 <tommd> phillip: You are passing a single argument to your recursive foldList call.
21:44 <tommd> phillip: What do you think "op tail x" does?
21:44 noddy joined
21:44 <tommd> consider instead "foldList op (tail x)"
21:46 hybrid joined
21:46 <phillip> tommd: ahh thanks a lot. Thats what it should do!
21:48 uglyfigurine joined
21:48 HoloIRCUser left
21:48 uglyfigurine joined
21:49 <phillip> have a great week, bye!
21:49 <jle`> sproingie: hoogle is actually out of date
21:50 <jle`> ( tommd )
21:50 <jle`> its index hasn't been updated in almost three years
21:50 <bennofs> jle`: even the one at http://hoogle.haskell.org/ ?
21:50 <reactormonk[m]> jle`: what happened?
21:50 <reactormonk[m]> that would explain why hayoo is decent. Or just use stackage search?
21:51 <jle`> bennofs: that one is being updated, i believe
21:51 <jle`> just the 'official' hoogle is out of date
21:51 Guest45329 joined
21:51 <jle`> reactormonk[m]: updates were suspended pending the upcoming release of hoogle 5
21:51 <lyxia> "upcoming" since forever
21:52 <jle`> to be fair, it's a complete rewrite
21:52 <jle`> this is the latest news i believe http://neilmitchell.blogspot.com/2015/01/hoogle-5-is-coming.html
21:53 hiratara joined
21:53 <lyxia> yeah he seems to be pretty busy
21:54 <jle`> oh this is the latest update http://neilmitchell.blogspot.com/2015/02/why-is-hoogle-index-so-out-of-date.html
21:56 flatmap13 joined
21:58 Rodya_ joined
21:58 nschoe joined
21:58 <sproingie> ugh. didnt know it was *that* out of date now
21:59 orhan89 joined
21:59 orhan89` joined
22:00 <sproingie> second system effect ("it's a total rewrite! it'll be awesome! real soon now!") and its effect on the current version
22:00 newhoggy joined
22:00 <sproingie> maybe "vaporware strike" is the term, even if it's self-directed?
22:01 bitrauser joined
22:03 smccully joined
22:04 <monochrom> endomorphic vapourware strike :)
22:04 <sproingie> that'd be a good band name
22:04 <Gurkenglas> He's been working for years on a tool that'll save him two hours on each several-yearly index update?
22:05 <sproingie> i'd imagine more features too
22:05 anuxivm joined
22:07 laplacian joined
22:07 NeverDie joined
22:08 newhoggy joined
22:10 Kuros` joined
22:11 freechips joined
22:12 thewired_ joined
22:14 OutlawStar joined
22:17 aer[m] joined
22:17 <That_Guy> Hello, question. Supposed I have a type "data Foo (a :: Bool) = Foo" and I want to have a function that does something similiar to the following "checkFoo :: Foo a -> Foo b -> Foo (a && c)"
22:18 moth joined
22:18 <That_Guy> woops thats supposed to be "a && b", basically i want to and the types. Is that possible?
22:18 newhoggy joined
22:18 epsilonhalbe left
22:18 <jle`> That_Guy: you would have to define your own &&
22:19 <That_Guy> yes thats my intent
22:19 <jle`> but otherwise, yes, it's possible
22:19 kattak joined
22:19 <That_Guy> cool, What extensions would I need for something like that?
22:19 <jle`> type family a && b where False && b = False; a && b = b
22:19 <jle`> TypeFamilies
22:19 <jle`> * True && b = b
22:20 <That_Guy> ok, I will try that nvr tried type famalies before :) thx
22:20 <jle`> no problem! be aware that bools at the type level are much less useful than bools at the value level, though
22:20 <jle`> and there's uaually a better way of doing what you want to do
22:21 <sproingie> type level bools are () and Void, no?
22:21 <That_Guy> oh well
22:21 <jle`> type level bools are data Bool = False | True
22:21 <That_Guy> the example i gave was really simple
22:22 <That_Guy> What I really have is an Operation type, so "data Operation (o :: Optype) l r = ..."
22:22 mizu_no_oto joined
22:22 <That_Guy> and my op type has "Fixed | Streamed"
22:22 argent0 joined
22:22 soniku joined
22:22 <That_Guy> I basically want semantics "Fixed && Fixed = Fixed" "Stream && Stream == Error" and "Stream && Fixed = Stream"
22:23 e14 joined
22:23 <That_Guy> So I basically want a compiler error on "Stream && Stream"
22:23 <jle`> is Error a different type you haven't mentioned here
22:23 <That_Guy> though not sure if that is going to work
22:24 <sproingie> yah, not so much bools as isomorphic to them. fiddling with unit and void at the type level is type-level bools qua bools
22:24 <That_Guy> ah well by Error I meant "compiler error"
22:24 <jle`> oh you want a compiler error
22:24 a3Dman joined
22:24 <jle`> you can use GHC.TypeLits in your type family to get compiler errors on bad combinations
22:24 <jle`> with nice error mesages
22:24 <That_Guy> oh really!?
22:24 <monochrom> Instead of an "error" type, simply omit anything that specifies what to do with Stream && Stream.
22:24 <That_Guy> that be nice
22:25 <sproingie> ooh anything that lets me have friendlier type errors is nice
22:25 <jle`> see the example in http://hackage.haskell.org/package/base-
22:25 <sproingie> it's weird that i know more about how to do that in C++ than haskell
22:25 <monochrom> Oh yikes haha that's better.
22:26 <sproingie> c++ you just make a template that has a deliberately failing static_assert to rule out illogical types
22:26 <monochrom> I guess it's an addition I didn't notice when upgrading to GHC 8
22:26 <sproingie> and your assert has a nice friendly error you give it
22:26 <That_Guy> I don't support there is a nice code example of doing what I want to achieve?
22:26 shainer left
22:27 newhoggy joined
22:27 skeuomorf joined
22:27 dm3 joined
22:28 aarvar joined
22:28 <That_Guy> actually this might be similiar to what I want no? type family And (a :: Bool) (b :: Bool) :: Bool where from the type family page
22:28 <sproingie> in c++? i could probably dig up template metaprogramming examples. for haskell i'm pretty much a newb at type-level stuff
22:28 <jle`> That_Guy: the example i linked to is close to what you mean
22:28 <jle`> and yes
22:28 flatmap13 joined
22:29 <That_Guy> k thanks alot jle, I'll give it a shot :)
22:29 <sproingie> oh you just create instances of TypeError for whatever you want to reject?
22:30 <sproingie> that's ... pretty much the same as c++'s approach, come to think. with much less evil syntax.
22:31 hiratara joined
22:32 <sproingie> any way to do arbitrary integer arithmetic at type level? c++'s constexpr makes that pretty simple.
22:33 <jle`> there are a couple of ways you could go about it
22:33 <sproingie> i'm reasonably comfortable doing it strictly symbolic though, a la prolog
22:34 <sproingie> where it = complex type logic
22:34 Wizek_ joined
22:34 <sproingie> and i'm told haskell's type system is isomorphish to prolog
22:36 newhoggy joined
22:39 blym_ joined
22:39 eazar001 joined
22:40 {emptyset} joined
22:41 nicknovi1 joined
22:41 n1k joined
22:41 <That_Guy> jle`, is there a way to do the type error pre ghc 8.0
22:42 <jle`> i'm not sure
22:42 <That_Guy> :(
22:42 <That_Guy> Is there a way to do any error at all?
22:42 <That_Guy> 'error' doesn't work
22:42 <sproingie> that's runtime
22:42 <That_Guy> yup
22:42 <That_Guy> makes sense
22:43 <monochrom> The instance system actually. "instance Monoid a => MonadWriter a m" = "MonadWriter(a, m) :- Monoid(a)".
22:43 ziocroc joined
22:43 <monochrom> Actually, add a cut there, too. No backtracking after "MonadWriter(a, m)" matches.
22:44 <glguy> You can't learn the Monoid instance of a from the fact that there's a MonadWriter(a,m) instance
22:44 <monochrom> Also, in reality, MonadWriter also somes with a functional dependency I don't know how to translate to Prolog.
22:45 <jle`> That_Guy: well you can have it be a compiler error if you just leave off that branch
22:45 <jle`> like monochrom mentioned earlier
22:45 <* monochrom> uses the subtraction method :)
22:45 newhoggy joined
22:45 <That_Guy> ok, that I gues will work, thx jle`
22:45 <monochrom> To get more compiler errors, simply delete more code. :)
22:46 Noldorin joined
22:46 <monochrom> But TypeError is more ergonomic and self-documenting.
22:46 <exio4> That_Guy: ("This failed" ~ "")
22:46 <glguy> exio4: That works for generating impossible constraints, at least
22:47 <exio4> ("This failed" ~ "") => () :)
22:47 <glguy> It doesn't help to make an impossible case in a type family like this though
22:47 hvr joined
22:47 hvr joined
22:47 <exio4> I guess so, I haven't played much with type families :P
22:47 dan_f joined
22:48 kamog joined
22:48 <That_Guy> typefamilies seem to be very powerful, I need to find the time to really learn about them
22:48 <That_Guy> though I think for now I can achieve what I need :)
22:49 binaryplease joined
22:49 mauke joined
22:51 t0m0 joined
22:53 meck joined
22:54 <That_Guy> Hmm so I am getting any error, I think I am using the type families wrong. http://lpaste.net/354891
22:54 cheater joined
22:54 <That_Guy> complains o1 is applied to too many type arguments
22:55 <glguy> That_Guy: XOR o1 o2
22:55 <glguy> it's like any other type
22:55 <That_Guy> ahh
22:56 <That_Guy> thx!
22:56 <glguy> or turn on TypeOperators and o1 `XOR` o2
22:56 <That_Guy> yes, just found that :)
22:58 jaziz joined
22:58 ludat joined
22:59 meck joined
23:00 Tourist joined
23:00 Tourist joined
23:02 uuplusu joined
23:02 theDon_ joined
23:02 unyu joined
23:03 sigmundv joined
23:04 Ranhir joined
23:04 benl23 joined
23:04 kamyar joined
23:05 <kamyar> Hello fellows
23:05 <kamyar> Please help me understand this Haskell code: https://gist.github.com/Fristi/7327904
23:05 <kamyar> Lines 21 to 23
23:06 cheater joined
23:06 <geekosaur> those are associated data families https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#associated-data-and-type-families
23:07 Molosse joined
23:08 <Molosse> yo
23:08 newhoggy joined
23:09 <kamyar> geekosaur: What that means?
23:10 <kamyar> * -> *
23:10 <kamyar> DOes it mean anything to anything?
23:10 <sproingie> it means a type to a type
23:11 e14 joined
23:11 <sproingie> which means it's a type with one arg. usually a functor
23:11 NyanPasu joined
23:11 <sproingie> or a function (which is also a functor)
23:12 <glguy> Kinds: https://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-640004.1.1
23:12 <jle`> in modern times we might have written it as 'Type -> Type'
23:12 <jle`> so things like IO, Maybe, Either Int, etc.
23:13 <* glguy> isn't ready to give up on * yet
23:13 <jle`> i've already made the switch since * doesn't work when you have TypeInTyoe on :'(
23:13 <geekosaur> kamyar, * represents a "normal" type, one which has values
23:13 <jle`> oh wait it does work
23:14 okuu joined
23:14 <geekosaur> jle`, I think you just have to import it?
23:14 <kamyar> geekosaur: What is an anormal type then?
23:14 <jle`> yeah, it works
23:14 <geekosaur> :k Maybe
23:14 <lambdabot> * -> *
23:14 <jle`> i guess my main problem is that it is a special-case syntax
23:14 Warrigal joined
23:14 _Bin4ry joined
23:14 <kamyar> geekosaur: Ok thnx
23:14 <geekosaur> you can;t have things of type "Maybe", but you can have things of type "Maybe Int" or ...
23:14 sgronblo joined
23:15 <jle`> *'s characters suggest it is an operator, but it's not
23:15 <kamyar> geekosaur: It means concrete type
23:15 <jle`> so the syntax has to be special-cased
23:15 <jle`> kamyar: 'concrete type' isn't a term we like to use, since it's ambiguous
23:15 <jle`> there are many different definitions of concrete type
23:15 emmanuel_erc joined
23:15 newhoggy joined
23:16 dbmikus_ joined
23:16 <kamyar> jle`: That means a type with no partial or generci-like parts
23:16 <geekosaur> ...
23:16 mjora7 joined
23:16 <sproingie> Maybe Int vs Maybe a?
23:16 <kamyar> geekosaur: So for example 'Just 5' can not be used there
23:16 <geekosaur> huh?
23:17 jmcarthur joined
23:18 fakenerd_ joined
23:18 <Tuplanolla> :t concrete
23:18 <lambdabot> Reinforced
23:18 a3Dman joined
23:18 <sproingie> heh
23:18 <sproingie> :kind weed
23:19 <jle`> they left
23:19 seangrove joined
23:23 {emptyset} joined
23:24 sigmundv joined
23:25 _Bin4ry joined
23:27 ExpHP joined
23:27 newhoggy joined
23:29 wroathe joined
23:29 sigmundv joined
23:30 bananagram joined
23:30 ckubrak joined
23:31 e14 joined
23:31 miguel_fontes__ joined
23:31 Lord_of_Life joined
23:32 a3Dman joined
23:32 Warrigal_ joined
23:32 manek joined
23:33 Rodya_ joined
23:33 <manek> Hello! Is there anything in haskell that is similar to Enum, but just allows me to assign ascending numbers to constructors, that could not be nullary
23:33 <manek> ? :)
23:33 mavihs joined
23:34 <thang1> what sort of thing would you use that for?
23:34 JagaJaga joined
23:34 <sproingie> Numbers? as in aliases for ints? that's not what Enum is in haskell.
23:34 smillmorel joined
23:35 <manek> thang1: just for implementing Ord class in Lexer
23:35 <manek> sproingie: I know, I've written, something similar to enum :) Maybe it was to simplified, sorry for the confusion. I just want, having a value of a specific onstructor, get it number
23:36 lambda-11235 joined
23:36 arpl left
23:36 crobbins joined
23:37 <jle`> you can achieve something similar with generics
23:37 newhoggy joined
23:37 <Tuplanolla> Can you not derive `Enum` and use `fromInteger` and `toInteger`, manek?
23:37 <jle`> data types with non-nullary constructors can't derive Enum
23:37 <geekosaur> I think they want this for a non-nullary constructor?
23:37 <geekosaur> so no, Enum not derivable
23:38 <geekosaur> but Ord *should* be derivable. so, why is it not being derived?
23:38 heath joined
23:39 <jle`> yes you can probably implement this using GHC.Generics
23:39 <MonadHendrix> quick way to check if a list of Maybe Ints has any nothings in it?
23:39 <sproingie> toEnum/fromEnum seems as close as it gets, but yeah only nullary constructors need apply
23:39 <jle`> MonadHendrix: null . catMaybes ?
23:39 <geekosaur> that sounds like any non-nothings
23:40 <manek> geekosaur: Ord is derivable, but it's not a valid Ord then. In fact this is kind-of not a real problem. It is caused by I think unnecesary constraint in megaparsec, which tells that every token has to be Ord'able. In fact everything works even if you define Ord without implementation. I asked the question out of curiosity - if it is just possible in any standard way
23:40 <manek> without implementing it in generics by myself
23:40 <MonadHendrix> jle`: ah yes catMaybes is what ive been looking for
23:40 <MonadHendrix> cheers
23:40 <ChaiTRex> MonadHendrix: not . null . dropWhile isJust or something like that
23:40 <geekosaur> :t any . isNothing
23:40 <lambdabot> error:
23:40 <lambdabot> • Couldn't match type ‘Bool’ with ‘a -> Bool’
23:40 <lambdabot> Expected type: Maybe a1 -> a -> Bool
23:40 soniku joined
23:40 <Sornaensis> :t any isNothing
23:40 <lambdabot> Foldable t => t (Maybe a) -> Bool
23:41 <geekosaur> yeh
23:41 <Tuplanolla> Sounds like a job for `asum`.
23:41 <Sornaensis> :t asum
23:41 <lambdabot> (Alternative f, Foldable t) => t (f a) -> f a
23:41 <ChaiTRex> Yeah, any isNothing is nice :)
23:41 <jle`> asum might potentially do too much work
23:41 <sproingie> meh. generalization is general
23:41 <jle`> > isJust . asum $ repeat Nothing
23:41 <Sornaensis> generalization makes me blush'
23:41 <lambdabot> mueval-core: Time limit exceeded
23:42 <jle`> > isJust . asum $ repeat (Just ())
23:42 <lambdabot> True
23:42 <jle`> > isNothing . asum $ repeat (Just ())
23:42 <lambdabot> False
23:42 <jle`> asum would do too much work since it has to check after the first Nothing it encounters
23:42 <jle`> actually i'm not sure it could even be used to detect if there are any nothings
23:42 <jle`> it wouldn't be asum...it'd be sequence
23:43 <jle`> > isJust . sequence $ repeat Nothing
23:43 <lambdabot> False
23:43 <jle`> > isNothing . sequence $ repeat Nothing
23:43 <lambdabot> True
23:43 <jle`> sequence should stop at the first Nothing
23:43 <jle`> er, but use sequence_
23:43 <MonadHendrix> > length $ catMaybes [Just 5, Just 6] == 2
23:43 <lambdabot> error:
23:43 <lambdabot> • Couldn't match expected type ‘[a1]’ with actual type ‘Bool’
23:43 <lambdabot> • In the second argument of ‘($)’, namely
23:43 <Sornaensis> :t sequence_
23:43 <lambdabot> (Monad m, Foldable t) => t (m a) -> m ()
23:43 <jle`> > isNothing . sequence_ $ repeat Nothing
23:43 <lambdabot> True
23:44 latro`a joined
23:44 newhoggy joined
23:44 sigmundv joined
23:45 <jle`> sequence is some dual of asum i suppose
23:45 <Sornaensis> @src asum
23:45 <lambdabot> Source not found. My pet ferret can type better than you!
23:45 <Sornaensis> >:{
23:45 <jle`> if Just is True, then sequence ~ all, asum ~ any
23:45 <Sornaensis> @hoogle asum
23:45 <lambdabot> Data.Foldable asum :: (Foldable t, Alternative f) => t (f a) -> f a
23:45 <lambdabot> Data.Conduit.Combinators asum :: (Monad m, Alternative f) => Consumer (f a) m (f a)
23:45 <lambdabot> CorePrelude asum :: (Foldable t, Alternative f) => t (f a) -> f a
23:45 <jle`> asum = foldr (<|>) empty
23:45 <jle`> it's like mconcat but with <|> instead of <>
23:46 <MonadHendrix> > length (catMaybes [Just 4, Just 6]) == 2
23:46 <lambdabot> True
23:46 <MonadHendrix> > length (catMaybes [Just 3, Nothing]) == 2
23:46 <lambdabot> False
23:46 <MonadHendrix> :t length . catMaybes
23:46 <lambdabot> [Maybe a] -> Int
23:47 <MonadHendrix> im using it to check if either or both of the two values inputted are Nothing
23:48 <MonadHendrix> i could just `case choice of (a == Nothing) || (b == Nothing)
23:48 <thang1> Can you not just pattern match it?
23:48 <jle`> that doesn't make sense
23:48 bjz joined
23:48 <jle`> i'm not sure if that's even valid syntax?
23:49 <MonadHendrix> me neither but you get the idea
23:49 <jle`> if you want to return Nothing if either thing is Nonthing, use *>
23:49 <jle`> MonadHendrix: i don't get the idea :(
23:49 <jle`> that's why i mentioned it
23:49 <jle`> i'm not sure what you're trying to write
23:49 <MonadHendrix> ok
23:49 <MonadHendrix> user inputs 2 ints, using `readMaybe <$> getLine` each time
23:49 <jle`> if you want to return Nothing if either thing is Nothing, you can use (*>)
23:49 <MonadHendrix> i want to exit if either are Nothing
23:49 <jle`> :t \x y -> isNothing (x *> y)
23:49 <lambdabot> Maybe a1 -> Maybe a -> Bool
23:50 doubleleft joined
23:50 a3Dman_ joined
23:51 <thang1> MonadHendrix: a lot of haskell is designed around handling errors gracefully and robustly. Why do you want to blow everything up if the user messes up?
23:51 Welkin joined
23:51 newhoggy joined
23:51 <MonadHendrix> thang1: when i say quit, i of course mean restart the program ;)
23:52 <MonadHendrix> the point is detecting if either of the inputs are nothing
23:52 <jle`> if you actually want to *use* the things inside the results, you can use fmap or applicative combinators or do notation
23:54 <MonadHendrix> hmm, i could just `(+) <$> a <*> b` then check if its Nothing on its own after
23:55 nakal joined
23:55 <jle`> mhm, thats the beauty of the applicative abstraction :)
23:55 <Welkin> :t fmap <$> fmap <*> fmap
23:55 <lambdabot> Functor f => (b -> b) -> f b -> f b
23:55 markus1209 joined
23:55 <MonadHendrix> > isNothing $ (+) <$> Just 3 <*> Just 5
23:55 <lambdabot> False
23:55 <MonadHendrix> > isNothing $ (+) <$> Just 4 <*> Nothing
23:55 <Welkin> (fmap <$> fmap <*> fmap) id (Just 3)
23:55 <lambdabot> True
23:55 infinity0_ joined
23:55 markus1219 joined
23:56 <Welkin> ? (fmap <$> fmap <*> fmap) id (Just 3)
23:56 infinity0_ joined
23:56 <Welkin> > (fmap <$> fmap <*> fmap) id (Just 3)
23:56 <lambdabot> Just 3
23:56 <Welkin> lol
23:56 <Welkin> > (fmap <$> fmap <*> fmap) (+1) (Just 3)
23:56 <lambdabot> Just 5
23:56 <Welkin> hahaha
23:56 <MonadHendrix> got it, cheers for letting me bounce my head off you
23:56 heath joined
23:57 <Welkin> I created a monster
23:57 <thang1> > (fmap <$> fmap <*> fmap) (+1) id id id id id id id id id id (Just 3)
23:57 <lambdabot> error:
23:57 <lambdabot> • Ambiguous type variable ‘a0’ arising from a use of ‘show_M885504224118...
23:57 <lambdabot> prevents the constraint ‘(Show a0)’ from being solved.
23:57 <thang1> ;-;
23:57 blym_ joined
23:57 <jle`> no problem!
23:57 <* MonadHendrix> goes off to scrub up on Applicative
23:57 <Tuplanolla> :t fmap <$> fmap <*> fmap
23:57 <lambdabot> Functor f => (b -> b) -> f b -> f b
23:57 <Tuplanolla> That's... great.
23:57 sgronblo joined
23:58 <Welkin> I often find very interesting functions by typing ins random things
23:58 infinity0 joined
23:59 newhoggy joined