<  February 2017   >
Su Mo Tu We Th Fr Sa  
          1  2  3  4  
 5  6  7  8  9 10 11  
12 13 14 15 16 17 18  
19 20 21 22 23 _2_4 25  
26 27 28
00:00 <phz_> so that evaluating sf s' is possible now?
00:00 <monochrom> No, nothing is executed now.
00:00 <monochrom> What is the thing after "in". *That* is executed now.
00:00 <phz_> after in?
00:00 <monochrom> Yes, after in.
00:00 <phz_> what in?
00:01 <phz_> ah, let in?
00:01 <monochrom> Whenever you see "let blahblah in foofoo", no one is executing blahblah.
00:01 <phz_> I think I should just try to write such a weird let in.
00:01 <phz_> monochrom: you’re playing with words
00:01 <monochrom> foofoo is the thing executed and it may or may not trigger executing some or all or none of blahblah
00:01 <phz_> it gets executed at some time
00:01 <monochrom> No.
00:02 <phz_> yeah, that’s what I said above
00:02 <phz_> in (b, s'')
00:02 <phz_> so it’ll need to execute both
00:03 <phz_> so I guess we have to pick one, and the order doesn’t matter
00:03 <phz_> let’s say (a, s'') = sf s'
00:03 <phz_> it needs the expression holding s' to be evaluated
00:04 <phz_> yeah wtf, this is just overwhelming
00:04 <phz_> I can’t see how someone can quickly state that that code doesn’t loop forever
00:04 <haskellnoob> how can I make this prettier? ... http://lpaste.net/352633
00:04 Stratege_ joined
00:05 takle joined
00:06 lambda-11235 joined
00:06 path[l] joined
00:08 LeCamarade joined
00:09 harfangk joined
00:09 Micamo joined
00:09 plutoniix joined
00:10 markus1189 joined
00:10 markus1199 joined
00:11 <deepfire> phz_, by the way, what do you think of Lambdacube3d ?
00:11 heurist`_` joined
00:12 nxtr_ joined
00:12 <phz_> deepfire: I know a little csaba
00:12 zcourts joined
00:13 <phz_> I think the idea is interesting, but in the same time, I think it won’t go anywhere
00:13 <phz_> that’s the reason why I dropped Haskell in favor of Rust
00:14 <phz_> rendering / animation / video game is a domain in which you need a lot of determinism – in the sense of metal / hardware performance – and great control of your memory
00:14 <phz_> Haskell is not suited for that, hence, trying to make a very good 3D framework is noble, but in my opinion, it’s doomed
00:15 chrisdotcode joined
00:16 excelsiora joined
00:16 JeanCarloMachado joined
00:16 pasukon joined
00:16 TxmszLou joined
00:18 zcourts joined
00:20 cschneid_ joined
00:20 path[l] joined
00:21 <deepfire> lambdacube-quake3 sure looks cool : -)
00:21 nakal joined
00:21 CoolerExtreme joined
00:22 <deepfire> phz_: moreover.. there was a lot of work done on taming GC/laziness in Haskell
00:22 <phz_> ?
00:23 <phz_> I think that quake 3 stuff is just hilarious
00:23 <deepfire> phz_: do tell : -)
00:23 <phz_> because quake 3 ran on old machines with a hardware that any haskell programm wouldn’t even run on today
00:23 <phz_> (the C version I mean)
00:23 <phz_> (the original one)
00:24 <deepfire> phz_: the point is in how the rendering pipeline gets constructed, isn't it?
00:24 <Axman6> i use to run quake on my iPod 5G
00:24 <phz_> deepfire: basically, to the fact that Haskell doesn’t let you know which computation will go first
00:24 <phz_> to the fact its allocation scheme is just too violent
00:25 <Axman6> I"m not sure either of those are true
00:25 <phz_> and that when writing a 3D engine, you need to worry about a lot of stuff Haskell fails to help you reason about
00:25 <phz_> like cache misses, for instance
00:25 <koala_man> phz_: apart from the predictability, how is Rust compared to Haskell?
00:25 <phz_> well, I wrote a demo in Rust
00:25 <phz_> and it runs so fast
00:25 <koala_man> in language terms I mean
00:25 <phz_> ah
00:25 <phz_> well
00:25 <deepfire> phz_: isn't the modern-day problem in 3D being in the GPU pipeline, rather?
00:25 <phz_> it’s imperative with functional aspects
00:26 <deepfire> the CPU side is probably the boring side
00:26 <phz_> it has the concept of traits – typeclasses
00:26 <phz_> deepfire: it is if you consider that the CPU side is already well implemented
00:26 <phz_> that is, not too much cache miss, correct branch prediction, etc.
00:26 snowalpaca joined
00:26 <deepfire> linear types will come, StrictHaskell is a thing
00:26 <phz_> in Haskell, where you can have many gigabytes of memory allocated per second…
00:27 <deepfire> ..linear types
00:27 andyhuzhill joined
00:27 <phz_> well, if one day Haskell gets rid of its GC
00:27 <deepfire> ..ditto
00:27 <phz_> I might consider getting back to doing graphics in Haskell
00:27 <phz_> but that won’t happen
00:27 <phz_> it might come from Idris instead :)
00:27 <deepfire> Idris already has linear types
00:27 <deepfire> indeed..
00:27 <phz_> yes it has
00:28 <phz_> it also have effects
00:28 <phz_> Haskell also has that wrong :D
00:29 <deepfire> that comes with being, what, 30 years, in advance? : -)
00:30 <phz_> what do you mean?
00:30 <deepfire> haskell goes way back
00:30 <phz_> do you links about that btw?
00:30 <deepfire> that it manages to evolve at its current pace is, well, nothing short of amazing
00:30 <phz_> Haskell is amazing, I love it
00:30 <monochrom> phz_: With the wrong sf or f, the code could loop forever.
00:30 <phz_> but I’m starting to love Rust maybe a little more now :)
00:31 <phz_> monochrom: yeah, I figured that out
00:31 <phz_> I guess I have to apply the best behavior: not trying to actually understand it :D
00:31 nighty joined
00:31 <monochrom> You should try some actual sf and f.
00:31 <phz_> and just “nothing is evaluated, so I can put anything I want, even weird relations”
00:32 <phz_> it’s the same thing as fix f = let x = fx in x
00:32 <phz_> but this one is simple to undersand
00:32 <phz_> understand
00:32 <deank> haskellnoob http://lpaste.net/352633#a352635
00:32 MrJazz joined
00:32 <monochrom> Try also this: http://lpaste.net/41790/ (Just vanilla Control.Monad.State)
00:32 <deepfire> phz_: according to wikipedia: "The first version of Haskell ("Haskell 1.0") was defined in 1990."
00:33 <phz_> in my mind, I just state that let x = f x in x creates some kind of “place” – you don’t seem to like the term “box” :) – which has a pointer ; we can allocate it at first, then it’s just a recurring call to that address
00:33 takle joined
00:33 <monochrom> OK, I thought about it and I guess I shouldn't be too harsh on "box".
00:34 <phz_> well
00:34 <phz_> the first one actually loops, right?
00:34 athan joined
00:34 <monochrom> Because I would talk about "a network of expressions" but then I will have nodes (graph theory) and that's same difference.
00:34 <phz_> because it’s like gen >> gen >> gen >> gen >> gen… >> modify (() :)
00:34 <phz_> with a lot of modify as well
00:35 <monochrom> Have you run it on a computer?
00:35 <phz_> not yet
00:35 <monochrom> try "take 10 many"
00:35 Rainb joined
00:35 <monochrom> Also of interest is why I can get away with undefined at that place.
00:36 Rizy joined
00:36 <phz_> well that’s easy
00:36 andyhuzhill joined
00:36 <phz_> monochrom: I’ve been doing Haskell for 3 years eh
00:36 <phz_> if you don’t ever read the state – which you don’t – no problem with undefined
00:37 <monochrom> But I have "modify" which seems to read the state.
00:37 <phz_> it doesn’t
00:37 <monochrom> I can admit and agree that "seems" is not good enough.
00:37 <phz_> monochrom: cons doesn’t read it
00:37 <monochrom> That does it.
00:38 LordBrain joined
00:38 <phz_> well, evaluate*
00:38 <monochrom> s/That does it/You've identified the key/
00:38 <phz_> > ()
00:39 <lambdabot> ()
00:39 <phz_> ok, that still works
00:39 <phz_> yeah, look:
00:39 <phz_> I hope I won’t make any mistake and that my Haskell is still ok :D
00:39 theDon_ joined
00:39 <phz_> > take 3 $ () <$ fix (undefined:)
00:39 <lambdabot> [(),(),()]
00:39 <phz_> :)
00:40 <phz_> I have no problem getting that kind of laziness in such a flat situation
00:40 <phz_> I just struggle with the tuple situation
00:40 <phz_> but I guess it’s kind of the same?
00:40 chao-tic joined
00:40 Sgeo joined
00:40 ContessaTP joined
00:41 <monochrom> It is more involved.
00:41 <phz_> I remember having bad times trying to understand MonadFix as well
00:42 <patientpl> data Piece = Piece Float Float deriving (Show)
00:42 <patientpl> main = do
00:42 <patientpl> let blackpiece = Piece 0 0
00:42 <patientpl> blackpiece
00:42 <patientpl> i want to get the above to run, but im getting an error and im not sure why
00:42 <monochrom> Also probably you haven't seen the rules about what if the LHS is a general pattern rather than just a name.
00:42 <phz_> monochrom: yeah
00:42 <Koterpillar> patientpl: what do you want to happen here? What is the type of main? What is the type of blackpiece?
00:43 <monochrom> Change the last line to "print blackpiece"
00:43 <phz_> monochrom: actually
00:43 Rotaerk joined
00:43 <phz_> that RState makes me think of Cont
00:43 <patientpl> main is main i guess? main is the main function - im not sure that it has a type. the type of the blackpiece is defined by data
00:44 <phz_> how what you get in the do notation is actually something that has not happened yet
00:44 <phz_> because of being covariant in a
00:44 <phz_> (a -> r) -> r
00:44 cschneid_ joined
00:44 <phz_> I find that very interesting :)
00:44 <monochrom> OK yes Cont is interesting.
00:44 <patientpl> Koterpillar what do you mean by main having a type? i find that question very confusing.
00:45 <Koterpillar> patientpl: everything has a type
00:45 <phz_> main :: IO ()
00:45 crobbins joined
00:45 <patientpl> so im not allowed to define variables from main? is that what im hearing?
00:46 <Koterpillar> you can define variables
00:46 <phz_> what are you trying to do?
00:46 <Koterpillar> yeah
00:46 <Koterpillar> and what does the error tell you?
00:46 <patientpl> should it not be obvious what i want to do from my (broken) code?
00:46 <patientpl> not to be rude
00:46 <phaazon> patientpl: I think monochrom gave the best answer given the code you pasted
00:47 <monochrom> But they like to ignore me.
00:47 <phaazon> I saw :(
00:47 sigmundv_ joined
00:47 <monochrom> I am Delphi and people like to ignore me when I tell them what they need to hear.
00:47 <patientpl> do you have any suggestions Koterpillar
00:47 CaptainLex joined
00:47 anuxivm1 joined
00:47 <Koterpillar> patientpl: see what monochrom said
00:47 <phaazon> I think they actually truly ignore you :D
00:47 <deepfire> patientpl: IO a != a
00:47 dsh joined
00:48 <patientpl> i see well then i wont ask advice from you too any more
00:48 <patientpl> does anyone else have suggestions?
00:48 <patientpl> *two
00:48 <phaazon> we tried to help you
00:48 <phaazon> and we gave you an answer
00:48 <patientpl> what do you mean by that deepfire?
00:48 <phaazon> what else could we do? :(
00:48 Jonno_FTW joined
00:48 <phaazon> deepfire: please just say “what monochrom said”
00:48 dan_f joined
00:48 <kadoban> They are quickly running low on people they haven't ignored yet.
00:49 <dfeuer> patientpl: it's actually pretty hard to see what you're trynig to do from that.
00:49 <phaazon> and he’s called patientpl, how ironic
00:49 justinfokes joined
00:49 <phaazon> they’re*
00:49 <patientpl> im trying to set blackpiece to a datatype of Piece with floating points 0 and 0 and then print out blackpiece. i was trying to make a trivial example but i cant get it to compile
00:50 <deepfire> patientpl: more specifically, your problem is that IO Piece != Piece
00:50 <phaazon> yeah
00:50 <phaazon> and monochrom just gave you 3,9THE answer, patientpl
00:50 <patientpl> i still dont understand
00:50 <deepfire> or, actally, sorry, IO () != Piece
00:50 <dfeuer> patientpl: well, the let is fine.
00:50 <ertes> patientpl: but you're not actually requesting to print it…
00:50 <dfeuer> Right.
00:50 <dfeuer> You're just sticking it there as though it were an IO action.
00:51 <ertes> patientpl: each line of a do-block must be an IO action… a Piece is not an IO action
00:51 <phaazon> just replace your blackpiece by print blackpiece, on the last line
00:51 <ertes> but (print blackpiece) is an IO action
00:51 <phaazon> it’ll work \o
00:51 eacameron joined
00:51 <dfeuer> Yeah. What ertes said.
00:52 <patientpl> so should i just call main then? ive not seen main called without main = do
00:52 <phaazon> I…
00:52 <ertes> patientpl: you see that line that you wrote that says just "blackpiece"?
00:52 <patientpl> also putStrLn(blackpiece) doesnt work because blackpiece is not a function im guessing
00:52 <dfeuer> patientpl: you need to add print.
00:52 <phaazon> I think my dreams of one day trying to teach stuff to people just collapsed
00:52 <dfeuer> patientpl: no, putStrLn blackpiece doesn't work because blackpiece isn't a *string*.
00:53 <phaazon> patientpl: have you read a Haskell tutorial?
00:53 <deepfire> phaazon: living people != IRC approximations, thankfully
00:53 <dfeuer> You can use putStrLn (show blackpiece)
00:53 <phaazon> looks like you don’t know what you’re doing
00:53 <phaazon> deepfire: sure
00:53 <patientpl> interesting
00:53 <dfeuer> Or you can use print plackpiece.
00:53 <dfeuer> Which is the same.
00:53 <dfeuer> *blackpiece
00:53 <patientpl> does print("im a string!") also work?
00:53 <dfeuer> Yes. It prints the string with quotes around it.
00:53 <patientpl> ahh
00:53 <patientpl> thank you
00:53 <dfeuer> print = putStrLn . show
00:54 takle joined
00:54 <phaazon> dfeuer: I think they have no idea what (.) is
00:54 <dfeuer> > show "Foo"
00:54 <lambdabot> "\"Foo\""
00:54 <patientpl> neat
00:54 <ertes> thank monochrom… everyone else has just been repeating it
00:54 <monochrom> Thank you ertes.
00:54 <dfeuer> . is function composition. (.).(.) is function composition composed with itself.
00:54 <phaazon> I think monochrom just left their computer and drown under the shower for a while
00:54 <phaazon> ah they’re back \o
00:55 <deepfire> dfeuer, also, a literal substitution of "print" with "putStrLn . show" will /probably/ cause more confusion in this particular case : -)
00:55 mr_sm1th joined
00:55 <dfeuer> deepfire: yes, that would require paretheses.
00:55 <phaazon> or a $
00:55 faberbrain joined
00:55 <phaazon> to make things even more confusing for them
00:55 <phaazon> :)
00:55 <dfeuer> I tend to assume people already know how to use parentheses, but that assumption is often proven false.
00:55 <phaazon> though, defining print as print = putStrLn . show doesn’t require parens
00:56 <patientpl> monochrom was sarcastic to me - that's not something I do to others and it's something I don't have tolerance from from others. if my questions are too trivial to get advice that isn't ego driven, feel free not to respond.
00:56 <dfeuer> Because a lot of other languages do it weird.
00:56 <ertes> dfeuer: lispers will disagree on how parentheses work =)
00:56 <phaazon> patientpl: they wasn’t
00:56 <phaazon> they weren’t?*
00:56 <dfeuer> ertes: but lispers also don't expect to use operators infix ,so that's okay.
00:56 <ertes> patientpl: i think you misunderstood something there
00:57 eacameron joined
00:57 cdg joined
00:57 <ertes> there is a "results first, then explanations" approach to teaching that works fairly well
00:58 <phaazon> in Haskell especially
00:58 <phaazon> otherwise, we’d all still be learning.
00:58 <phaazon> :D
00:59 <patientpl> im not going to rehash it - again no tolerance for rudeness
00:59 sooheon joined
00:59 <phaazon> I think I better be out of here for a while
01:00 <phaazon> before I get to actually being rude for real
01:00 markasoftware joined
01:00 <deepfire> patientpl: please, trust us, monochrom didn't mean to offend -- he 1) offered advice, and 2) observed the lack of feedback from you
01:01 umib0zu joined
01:02 <ertes> some people were sarcastic, and i don't appreciate it any more than patientpl does
01:02 zzz joined
01:06 Argue_ joined
01:08 rootnode joined
01:08 stoopkid joined
01:08 noddy joined
01:09 Ptival joined
01:09 <ertes> patientpl: one (almost) universal truth in haskell is that "=" means "is equal to"… when dfeuer says something like (print = putStrLn . show), then regardless of whether you know what the "." means, you can replace "print blackpiece" by "(putStrLn . show) blackpiece", and it will do exactly the same thing
01:10 <ertes> when people say that haskell is "pure" or "referentially transparent", they mean that you can use equational reasoning like that
01:10 vicfred joined
01:10 <patientpl> interesting thank you
01:11 FreeBirdLjj joined
01:11 guardianJ joined
01:11 umib0zu joined
01:11 <ertes> notably, if you're coming from other languages, "=" does not mean assignment… we use it as an equation symbol (almost) exclusively
01:12 umib0zu left
01:12 takle joined
01:14 <deepfire> ertes, thank you, seriousy
01:14 <deepfire> *seriously
01:15 maybefbi joined
01:15 <maybefbi> what do people ask in haskell interviews?
01:15 <maybefbi> is it about typeclassopedia?
01:16 <maybefbi> or fizzbuzz perhaps?
01:16 <phaazon> I had one a few weeks ago, it was about general knowledge
01:16 <* Koterpillar> got generic questions about some libraries
01:16 <ertes> maybefbi: i would ask about common libraries and abstractions
01:16 <hpc> zygohistomorphic prepromorphisms ;)
01:16 <phaazon> like “Do you know how you’d implement a differential list? what is it?”
01:16 <phaazon> or “implement a tree in which we’d like to update stuff and keep them ordered”
01:16 <phaazon> that kind of questions
01:16 <maybefbi> oh k
01:16 <hpc> but yeah, looking for understanding of abstractions and CS in general really
01:16 <phaazon> “what is a zipper?”
01:16 <phaazon> I got that kind of question
01:17 <phaazon> I even got the question “do you know free monads? what are they good for?”
01:17 <phaazon> :)
01:17 <hpc> interviews tend to all come out the same, once you account for the different focus of the company
01:17 <hpc> maybe you get a networking question, or an http question, or an smtp question
01:17 cpennington joined
01:18 <hpc> and then you pick an abstraction for it and they follow up on it
01:18 Foras joined
01:18 <maybefbi> hmm interesting
01:18 eacameron joined
01:18 <maybefbi> i have one next week. im wondering what to focus my practice on.
01:18 <hpc> you can't go wrong with data structures
01:19 <maybefbi> im currently just rehearsing my standard typeclass derivations
01:19 <maybefbi> ok
01:19 <exio4> cool, a haskell interview!
01:19 <ertes> maybefbi: look at widely used libraries and write a guestbook in at least one web framework
01:19 alx741 joined
01:19 <maybefbi> copy that. i like the servant, hasql combination
01:20 <maybefbi> maybe i will write something simple in it
01:20 <ertes> maybefbi: also keep an eye on trends by reading /r/haskell and/or twitter
01:20 zcourts joined
01:20 <maybefbi> yeah to be frank i just focus on principles like that peyton jones talk about lens
01:21 <maybefbi> there are too many operators to memorize in Control.Lens
01:21 <ertes> and common abstractions… learn your free monads, lenses, parsers and pipes/conduits =)
01:21 <ertes> actually the operators follow a naming scheme that is easy enough to get used to
01:22 mettekou joined
01:22 Foras joined
01:22 <ertes> also: learn libraries and abstractions that are relevant to the job
01:22 vergil_s joined
01:23 <ertes> i would say: learn data structures, but i'm afraid that a week will not be enough =)
01:23 alx741 joined
01:23 <maybefbi> i guess i will just learn standard typeclass, solve a few leetcode problems, and then write a guestbook rest api in servant and hasql
01:24 jmcarthur joined
01:25 <maybefbi> the standard typeclasses always amaze no matter how many times i learn it. it deserves a lifetime of meditations
01:26 Catalectic joined
01:26 <ertes> just keep in mind that this is a job interview… you will be doing a lot of "getting stuff done" =)
01:27 <ertes> if zygohistomorphic prepromorphisms don't sound like "getting stuff done" to you, they will not sound like that to your interviewer =)
01:27 <maybefbi> nah im talking like functor, applicative functor, monad
01:27 ContessaTP left
01:28 peschkaj joined
01:28 <phaazon> what is the syntax to build a specific target with stack again?
01:28 <ertes> also don't waste time understanding the joke: "monads? they're just monoids in the category of endofunctors, what's the problem?"
01:28 <phaazon> stack build stuff?
01:29 <phaazon> I have a two bins
01:29 <ertes> when i understood it after years of haskell, my first thought was: well, that was a waste of time =)
01:29 <ertes> spending years to understand a joke just to find that it isn't that good =)
01:30 <johnw> ertes: well, it is kind of beautiful to understand how pervasive monoids are
01:30 takle joined
01:30 <maybefbi> ertes, i like the fish based definition of monad more than the join or bind based one. fish does seem like a composition operator for kleisi arrows
01:31 <hpc> that's because it is
01:31 <johnw> doesn't the fish version make the monoid aspect harder to see?
01:31 <johnw> since the fish is a composition
01:31 <maybefbi> and then it is kinda obvious that monads are composition operators in the category of kleisi arrows
01:31 <ertes> not if you think of categories as monoids on steroids
01:31 <maybefbi> which is a better joke in my opinion
01:31 <dmwit> I think fish makes the monoid aspect easier to see.
01:31 <hpc> johnw: it's still fairly easy to see, just gotta get to category and the rest is "oh by the way, endofunctors"
01:31 <hpc> or something like that
01:31 <phaazon> no one for the stack error?
01:32 <dmwit> return >=> x = x = x >=> return -- these are the unit laws for monoid
01:32 <dmwit> x >=> (y >=> z) = (x >=> y) >=> z -- these are the associativity laws for monoid
01:32 <ertes> s/monoid/category/
01:32 yrdz joined
01:32 <hpc> :t sequence
01:32 <lambdabot> (Traversable t, Monad m) => t (m a) -> m (t a)
01:33 <hpc> (almost mconcat)
01:33 <ertes> but i suppose johnw is talking about those other monoids
01:33 pera joined
01:33 <dmwit> Oh, you're specifically talking about the "monoids in the category of endofunctors" joke. Never mind, then, I don't think these are related to that kind of monoid.
01:34 <dmwit> These are related to the "categories are just typed monoids" perspective.
01:36 wedify joined
01:36 <dolio> I don't see why understanding that definition would make the 'joke' funny.
01:37 <johnw> maybe a point being made here is that once you get the joke, it's not funny anymore. :)
01:37 <dolio> The 'joke' is that it takes years (maybe) of understanding to unpack that definition, then saying, "what's the problem."
01:38 uuplusu joined
01:39 uuplusu joined
01:39 <ertes> say "ε < 0" in a room full of mathematicians, and you'll see that they don't have particularly high standards when it comes to jokes
01:39 FreeBirdLjj joined
01:40 JavaSucksMan joined
01:40 yrdz joined
01:40 conal joined
01:40 <JavaSucksMan> OK... it's bad enough that the ghci_history file is backwards....
01:40 <JavaSucksMan> How do I get it to keep more than 100 lines?
01:41 ptvirgo joined
01:41 <JavaSucksMan> mike@kingman:~$ cat .ghc/ghci.conf
01:41 <JavaSucksMan> System.Console.Editline.Readline.stifleHistory 1000000
01:41 <JavaSucksMan> gave me the error
01:41 <JavaSucksMan> Not in scope: ‘System.Console.Editline.Readline.stifleHistory’
01:42 jmg8766 joined
01:42 <ertes> JavaSucksMan: http://trac.haskell.org/haskeline/wiki/UserPrefs
01:44 <JavaSucksMan> No... 40 is too small ;-)
01:44 <JavaSucksMan> just kidding... Nothing is the max
01:44 <JavaSucksMan> thanks
01:46 yan4138 joined
01:46 chenyn joined
01:47 JeanCarloMachado joined
01:48 <monochrom> yikes, monoids on steroids.
01:50 <monochrom> The Olympic gods forbid steroids applicative to monoids or any athlete enhancements.
01:50 <ertes> JavaSucksMan: i don't think there is a max… GHC is written in haskell, not in C =)
01:51 <ertes> monochrom: "enhancements"? you mean extensions?
01:51 <monochrom> Ah but libgmp is written in C too.
01:51 <monochrom> extensions is better!
01:51 guardianJ joined
01:51 <monochrom> Also, the history size field is Maybe Int, not Maybe Integer. There is a max, at least in the Just case.
01:52 juhp joined
01:52 <monochrom> consequence being: you can't have a limit of 293084930284039242348.
01:53 <ertes> ah, indeed… stupid 'take'
01:53 chao-tic joined
01:54 pasukon joined
01:55 <monochrom> I do not actually understand why they bother with Maybe Int to begin with, looks like worst of both worlds, but meh, historical reasons.
01:55 <ertes> i don't know what Nothing means
01:56 <monochrom> True.
01:58 Rizy joined
02:00 myk267 joined
02:01 <lpaste_> monochrom pasted “(lazy) pattern bindings” at http://lpaste.net/352637
02:01 <monochrom> phaazon: That.
02:02 basdb joined
02:02 coltfred joined
02:04 takle joined
02:07 JoshS joined
02:12 maksim__ joined
02:13 P1RATEZ joined
02:13 <phaazon> monochrom: yeah
02:13 <phaazon> it makes sense :)
02:13 <phaazon> thanks
02:14 <monochrom> :)
02:16 <phaazon> > let h x xs = x : x : xs; let z:zs = h z zs; (z, take 5 zs)
02:16 <lambdabot> <hint>:1:59: error:
02:16 <lambdabot> parse error (possibly incorrect indentation or mismatched brackets)
02:16 <monochrom> missing "in z" or something
02:16 <phaazon> > { let h x xs = x : x : xs; let z:zs = h z zs; } in (z, take 5 zs)
02:17 <monochrom> Oh!
02:17 <lambdabot> <hint>:1:1: error: parse error on input ‘{’
02:17 <phaazon> dammit
02:17 <monochrom> let {
02:17 yrdz joined
02:17 mkoenig joined
02:17 <Koterpillar> > let h x xs = x : x : xs; z:zs = h z zs in (z, take 5 zs)
02:17 <phaazon> > let { h x xs = x : x : xs; let z:zs = h z zs } in (z, take 5 zs)
02:17 <lambdabot> <hint>:1:46: error: parse error on input ‘}’
02:17 <lambdabot> mueval-core: Time limit exceeded
02:17 <Koterpillar> I win
02:17 <phaazon> yeah I knew it. :D
02:18 <monochrom> but "length (take 5 zs)" will work
02:18 <phaazon> > let h x xs = 1 : x : xs; let z:zs = h z zs in (z, take 5 zs)
02:18 <lambdabot> <hint>:1:62: error:
02:18 <lambdabot> parse error (possibly incorrect indentation or mismatched brackets)
02:18 <monochrom> You also have one more "let" than necessary.
02:18 <phaazon> > let h x xs = 1 : x : xs; z:zs = h z zs in (z, take 5 zs)
02:18 <lambdabot> (1,[1,1,1,1,1])
02:18 <phaazon> I’m tired :)))
02:18 <monochrom> neat
02:18 maybefbi left
02:19 <phaazon> this is a bit mindfarting, but hm :D
02:19 <phaazon> anyway, it’s 3:20 AM
02:19 <phaazon> night all
02:19 <monochrom> yikes
02:19 <phaazon> thanks for your help explaination
02:19 <phaazon> it’s been a while I hadn’t done any Haskell
02:19 <monochrom> you're welcome. good sleep.
02:20 <phaazon> I just migrated my website from HDBC to sqlite-simple in the meantime
02:20 <phaazon> :)
02:20 <phaazon> thanks! see you around, have a good day/sleep as well
02:20 zcourts joined
02:21 jmg8766 joined
02:22 mr_sm1th joined
02:23 pleax joined
02:23 pera joined
02:25 <monochrom> I compiled this code with -O: x,y :: Int; (x, y) = divMod (y+1) (x+2)
02:25 <monochrom> I looked at the core code. It goes simply "y = y; x = y"
02:26 <monochrom> damn you smart compiler.
02:28 stephA joined
02:29 JeanCarloMachado joined
02:30 takle joined
02:30 <stephA> little question. Do you know of any simple way to transform a data MyData = OptA | OptB | OptC into integral values 1,2,3 or 0,1,2 respectively for OptA, OptB,OptC. I may define a custom function doing the pattern matching, but I'm wondering if haskell has not something ready for doing that.
02:31 <pacak> stephA: deriving (Enum)
02:31 <pacak> :t toEnum
02:31 <lambdabot> Enum a => Int -> a
02:31 <pacak> :t fromEnum
02:31 <lambdabot> Enum a => a -> Int
02:31 <stephA> cool
02:31 <pacak> fromEnum True
02:31 <pacak> > fromEnum True
02:31 <lambdabot> 1
02:31 <pacak> > fromEnum False
02:32 <lambdabot> 0
02:32 <stephA> perfect !
02:32 <MarcelineVQ> though usually the point of a datatype like that is to avoid using numbers to stand in for things :>
02:32 michael1 joined
02:32 <stephA> yep, but I want to do some kitchen recipe formula for a fantasy ration, and some literal value are better multiplied when integers instead :-°
02:32 <stephA> :-)
02:33 <MarcelineVQ> :D
02:33 raycoll joined
02:36 <patientpl> can someone tell me why the following doesn't compile:
02:36 <patientpl> main = do
02:36 <patientpl> let blackset = []
02:36 <patientpl> blackset++[1]
02:36 <patientpl> print(blackset)
02:36 <patientpl> ?
02:36 systemfault joined
02:37 <patientpl> im attempting to make an empty list, store a value of 1 in it, and finally print it, from main
02:37 <pacak> (10:36:32) patientpl: blackset++[1]
02:37 <pacak> probably this
02:37 <patientpl> what's wrong with that?
02:37 <pacak> main supposed to be IO monad
02:38 <pacak> let blackset = [] -- blackset is an empty list
02:38 <patientpl> yep
02:38 <pacak> next line should be an IO action
02:38 <patientpl> and then i want to add one to the list
02:38 <pacak> but it's not
02:38 <pacak> There are no variables in haskell.
02:38 <exio4> patientpl: you can't "add one to the list", though
02:38 <pacak> Lists are immutable
02:38 <patientpl> ok
02:39 <c_wraith> patientpl: the mistake is the mental model. You don't change data structures in Haskell.
02:39 <pacak> let blackset1 = blackset ++[1]
02:39 <pacak> print blackset1
02:39 <c_wraith> patientpl: fortunately, you don't need to. You can always create a new one based on an older one.
02:39 <patientpl> mmm
02:39 <patientpl> so the issue is the mutability?
02:40 <pacak> In your case it simply failed to typecheck
02:40 <c_wraith> The (++) operator doesn't mutate lists.
02:40 <patientpl> ok that compiles however
02:40 <c_wraith> It returns a new list
02:40 <c_wraith> You were attempting to treat the returned list as an IO action
02:41 <c_wraith> Those are not the same thing, so you got a type error
02:41 <patientpl> I tried to use : and that doesn't work either. the issue is that I will need to mutate lists for what I have in mind
02:41 <pacak> let blackset1 = 1 : blackset
02:41 <c_wraith> patientpl: here's a secret: you don't need to mutate anything, ever, with the right computational models. :)
02:41 <pacak> patientpl: I suppose it is tempting, if the only tool you have is a hammer, to treat everything as if it were a nail.
02:42 <patientpl> sure, that works, i understand that. however for what i want to do im going to have to add and subtract lots of items from a list
02:42 <pacak> patientpl: You probably don't need to mutate stuff.
02:42 <exio4> patientpl: you need to think the problem such that you don't need to!
02:42 <patientpl> stop
02:42 <patientpl> lets say that i do
02:42 <patientpl> is there a way to do this
02:43 <ertes> patientpl: about your earlier example: remember what i said about "="? you wrote: blackset = []
02:43 <ertes> that means blackset is equal to [] and will be equal to [] forever
02:44 <patientpl> ertes i understand the constraints of an immutable variable. im asking if there is a way of defining a mutable list in haskell.
02:44 <c_wraith> patientpl: there are ways to use mutability, but they're a lot more mental overhead, as they should be.
02:44 rootnode joined
02:44 <c_wraith> patientpl: mutability is *really hard* to get right. It should therefore force you to think to use it.
02:44 <exio4> patientpl: they're quite annoying to work with, and bulky :)
02:45 <c_wraith> patientpl: and you can't ever mutate a data structure that wasn't intended for it.
02:45 winterland1989 joined
02:45 <ertes> patientpl: yes, but you shouldn't use them
02:45 JeanCarloMachado joined
02:45 <ertes> patientpl: the way to achieve state in haskell is recursion
02:46 <patientpl> so use a recursive function
02:46 <ertes> patientpl: of course what you're doing right now is stateless, so the pedantic answer is: just define (blackset = [1]) instead
02:47 snowalpaca joined
02:47 <ertes> patientpl: exercise: define a function (printHelloTimes :: Int -> IO ()) that prints the line "Hello world!" the given number of times
02:47 <ertes> so the program (main = printHelloTimes 10) prints "Hello world!" 10 times
02:48 path[l] joined
02:48 montagy joined
02:49 jrmann100 joined
02:50 cereal_killer_ joined
02:50 mrkgnao joined
02:51 takle joined
02:52 skeuomorf joined
02:53 JavaSucksMan joined
02:53 jrmann100 left
02:53 pasukon joined
02:55 xall_ joined
02:55 Big_G joined
02:56 <dmwit> pacak++ c_wraith++ exio4++ ertes++ for incredible patience
02:57 takle joined
02:58 meba joined
03:00 <ertes> patientpl: this is an exercise on pure state… if you need help, feel free to ask… we can also do it step by step
03:00 <Rotaerk> why'd you just concatenate pacak, c_wraith, exio4, ertes, and (for incredible patience)
03:00 <monochrom> haha
03:00 <ertes> =)
03:00 hucksy_ joined
03:00 <c_wraith> patience is concatenative, right?
03:00 <exio4> Rotaerk: we're stronger together!
03:00 <Rotaerk> :P
03:00 <ertes> but i'm not a list!
03:01 <c_wraith> Does this imply there's a patience monoid?
03:01 MrJazz_ joined
03:02 <ertes> sure there is a patience monoid: newtype Patience = Patience Patience
03:03 <monochrom> What is its mempty?
03:03 <ertes> mempty
03:03 <Koterpillar> no one's got time to answer that!
03:03 <monochrom> yikes
03:03 <ertes> Koterpillar: just be patient
03:04 doubleleft joined
03:05 staffehn joined
03:06 doubleleft joined
03:08 mizu_no_oto joined
03:09 Rodya_ joined
03:09 TxmszLou joined
03:10 <pacak> use concat instead of a bunch of ++
03:10 eSVG joined
03:11 burdges joined
03:12 uuplusu joined
03:12 uuplusu joined
03:13 Catalectic joined
03:13 niteria joined
03:14 chao-tic joined
03:15 jshjsh joined
03:16 MrJazz joined
03:16 fabianhu joined
03:18 Rodya_ joined
03:19 roconnor joined
03:19 uuplusu joined
03:20 exferenceBot joined
03:21 hexagoxel joined
03:21 takle joined
03:21 path[l] joined
03:21 zcourts joined
03:21 <byorgey> dmwit: working with diagrams over Integer or Rational is hard (I have considered it), you really need square root. And in any case I don't think it would solve benzrf's problem. Rendering itself introduces error even if your diagrams are represented exactly.
03:22 Catalectic joined
03:22 sellout- joined
03:22 Catalectic joined
03:22 <wizard1337> is there a strict by default haskell?
03:22 <dmwit> Yes. I never wrote up my cunning plan, but it was something along the lines of "rendering causes rounding, and we don't want rounding... what if we never render the diagram?". ;-)
03:24 <ertes> wizard1337: you can make modules strict by default via -XStrict, but you won't get a strict haskell that way
03:24 lspitzner joined
03:25 uuplusu joined
03:25 pleax joined
03:25 uuplusu joined
03:26 indi_ joined
03:26 xall joined
03:26 JeanCarloMachado joined
03:27 deepbook5broo joined
03:28 <monochrom> dmwit: That is anti-climatic. I was hoping for something cleverer than that.
03:29 <monochrom> But the real horror is that benzf indicated that they were using cyclotomic numbers already.
03:29 JoeyAdams joined
03:29 <benzrf> :D
03:30 deepbook5broo left
03:30 <monochrom> We need analog vector graphics on a CRT
03:30 <benzrf> @let newtype Patience = Patience Patience
03:30 <lambdabot> Defined.
03:30 <Koterpillar> monochrom: been done
03:30 <benzrf> @let patient = Patience patient
03:30 <lambdabot> Defined.
03:31 _sg joined
03:31 <monochrom> Yeah I heard that McCarthy did his first windowing system on vector graphics CRT
03:31 JeanCarloMachado joined
03:32 TxmszLou joined
03:33 nomicflux joined
03:33 Rizy joined
03:35 jrmann100 joined
03:36 AndiK joined
03:39 <nshepperd> > undefined :: Patience
03:39 <lambdabot> Patience (Patience (Patience (Patience (Patience (Patience (Patience (Patien...
03:40 <dmwit> nshepperd: your Patience is unmatched
03:40 <monochrom> haha
03:40 <LeCamarade> Hah! Not funny! 😁
03:42 <byorgey> dmwit: hahahaha (I am laughing at both jokes)
03:42 snowalpaca joined
03:42 <dmwit> =D
03:43 uuplusu joined
03:43 jrmann100 left
03:44 phileas joined
03:44 <nshepperd> The close paren is sure to come tomorrow.
03:44 Textmode joined
03:46 <monochrom> The Racket Summer School is advertising on the haskell mailing list.
03:46 <monochrom> I have no objection, except "As soon as you get accepted, we will send you your first problem set. Get ready.", which suggests that it starts now.
03:47 <monochrom> We are still 6 months away from summer!
03:50 mmachenry joined
03:50 rkazak joined
03:50 mudfog_ joined
03:50 mikecaruso joined
03:50 <nshepperd> it's always summer (somewhere)
03:51 vicfred joined
03:51 mmachenry1 joined
03:51 ramzifu joined
03:52 mmachenry2 joined
03:53 surtn joined
03:54 eklavya joined
03:54 <patientpl> given i have addone = (:[1]) and emptylist = [] i want to write addone emptylist
03:55 <patientpl> however i get the error "non type-variable argument in the constraint Num [t] use flexiblecontexts to permit this"
03:57 JeanCarloMachado joined
03:58 dramforever joined
03:58 <Koterpillar> patientpl: give them types
03:58 <dmwit> I suspect you would prefer `addone = (1:)`.
04:00 <dramforever> :t (:[1]) []
04:00 <lambdabot> Num [t] => [[t]]
04:00 <dmwit> > []:[1]
04:00 <lambdabot> error:
04:00 <lambdabot> • Ambiguous type variable ‘t0’ arising from a use of ‘show_M886538537024...
04:00 <lambdabot> prevents the constraint ‘(Show t0)’ from being solved.
04:00 <dmwit> > 1:[]
04:01 <lambdabot> [1]
04:01 indi_ joined
04:01 Goplat joined
04:02 <dramforever> patientpl: See? Num [t] is the problem
04:02 <dramforever> Lists aren't numbers
04:02 indi_ joined
04:02 <EvanR> instance Num [
04:02 <EvanR> instance Num [Bit] where
04:02 <dmwit> dramforever: I am mildly curious how you are able to see the conversation. My client pins you as having joined *after* the things you're responding to.
04:03 <dramforever> dmwit: See the topic of #haskell?
04:03 <dramforever> We have logs
04:03 <dmwit> Do you have some client integration with those logs, or do you just check them yourself?
04:03 uuplusu joined
04:04 <dramforever> The ircbrowse logs somehow stopped updating since about 2 weeks ago, but the tunes logs are fine
04:04 <dramforever> dmwit: I just check them manually
04:04 <dramforever> I always do this
04:04 <dmwit> fun
04:04 chopsuey joined
04:05 Cooler joined
04:05 <dmwit> EvanR: Or `instance Num a => Num [a] where (+) = liftA2 (+); fromInteger = pure . fromInteger` etc.
04:05 takle joined
04:05 aib joined
04:06 kolko joined
04:06 <EvanR> > liftA2 (+) [1,2,3] [4,5]
04:06 <lambdabot> [5,6,6,7,7,8]
04:06 tlahtoani joined
04:06 <dramforever> but hey
04:07 <* dmwit> . o O ( What are the `Num` laws? )
04:07 <monochrom> (x:xs) + (y:ys) = (x+y) `mod` 10 : (xs + ys + carry)
04:07 <dramforever> Heck
04:07 <dmwit> monochrom: yep, 10 seems like the natural base
04:07 <dramforever> [[], 1] Just outright doesn't make much sense
04:08 <dramforever> monochrom: How about polynominal?
04:08 <monochrom> http://www.vex.net/~trebla/humour/tautologies.html #10
04:08 chreekat joined
04:08 indi_ joined
04:09 <monochrom> Doug McIlroy did polynomials
04:10 <monochrom> http://www.cs.dartmouth.edu/~doug/powser.html
04:10 <monochrom> more than polynomials. power series he did.
04:11 `Guest05 joined
04:11 <tlahtoani> Ah
04:11 <dramforever> wtf
04:11 JeanCarloMachado joined
04:12 <tlahtoani> How would I go about doing a left wrapping bitwise rotation in Haskell?
04:12 <monochrom> something in Data.Bits. Does "rotate" help?
04:13 <monochrom> also rotateL and rotateR
04:13 <tlahtoani> Do they wrap?
04:13 takle joined
04:13 Rizy joined
04:13 <dramforever> > printf "%x" (rotateL 0xf0f0f0f0) :: String
04:13 <monochrom> If I understand "wrap" correctly, yes.
04:13 <lambdabot> error:
04:13 <lambdabot> • No instance for (PrintfArg (Int -> a0))
04:13 <lambdabot> arising from a use of ‘printf’
04:13 <tlahtoani> It's imperative that it wraps
04:14 <dramforever> :t rotateL
04:14 <lambdabot> Bits a => a -> Int -> a
04:14 cschneid_ joined
04:14 <dramforever> > printf "%x" (rotateL 0xf0f0f0f0 4) :: String
04:14 <lambdabot> "f0f0f0f00"
04:14 <dramforever> uhoh
04:14 <tlahtoani> That did not wrap
04:14 <monochrom> say "Int32" or "Word32"
04:14 <dramforever> tlahtoani: I did it wrong sorry
04:14 <tlahtoani> It just sort of added a bit
04:15 <dramforever> > printf "%x" (rotateL 0xf0f0f0f0 4 :: Word32) :: String
04:15 <lambdabot> "f0f0f0f"
04:15 <dramforever> tlahtoani: because Integer is unbounded
04:15 <dramforever> So it will never wrap
04:15 <dramforever> Word32 will wrap
04:15 cdg joined
04:15 <tlahtoani> I guess I should specify that my use case invoked 2-128 bits...
04:16 <tlahtoani> Involves*
04:16 <monochrom> But which number type are you using?
04:16 <EvanR> theres a Word128 lying around probably
04:16 <tlahtoani> The one that is only limited by RAM
04:16 doodlehaus joined
04:17 <dramforever> Integer or Natural, presumably
04:17 <tlahtoani> Integer
04:17 <monochrom> Integer and Natural does not know that you're interested in 128 bits.
04:17 roconnor joined
04:17 <kadoban> "For unbounded types like Integer, rotate is equivalent to shift." from the docs
04:17 <tlahtoani> My specific use case is 128 bits but the ability to rotate 24000 bits is okay
04:18 <kadoban> Which is all it could really do.
04:18 <monochrom> I think you'll have to code up something yourself.
04:18 <tlahtoani> Aww
04:18 <EvanR> a bit zipper
04:18 <tlahtoani> JS made me convert to strings
04:19 <tlahtoani> I need to shift the most significant bit to make it the least significant bit
04:19 <tlahtoani> Which is harder in practice than I thought
04:19 Rodya_ joined
04:19 <monochrom> Do you only shift for 1 bit?
04:21 takle joined
04:21 <tlahtoani> Yes
04:21 <tlahtoani> Just a single bit
04:22 <monochrom> I'm thinking how to obtain a bit mask that has exactly one 1 and it is right at your MSB.
04:22 <alx741> hello everyone. Is there a package to print out a human representation of time from a UTCTime type, like in "1 week ago" or "30 minutes ago"?
04:22 patbecich joined
04:23 earldouglas joined
04:23 <monochrom> Or a bit mask that has 1's from your MSB to 0
04:24 <tlahtoani> The important part is that 1001 become 0011
04:26 pleax joined
04:26 howdoi joined
04:27 <EvanR> alx741: thats not a function of one UTCTime, but rather 2
04:27 <tlahtoani> A complicated solution to a complicated problem...
04:27 <EvanR> or one Integer number of seconds
04:28 <EvanR> (NominalDiffTime)
04:28 <alx741> EvanR: oh!, you're right, the current time. UTCTime -> UTCTime -> IO String
04:28 <EvanR> IO???
04:29 <tlahtoani> Shifting to the the left while wrapping the bit is the solution to the Josephus permutation
04:29 robotroll joined
04:30 <alx741> EvanR: will take a look at NominalDiffTime, thanks! (and yep, IO would be dumb in there, my mistake)
04:30 <EvanR> search for time formatting packages
04:32 <dmwit> tlahtoani: http://hackage.haskell.org/package/arithmoi-
04:32 <dmwit> for getting the MSB
04:32 sajith joined
04:32 nomotif joined
04:32 <EvanR> i have a feeling the most significant bit is 1
04:33 <dmwit> Yes. For getting the *index* of the MSB.
04:34 <dmwit> But I doubt this is really what's wanted.
04:34 adarn joined
04:34 <dmwit> After "rotating" the MSB into the LSB position, the index of the MSB may decrease.
04:34 <alx741> EvanR: humanRelTime is the winner, just the type signature I was looking for :) , thanks!
04:34 <dmwit> So 1001 would not become 0011, it would become 11.
04:35 <EvanR> heh "30 seconds ago" is the "human" rendering]
04:35 <tlahtoani> Which is fine
04:36 <tlahtoani> The zeros were there to keep the representation consistent
04:36 <Axman6> tlahtoani: I missed the beginning of this, what're you trying to do? looks like something HAcker's Delight would have solutions for
04:36 <tlahtoani> Solve the Josephus permutation without calculating each answer
04:36 <Axman6> (I have a copy of it with me if it might be useful)
04:37 Textmode joined
04:38 <tlahtoani> Instead doing a neat bit hack gives you the correct answer Everytime
04:38 <Axman6> there was a video on this recently... which youtube channel was it...
04:39 <tlahtoani> Number phone
04:39 <tlahtoani> Fff
04:39 <tlahtoani> Numberphile
04:39 <Axman6> yes, that one
04:40 otto_s_ joined
04:40 <Axman6> so, what bit twiddling are you trying to do?
04:41 <Axman6> (also writing an efficient rotate function if pretty trivial, it's just two shifts
04:41 <tlahtoani> 1001 -> 0011
04:41 <EvanR> 1011 -> 0111 ?
04:41 <tlahtoani> Yah
04:41 mmachenry joined
04:42 <EvanR> 100101101 -> 001101101?
04:42 systemfault joined
04:42 <tlahtoani> Nej
04:42 <EvanR> heh
04:42 <Axman6> > let rot x n = rotateL x n .|. shiftR x (bitSize x - n) in rot (0b1001 :: Word8)) 1
04:42 <lambdabot> <hint>:1:80: error: parse error on input ‘)’
04:42 <Axman6> > let rot x n = rotateL x n .|. shiftR x (bitSize x - n) in rot (0b1001 :: Word8) 1
04:42 <lambdabot> error: Variable not in scope: b1001
04:42 <tlahtoani> 100101101 -> 001011011
04:42 <Axman6> bleh
04:43 <Axman6> Y U NO BITS
04:43 xall joined
04:46 hexagoxel joined
04:46 steeze joined
04:46 dramforever joined
04:47 Ranhir joined
04:47 path[l] joined
04:47 raichoo joined
04:48 stass joined
04:51 TxmszLou joined
04:51 lubricy joined
04:52 JeanCarloMachado joined
04:52 <ubsan> is there any way to force onesself to write function types?
04:53 <ubsan> make the compiler error in those cases where you define a function without giving its type?
04:53 i-amd3 joined
04:53 <ubsan> I really don't like full program inference
04:54 <Maxdamantus> Presumably you're not referring specifically to functions and you are referring specifically to top-level definitions?
04:54 <ubsan> Maxdamantus: yeah
04:54 <Koterpillar> ubsan: there's a warning, which you can make into error
04:54 <dramforever> I'm pretty sure -Wall -Werror does that
04:54 <lubricy> join #haskell-beginners
04:54 <dramforever> Koterpillar: lol
04:54 takle joined
04:55 lubricy left
04:55 faberbrain joined
04:55 <ubsan> Koterpillar: how do?
04:55 yan4138 joined
04:55 <ubsan> -Wall -Werror, I guess
04:55 <dramforever> -fwarn-missing-signatures
04:55 fizruk joined
04:56 <ubsan> it's very strange to see gcc-style flags in a non-C++ compiler, tbqh :P
04:57 andyhuzhill joined
04:58 <dramforever> ublubu: gcc has them under -W not -fwarn
04:58 <ubsan> dramforever: -Werror and -fwarn
04:58 bostonfan94 joined
04:59 lubricy joined
04:59 mmachenry joined
04:59 <dramforever> Sorta
04:59 <ubsan> dramforever: I mean, it looks like C compiler options lol
04:59 <lubricy> @help
04:59 <lambdabot> help <command>. Ask for help for <command>. Try 'list' for all commands
05:00 FreeBirdLjj joined
05:00 <geekosaur> ghc8 uses the -W style, fwiw (the -f forms are still supported for backward compatibility)
05:01 <dramforever> Geekingfrog: Thanks for the information
05:01 <ubsan> geekosaur: oh, cool
05:01 <dramforever> Uh sorry I meant geekosaur
05:01 <geekosaur> but, show me the C++ compiler with -Wunused-do-binds :)
05:01 <ubsan> dramforever: you kinda suck at pinging the right person :P
05:01 <ubsan> lol
05:01 <ubsan> geekosaur: I mean
05:02 <ubsan> maybe not do-binds
05:02 <ubsan> but
05:02 <dmwit> Uniform interfaces are good HCI.
05:02 <ubsan> -Wunused-variable
05:02 <dmwit> Why invent a new interface when the old one is already familiar?
05:02 <dramforever> ubsan: It's hard to get nick autocompleete to work all the time in a 1500-user channel
05:02 <dramforever> dmwit: Looking at you, -O and -O2
05:02 <dmwit> dramforever: Configure your client to prefer recent speakers.
05:02 <ubsan> dramforever: just teasing :)
05:03 <dmwit> Most of the 1500 users never talk.
05:04 zcourts joined
05:04 <dmwit> monochrom: I very much like "Every inexplicable problem is caused by something you don't think is the cause.".
05:04 JeanCarloMachado joined
05:04 <dramforever> dmwit: I didn't know it was a thing. Thanks
05:04 montagy joined
05:05 <lubricy> @pl map
05:05 <lambdabot> map
05:05 <dmwit> ?unpl map
05:05 <lambdabot> map
05:05 <dmwit> pfft
05:05 <monochrom> thallada: If you use 0-based indexing instead of 1-based indexing, you don't have to add 1.
05:05 <monochrom> heh dmwit
05:05 <lubricy> hi guys
05:06 <dmwit> hi lubricy
05:06 <lubricy> new to this IRC thing
05:06 <dramforever> hi
05:06 <dramforever> To talk privately to lambdabot, use this command: /query lambdabot
05:06 <Axman6> Welcome to multiplayer notepad!
05:06 <todaystomorrow> I love mutliuser vim
05:07 <Axman6> it's probably more like multiplayer ed
05:08 <ubsan> Axman6: ... I really want to build this now
05:08 <dramforever> Twitch exits vim
05:09 joshuagross joined
05:09 eacameron joined
05:09 <Axman6> Hard mode: Twitch exits Emacs
05:10 <MP2E> haha
05:10 <Maxdamantus> If you press ctrl-c in vim it tells you how to exit.
05:10 <* Maxdamantus> suspects that won't work in emacs.
05:10 <dramforever> C-c C-c is undefined
05:11 <Axman6> it'll just sit there and eventually say "Well? I'm waiting? what do you want from me!"
05:11 Deide joined
05:11 <monochrom> No, your laptop battery dies first.
05:15 JeanCarloMachado joined
05:16 justanotheruser joined
05:17 Rainb joined
05:22 mmachenry joined
05:23 alx741 joined
05:26 andyhuzhill joined
05:27 pleax joined
05:31 yan4138 joined
05:32 platz joined
05:34 takle joined
05:34 electrostat joined
05:35 jbiesnecker joined
05:35 justicefries joined
05:37 latro`a_ joined
05:39 xtreak joined
05:39 greatdex joined
05:40 path[l] joined
05:43 ramzifu joined
05:44 vlatkoB joined
05:45 <zipper> You guys do unsafePerformIO a lot? I keep doing it nowadays.
05:47 uuplusu joined
05:48 yan4138 joined
05:49 JeanCarloMachado joined
05:50 indi_ joined
05:50 pavonia joined
05:53 <peddie> zipper: not sure I've ever used it myself, maybe a few times with the FFI
05:54 <MarcelineVQ> I've never been able to use it. Mostly due to this line in it's docs "For this to be safe, the IO computation should be free of side effects and independent of its environment." I've never used an IO compution that actually did work that met that crieria
05:56 chrisdotcode joined
05:59 Rizy joined
06:00 sometestguy joined
06:00 jgertm joined
06:01 jutaro joined
06:01 thunderrd joined
06:02 dec0n joined
06:02 zcourts joined
06:04 <zipper> MarcelineVQ: In my case I wanted to get a random element in a JSON array while parsing JSON.
06:04 <zipper> So it was already in a monad that was not IO
06:05 <zipper> Unless I could transfrom the IO monad into the Parser Monad which I don't know how to.
06:05 <MarcelineVQ> liftIO possibly, not sure without seeing it
06:06 fizruk joined
06:07 <zipper> MarcelineVQ: https://github.com/nairobilug/nairobi-bot/blob/master/src/Bot/Types.hs#L119
06:07 faberbrain joined
06:07 <zipper> I'll try that
06:07 kritzcreek joined
06:07 AndiK joined
06:07 <zipper> :t liftIO
06:07 <lambdabot> MonadIO m => IO a -> m a
06:08 <zipper> hmmm
06:08 indi_ joined
06:08 chopsuey left
06:09 jan_sipr joined
06:11 <zipper> Where is it defined https://hackage.haskell.org/package/transformers- ?
06:11 <zipper> Can't find it there
06:11 <zipper> :i liftIO
06:11 heurist__ joined
06:13 <zipper> Seems to have been removed from newer versions of transformers
06:13 raycoll joined
06:13 <MarcelineVQ> http://hackage.haskell.org/package/base-
06:14 <zipper> MarcelineVQ: Thanks
06:15 fcpga_te joined
06:15 osa1 joined
06:15 osa1 joined
06:15 pleax joined
06:15 djellemah_ joined
06:17 <MarcelineVQ> likel it doesn't have a MonadIO instance anyway but it's good to be aware of liftIO
06:17 <MarcelineVQ> *likely
06:17 <zipper> hmmmm "No instance for MonadIO aeson-" I wonder how other people do it
06:18 <MarcelineVQ> what is the reason for the random selection btw?
06:19 chrisdotcode joined
06:19 andyhuzhill joined
06:21 jhrcek joined
06:21 Rodya_ joined
06:22 buttons840 joined
06:22 zv joined
06:23 insitu joined
06:26 basdb joined
06:27 zcourts joined
06:27 jbiesnecker joined
06:27 SpinTensor joined
06:31 JeanCarloMachado joined
06:32 castlelore joined
06:32 castlelore joined
06:34 cschneid_ joined
06:35 justicefries joined
06:37 cpup joined
06:38 michael1 joined
06:40 fcpga_te joined
06:40 juhp joined
06:40 zeroed joined
06:40 zeroed joined
06:41 raichoo joined
06:42 abhiroop joined
06:43 path[l] joined
06:45 ertesx joined
06:45 ketil__ joined
06:45 <dmwit> zipper: I think other people don't do it. But if you really need to do it, you could consider parameterizing your type. While parsing, put in `()`s where you want random bits. Then afterwards...
06:46 <dmwit> :t traverse (\() -> randomRIO (0, 10))
06:46 <lambdabot> (Random b, Traversable t, Num b) => t () -> IO (t b)
06:46 <dmwit> Or put in whatever data you would use to pick a random number and use it inside the function you pass to `traverse`, of course.
06:49 <zipper> MarcelineVQ: I want to select a random gif out of a list of gifs
06:49 MrJazz_ joined
06:49 <zipper> So that say request for a cat gif twice doesn't give you the same cat
06:49 edsko joined
06:49 <zipper> MarcelineVQ: Not something like landing aeroplanes :)
06:50 <zipper> dmwit: Thanks
06:50 <geekosaur> nevertheless, you need something you can't get from a FromJSON instance
06:50 snowalpaca joined
06:50 <zipper> geekosaur: Yes
06:50 <geekosaur> tbh, it seems to me you'd generate the structure with an object map, and let a postprocessing step do the random pick
06:50 padre_angolano joined
06:51 <geekosaur> (well, I suppose object array)
06:51 <geekosaur> trying to do too much in one step is not necessarily wise anyway
06:51 <zipper> geekosaur: I see what you mean.
06:51 <MarcelineVQ> another option is to use parts of what you parse in a psudo-random (thus avoiding IO) fashion, creating a StdGen from the length of lst for example, and using next on it once for slightly better range. I wouldn't go that route because unless you're fetching many many gifs that number isn't an especially good seed though
06:51 <zipper> I should pick the random element at a step that is outside of the parsing
06:51 <geekosaur> ...and you may find you need to do that anyway (consider that you may need to ensure you pick a different one later)
06:52 <zipper> Leave the parsing to do just the parsing
06:52 <MarcelineVQ> If you don't want the same cat twice often the solution is so track the cats you've seen already
06:52 <zipper> MarcelineVQ: You mean introduce state?
06:54 filterfish joined
06:54 <MarcelineVQ> Yeah, though whether that's the reasonable route depends a lot on your use case
06:55 eazar001 joined
06:57 <zipper> MarcelineVQ: naaah one time a person wants a cat gif
06:57 <zipper> Another wants a cats gif
06:57 <zipper> It would be hard to track all the search words
06:57 <zipper> and associate them
07:00 <osa1> does anyone know a functional queue library that implements this: `data Queue a = Queue { _front :: [a], _back :: [a] }` I need a functional queue implementation but surprisingly I can't find it on Hackage. should I use Data.Sequence (finger tree) instead?
07:00 louispan joined
07:01 <ubsan> osa1: https://hackage.haskell.org/package/dequeue-0.1.12/docs/Data-Dequeue.html ?
07:01 <ezyang> osa1: Well, if you need it fast, this queue is really easy to implement ;)
07:01 <MarcelineVQ> ezyang, osa1: fun too!
07:02 <ubsan> I may be misunderstanding your problem
07:02 <ezyang> ubsan's link is for the fancy version
07:02 <ezyang> (also in Okasaki)
07:03 <monochrom> TChan does the front-list-and-back-list too.
07:03 <osa1> monochrom: you mean stm? I need a pure one
07:03 <monochrom> True.
07:04 <osa1> anyway, I already implemented it, takes just a couple of lines to implement push and pop but I'd rather just import it if possible.
07:05 quchen joined
07:05 twitchett joined
07:05 Xanather joined
07:06 <monochrom> I just did http://hackage.haskell.org/packages/search?terms=queue and I think no one has ever uploaded this simple thing.
07:06 <monochrom> Everyone has to aim high when releasing a package, eh?
07:06 insitu joined
07:09 <osa1> heh well if anyone needs it https://gist.github.com/osa1/6427742c411bb53d6894f564e3fde4dd
07:09 indi_ joined
07:10 indi_ joined
07:10 nomotif joined
07:11 takle joined
07:13 laz joined
07:13 dfeuer joined
07:15 nxtr joined
07:16 alfredo joined
07:16 thunderrd joined
07:16 freusque joined
07:16 zariuq joined
07:17 pleax joined
07:22 filterfish joined
07:23 Rodya_ joined
07:23 <zipper> I really need to read on pipes :(
07:24 ihradek joined
07:25 HalfEatenPie joined
07:25 andyhuzhill joined
07:25 michael3 joined
07:26 free_beard joined
07:27 takuan joined
07:27 zcourts joined
07:28 greatdex joined
07:29 takle joined
07:30 joshuagross joined
07:31 JeanCarloMachado joined
07:33 mfukar joined
07:33 deepfire joined
07:36 SeMas joined
07:37 juhp joined
07:38 zennist joined
07:43 justicefries joined
07:45 BartAdv joined
07:45 andyhuzhill joined
07:46 matej_ joined
07:48 bjz joined
07:48 fizruk joined
07:48 matej_ joined
07:50 mszczygiel joined
07:50 caumeslasal joined
07:50 sword865 joined
07:50 takle joined
07:51 jutaro joined
07:54 ragepandemic joined
07:54 ynyounuo- joined
07:55 HanlonsRazor joined
07:57 kqr left
07:58 guiben joined
07:58 FreeBirdLjj joined
08:00 JeanCarloMachado joined
08:00 andyhuzhill joined
08:00 insitu joined
08:06 pleax joined
08:07 <ongy> is parsec a good choice to build a config parser?
08:07 ramzifu joined
08:07 biglama joined
08:08 alexknvl joined
08:09 Wizek_ joined
08:09 Wizek joined
08:09 Wizek__ joined
08:10 DavidEichmann joined
08:11 Beetny joined
08:11 takle joined
08:12 tsahyt joined
08:12 mattyw joined
08:13 <ezyang> ongy: Yes.
08:14 henriksod joined
08:14 <ongy> ok, then I will have to wrap my head around it
08:15 Nerterologist joined
08:16 thunderrd joined
08:16 thc202 joined
08:18 Iskarlar joined
08:18 <thunderrd> slyfox: thanks for all the work, everything successfully built now
08:19 Itkovian joined
08:19 JeanCarloMachado joined
08:22 indi_ joined
08:22 <ongy> what's the most recent idiot-friendly parsec tutorial? The website seems to be down, the archive is rather outdated
08:23 Yuras joined
08:23 unK_ joined
08:24 <ertes> ongy: you could also just use a common format and not bother with writing a parser
08:24 <ertes> @package yaml
08:24 <lambdabot> http://hackage.haskell.org/package/yaml
08:25 augur joined
08:26 <ongy> my current plan is to have a small language for specifying match-rules either way, so I will need a parser either way. Also yuck, yaml
08:27 yoneda joined
08:27 louispan joined
08:27 path[l] joined
08:27 <louispan> what are some of the bad extensions?
08:28 silver joined
08:29 caumeslasal joined
08:30 twitchett_ joined
08:30 zennist joined
08:32 Miroboru joined
08:32 prohobo joined
08:33 chris_ joined
08:33 prohobo left
08:33 <osa1> RecordWildCards :-)
08:36 CoolerExtreme joined
08:36 CoolerExtreme joined
08:37 AndreasK joined
08:38 systadmin joined
08:39 doomlord joined
08:39 indi_ joined
08:40 JeanCarloMachado joined
08:43 Younder joined
08:43 prohobo joined
08:43 prohobo left
08:43 jpthing joined
08:44 filterfish joined
08:47 <ezyang> Public service announcement: do NOT use regex-posix (and transitively, regex-compat) on Windows, it's buggy as hell
08:48 oish joined
08:48 clinton joined
08:48 Cooler joined
08:49 xtreak joined
08:49 Cooler joined
08:49 <clinton> I'm using rewrite rules, and I'm getting this type of error: "add (C l) to the context of the RULE...". Where do I add a signature, including class constraint, into a rule (I can't find an example like it in the docs)
08:50 <clinton> as in "Possible fix: add (C l) to the context of the RULE..." is the error I'm getting
08:50 <pavonia> ezyang: I'm using both on Windows, could you elaborate?
08:51 CoolerExtreme joined
08:51 <ezyang> pavonia: Look at this: http://lpaste.net/352641
08:52 <ezyang> Also look at http://stackoverflow.com/questions/39047317/simple-regular-expression-substitution-crashes-on-windows-using-regex-compat/39101634#39101634
08:53 <ezyang> this is with regex-posix-0.95.2
08:53 pleax joined
08:54 CoolerExtreme__ joined
08:55 <`Guest05> Hackage needs comments to packages
08:56 <ezyang> bleh, time to find a new regex library
08:56 <pavonia> ezyang: My version is regex-compat-0.93.1 and it returns the correct result "<ROOT>\\xxx\\yyy\\zzz"
08:56 browndawg joined
08:57 <ezyang> pavonia: Interesting. Could be a regression in the newer version!
08:57 <ezyang> oh wait, don't give me your compat version, give me your regex-posix version
08:57 bollu joined
08:57 <pavonia> regex-posix-0.94.4
08:58 <ezyang> ok, my comment stands ;)
08:58 <ezyang> btw, this is 64-bit windows
08:58 fbergmann joined
08:59 kazagistar joined
09:00 justicefries joined
09:00 mmn80 joined
09:00 <cdornan> ezyang: realised we were in this swamp a while back and switched to regex-tufa
09:01 <cdornan> Might also want. To look at regex
09:01 <ezyang> cdornan: Thanks
09:01 janos joined
09:01 <ezyang> I find the regex-* family of packages to have... really hard to understand APIs
09:01 <ezyang> like, how do I do a search-replace with the non compat interface?!
09:02 JoshS joined
09:02 <cdornan> Actually you have a great opportunity to shape regex as it is about to hit RFC
09:02 <ezyang> heh
09:03 <cdornan> ezyang: regex intends to capture goodness of regex-base with a nicer API
09:03 andyhuzhill joined
09:03 <ezyang> So many deps :(
09:03 pleax joined
09:03 <cdornan> GOING
09:04 <cdornan> going to split the package
09:04 <ezyang> good! :)
09:04 <cdornan> Just about to upload a version that strips library deeps to minimum
09:05 <ezyang> I wonder what the canonically used regex libraries in yesod/stack-world are
09:05 <pavonia> ezyang: Btw, the linked SX program works for me too
09:06 <cdornan> I thing they are based on regex-base, regex-tdfa, regex-pcre
09:06 <ezyang> pavonia: Still with the older version?
09:06 <pavonia> Yes
09:07 <ezyang> pavonia: If you're curious, try it with the new version :)
09:07 ramzifu joined
09:08 schjetne joined
09:09 <ezyang> wait, I'm reading a blog post that claims the new-style regex-* apis (including regex-pcre/regex-tdfa) doesn't support substitutions at all
09:09 <ezyang> is this actually ture
09:09 gregman_ joined
09:09 <ezyang> well, there seems to be a regex-compat-tdfa to solve this
09:09 Shou joined
09:10 a3Dman joined
09:10 jgertm joined
09:10 <cdornan> @ezyang yes -- a major motivation for regex
09:10 <lambdabot> Unknown command, try @list
09:10 <ezyang> cdornan: :) Did you also look at the other regex libraries out there before deciding to build one?
09:11 <cdornan> Yes indeed
09:11 <ezyang> what did you discover?
09:11 doodlehaus joined
09:11 simukis_ joined
09:12 iomonad joined
09:12 oish joined
09:12 ali_bush joined
09:12 ali_bush joined
09:13 <cdornan> Serious stacks are rightly based on regex-{base,pcre,tufa} but as you say the API is not easy to use and missing stuff
09:13 tomphp joined
09:13 CoolerExtreme__ joined
09:14 danza joined
09:14 lukaramu joined
09:15 petercommand joined
09:15 <ezyang> btw, does your library have escaping fns?
09:15 <cdornan> I have tried to add every thing that the other packages were providing -- and then some -- but build it strictly on top of the regex-base framework
09:15 lithie joined
09:15 <* ezyang> nods
09:16 <cdornan> Escaping fns?
09:16 matej_ joined
09:16 juhp joined
09:16 <ezyang> Takingh a string and escaping it so you can include it in a regex
09:16 iomonad joined
09:16 <cdornan> Not yet!
09:17 dynrzk_ joined
09:17 <cdornan> I do have regex analysis under the hood -- should be easy to extend it for this
09:17 <ezyang> good!
09:18 <cdornan> I will do this but feel free to take credit by raising an issue
09:19 augur joined
09:19 <cdornan> (can't do it immediately -- under the cosh -- but happy to put it into the roadmap)
09:19 <ezyang> np
09:20 <ezyang> Cabal isn't going to grow a dep on regex in the near future, anyhoo
09:21 andyhuzhill joined
09:22 ublubu joined
09:22 takle joined
09:24 atomi joined
09:24 t0by joined
09:25 burdges joined
09:28 doomlord joined
09:29 bruschkov joined
09:30 bruschkov joined
09:31 Galoyz joined
09:31 geekosaur joined
09:34 janos joined
09:35 pepeiborra joined
09:36 _sg joined
09:36 merijn joined
09:36 <pepeiborra> I have a Lens question but Haskell-lens is not being very responsive. Given an IndexedLens, what is the best way to produce a Getter for the index ?
09:38 Yuras joined
09:38 simukis__ joined
09:41 <merijn> pepeiborra: I think a lot of haskell-lens peeps tend to be in the US timezone, so most of them are probably asleep atm
09:41 coot joined
09:41 t_h joined
09:42 redeemed joined
09:42 Miroboru joined
09:43 Gloomy joined
09:44 Argue_ joined
09:44 <ongy> in parsec many1 should run a parser 2 to N times, returning N-1 itmes, when the Nth try to parse fails, right?
09:44 <merijn> ongy: Yes
09:45 <MarcelineVQ> why 2 to n?
09:46 Argue joined
09:48 <ongy> because it's a special case if when first one fails
09:48 kthnnlg joined
09:49 <merijn> Well, I suppose it could run only once and abort immediately
09:49 netheranthem joined
09:49 CoolerExtreme joined
09:49 psychicist__ joined
09:49 mdarse joined
09:50 <tsahyt> :r
09:50 <tsahyt> ... I should make my IRC client block that
09:51 <tsahyt> it happens way too often. sorry.
09:51 <cocreature> ongy: also note that the Nth try should fail but _not_ consume any input while doing so
09:52 <ongy> I just noticed that. Explains why it didn't behave like I thougt it should
09:52 <cocreature> that’s why you often see many (try …)
09:53 slomo joined
09:53 slomo joined
09:54 Iskarlar joined
09:56 iomonad joined
09:56 <ongy> I just slightly changed the parser to make up for it (whitspaces at the end, not front)
09:56 slomo joined
09:56 slomo joined
09:56 marr joined
09:56 <cocreature> if you can avoaid try that’s definitely the better solution :)
10:00 inad922 joined
10:00 <ezyang> see also http://blog.ezyang.com/2014/05/parsec-try-a-or-b-considered-harmful/ ;)
10:00 t_h joined
10:01 mda1 joined
10:01 <merijn> ezyang: That blog post has saved me so much typing in here over there past years :p
10:01 yan4138 joined
10:02 augur_ joined
10:03 <cdornan> ezyang: absolutely -- at the very least a stable 1.x version will be needed for that
10:05 mohsen_ joined
10:05 jaspervdj joined
10:05 chrisdotcode joined
10:07 JeanCarloMachado joined
10:08 jaziz joined
10:09 Yuras joined
10:09 MrJazz joined
10:10 schjetne joined
10:13 jmg8766 joined
10:13 systadmin joined
10:15 Argue_ joined
10:16 <tsahyt> is there any resource that can help me understand loop from ArrowLoop better?
10:16 Rizy joined
10:17 patbecich joined
10:17 <tsahyt> I've got a type here for which I think an instance should be possible but just letting the types guide the implementation wasn't exactly fruitful so far
10:17 CoolerExtreme joined
10:18 <merijn> tsahyt: Think of the 'd' type in the tuple as a local State
10:19 <tsahyt> I'll give it another shot later on. first I need to check the laws on some other instances I wrote. having a Monad instance for waveforms seems weird somehow.
10:22 <tsahyt> wasn't there some package that provided quickcheck properties for common typeclass laws?
10:22 <tsahyt> it would be easier to use that as a sanity check before I delve into equational reasoning I think
10:22 Atrumx joined
10:22 <MarcelineVQ> checkers
10:23 <tsahyt> thanks!
10:25 unK_ joined
10:25 Rodya_ joined
10:26 justicefries joined
10:28 unK_ joined
10:29 janos joined
10:32 pepeiborra joined
10:32 binaryplease joined
10:33 bollu joined
10:33 geekosaur joined
10:36 skapazzo joined
10:37 bennofs joined
10:37 faberbrain joined
10:44 Rizy joined
10:44 mattyw joined
10:48 Cooler joined
10:49 jtojnar___ joined
10:49 <Cooler> what does this mean? Surprise! You can bind infix names for function arguments.
10:49 <`Guest05> flip3
10:50 locallycompact joined
10:50 <Cooler> does that mean <> can be bound to any function at runtime? \ (<>) a b c ->
10:50 <Cooler> a <> (b <> c) == (a <> b) <> c
10:51 Jicoss joined
10:52 doomlord joined
10:52 sooheon joined
10:53 ph88^ joined
10:54 infinity0_ joined
10:54 <merijn> Cooler: yeah
10:54 <infinity0_> is there a function to turn a Lens' s a into a Lens' (s, r) (a, r) ?
10:54 <merijn> > let a <> b = a+b * a+b in 3 <> 4
10:55 <lambdabot> 19
10:55 <tsahyt> > let 2 + 2 = 5 in 2 + 2
10:55 <infinity0_> ofc i could write it myself but, would be good if there was a standard one
10:55 <lambdabot> 5
10:55 <merijn> wut
10:55 <tsahyt> evil but legal
10:55 <tsahyt> tbf the compiler will shout warnings at you for that
10:55 <merijn> I'm pretty sure 7*7 is not 19...
10:55 <merijn> > let a <> b = a+b * a+b in 3 <> 4
10:55 <lambdabot> 19
10:55 <merijn> @undefine
10:55 <lambdabot> Undefined.
10:55 <merijn> > let a <> b = a+b * a+b in 3 <> 4
10:55 <lambdabot> 19
10:55 <merijn> oh
10:55 <merijn> I'm an idiot >.>
10:55 _ashbreeze_ joined
10:56 <merijn> tsahyt: Only with -Wall or the shadowing warning
10:56 <merijn> And you can just define a non-shadowing operator instead
10:56 <quchen> > let 7*7 = 19 in 7*7
10:56 <lambdabot> 19
10:56 <tsahyt> merijn: but defining a non-shadowing operator isn't as evil
10:57 <tsahyt> checkers really needs category laws too
10:57 <merijn> > let x ☃ y = (x+y) * (x+y) in 3 ☃ 4
10:57 <lambdabot> 49
10:57 <tsahyt> but at least my other instances check out, and the category laws are trivial to prove in my case
10:57 <merijn> actually, I suppose this showing the wrong thing
10:57 <merijn> This is defining an infix function, not an infix argument
10:57 <tsahyt> I need an uppercase tortilla unicode character, so I can finally reimplement that paper
10:58 <merijn> > let foo (+) x y = x + y in foo (*) 3 4
10:58 <lambdabot> 12
10:58 heurist joined
10:58 <merijn> > let foo (+) x y = x + y in foo (+) 3 4
10:58 <lambdabot> 7
10:58 <merijn> > let foo (+) x y = x + y in foo (-) 3 4
10:58 <lambdabot> -1
10:58 <merijn> I suppose that was the real original question
10:58 <tsahyt> this process of just randomly walking through the design space that I'm in is really strange at times. so I have a handful of law abiding instances for my types and yet have no idea of their semantics
10:59 <tsahyt> e.g. the monad instance for my waves, or the applicative instance for arrows between waves
10:59 samvher joined
11:01 xall_ joined
11:01 Gurkenglas joined
11:04 oish joined
11:04 Rodenbach joined
11:06 Shou joined
11:06 bjz joined
11:07 forgottenone joined
11:08 vektorweg1 joined
11:09 samvher joined
11:10 systadmin joined
11:11 chrisdotcode joined
11:12 SudhanshuJ joined
11:13 bollu joined
11:13 geekosaur joined
11:16 fcpga_te joined
11:17 chrisdotcode joined
11:18 patbecich joined
11:18 <dbeacham> has anyone got any particularly good examples of rest api bindings in haskell?
11:18 SpinTensor joined
11:19 cur8or joined
11:19 <tsahyt> I'm rather fond of using servant-client for that. The servant-github package does it like that for example.
11:21 mettekou joined
11:21 <infinity0_> is there a function to turn a Lens' s a into a Lens' (s, r) (a, r) ?
11:22 <infinity0_> i don't think any composition involving _1 will suffice, because it can't touch the second element, but Lens' (s, r) (a, r) could touch the second element
11:22 <infinity0_> (i could ofc write my own, but wondering if there was a standard one to do that)
11:23 MrJazz_ joined
11:24 <phadej> infinity0_: there is
11:24 <Gurkenglas> :t alongside
11:24 <tsahyt> is the reader monad the only monad that can be defined over ((->) r) for some fixed r?
11:24 <phadej> :t beside id id
11:24 <lambdabot> LensLike (Control.Lens.Internal.Getter.AlongsideLeft f b') s t a b -> LensLike (Control.Lens.Internal.Getter.AlongsideRight f t) s' t' a' b' -> LensLike f (s, s') (t, t') (a, a') (b, b')
11:24 <lambdabot> (Data.Bitraversable.Bitraversable r, Data.Profunctor.Rep.Representable q, Applicative (Data.Profunctor.Rep.Rep q), Applicative f) => Optical q q f (r s' s') (r t' t') s' t'
11:24 <phadej> ah, alongside too
11:24 bjz_ joined
11:24 <phadej> can't ever remember which is which
11:24 <infinity0_> phadej, Gurkenglas: nice, thanks!
11:25 <tsahyt> or can some specific choices for r lead to different semantics?
11:25 <tsahyt> open up the possibility for different semantics I should say
11:25 Jicoss joined
11:26 <Gurkenglas> tsahyt, I think this is related to that question on whether there are coapplicatives
11:26 Rodya_ joined
11:26 systadmin joined
11:27 <tsahyt> wouldn't that be Divisibles or whatever they were called?
11:27 JagaJaga joined
11:28 <Gurkenglas> (you mean comonoids? coapplicatives are to comonoids as applicatives to monoids so sure)
11:28 <tsahyt> oh I was thinking of contravariant functors and their applicative counterpart
11:29 calincru joined
11:29 <phadej> thallada: with Natural -> a you can have ZipList like monad (which isn't, cause list can be finite), or [a] like monad
11:29 <phadej> the ZipList is like reader
11:30 MrJazz joined
11:31 <phadej> relates to the fact, that for Vec i a, one can define different (indexed) monads depending on which monoid operations you pick for `i`
11:31 <Gurkenglas> tsahyt, you can think of it as "instance Comonoid r => Monad ((->) r) where ..." with the same instance as usual, but r provides the "r -> ()" to get rid of the r in for the implementation of return and the "r -> (r, r)" to be able to use the r twice for the implementation of join
11:31 juhp joined
11:31 <Gurkenglas> *but Comonoid r provides
11:31 prohobo joined
11:34 mattyw joined
11:35 mounty joined
11:36 t_h joined
11:37 mettekou joined
11:37 psychicist__ joined
11:38 t_h joined
11:38 <tsahyt> right. now I just need to figure out what a Comonoid is
11:41 jeltsch joined
11:41 samvher joined
11:43 wlemuel joined
11:43 deepfire joined
11:44 <ongy> does the Text.Parser.Expr buildExpressionParser support parens in the expresion? If not, what's the easiest way to do that?
11:45 pleax joined
11:46 OnkelTem joined
11:46 prohobo left
11:49 RegEchse joined
11:49 systadmin joined
11:50 aglorei joined
11:51 JagaJaga joined
11:52 CoolerExtreme joined
11:54 <mutsig_> ?src mapM
11:54 <lambdabot> mapM f as = sequence (map f as)
11:54 Xanather joined
11:54 stianhj joined
11:55 insitu joined
11:55 <quchen> Does an allocation always clean the pipeline/miss the cache, or is that just a very likely side effect of it?
11:55 mettekou joined
11:55 <quchen> I’m trying to understand why GHC schedules its yields to happen only on allocation
11:57 eliasr joined
11:57 <alexbiehl> quchen: can you elaborate?
11:57 <alexbiehl> I often look at cmm/asm code and it seems allocation really is just a bump of some register, no calls to rts involved
11:58 <alexbiehl> so I don't see how it can sync on allocation
11:58 <quchen> alexbiehl: GHC allows context switches after heap allocations, and I’m wondering why exactly
11:58 <merijn> quchen: Well, why not?
11:59 <ongy> if you are looking at asm, that's probably the stack allocation. Heap allocation has to be more than that
11:59 <quchen> merijn: Why not elsewhere?
11:59 <quchen> Eh, »GHC *only* allows context switches after heap allocs«
11:59 <merijn> quchen: Because then you'd have to change the code generation everywhere to check whether to yield
11:59 <merijn> quchen: allocation already interrupts the flow of code, so easy to sneak a schedule check in there
11:59 vkshah2 joined
11:59 <alexbiehl> maybe its more concrete: not only heap allocation but allocation of thunk maybe?
12:00 <merijn> alexbiehl: thunks *are* heap allocations
12:00 <quchen> merijn: Why does allocation interrupt the code flow?
12:00 <alexbiehl> Iam pretty sure it does not
12:00 <alexbiehl> Entering a thunk is
12:00 <merijn> quchen: Lemme rephrase, when else would you check whether to yield or not? Every instruction? Require hardware interrupt?
12:01 <quchen> Yes, for example.
12:01 <quchen> Every 10 clock cycles. Every 10 minutes. Every time we enter a case expression.
12:01 <quchen> Why was after heap allocs chosen specifically?
12:01 <merijn> quchen: Hardware interrupt is a messy thing, since you can't reliably cause them
12:01 <merijn> quchen: You'd have to rely on posix signals (which isn't portable) and they are costly
12:02 <merijn> quchen: They effectively require a context switch to yield, then
12:02 <ongy> don't we have the "every X-time" with the SIGVALARM? I thought that's what it's used for
12:02 Snircle joined
12:02 <merijn> quchen: Allocations happen frequently enough to allow somehwat preemptive scheduling, but infrequently enough to not interfere with performance significantly
12:02 <quchen> alexbiehl: The heap contains mostly thunks
12:03 <merijn> ongy: What about systems without SIGVALARM, not to mention the fact that signal interrupts aren't very fast
12:03 <merijn> So using signals for frequent interrupts will slow you down
12:03 <quchen> merijn: So it’s just a »works« solution? That sounds a bit too simple
12:03 <merijn> quchen: Why?
12:03 <alexbiehl> yes: but if you look closely on cmm code you can see that allocation itself is just a bump of the heap pointer, no call to rts to preempt or something
12:03 <exio4> sounds something like "best compromise we could find" :P
12:04 <merijn> quchen: I'm pretty sure that most schemes you listed will end up being significantly slower, tbh
12:04 <quchen> merijn: I thought it had something to do with the way CPUs work, which makes it a particularly efficient arbitrary choice.
12:04 vaibhavsagar joined
12:04 sdothum joined
12:04 xall_ joined
12:04 <quchen> Such as »we have a cache miss already, so we might as well miss it twice« or something like that.
12:04 <merijn> quchen: Well, it certainly is when compared to interrupts for scheduling
12:04 <quchen> Hence me asking what an allocation entails that makes it such a good place to yield.
12:05 <merijn> quchen: And if not interrupts, you're stuck doing checks in places that happen reliably enough to not hog the CPU
12:05 <quchen> Hm. I guess the reliability is key, and the lack of alternatives.
12:05 <quchen> But still, I’m wondering whether there’s something deeper :-s
12:06 <merijn> quchen: Not really, afaict from the GHC/RTS documentation/papers I've read
12:06 <quchen> But the non-working alternatives are pretty helpful to know about.
12:06 systadmi1 joined
12:06 <ongy> merijn: there's a fallback of course. But I'm pretty sure the default setting is with SIGVALARM and that quite often. I'd have to check the -V option to the RTS
12:06 <quchen> merijn: Do you know one that talks about this issue?
12:06 <exio4> it also allows to tight loops to be heavily optimized (at the expense of not having context switches inside it)
12:07 <merijn> ongy: It uses SIGVALARM for threadDelay (i.e. sleep), not for yielding running threads
12:07 geekosaur joined
12:08 <ongy> merijn: then why does it need so many of them? IIRC that's a recouring timer with a fixed intervall
12:09 <merijn> ongy: I don't remember seeing that, but I don't recall too much detail
12:09 samvher joined
12:10 <bennofs> ongy: perhaps it's for idle GC?
12:10 <bennofs> but that would be too often as well i think
12:11 chrisdotcode joined
12:12 TCZ joined
12:13 twanvl joined
12:13 <ongy> https://downloads.haskell.org/~ghc/7.4.1/docs/html/users_guide/runtime-control.html -V here. Probably the timer is used for counting if a context change is in order, not triggering it then
12:13 Snircle_ joined
12:13 tsdh joined
12:15 michael4 joined
12:15 <alexbiehl> Interesting: http://ezyang.com/jfp-ghc-rts-draft.pdf p. 9 footnote 7. GHC yields threads at heap checks. The timer sets the heap limit to 0 which triggers a "false heap overflow"
12:15 schjetne joined
12:16 eacameron joined
12:16 systadmin joined
12:17 <alexbiehl> ezyang mentions that heap checks are nice places for context switches because we save the execution context anyways in case garbage collection happens
12:18 mettekou_ joined
12:20 bjz joined
12:20 davezd joined
12:21 cschneid_ joined
12:22 chrisdotcode joined
12:24 xall_ joined
12:24 ccomb joined
12:25 ramzifu joined
12:26 <quchen> ezyang should »complete, flesh out, rewrite« all the coloured parts of that paper, it’s awesome :-)
12:27 ziocroc joined
12:27 Rodya_ joined
12:28 Zialus joined
12:29 xtreak joined
12:32 burdges joined
12:32 vektorweg1 joined
12:33 bjz joined
12:34 <Cooler> why can't non empty be data NonEmpty a = a : [a] deriving (Eq, Ord, Show)
12:34 <Cooler> ?
12:34 <Cooler> why does it need :|
12:34 <Cooler> ?
12:34 <bennofs> Cooler: because : is already used for List?
12:34 <Cooler> oh
12:35 <bennofs> also I don't think you can use : as a constructor in your own code, i believe it is built in
12:35 <Cooler> newtype NonEmpty a = NonEmpty (a : [a])
12:37 gawen joined
12:37 eacameron joined
12:39 faberbrain joined
12:40 samvher joined
12:42 sdothum joined
12:43 jbiesnecker joined
12:43 <kgadek> Cooler: your example doesn't work even with DataKinds & TypeOperators. The reason: "Expected a type, but ‘a : [a]’ has kind ‘[*]’"
12:43 <quchen> merijn: Ah, I found something in ezyang’s preprint. When allocation is supposed to happen, we have to do a heap check (»enough mem? else GC«). GC should only happen when we’re in a »clean« execution state. And since we’ve cleaned up already, we might as well handle the context switching business at the same time.
12:43 <kgadek> i.e. you're creating a list of kinds there
12:45 <kgadek> Cooler: in other words — to state that you have at least one element, you need a different mechanism. The one that will not make you a [KIND] but rather a KIND
12:45 pepeiborra joined
12:45 <kgadek> (n.b. I'm using KIND and * interchangeably)
12:46 <Cooler> kgadek, what does [*] mean? a list of possibly different types?
12:46 <kgadek> let's call it [KIND], will be easier a bit to understand
12:47 <Cooler> [a] is of kind * right?
12:47 <kgadek> yes
12:47 Schrostfutz joined
12:47 <Cooler> so a : [a] is also kind *
12:47 <kgadek> when you have any type that you can construct, it's type is KIND
12:47 <kgadek> when you have a type constructor
12:47 <kgadek> like Functor
12:48 <kgadek> it's kind is KIND -> KIND
12:48 mettekou joined
12:48 <kgadek> (i.e. * -> *)
12:48 <kgadek> that means
12:48 <Cooler> yes i know
12:48 <kgadek> that given a KIND, it will produce a KIND
12:48 <kgadek> so
12:48 <kgadek> we're talking about [*]
12:48 <kgadek> [KIND]
12:48 <kgadek> I know no uses of it right now
12:48 <Cooler> just to be clear a : [a] == [a] ?
12:49 <kgadek> hmm, rather [a,a] as to how `:` works
12:49 <kgadek> but not sure now
12:49 <Cooler> or well
12:49 <Cooler> a : [a] :: a
12:49 <Cooler> a : [a] :: [a]
12:49 MrJazz_ joined
12:49 <kgadek> wait
12:49 <Nik05> 13:48 < Cooler> just to be clear a : [a] == [a] ? -- What about 1 : [2] == [2]?
12:49 <kgadek> :k Int : '[Int]
12:50 <lambdabot> [*]
12:50 <Cooler> no a doesn't represent a value
12:50 <Cooler> t : [t] :: [t] is perhaps more clear
12:50 <Cooler> t represents a type not a value like 2
12:50 wlemuel joined
12:51 <Nik05> Notation is imporant here :P
12:51 jomg joined
12:51 <Nik05> But well yes a : [a] :: [a], per definition of List
12:52 <Cooler> ok and [a] is of kind *?
12:52 <kgadek> :kind! Int : '[Int]
12:52 psychicist__ joined
12:52 <kgadek> oh, lambdabot doesn't understand this? :<
12:52 <kgadek> λ> :kind! Int : '[Int]
12:52 <kgadek> Int : '[Int] :: [*]
12:52 <kgadek> = '[Int, Int]
12:53 <Cooler> [a] is of kind * not [*] ?
12:53 SudhanshuJ joined
12:53 mabox joined
12:53 <Nik05> Cooler [Int] :: *
12:53 <kgadek> it's: '[a] :: [*]
12:54 <kgadek> wait, Im confused right now
12:54 <kgadek> Nik05: you sure? GHCi tells me otherwise
12:54 Sose joined
12:54 <kgadek> ohhhhhh
12:54 <Cooler> ok now i am confused is [a] :: * -> * ?
12:54 <kgadek> I see
12:54 <Nik05> kgadek a is a kind variable
12:54 <kgadek> I'm using '[]
12:54 <kgadek> and not []
12:54 <kgadek> THIS is the difference
12:54 dramforever joined
12:55 <Nik05> [] :: * -> *
12:55 <Cooler> what about [a] ?
12:55 superherointj joined
12:55 <kgadek> :k []
12:55 <lambdabot> * -> *
12:55 <kgadek> :k '[]
12:55 <Cooler> :k [a]
12:55 <lambdabot> [k]
12:55 <lambdabot> error: Not in scope: type variable ‘a’
12:55 <superherointj> Is generics the same as parametric polymorphism?
12:55 <Nik05> What is '[]?
12:55 <kgadek> a kind constructor
12:55 <Cooler> a type constructor?
12:56 <Cooler> a kind constructor? that would be one more level up
12:56 <Nik05> oh, oke
12:56 <kgadek> it works on both levels to my knowledge
12:56 <kgadek> (i.e. it's both kind and type constructor)
12:56 <kgadek> in other words:
12:57 <hpc> or to be slightly more precise, there is a kind constructor and a type constructor that both have that name
12:57 <hpc> (they're still in different namespaces, ish)
12:57 <kgadek> [Int] is a type representing a list of types. It's * because it can be constructed
12:57 <Nik05> Why would you want to have a list of kinds?
12:57 <kgadek> '[Int] is not a type, it's a [*]. It can't be constructed
12:57 <kgadek> for example in type level programming
12:58 <hpc> Nik05: it's a list of types
12:58 <kgadek> like: write a set operations on type level
12:58 <hpc> Nik05: but you'd want either of them in order to do programming in the type system
12:58 <Cooler> ok but what is [a]?
12:58 <Cooler> its of kind *\
12:58 <Cooler> its of kind * assuming a is a concrete type
12:59 aphorisme joined
12:59 <kgadek> remind me, `a` is a type or kind?
12:59 <Cooler> so a : [a] :: [a] which is of kind *
13:00 <Cooler> so <Cooler> newtype NonEmpty a = NonEmpty (a : [a])
13:00 <dramforever> superherointj: Short answer: no
13:00 <quchen> No?
13:00 <hpc> java generics?
13:01 <quchen> Java generics are a horribly broken version of parametric polymorphism, if »generics« refers to that.
13:01 <superherointj> For example. People say, Go doesn´t have .map/reduce because it doesnt support generics.
13:01 oisdk joined
13:01 <hpc> there are deliberate similarities though (java generics were designed by one of the simons)
13:01 mada joined
13:01 <quchen> hpc: Simons? I think you mean Wadler
13:01 <dramforever> Generally, if you ask questions like 'Is <foo> the same as <bar>?' where <foo> is a Haskell concept and <bar> is a concept from another more 'mainstream' programming language, the answer is almost alwaysNo.
13:02 <hpc> quchen: ah, misremembered
13:02 TxmszLou joined
13:02 <superherointj> Is Haskell wrong on something?
13:02 <hpc> go doesn't support polymorphism in any way at all
13:02 <kgadek> hpc: "In 1998, Gilad Bracha, Martin Odersky, David Stoutamire and Philip Wadler created Generic Java"
13:02 <quchen> Wadler and Odersky if I remember correctly
13:02 jbiesnecker joined
13:02 <hpc> so not only can you not write map or reduce, you can't even write sort
13:03 <kgadek> hpc: well, golang is happy to provide `sort` (even in a quite nice way. Surely not as good as in Haskell, but "okayish")
13:03 <dramforever> superherointj: What do you mean?
13:04 <kgadek> superherointj: there are many wrongs in Haskell, depends on who you ask :)
13:04 <tsahyt> is fmap over something that is an arrow always the same as post-composition with a pure function?
13:04 <dramforever> If you think different == wrong, then nope
13:04 <tsahyt> i.e. is fmap == ^<<
13:04 <hpc> :t (^<<)
13:04 <lambdabot> Arrow a => (c -> d) -> a b c -> a b d
13:04 <superherointj> I hear a lot of good things on Haskell. And how many other languages are messed up. So I was wondering what about Haskell that might not have been well thought out.
13:04 <dramforever> tsahyt: Yes, you can verify the functor laws
13:05 <hpc> superherointj: n+k patterns were pretty terrible
13:05 <tsahyt> dramforever: alright, thanks
13:05 <dramforever> And the fact that a functor instance is unique
13:05 Guest49740 joined
13:05 <hpc> superherointj: record syntax is not as good as it could be either, but it's not clear what changes would improve it
13:05 schjetne joined
13:06 <hpc> but ultimately you can ignore those
13:06 <dramforever> superherointj: One thing that definitely hasn't been well thought out is adoption
13:06 <tsahyt> hpc: what about DatatypeContexts?
13:06 <quchen> There are many language extensions required by many modern Haskell libraries, so Haskell-the-language lacks those, but Haskell-the-GHC-implementation has them.
13:06 <tsahyt> and other deprecated extensions for that matter
13:06 mettekou_ joined
13:07 <hpc> tsahyt: also terrible, but i have never seen them used
13:07 <quchen> So all good GHC extensions can be seen as something missing in Haskell.
13:07 <quchen> e.g. rank-N types.
13:07 <quchen> Or flexible type class instances.
13:07 <tsahyt> quchen: s/Haskell/Haskell98 or Haskell2010.
13:07 <tsahyt> and now we wait for Haskell Prime
13:08 <dramforever> quchen: it's not very fair, because it gives languages with de-facto standards (instead of written down ones) advantage
13:08 <hpc> really where it matters is the ability to write abstractions
13:08 <quchen> Waiting won’t bring us further, I should get to working on it again, tsahyt :-s
13:08 <hpc> that's usually what you would here anyone here ding another language on
13:08 <merijn> hpc: I've seen them used, but only once and I got a patch approved to remove that use ;)
13:08 <tsahyt> quchen: as far as I'm concerned I'm pretty happy with GHC Haskell and accepting the state of GHC as the current "standard"
13:08 Wuzzy joined
13:08 <ahihi> I'm not a big fan of error handling in haskell
13:08 <ahihi> particularly IO exceptions
13:08 Salih joined
13:08 <tsahyt> although having an updated language standard would be great of course
13:09 ramzifu joined
13:09 <merijn> Yes, unchecked exceptions were a bad idea
13:09 <quchen> GHC isn’t a standard, we don’t even know how many of the extensions interact.
13:09 <merijn> I would love checked exceptions, but I'm not sure that can ever be retrofit into Haskell
13:09 <kgadek> superherointj: it's not a problem per se, but I'm very curious of how Haskell would look if instead of monad transformers it was using freer-effects everywhere
13:09 <quchen> Just being there doesn’t make a standard
13:09 <tsahyt> quchen: hence the quotes
13:09 <hpc> also getting people to not hate them
13:10 <kgadek> merijn: hmm, you mean checked async exceptions?
13:10 <merijn> kgadek: Not all transformer functionality can be subsumed by effects
13:10 <hpc> java got checked exceptions and the first thing everyone did was extend RuntimeException to avoid it
13:10 <superherointj> Interesting.
13:10 <dramforever> kgadek: It loses like 90% of the current amount users and gains <1%
13:10 <tsahyt> my point is really that I'm okay with being rather pragmatic about it, since there is no competing compiler at the moment anyhow as far as I know
13:10 <kgadek> merijn, dramforever : oh? just started playing with them, they seemed nice
13:10 samvher joined
13:10 <merijn> kgadek: Async exceptions == exceptions thrown from other threads. I would love to see *those* checked too, but that *definitely* is infeasible to retrofit in haskell
13:10 <dramforever> kgadek: Actually, maybe not
13:10 <dramforever> because we f**ked up with monads
13:10 <kgadek> merijn: ok, got it & agree
13:11 <merijn> kgadek: transformers have an explicit ordering, effects do not, but the ordering matters!
13:11 <dramforever> And getting a new concept in place could actually be quite good
13:11 netheranthem joined
13:11 <kgadek> merijn: you can impose ordering AFAIR
13:11 <kgadek> in the runner
13:11 Jicoss joined
13:11 <kgadek> but yeah, I got it
13:12 <kgadek> you can't say anything about ordering in the definition because the order is imposed at caller site
13:12 <kgadek> (or did I mess it up? not sure about that)
13:13 Itkovian joined
13:13 pleax joined
13:14 <dramforever> superherointj: Monads. Basically *the* one thing about Haskell that wan't well thought out. And I mean its adoption, not monad per se.
13:14 <superherointj> What about dependent types? Is it an issue?
13:14 <hpc> dependent types are coming soon
13:15 <superherointj> dramforever, but that wouldnt be a language problem, right?
13:15 <dramforever> Dependent type isn't a solved problem
13:15 <hpc> if you look at the math behind it, dependent types are an extremely new concept
13:15 <hpc> calculus of constructions in the late 80s, first language to implement it in 2007-ish
13:15 <dramforever> You can't expect open problems to be well thought out
13:16 nomicflux joined
13:16 <dramforever> superherointj: it's the first thing beginners *expect* to stumble upon
13:16 <hpc> this is sort of where i consider haskell and the languages built off of it to be the next 20 years of computer science development
13:16 <dramforever> I award it the most mis-ununderstood programming concept
13:16 maerwald left
13:16 maerwald joined
13:17 <hpc> maybe once a week at my current job, someone has presented a new idea and went "brace yourselves, because $something_already_common_in_haskell"
13:17 newbie1 joined
13:18 <hpc> and i just sit there and chuckle
13:18 MoKhSu joined
13:18 <dramforever> superherointj: If a problem serious blocks adoption of a language X, I don't know where else to put it
13:18 <kgadek> hpc: I have JS and Elixir friends. This is really common :D
13:18 <dramforever> hpc: examples?
13:18 <kgadek> OH LOOK AT THIS AMAZING $actually_a_lens
13:19 <hpc> the other day it was using some shennanigans with ruby's blocks to express configuration instead of imperative steps to be executed
13:19 pleax joined
13:19 <hpc> which... do notation
13:19 patbecich joined
13:19 <hpc> i ended up explaining afterwards a piece of code i wrote that runs both backwards and forwards (to do some image manipulation with short-circuiting)
13:20 <hpc> and my coworker looked at me like i was a cheeseman from the dark side of the moon
13:20 <kgadek> ye, in Ruby I had abused the ||= only to get Nothing monad-like effects
13:21 <dramforever> superherointj: Did you mean it's a problem with humans not languages?
13:21 <superherointj> Yes. Or motivation. Or education.
13:22 <superherointj> Not a technical fault.
13:22 <dramforever> That's like half of Haskell's problems
13:22 <ongy> I would argue in this case: if a language produces the errors from humans, it's in the language.
13:23 <dramforever> I would argue: this classification is pointless
13:23 <ongy> since it's more lively now, I'll ask again :)
13:23 <ongy> does the Text.Parser.Expr buildExpressionParser support parens in the expresion? If not, what's the easiest way to do that?
13:25 <dramforever> ongy: write two expression parsers 'expr' and 'exprAtom'
13:25 <jaspervdj> ongy: if you have a token parser, it's just: expr = parens expr <|> expr
13:25 raichoo joined
13:26 <dramforever> Construct expr with buildExpressionParser, giving exprAtom as the second argument
13:26 <dramforever> in exprAtom, add a case: parens expr
13:26 <dramforever> ongy: Hey it's literally at the bottom of here: http://hackage.haskell.org/package/parsec-3.1.11/docs/Text-Parsec-Expr.html
13:27 pepeiborra joined
13:27 mjs2600 joined
13:27 Schrostfutz joined
13:28 <ongy> dramforever: where? Do we get different pages, or have I worded my question badly?
13:28 Rodya_ joined
13:28 <dramforever> see this? 'term = parens expr'
13:28 eSVG joined
13:28 sepp2k joined
13:29 <dramforever> ongy: ^
13:29 <ongy> ohh didn't see that. So it can recurse into itself, I was wondering how to do it
13:29 <ongy> thanks
13:29 <dramforever> It's an indirect recursion
13:30 Jicoss joined
13:31 bennofs joined
13:31 lukiramu joined
13:32 Iskarlar joined
13:32 deank joined
13:32 Guest49740 joined
13:34 aries_liuxueyang joined
13:34 matej_ joined
13:36 pepeiborra joined
13:36 chrisdotcode joined
13:37 eacameron joined
13:39 nomicflux joined
13:40 samvher joined
13:41 Schrostfutz joined
13:42 <Axman6> anyone know if Haskell defines a sloating point floor function? the one from RealFrac returns an Integral type, I want one which returns the same type a la C++'s std:floor
13:42 oisdk joined
13:43 <Nik05> Axman6 what about floor?
13:43 <Nik05> http://hackage.haskell.org/package/base-
13:43 <Nik05> oh oops
13:43 <geekosaur> :t floor
13:43 <lambdabot> (RealFrac a, Integral b) => a -> b
13:43 <kgadek> Axman6: you want Floating returned?
13:43 <geekosaur> "Integral"
13:43 <Axman6> yes
13:44 newbie1 joined
13:44 <Axman6> well... floored
13:44 <Axman6> uh, misread
13:44 <kgadek> hmm… fromIntegral?
13:44 kubbe joined
13:44 <kgadek> :t :t fromIntegral . floor
13:44 <lambdabot> error: parse error on input ‘:’
13:44 <Axman6> I'm not sure if the behaviour will be exactly the same
13:44 <kgadek> :t fromIntegral . floor
13:44 <lambdabot> (RealFrac a, Num c) => a -> c
13:44 Snircle joined
13:44 <Axman6> but, I guess if I ensure it's a 64 bit Int, then it should be
13:45 <kubbe> Hello guys! So I have an array, filled with arrays. How can I check so that each array inside my array is of equal length?
13:45 tst_ joined
13:45 <Axman6> kgadek: numerical precision is key here
13:45 <Axman6> kubbe: any reason not to use a two dimensional array?
13:46 <Axman6> I think fromIntegral is probably ok for this
13:46 <kgadek> Axman6: ensure you get Integer in the mid of the expression
13:46 <kgadek> and you should be okay
13:46 <kgadek> Integer is arbitrary precision IIRC
13:46 newbie1 joined
13:46 <Axman6> if you're trying to compute sin on something *10^300 then you have other problems
13:46 <kubbe> Hmm.. So this is how it looks Axman6: type Grid = [[Cell]]
13:46 <Axman6> kgadek: it is, but may also be slow
13:46 <kgadek> Axman6: yeah, true
13:46 <Axman6> kubbe: those aren't Arrays ;)
13:46 <kubbe> It is a grid as you can tell! Its a list then.. xD(?)
13:47 newbie12 joined
13:48 Jicoss joined
13:48 <ongy> list of lists
13:48 <kubbe> I want to check that the grid is valid, which means that I want to check that the length of [Cell] is equally against all other [Cell]
13:49 <ongy> a simple aproach would be to 1. make a list of lengths 2. us nub on that list 3. Check that length of that list is 1
13:49 <ongy> nub removes duplicates from a list.
13:51 <ongy> kubbe: can you come up with the code for that idea, or do you need a bit more help?
13:51 <kubbe> yes!
13:51 <kubbe> http://pastebin.com/qtgmPXAm
13:51 pleax joined
13:51 <kubbe> So, this is how far I have gotten.
13:52 oisdk joined
13:52 <kubbe> The thing is that the validGrid is supposed to give me True when my input is goodgrid and False when my input is badgrid. As you can see the badgrid misses 1 element in the 2nd index
13:52 ketil__ joined
13:52 <ongy> ok. Do you know how to do the first step? The type would be [[Cell]] -> [Int]
13:53 <kubbe> Oh, okey. yeah
13:53 <ongy> and then nub (from Data.List, maybe it's in prelude) will remove all duplicates
13:54 <ongy> so for the good gird, the result is [4] for the bad grid it would be [4, 3]
13:56 xtreak joined
13:57 <kubbe> Ohhhh, alright! Amazing :D
13:57 oisdk_ joined
13:57 <kubbe> look at this: http://pastebin.com/SvMn1KhL
13:57 <kubbe> Works perfectly fine. Thank you! nub is from Data.List by the way
13:58 <kubbe> ongy
13:58 wretch joined
13:59 <ongy> kubbe: :) I will make no guarantees bout the performance of this, but's it's a nice high-ish level to think about this
13:59 wretch left
13:59 <ongy> also style nots: `[x] ++ xs` should be `x:xs`
13:59 <ongy> :t (++)
13:59 <lambdabot> [a] -> [a] -> [a]
13:59 <ongy> :t (:)
13:59 <lambdabot> a -> [a] -> [a]
13:59 <kubbe> Haha it is fine! We wont work with so big grids so the performance is fine for this :)
13:59 <ongy> and you may want to check out map
13:59 <ongy> :t map
13:59 <lambdabot> (a -> b) -> [a] -> [b]
14:00 <kubbe> yeah, haha! That would be later, when my pinball works. then it is time to make the performance better :)
14:01 Gloomy joined
14:02 <kubbe> Ehm ongy, on what function should I use map? My partner wanted me to ask :D
14:02 zariuq joined
14:02 dhil joined
14:03 <ongy> kubbe: you can replace validGridLength with `map length` in validGrid here
14:03 eschnett joined
14:04 <ongy> are you doing a course? If you ever encounter fmap, map is fmap specialized to lists
14:05 <kubbe> yeah, this is some assignment we are supposed to do. Yeah we have just been slightly introduced to map, so I still find it a bit unsual but I am getting there
14:05 <ongy> others here: Is there a current consensus on whether map should be recommended (for nicer errors) or go directly to fmap?
14:05 <ongy> kubbe: if you have been introduced to map, think about what you are doing here and why map does the same
14:06 <kubbe> Oh! yeah :D solved it!
14:06 <kubbe> ongy: now it looks like this: validGridLength x = map length x
14:06 ishtu joined
14:07 <kubbe> much nicer!
14:07 newbie1 joined
14:08 benneh joined
14:08 ski joined
14:08 yqt joined
14:09 codesoup joined
14:09 myk267 joined
14:09 <benneh> I have some code which does a lot of file reading, but no other I/O. Since I'm not using most of its capabilities, would it be considered bad practice to do this in the IO monad?
14:10 <quchen> no
14:10 <quchen> In fact, IO is the only type in which you can do this.
14:10 <quchen> (up to wrapper types around it)
14:11 samvher joined
14:11 mpsag joined
14:11 <benneh> quchen: I was wondering whether there was some way of lazily reading the entire filesystem and passing it around in a Reader-like fashion.
14:12 <benneh> Or the part of the filesystem I care about, anyway.
14:12 UnrealQuester joined
14:12 <cocreature> one thing you can do is to make something like a MonadFileIO class and then keep your code polymorphic so you can not use any other IO except for the one provided by MonadFileIO. I usually find that to not be worth the effort but some people like it
14:13 rgr joined
14:14 tfc joined
14:14 Schrostfutz joined
14:15 chlong joined
14:15 PennyNeko joined
14:16 <benneh> I was basically just hoping that someone had already implemented something like that.
14:16 <benneh> If not, then I agree with you, it seems like it would be more effort than it's worth.
14:16 <zipper> benneh: You wanna read a whole filesystem?
14:16 <zipper> You have to do IO in the IO monad
14:17 <zipper> How else would you do the I ?
14:17 <benneh> zipper: But I don't have to do the logic in the IO monad. For example, I can accumulate some output in the Writer monad, then the only I/O is actually outputting it in a single location.
14:18 <benneh> I was wondering whether there was something similar I could do for file reading.
14:18 <cocreature> benneh: just read your file and pass it to some pure function?
14:18 <zipper> cocreature: Yeah I think that's what you want
14:18 <zipper> but you want to read the file lazily, right?
14:19 <zipper> You could try a lazy bytestring
14:19 <benneh> cocreature: But the contents of the file will determine which other files I need to read, and so on.
14:19 <benneh> It is unavoidably monadic.
14:19 <zipper> hmmmm you want a forever with an if
14:19 aries_liuxueyang joined
14:19 janos joined
14:19 Argue_ joined
14:19 <zipper> read a file check for something readfile again
14:20 Rodya_ joined
14:20 dsh joined
14:21 <cocreature> benneh: you might be able to have a pure function return a lists of files that will be processed next but the exact way that you implement this heavily depends on your specific code
14:21 mjs2600 joined
14:21 mettekou joined
14:22 patientpl joined
14:22 mizu_no_oto_work joined
14:22 <zipper> `fn(f) = readFile f >>= \x -> g(x)` where g(x) calls f again with a certain file
14:22 oisdk joined
14:22 <zipper> I could be totally wrong that's just a quick thing
14:24 <zipper> *calls fn
14:24 <zipper> but g(x) would be impure? idk
14:24 ramzifu joined
14:24 fizbin joined
14:25 <benneh> zipper: That's essentially what I'm doing currently, but it means that all of the code has to be in IO.
14:25 doodlehaus joined
14:25 mekeor joined
14:25 mrleet joined
14:25 yqt joined
14:25 <benneh> But it seems like that's unavoidable.
14:26 <fizbin> Is there a standard preprocessing symbol or similar I can use to compile differently when Int is at least 64 bits?
14:26 <zipper> Ok ummmmm after reading your file you want to do some "pure stuff", right?
14:26 cyborg-one joined
14:26 <zipper> fizbin: That is not setting a type to Int* ?
14:26 contiver joined
14:27 <nshepperd_> data FSTree = Tree (Map Filename Bytestring) (Map Filename FSTree) -- make one of these with lazy io?
14:27 <benneh> zipper: I want to do some stuff involving "pure" logic and file reading, but no other form of I/O.
14:27 <fizbin> I've got some code where I'm a bit worried about the performance, and I'm using Integer currently because the values I'm processing can be up to 64 bits long, but I'd like to use Int when I know that's big enough.
14:27 <fizbin> Specifically, I want to use IntSet.
14:28 <zipper> benneh: but you determine the next step based on the contents of your file, right?
14:28 <fizbin> (Instead of (Set Integer))
14:28 nemorichard joined
14:28 AndreasK joined
14:28 <nshepperd_> Alternatively you could make a custom Free monad containing only "list directory, read file" commands and interpret it in io
14:29 <benneh> zipper: Yes.
14:29 <nshepperd_> That might be considered pointless though
14:29 <zipper> nshepperd_: hmmmm you have an interesting approach
14:29 <zipper> Using a Tree
14:30 <zipper> benneh: because you answered yes you don't have a pure function, or do you?
14:30 <zipper> Your g(x) doesn't always give the same output
14:30 <zipper> You could do it in a let in your IO
14:30 jerme_ joined
14:31 raichoo joined
14:31 ragepandemic joined
14:31 <benneh> zipper: Sorry, I meant to say that there is a large amount of pure logic, and a small amount of impure logic that involves file reading but no other I/O.
14:31 <nshepperd_> (you probably want to use lazy Bytestring and definitely lazy Map in that FSTree)
14:31 doodlehaus joined
14:32 <benneh> nshepperd_: That's an interesting idea. Thanks.
14:32 burdges joined
14:33 <zipper> Ah
14:33 alexbiehl left
14:33 <ongy> depending on how you look at your filesystem, it's not alwasy a tree. Be careful with that
14:33 alexbiehl joined
14:33 yqt joined
14:34 ystael joined
14:34 doodlehaus joined
14:34 mstruebing joined
14:34 cpennington joined
14:34 <nshepperd_> Possibly the values in the maps should be Maybes or Eithers if you want to have some non-crashing response to a file being removed after reading the directory but before reading the file
14:35 yqt joined
14:35 bruschkov joined
14:35 jwynn6 joined
14:35 yqt joined
14:36 dfeuer joined
14:36 yqt joined
14:36 <zipper> benneh: http://lpaste.net/3127984351933890560
14:36 wlemuel joined
14:36 schjetne joined
14:36 oneeman joined
14:36 bruschkov joined
14:37 yqt joined
14:37 <ongy> does a monad exist that's kinda read-only state? So I can have monadic actions as getters, but not setters? (I can just use state, but restricting myself is good)
14:37 jao joined
14:37 bruschkov joined
14:37 lspitzner joined
14:38 eacameron joined
14:38 <benneh> ongy: The Reader monad?
14:39 ChristopherBurg joined
14:39 <zipper> benneh: :)
14:39 <mfukar> or State, sounds like both fit the bill
14:39 <zipper> ongy: If you only read isn't that just being a pure function?
14:39 <ongy> last I looked into that I thought it's more of a streaming abstraction, maybe I got it wrong
14:39 <zipper> mfukar: but he doesn't want to be able to set
14:39 bruschkov joined
14:40 <Adluc> t
14:40 <Adluc> es
14:40 <Adluc> sorry, mistype
14:40 chrisdotcode joined
14:40 Catalectic joined
14:41 faberbrain joined
14:41 samvher joined
14:41 <ongy> zipper: I should be doable with a pure function and an explicit argument, yes
14:41 bruschkov joined
14:42 <zipper> ongy: What's the problem then?
14:42 <zipper> You don't have the arg?
14:43 <ongy> I want to store the function to apply it later when I have the arguments. And I may have multiple arguments over the runtime of the application
14:44 <zipper> ongy: You want to store a function to apply later when you have the args
14:44 <zipper> Aha! as benneh said
14:44 <zipper> Reader newtype
14:44 <ongy> I don't think it's hard to write the code. I mainly want it to look nice :)
14:44 <zipper> newtype Reader = Reader {runReader :: r -> a}
14:44 Itkovian_ joined
14:44 <zipper> newtype Reader r a = Reader {runReader :: r -> a}
14:45 chrisdotcode joined
14:45 <zipper> So yeah Reader has your back there
14:45 coltfred joined
14:46 <zipper> ongy: No?
14:47 <zipper> Maybe mfukar benneh can explain better
14:47 <zipper> Crap
14:47 <zipper> I am typing wong nicks sorry
14:47 <* zipper> out
14:47 eacameron joined
14:48 steeze joined
14:49 pleax joined
14:49 <ongy> zipper: I think it should work
14:50 indi_ joined
14:52 meba joined
14:52 fcpga_te joined
14:53 bruschkov joined
14:57 aries_liuxueyang joined
14:57 <tsahyt> what's the difference between quotRem and divMod again?
14:58 <Axman6> the handling of negatives
14:58 bruschkov joined
14:58 alx741 joined
14:58 drdo joined
14:59 <tsahyt> is there a performance difference when inputs are strictly positive?
14:59 kadoban joined
14:59 <Axman6> > [(x,y,divMod x y, quotRem x y) | x <- [-7,7],y <- [-4,4]]
15:00 <lambdabot> [(-7,-4,(1,-3),(1,-3)),(-7,4,(-2,1),(-1,-3)),(7,-4,(-2,-1),(-1,3)),(7,4,(1,3...
15:00 oisdk joined
15:00 <ski> tsahyt : `quotRem' is probably to be preferred, efficiency-wise, under those conditions
15:01 <tsahyt> I'll set up a criterion benchmark
15:01 nemorichard joined
15:02 redShadow joined
15:02 uiop__ joined
15:02 mmachenry joined
15:03 dan_f joined
15:03 yqt joined
15:03 rekahsoft joined
15:04 danharaj joined
15:04 benneh left
15:04 juhp_ joined
15:04 <tsahyt> there's no tangible difference
15:05 <tsahyt> in my case I'm operating on Words and the second argument is a power of 2.
15:05 simukis__ left
15:05 merijn joined
15:05 <Axman6> in that case there are better methods
15:05 Apocalisp joined
15:06 rumble joined
15:06 <tsahyt> well, they're powers of 2 in the ideal case. unless I can figure out a way how to ensure this property in types (I'm using typelits at that point), I need to support other numbers as well
15:06 simukis__ joined
15:06 <Geekingfrog> Using amazonka, I want to catch multiple errors in one go with catching. Is there a way to compose the amazonka errors? The type of an error is typically: Getting (First ServiceError) a ServiceError
15:06 <Axman6> use myMod x y = x .&. y-1 and moyQuot x y = x .&. complement (y-1)
15:06 oish joined
15:07 CoconutCrab joined
15:07 bruschkov joined
15:07 <Axman6> Geekingfrog: are there prisms provided for the different error types?
15:07 <tsahyt> is that x .&. (y-1)?
15:07 <Geekingfrog> Yes, these are prism (according to the doc). The whole thing is designed to be used with Control.Exception.Lens
15:08 <Axman6> Geekingfrog: you probably want to use handler
15:09 <Axman6> http://hackage.haskell.org/package/lens-4.15.1/docs/Control-Exception-Lens.html#t:Handleable
15:09 <Axman6> if you're trying to handle different exceptions in different ways
15:09 <tsahyt> Axman6: it actually turns out slightly slower
15:09 <tsahyt> unless I've made a mistake somewhere
15:09 <Axman6> tsahyt: it?
15:09 <ongy> also slightly different, since x .&. complement(y-1) still has to be shifted
15:09 <tsahyt> Axman6: your myMod and myQuot
15:10 <Axman6> also what types are you operating on? Int? Integer? Word?
15:10 bruschkov joined
15:10 <tsahyt> Word64
15:10 schjetne joined
15:10 <ongy> iirc divMod (or/and) quotRem are an x86 instruction
15:10 <Axman6> ongy: oh yes, of course =)
15:10 carlomagno joined
15:10 <Geekingfrog> Axman6: I'd like to use the same handler for a few exceptions. Any way to lump them together?
15:10 chu joined
15:10 <Axman6> Geekingfrog: not sure I understand what you mean
15:10 <tsahyt> that explains it. at ~3.8ns I don't think it'll become the bottleneck here any time soon
15:10 pepeiborra joined
15:11 <Axman6> no...
15:11 samvher joined
15:11 <glguy> Geekingfrog: you can combine them with failing
15:11 burdges joined
15:12 <Geekingfrog> Currently I would need to duplicate the handling part: catches [handler ExcPrism1 handlingAction, handler ExcPrism2 handlingAction]. Ideally I would have [handler (ExcPrims1 || ExcPrism2) handlingAction]
15:12 <ongy> so it's like 1 (slow) instruction against 5 (I think) fast ones. And div is pretty fast these days.
15:12 <Axman6> glguy: argh! I needed exactly that yesterday!
15:13 <Geekingfrog> glguy: what do you mean?
15:14 newbie1 joined
15:14 <Axman6> :t failing _Left _Right
15:14 <lambdabot> Applicative f => Over (->) f (Either c c) (Either c c) c c
15:14 mamemaki joined
15:15 <Geekingfrog> :i failing
15:15 CaptainLex_ joined
15:15 <Geekingfrog> Ok, let me work my way through this thing. Thanks for the help
15:17 bruschkov joined
15:17 eschnett joined
15:21 patbecich joined
15:21 bollu joined
15:22 oisdk joined
15:23 <ongy> :t failing
15:23 <lambdabot> (Conjoined p, Applicative f) => Traversing p f s t a b -> Over p f s t a b -> Over p f s t a b
15:23 mmm_ joined
15:24 mmm_ left
15:26 ludat joined
15:27 <bollu> where is Identity?
15:28 <bollu> nvm, found it. import Data.Functor.Identity
15:28 SpaceGazebo3 joined
15:28 ihradek joined
15:29 jutaro joined
15:29 robotroll joined
15:30 connrs joined
15:31 wraithm joined
15:32 <bollu> what is the extension that lets me write types in where clauses?
15:32 <cocreature> bollu: you don’t need an extension for this
15:32 wraithm joined
15:32 <bollu> cocreature: oh, really? I thought you needed the thing that lets you write type signature in class instantiation?
15:33 <bollu> cocreature: damn, TIL that I have been enabling an extension for no reason :)
15:33 <ski> you can't define local types, unfortunately
15:33 <* ski> assumes cocreature was thinking of type *signatures*
15:33 <cocreature> oh yeah
15:34 <bollu> oh, hm
15:34 <bollu> I vaguely remember doing this
15:34 <bollu> okay, maybe I'm mistaken. thanks!
15:34 <ski> hm, on second thought, it seems that's also what bollu was wanting. proceed
15:34 <cocreature> bollu: you can add _type signatures_ to where clauses. you can’t define a new type with "data X = Y"
15:36 coltfred joined
15:36 CoconutC1ab joined
15:36 <bollu> cocreature: oh, yeah, I wanted signatures itself
15:36 <bollu> not new type declarations
15:36 <bollu> sorry for being vague :)
15:37 aphorisme joined
15:37 matej_ joined
15:38 Apocalisp joined
15:38 olivierw joined
15:39 <lpaste_> bollu pasted “flip-lens-type-error” at http://lpaste.net/352648
15:39 <bollu> ^ I'm having a weird type error if I use "get"
15:39 <bollu> if I use "flip"
15:39 <bollu> with an existentially quantified type variable
15:39 <bollu> could someone take a loop?
15:39 <bollu> look*?
15:39 <bollu> (works if I implement flip myself)
15:39 bitemyapp joined
15:39 <bollu> oh, why didn't lpaste try to compile my code? :(
15:40 SpaceGazebo3 joined
15:40 <lpaste_> bollu revised “flip-lens-type-error”: “flip-lens-type-error.hs” at http://lpaste.net/352648
15:40 <lyxia> :t flip
15:40 <lambdabot> (a -> b -> c) -> b -> a -> c
15:40 ystael joined
15:40 <bollu> yes
15:40 <bollu> -- (^.) o l = get l o <- this line compiles fine
15:40 <lyxia> bollu: GHC doesn't unify variables with polymorphic types
15:40 wz1000 joined
15:40 <bollu> lyxia: which variable here has a polymorphic type?
15:41 <lyxia> a ~ Lens o a
15:41 <bollu> lyxia: and why not?
15:41 samvher joined
15:41 <bollu> lyxia: okay, I don't understand what "polymorphic types" means in that case
15:41 <bollu> lyxia: what does it mean for a type to be polymorhphic? could you please explain?
15:41 bruschkov joined
15:41 mjs2600 joined
15:41 <nshepperd> contains a forall
15:42 <Reisen> If I have some associated type family: `class A a where; type X a`, and I want to write some method: `x :: A a => X a -> ()`, I get an error about a0 being ambiguous in the type signature
15:42 <Reisen> Is this something TypeApplications can solve?
15:42 <bollu> I see
15:42 <bollu> nshepperd: like, "higher ranked" forall right?
15:42 <lyxia> bollu: This behavior is documented here https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#impredicative-polymorphism
15:42 shayan_ joined
15:42 glopglop joined
15:42 <bollu> lyxia: thank you :)
15:44 raichoo joined
15:44 bruschkov joined
15:44 <nshepperd> hence, when consuming lenses, you usually use LensLike' f s a with some concrete f
15:44 bruschkov joined
15:44 glopglop left
15:45 <nshepperd> to avoid higher ranked shenanigans
15:45 <lyxia> Reisen: you need AllowAmbiguousTypes to write such a method, and TypeApplications to use it.
15:45 bruschkov joined
15:46 <Reisen> lyxia, but it is enough to have the return type be that type correct? I.E, `x :: A a => X a`
15:46 <Reisen> Should work with TypeApplications but without AllowAmbiguousTypes?
15:46 tromp joined
15:46 <ski> s/polymorphic type/universal type/
15:47 <ski> (a polymorphic type is something else)
15:47 <lyxia> ski: Oh.
15:47 aries_liuxueyang joined
15:48 Fairy joined
15:48 <ski> Reisen : perhaps you could use `data X a' instead ?
15:48 <lyxia> Yeah "polymorphic" should qualify the function.
15:48 <bollu> why do lenses compose "backwards" ?
15:48 <ski> (a polymorphic type would be a type whose *kind* looks like `forall k. ..k..')
15:48 <bollu> backwards to function composition
15:48 <bollu> like, why do they compose "correctly"? _2 . _1 = access 2 then 1. But function composition is backwards
15:48 <ski> (just like a polymorphic value is a value whose type looks like `forall a. ..a..', iow whose type is universal)
15:48 <bollu> I'm confused :P
15:49 snowalpaca joined
15:49 <lyxia> bollu: it makes more sense if you see lenses as transforming functions (a -> b) to (s -> t).
15:49 nxtr joined
15:49 <bollu> lyxia: could you unpack that? :)
15:49 <ski> bollu : `(. g) . (. f) = (. (f . g))'
15:50 <ski> (as opposed to `(f .) . (g .) = ((f . g) .)')
15:50 <bollu> ski: I can see how the equations work, but I do not see the relation to the lens type >_<
15:50 bruschkov joined
15:50 fosskers joined
15:51 raycoll joined
15:51 <lyxia> bollu: oh you didn't write the 4 variable version. with type Lens o a = forall f. Functor f => (a -> f a) -> o -> f o, a lens transforms functions on *views* (a -> f a) to functions on *sources* (o -> f o).
15:51 <nshepperd> bollu: here's your lens definition, with slightly different parens: type Lens o a = forall f. Functor f => (a -> f a) -> (o -> f o)
15:51 bruschkov joined
15:52 <nshepperd> bollu: so a lens takes a function that operates on values (a) and turns it into a function that operates on containers (o)
15:52 Iskarlar joined
15:52 <bollu> nshepperd: OK
15:52 bruschkov joined
15:53 <bollu> nshepperd: so function composition will take something like (a -> f a) -> (o -> f o), (o -> f o) -> (p -> f p) to (a -> f a) -> (p -> f p)?
15:53 <bollu> ohh
15:53 <bollu> neat :)
15:53 <bollu> thanks for rubber duckying :D
15:53 <nshepperd> yup
15:53 <lyxia> Reisen: it doesn't matter whether it's an argument or the return type. What matters is whether you can deduce "a" given "X a", which requires that X be injective.
15:54 <Reisen> lyxia, yup, sorry it just ocurred to me that that's the case, I had a type that looked something like
15:54 <bollu> nshepperd: can you tell me about Prism and Traverse? :3
15:54 <Reisen> Foo a => X a -> Y a
15:54 <Reisen> And I thought both X and Y were associated type families, but Y isn't, so it fixed the type
15:54 <ski> in `_2 . _1', the `_2' part explains how to traverse down from the whole/total structure into the second component of that (by explaining how to *lift* a modification of the second component into a modification of the whole). then `_1' in turn tells how to focus on the first component of *that* part
15:54 <Reisen> My own silly inability to read, sorry lyxia
15:54 <samvher> Does the continuation monad have something like ask? I'm trying to do something like this: http://www.haskellforall.com/2012/12/the-continuation-monad.html but I want the supplied continuation to be available in more than one function. Let me know if I'm not explaining clearly :)
15:54 <ski> @where SEC
15:54 <lambdabot> http://conal.net/blog/posts/semantic-editor-combinators/
15:54 pasukon joined
15:55 <bollu> ski: the paper has Prism and Taverse as well?
15:55 <ski> which paper ?
15:55 <bollu> ski: AFAIK there is a paper with the same name? (SEC)?
15:55 <ski> samvher : you're not explaining clearly :)
15:55 <bollu> ski: I want to understand Prism and Traversal as well
15:55 snowalpaca joined
15:55 <tsahyt> @hoogle Functor f => f (Either a b) -> Either (f a) (f b)
15:56 <lambdabot> Data.Functor.Adjunction uncozipL :: Functor f => Either (f a) (f b) -> f (Either a b)
15:56 <lambdabot> Data.List.NonEmpty unzip :: Functor f => f (a, b) -> (f a, f b)
15:56 <lambdabot> Control.Functor.HT unzip :: Functor f => f (a, b) -> (f a, f b)
15:56 <ski> bollu : ah .. no. but imho it helps to understand SEC before or about the same time
15:56 sooheon joined
15:56 <samvher> In the link it uses "ContT $ \f -> do [monad operations]"
15:56 <tsahyt> is such a function even possible in the general case?
15:56 aries_liuxueyang joined
15:56 <bollu> ski: SEC is not the same as lens?
15:56 <nshepperd> bollu: Traverse is basically the same, except the container can contain zero or more values, instead of exactly one. which means the function might be applied multiple times
15:56 <ski> bollu : it's related
15:56 <samvher> but I want to use this f in more than one place, I want to have multiple functions returning monadic values
15:56 <samvher> all accessing the same continuation
15:56 pepeiborra joined
15:57 <samvher> maybe I just don't want to use ContT, so then I should use lift, but then I don't know how to reference the continuation
15:57 <bollu> nshepperd: I see.
15:57 <samvher> hence "ask" because I think Cont and Reader seem sort of similar, only Cont takes a more specific argument
15:57 <ski> samvher : you're not explaining clearly :)
15:57 Apocalisp joined
15:57 <ski> samvher : perhaps you're looking for `callCC' ?
15:58 olivierw joined
15:58 <samvher> Haha ok. I was looking at callCC but somehow the type isn't what I would expect. Maybe I'm just confused by the Cont monad :)
15:58 <ski> samvher : .. or perhaps you'd rather use delimited continuations
15:58 Cale joined
15:58 <ski> being confused by `Cont' is normal
15:58 chrissl joined
15:59 <nshepperd> bollu: I think Prisms are zero or one? I'm not too sure about those
15:59 <ski> @type callCC
15:59 <lambdabot> MonadCont m => ((a -> m b) -> m a) -> m a
15:59 <ski> @type asks
15:59 <lambdabot> MonadReader r m => (r -> a) -> m a
15:59 <Cale> :t runCont . sequence . map cont
15:59 <lambdabot> [(a -> r) -> r] -> ([a] -> r) -> r
15:59 <ski> i suppose there's a certain similarity
15:59 <samvher> ok, I would have to read up on delimited continuations to know if that's what I need
15:59 <nshepperd> but they all follow the same pattern of lifting functions on values to functions on 'containers'
15:59 SpaceGazebo3 joined
15:59 <bollu> nshepperd: yes, for sum types
15:59 Schrostfutz joined
15:59 <ski> samvher : well .. perhaps it would be better if you tried to describe what you want to do ?
15:59 janos joined
15:59 Rodya_ joined
16:00 <nshepperd> :t traverse
16:00 <lambdabot> (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
16:00 rcat joined
16:01 <ski> samvher : using `ContT $ \f -> ..f..', if you use it in a certain stylized way, is equivalent to using `callCC'
16:01 doodlehaus joined
16:01 <ski> samvher : elaborate on "I want to have multiple functions returning monadic values","all accessing the same continuation" ?
16:01 <samvher> I'm building a website and I want to be able to supply blocks to my template. The template uses the Html monad from Lucid. I thought with the approach in this blog I could do this
16:02 <samvher> So I have "html statements >> f MyBlockType >> more html statements"
16:02 eacameron joined
16:02 <samvher> and then by supplying f from above I could fill different types of blocks
16:02 <samvher> so MyBlockType1, MyBlockType2, that kind of thing
16:02 <Cale> samvher: That sounds more like ReaderT than anything related to continuations.
16:03 <Cale> Or just a plain old function parameter
16:04 <ski> well .. *perhaps* it could be useful to use `ContT' here, to avoid clutter .. or perhaps not
16:04 <Cale> Note that transforming Lucid's monad isn't likely to be made worthwhile without a bunch of effort lifting all the things it provides you.
16:04 steeze joined
16:04 simukis__ joined
16:04 <samvher> I was looking a bit at ReaderT as well.
16:04 <samvher> Cale: yes that's what I was worried about as well, that I would have to do a lot of lifting.
16:05 <Cale> I'd just pass your f in as a function parameter
16:05 <samvher> Cale: I hoped I could maybe derive the Term monad or something
16:05 sellout- joined
16:05 <ski> perhaps samvher's wanting a relatively local use of `ContT' or `ReaderT' .. which wouldn't be bad
16:05 <Cale> maybe...
16:05 urodna joined
16:06 <ski> (e.g. just using it in one operation or a couple, to make the formulation of it/them nicer)
16:07 <ski> (though in the case of `ReaderT', i suppose it'd be less likely to be warranted in such situations)
16:07 abhiroop joined
16:07 <Cale> ah, right, I forgot about how Lucid was structured -- it might actually not be terrible
16:07 Ranhir joined
16:07 mjs2600 joined
16:07 <* ski> has no idea how `Lucid' is structured, btw :}
16:08 pepeiborra joined
16:09 <Cale> There's a relatively simple class which defines a few operations over which all the tag-building stuff is abstracted
16:09 <Cale> So you *could* just write a lifting instance of the Term class for ReaderT
16:09 pleax joined
16:10 cschneid_ joined
16:11 <Cale> ... or maybe it'd have to be a few, to match the instances which exist for HtmlT
16:11 samvher joined
16:11 <Nik05> I thought I read something about generalising type inference to kinds or programs. Does anyone know if this exists or not?
16:11 <samvher> Sorry about that, I somehow lost my connection on IRC
16:12 olivierw joined
16:12 <Cale> samvher: It might actually be possible to write instances of Term for ReaderT, but I'm not sure I'd even bother with that.
16:13 <Cale> I'd just make a record type for the blocks to be filled in
16:13 <samvher> Cale: you sound like you have experience with Lucid, do you have some nice approach for working with blocks in a template?
16:13 <Cale> and then pass that around
16:13 <samvher> Hm yeah I was afraid of that. But then I end up with many pieces of code taking the argument only to be able to pass it on to other code. I never really like that.
16:14 dynrzk_ joined
16:14 ape joined
16:14 <samvher> I was hoping I could derive the instances, but I tried a bit and that didn't go so easily.
16:14 cdg joined
16:14 matej_ joined
16:14 <Cale> I think people are over-anxious about introducing function parameters in general
16:15 <Cale> You can always figure out what things tend to travel to the same places and package them together.
16:15 <Cale> and once you have the program written and know what things are needed everywhere, you can work out something like ReaderT at that point
16:15 <samvher> Cale: Right. I know it's possible, I just find it a bit painful/ugly
16:16 <samvher> I was thinking I could maybe put the HtmlT over the ReaderT, but then I need to do some hoisting or so after running the Reader (which is also new to me)
16:16 <ape> I'm working on understanding dictionary-passing translation. if I have a function that takes an argument from a type class which contains a parametrized type like Maybe a, presumably the compiler needs to compile just one function to handle any argument of a type of the form Maybe a
16:17 <bollu> ski: SEC seems like a proto-lens
16:17 <bollu> ski: am I mistaken?
16:18 doodleha_ joined
16:18 <ape> how does the compiler product a single function to handle any argument of type Maybe a for any a?
16:18 <ape> *produce
16:18 <samvher> ski, Cale: in any case, thanks.
16:19 <Cale> ape: By just pushing pointers around and making sure it doesn't follow them
16:19 Fairy joined
16:19 <bollu> Cale: do you know of a general class of examples of Profunctor?
16:19 <ape> my guess is that if I try to e.g. get the value of a Just and then do addition, it's calling an external addition function (which itself has a dict of possibilities for Integer, Float, ...)
16:19 ramzifu joined
16:19 <bollu> Cale: I've seen the examples in Haskell, but I was hoping for more "universal" examples
16:19 <bollu> Cale: (heh, universal)
16:20 <ape> Cale: these pointers are the ones in the dict for the functions my function wants to call?
16:20 lithie joined
16:21 dmwit_ joined
16:21 <ski> bollu : i don't think so
16:22 <bollu> ski: :( okay
16:22 <bollu> ski: then I don't see why the idea of a profunctor even came about
16:22 <ski> bollu : i.e. i don't think you're mistaken :)
16:23 <Cale> ape: I mean, if a function wants to pattern match against (Just x) or Nothing, and the function doesn't have to examine what 'x' is, then there's no problem -- the same code will work no matter what's on the other end of that pointer.
16:23 <bollu> ski: oh xD that one
16:23 vlatkoB joined
16:23 kazagistar joined
16:23 kazagistar joined
16:23 cdg_ joined
16:24 <Cale> ape: Similarly, if a function gets a pointer to some x of type a, it can package that up in a Just data constructor without needing to examine x, so:
16:24 <Cale> :t Just
16:24 <lambdabot> a -> Maybe a
16:24 <Cale> ^^ parametrically polymorphic, because everything is pointers to code anyway
16:25 <Cale> :t map
16:25 <lambdabot> (a -> b) -> [a] -> [b]
16:25 kazagistar joined
16:25 wraithm joined
16:26 <Cale> Here, the code for map doesn't need to care about what actual memory layout the concrete values of types 'a' and 'b' have, because it's only ever going to be manipulating pointers to them.
16:26 <ape> Cale: that makes sense. so if my class needs to add something but doesn't know which type of class Num it's going to be, there's a reference to the "add" function, and the linker will figure out which add function to use?
16:27 <Cale> Oh, type classes are something I haven't mentioned yet
16:27 BlueRavenGT joined
16:27 <ape> (basically I'm trying to make sure I really understand why you can separately compile Haskell polymorphic functions, in contrast to C++ template functions)
16:27 <Cale> Type class polymorphism *is* implemented by passing dictionaries of operations around
16:27 eacameron joined
16:27 <ski> ape : not the linker. if the constraint isn't discharged, it's result in another implicit argument to the whole thing
16:27 <Cale> right
16:27 <Cale> e.g.
16:27 <Cale> :t sort
16:28 <lambdabot> Ord a => [a] -> [a]
16:28 <Cale> The implementation of sort merely uses the operations in the Ord type class (ordering comparisons like (<=) and (>) and compare)
16:28 <ape> so the compiled version of sort just shuffles around pointers and gets its comparison operator from the dict is receives, right?
16:28 <Cale> yeah
16:28 <ape> *it
16:29 <ape> cool, thanks! that clarifies things
16:29 <Cale> and the dictionary is computed from the available instances
16:29 <Cale> You can have instances like
16:29 <Cale> (Ord a, Ord b) => Ord (a,b)
16:29 <Cale> So, if you pass sort a list of type [(Integer, String)]
16:29 <ape> I guess what wasn't obvious to me is why this dict will necessarily be of finite size
16:30 <Cale> ah, the dictionaries can be computed at runtime
16:30 <ski> well .. what do you mean by "finite size" ?
16:30 <Cale> For example...
16:30 <ski> often it will be cyclic (thus infinite)
16:30 <ski> (recursive functions are cyclic data structures)
16:30 <ape> so if sort knows how to handle Maybe a, there are potentially infinitely many types: Maybe Integer, Maybe (Maybe Integer), ...
16:30 <ape> yes
16:30 pepeiborra joined
16:31 sigmundv_ joined
16:31 <Cale> > let f :: (Show a) => a -> Integer -> String; f x 0 = show x; f x n = f (x,x) (n-1) in map (f ()) [0..]
16:31 <lambdabot> ["()","((),())","(((),()),((),()))","((((),()),((),())),(((),()),((),())))",...
16:31 <Cale> ^^ This uses instances of Show for infinitely many types
16:32 <Cale> which are constructed from the instance Show ()
16:32 <Cale> and the instance (Show a, Show b) => Show (a,b)
16:32 sigmundv_ joined
16:33 <ski> `sort' itself doesn't know (or care) "how to handle Maybe a". it's the job of the caller to provide an instance for `Ord a' to use un `sort :: Ord a => [a] -> [a]'. the particular `a' the caller picks can be `Maybe b', for some `b' (maybe `Integer', maybe `(Integer,String)', maybe `(Integer,c)' for a type variable `c' that's not statically known to this caller, iow which it is polymorphic in)
16:33 <Cale> But in cases where you're not using polymorphic recursion, the compiler will often be able to generate the instances you actually use by inspection at compile time.
16:33 afarmer joined
16:34 <Cale> Yeah, you can think of the "Ord a =>" as representing an additional hidden parameter which is passed in by the user of the function.
16:34 <ski> "there are potentially infinitely many types: Maybe Integer, Maybe (Maybe Integer), ..." -- that's a consequence of `instance Ord Integer' together with `instance Ord a => Ord (Maybe a)'. `sort' is not involved here
16:34 <ape> ic. so the dict of implementations of the function just needs one implementation for each concrete type as well as e.g. an implementation that handles `Maybe a' by possibly re-calling a different implementation of itself
16:34 eschnett joined
16:34 <Cale> yeah
16:35 calincru joined
16:35 <Cale> Well, sort isn't itself part of any dictionary
16:35 <Cale> It's not a type class method, just something defined in terms of the methods of Ord
16:35 SpaceGazebo3 joined
16:35 _sg joined
16:36 <Cale> It's compiled once, and takes a dictionary for Ord, which is constructed somehow at the usage sites (sometimes by abstracting the definition they occur in over another dictionary parameter to defer the decision)
16:36 <ape> is there a good reference for more of this implementation-level stuff about Haskell? I'm pretty new to the language, and the sources I've found don't go too deep
16:37 <Cale> The papers by Simon Peyton Jones and Phil Wadler are particularly good -- there are lots of others as well.
16:37 <ski> ape : what do you mean by "the dict of implementations of the function just needs one implementation for each concrete type as well ..." ?
16:38 jathan joined
16:38 <Cale> my flight is boarding, so I'm off :)
16:38 <Cale> later!
16:38 <ape> thanks!
16:38 peschkaj joined
16:39 serendependy joined
16:39 <ape> ski: my understanding of how haskell implements polymorphic functions is that it replaces `f :: a -> ...' with `f_ :: dictOfFunctions -> a -> ...', where `dictOfFunctions' has implementations of `f' for different concrete values of `a'
16:40 <ski> that's not quite right
16:40 noddy joined
16:40 SudhanshuJ joined
16:41 <ape> ski: how does it go?
16:41 fcpga_te joined
16:41 pasukon joined
16:41 samvher joined
16:41 <Jaak> more like functions like "f :: Show a => a -> ..." will be replaced with "f :: ShowDict a -> a -> ..." where data ShowDict a = ShowDict { show :: a -> String ...
16:41 oisdk joined
16:41 <dolio> For one, `id :: a -> a` is polymorphic and does not require a dictionary of functions.
16:42 <ski> `f :: Ord a => ..a..' (not necessarily any `a ->' in there !) is translated to `f_ :: OrdDict a -> ..a..', where `OrdDict a' has *one* implementation of each of the operations of `Ord' (not of `f' !), for the particular type `a' chosen by the caller
16:42 faberbrain joined
16:43 <dolio> For three, this is how GHC implements it. The Haskell report doesn't specify how it's implemented, and there are other compilers that implement it differently.
16:43 <glguy> ape: A polymorphic Haskell function can be compiled independent its instantiation because normal Haskell values have a uniform representation
16:43 Uakh_ joined
16:43 <glguy> ape: While in C++ the values do not
16:43 octarin joined
16:43 <ape> ohhhh that makes more sense. the caller is responsible for providing the operations required by the type class(es) involved in the function definition
16:44 <ape> so the compiled function just has to refer to the pointers in that dict, which are guaranteed to be there
16:44 <ski> so if the user wants to call `sort :: Ord a => [a] -> [a]', with `a' being `Integer', then the corresponding dictionary argument of type `OrdDict Integer' will contain implemenentations of `(<)',`(<=)',&c. for the particular type `Integer'
16:44 <ski> @src Ord
16:44 <lambdabot> class (Eq a) => Ord a where
16:44 <lambdabot> compare :: a -> a -> Ordering
16:44 <lambdabot> (<), (<=), (>), (>=) :: a -> a -> Bool
16:44 <lambdabot> max, min :: a -> a -> a
16:44 <nitrix> Using conduit, I'm working with a library that yields a Source; I'm guessing I'll need to create a Sink and connect the two using ($$) in some ConduitM monad, but how do I create such Sink?
16:45 matej_ joined
16:45 <ski> ape : so, there's no implementations of `f' for any particular types stored in the dict. only implementations of the *actual* operations/methods in the type class (`Ord' here), for the *particular* type `a' that the caller chooses
16:45 armyriad joined
16:45 Wizek joined
16:45 Wizek_ joined
16:45 bollu joined
16:45 <ape> ski, others: thanks! gotta run off to work, where I get to apply 0% of what I learn about haskell
16:45 <ski> there being a contraint `Ord a' in `sort :: Ord a => [a] -> [a]' doesn't mean that `sort' is a method of `Ord'
16:45 Wizek__ joined
16:46 <ski> ape : have fun :)
16:46 <nitrix> It looks like I'd need `await` and that `Consumer` is a generalization of a `Sink`?
16:47 matej_ joined
16:48 matej_ joined
16:49 montagy joined
16:49 raichoo joined
16:51 whater joined
16:52 tsahyt joined
16:54 max3 joined
16:54 matej_ joined
16:54 <max3> what does pie in ghc-nopie-7.10.3 mean?
16:55 <Clint> max3: position-independent executable
16:56 <max3> Clint, why am i all of a sudden getting pie ghcs when doing stack setup
16:56 trism joined
16:56 <max3> and now stack is trying to install into /root/.stack for all dependencies!
17:00 Shou joined
17:02 Itkovian joined
17:03 Rodya_ joined
17:03 osa1 joined
17:03 osa1 joined
17:04 LUIS3VR joined
17:06 mattyw joined
17:06 boombanana joined
17:07 ertes joined
17:08 Unhammer joined
17:08 aglorei joined
17:09 Sonolin joined
17:11 Jesin joined
17:11 Berra joined
17:12 mettekou joined
17:12 samvher joined
17:13 asthasr joined
17:14 tromp joined
17:15 TheAuGingembre joined
17:17 <Clint> max3: i don't know anything about stack but presumably it has to do with "recent" toolchain changes on debian-based systems
17:18 oish joined
17:19 SudhanshuJ joined
17:19 inad922 joined
17:22 patbecich joined
17:22 graygoose124_ joined
17:24 oisdk joined
17:25 cpennington joined
17:27 wraithm joined
17:27 <platz> thinking about writing some binding packages to c libs, but haven't done much with FFI. Is c2hs the way to go in this space?
17:28 iomonad joined
17:28 <glguy> I'd stick with hsc2hs until you determine that you need more than it does
17:29 contiver joined
17:29 sellout- joined
17:30 Hexagenic joined
17:34 oisdk joined
17:35 <platz> I thought it might be easier if c2hs genereates the "foreign import"s for me, but i could also see how it might just be better to do it manually
17:38 jgertm joined
17:39 oisdk_ joined
17:41 prohobo joined
17:42 prohobo left
17:42 indi_ joined
17:42 samvher joined
17:43 raynold joined
17:43 peterbecich joined
17:43 Swizec joined
17:44 faberbrain joined
17:46 mjs2600 joined
17:46 mizu_no_oto_work joined
17:46 <flxw> Hi, I'd like to parse unix-style timestamps in log files. On hackage I found the Thyme library, which looks pretty cool for this task. My problem: parseTime (from Data.Thyme.Format) takes a TimeLocale argument from old-locale. I found ways to query the current locale using getCurrentLocale from system-locale and current-locale packages, but not old-locale. Am I missing something, or do I really have to instantiate a TimeLocale v
17:46 <flxw> hand?
17:46 peterbecich joined
17:48 Gurkenglas joined
17:48 MrJazz joined
17:49 kthnnlg joined
17:51 SaleemPheku joined
17:53 greatdex joined
17:53 wildlander joined
17:53 Elish joined
17:54 wildlander joined
17:57 louispan joined
17:58 <johnw> platz: you could use c2hsc instead
17:58 wildlander joined
17:58 tag joined
17:58 <johnw> it's designed around generating the FFI into an .hsc file that you can edit/review
17:59 matej_ joined
18:00 wildlander joined
18:01 sternmull joined
18:01 mettekou joined
18:02 insitu joined
18:06 faberbrain joined
18:06 <platz> johnw: this looks nice, I will definitely check it out - thanks!
18:06 patbecich joined
18:06 <johnw> sure thing; if you have questions, I'd be the one to ask :)
18:07 <johnw> I didn't like c2hs because it was too "automagic" for my tastes
18:09 cereal_killer_ joined
18:09 MrJazz_ joined
18:09 SaleemPheku joined
18:09 SaleemPheku joined
18:09 jutaro joined
18:10 pera joined
18:11 snowalpaca joined
18:11 personagrata joined
18:11 cpup joined
18:12 ziocroc joined
18:12 samvher joined
18:12 Swizec joined
18:14 oisdk joined
18:14 wraithm joined
18:16 Rodya_ joined
18:17 SpaceGazebo3 joined
18:17 peschkaj joined
18:17 mjs2600 joined
18:18 bab joined
18:20 insitu joined
18:21 chreekat joined
18:24 freusque joined
18:25 mettekou joined
18:26 ptvirgo joined
18:26 t4nk563 joined
18:27 janos joined
18:27 zcourts_ joined
18:27 mettekou joined
18:27 <t4nk563> Hello, friends! How do I use "where" so ghci understands it? Semicolon does not work ;/
18:28 conal joined
18:30 <glguy> t4nk563: It'd be easier if you just showed what you were trying to do than if we guess
18:30 <t4nk563> (+) 1 . sum . map (1 /) . take (n-1) $ iterate ((+) 3) 4 ; where n = 9
18:30 <glguy> Also, if you're writing something complicated enough to use a where it should probably be going into a file instead of GHCi directly
18:30 <glguy> You can't use where as part of building an expression like that
18:31 <glguy> That's what let is for
18:31 joshuagross joined
18:31 <t4nk563> Uhm.
18:31 <t4nk563> Why not?
18:31 cmsmcq_ joined
18:31 <glguy> where is part of the syntax for declarations and case alternatives
18:31 <glguy> it's not part of the syntax of expressions
18:32 <glguy> > let n = 9 in (+) 1 . sum . map (1 /) . take (n-1) $ iterate ((+) 3) 4
18:32 <lambdabot> 1.7703663441821336
18:32 <t4nk563> Thank you very much, I'll use let then :)
18:34 replay joined
18:34 path[l] joined
18:35 takle joined
18:36 vlatkoB_ joined
18:38 <kgadek> (maybe?) quick question. True or false?: freer-effects is the best/most developed lib providing FreeR monads
18:38 janos joined
18:39 <johnw> I'm guessing you mean "that's published on Hackage"?
18:39 Rainb joined
18:40 doux joined
18:40 epsilonhalbe joined
18:42 samvher joined
18:43 Zekka joined
18:45 <pikajude> is there a cloud-haskell irc channel
18:49 takle joined
18:49 crobbins joined
18:49 screggs joined
18:50 bollu joined
18:51 dhalgren joined
18:51 jwynn6 joined
18:52 zzz joined
18:54 zennist joined
18:55 insitu joined
18:55 jwynn6 joined
18:56 Kreest__ joined
18:56 janos joined
18:58 t_h joined
18:58 jwynn6 joined
18:58 grayjoc joined
18:59 mattyw joined
19:00 clmg joined
19:00 tromp joined
19:00 <crosleyt> is there any good way to uninstall all cabal packages?
19:00 <clmg> Does anyone know how to draw a border around some text using vty?
19:01 <johnw> crosleyt: rm -fr ~/.ghc ~/.cabal is the most devastating way
19:01 Lord_of_Life joined
19:02 <crosleyt> that was devastating, thx
19:03 mojjo joined
19:03 roconnor joined
19:03 atomi joined
19:04 pasukon joined
19:04 jwynn6 joined
19:05 takle joined
19:05 sandonfuge joined
19:06 <johnw> is skolem pronounced "school-em"?
19:06 jwynn6 joined
19:06 <johnw> the IPA notation is ˈskuːləm, which seems to suggest this
19:06 <Tuplanolla> I thought the o was supposed to be short, johnw.
19:07 mnislaih joined
19:07 bennofs joined
19:07 phaji joined
19:09 mizu_no_oto_work joined
19:09 none joined
19:10 <mekeor> is there a function 'f' (within the base package?) so that 'f "foo,bar,baz,qux," == ["foo","bar","baz","qux",""]' ?
19:10 <monochrom> johnw: I was in Stephen Cook's class and he still said it like English :)
19:10 <pikajude> mekeor: there's a split library
19:10 <pikajude> that can do that
19:10 urodna joined
19:11 <pikajude> mekeor: http://hackage.haskell.org/package/split-
19:11 <mekeor> thanks, pikajude :)
19:13 samvher joined
19:13 cyanobacteria joined
19:14 epsilonhalbe joined
19:14 tromp joined
19:15 grayjoc joined
19:16 zennist joined
19:16 matej_ joined
19:17 <crosleyt> hmm still in version hell...
19:17 <crosleyt> next goal: base (dependency of haskell98- rejecting: base- (conflict: haskell98 => base>=4.7 && <4.8)
19:18 <crosleyt> the idea was to uninstall all packages and then install haskell98 so that it works no matter what
19:18 <monochrom> Please don't do that.
19:18 <crosleyt> what to do instead
19:19 <monochrom> There are a small bunch of packages locked with your GHC. Replacing them breaks your copy of GHC.
19:19 sgflt joined
19:19 janos joined
19:19 <crosleyt> would I need a previous version of GHC to use that package then
19:19 mabox joined
19:19 <monochrom> And then there are a dozen more that, while an expert would know how to replace, it would take expertise.
19:19 <monochrom> Yes.
19:20 <clmg> anyone here know vty?
19:20 <monochrom> I do not actually know what you need this for. The solution depends on the problem.
19:21 <monochrom> At this point I can only tell you what will not solve any problem.
19:21 sanitypassing joined
19:21 <crosleyt> I'm trying to compile an older package which depends (among other things) on haskell98
19:21 <monochrom> hrm does haskell98 come with recent GHC?
19:22 janos joined
19:22 <monochrom> ah it's dropped.
19:22 <Tuplanolla> Are you sure you don't want Brick instead, clmg?
19:22 <monochrom> Now I wonder if you can simply add it.
19:22 olivierw joined
19:23 <monochrom> ah it can't be.
19:23 <monochrom> Short term: Use an older GHC. Long term: Modify the package for today's environment.
19:24 augur joined
19:24 skeuomorf joined
19:24 albertus1 joined
19:24 <crosleyt> ok, thx.
19:25 janos joined
19:26 <clmg> Tuplanolla: ah it has border. great.
19:28 Lord_of_Life joined
19:31 unyu joined
19:33 takle joined
19:34 ragepandemic joined
19:35 MrJazz joined
19:36 cyborg-one joined
19:36 doodlehaus joined
19:36 nomotif joined
19:37 justicefries joined
19:37 rgr joined
19:37 conal joined
19:38 oisdk joined
19:38 takle joined
19:38 cpennington joined
19:39 Apocalisp joined
19:42 max3 joined
19:42 <max3> should passing this -L/usr/lib/x86_64-linux-gnu/ -lavformat -lavcodec -lavfilter -lavutil to ghci pick up things like libavfilter.so.6.31.100
19:42 samvher joined
19:43 codesoup joined
19:44 Paprikachu joined
19:45 Tourist joined
19:45 Tourist joined
19:46 ishtu joined
19:46 fosskers joined
19:47 peterbecich joined
19:47 Paprikachu joined
19:48 sepp2k joined
19:48 mettekou joined
19:50 Paprikachu joined
19:53 Snircle joined
19:54 elperdut joined
19:54 oisdk joined
19:54 janos joined
19:54 xanadu joined
19:54 a3Dman joined
19:55 path[l] joined
19:55 takle joined
19:56 janos joined
19:58 <max3> i feel silly but how do i perform all of the imports in a .hs from the interpreter without running the main?
19:59 <monochrom> Use :load myfile.hs ?
20:00 matej_ joined
20:00 <max3> i've done that and none of the imports are in scope
20:00 janos joined
20:00 <monochrom> That's strange, because it works for me.
20:00 <max3> yea maybe i'm wrong
20:01 insitu joined
20:01 elperdut joined
20:01 <monochrom> Also I think your previous question about -L and -l is yes.
20:02 <monochrom> (GHC Users Guide section 5.6.2)
20:02 xanadu joined
20:08 ubsan joined
20:10 nxtr joined
20:11 Natch joined
20:12 noddy joined
20:12 samvher joined
20:14 phaji joined
20:14 takle joined
20:15 tromp joined
20:16 Uakh_ joined
20:18 mheinzel joined
20:18 olivierw joined
20:19 orion joined
20:19 orion joined
20:19 xanadu joined
20:21 takle joined
20:22 <dolio> Was your file already compiled? Because ghci works differently when loading already compiled vs. interpreted files.
20:22 feri joined
20:22 <dolio> I think it's not strictly compiled vs. interpreted, but that's the easiest way to trigger the difference.
20:23 aarvar joined
20:23 jwynn6 joined
20:23 grayjoc joined
20:24 <monochrom> I judged it unlikely because "ghc -c myfile.hs" would not cause it at all, it has to have the secret password "ghc -c -dynamic myfile.hs", but few people actually know.
20:24 cpennington joined
20:24 <monochrom> But oh maybe it's Windows and doesn't need -dynamic.
20:24 iddqd joined
20:25 doux joined
20:26 MrJazz joined
20:27 bjz joined
20:31 sz0 joined
20:35 MP2E joined
20:37 <Tuplanolla> Does the type `Reader r r` suggest something is designed poorly or should I go ahead with it?
20:37 <monochrom> Depends on context, no?
20:38 <monochrom> @type tell
20:38 <lambdabot> MonadWriter w m => w -> m ()
20:38 <monochrom> err no
20:38 <tdammers> @type ask
20:38 <lambdabot> MonadReader r m => m r
20:38 <tdammers> this one?
20:38 <monochrom> Yeah.
20:38 <Tuplanolla> What I really want is `StateT`, but only for the main thread, because forking would make the state diverge.
20:39 oisdk joined
20:40 <Rembane> Tuplanolla: What stops you?
20:40 <Tuplanolla> Self-doubt, Rembane.
20:40 gameer joined
20:41 <Rembane> Tuplanolla: I say: Go for it! You will learn things from it regardless if it's a good idea or not.
20:41 <Tuplanolla> My plan was to use `ReaderT` and finish by returning the new state, but that feels like abuse.
20:41 jwynn6 joined
20:42 shurick joined
20:42 <Rembane> Tuplanolla: I think StateT is the way to go. It has the right feel for your usecase.
20:43 <johnw> I love the feel of StateT
20:43 <Rembane> johnw: I love the smell of ContT in the morning.
20:43 jtojnar____ joined
20:43 samvher joined
20:43 gawen joined
20:43 <Tuplanolla> @hoogle smell
20:44 <lambdabot> No results found
20:44 <Rembane> I must fix this. Control.Smell
20:46 graygoose124 joined
20:47 locallycompact joined
20:49 zygentoma joined
20:49 olivierw joined
20:49 graygoose124_ joined
20:50 Tourist joined
20:50 Tourist joined
20:52 peschkaj joined
20:53 Shou joined
20:54 peterbecich joined
20:54 shurick joined
20:54 boon joined
20:56 boon left
20:56 jwynn6 joined
20:56 calincru joined
20:57 jwynn6 joined
20:59 mfukar joined
20:59 takle joined
21:02 ner0x652 joined
21:03 oisdk_ joined
21:04 ziocroc joined
21:04 pasukon joined
21:04 tfc joined
21:05 jwynn6 joined
21:05 pleax joined
21:07 <ReinH> Please. Data.Smell.
21:07 replay joined
21:07 albertus11 joined
21:07 EvilMachine joined
21:08 path[l] joined
21:08 <ReinH> End the arbitrary segregation of data from other, misnamed data.
21:08 <monochrom> I have a cunning plan to bring the two of us to a consensus. Both "control" and "data" could be unified under the umbrella of "code". So, Code.Smell
21:08 <monochrom> s/us/you/
21:09 snowalpaca joined
21:09 <* ReinH> slow claps
21:09 <monochrom> Should I slow-bow?
21:09 <ReinH> I mean... That doesn't look like anything to me.
21:10 Apocalisp joined
21:11 pasukon joined
21:11 fnurglewitz joined
21:11 <Tuplanolla> I wouldn't mind less descriptive categories like `Essential` or `Wacky`.
21:12 osa1 joined
21:12 osa1 joined
21:12 quoboo joined
21:14 takuan joined
21:16 <AWizzArd> Using Control.Monad.Writer and this function: logNumber :: Int -> Writer [String] Int
21:16 <AWizzArd> Why does this work? logNumber 5 >>= (\x -> writer ((), [])) — why can one input ()
21:16 travv0 joined
21:16 <AWizzArd> Basically this is the tell FN.
21:16 <Tuplanolla> :t writer
21:16 SpaceGazebo3 joined
21:16 <lambdabot> MonadWriter w m => (a, w) -> m a
21:17 replay joined
21:18 <EvanR> recent talk about unums https://www.youtube.com/watch?v=aP0Y1uAA-2Y
21:18 <Tuplanolla> You discard the integer and return `()`, AWizzArd. Nothing says `a` has to remain constant.
21:19 <Tuplanolla> :t fmap -- Here's a less convoluted function for changing `a` to something else.
21:19 <lambdabot> Functor f => (a -> b) -> f a -> f b
21:19 feri joined
21:20 <EvanR> i really like the part on "posits" which out perform floats at their own game
21:21 olivierw joined
21:21 fnurglewitz joined
21:21 <ph88^> is this an implementation of miniKanren ? https://hackage.haskell.org/package/unification-fd-
21:21 <AWizzArd> logNumber 5 >>= (\x -> writer ((), []) >>= (\y -> writer (2*x, ["Hello"]))) evaluates to WriterT (Identity (10,["Got number: 5","Hello"]))
21:22 <AWizzArd> So this is fine as long the value y isn’t used.
21:22 <AWizzArd> Okay, makes sense.
21:22 t_h joined
21:22 tag joined
21:22 <EvanR> and since there are no NaNs, computation throws an exception in the specific cases of 0/0. when someone said "but how do you try a bunch of computations some of which are bad, you dont want to throw out all the work from before and after" i immediately though about [Maybe Float]
21:23 <EvanR> floating point errors can be caught and masked as Nothings
21:23 <EvanR> though this takes some time and memory to do
21:25 mmachenry joined
21:25 deepfire joined
21:25 MP2E joined
21:25 pleax joined
21:28 `Guest05 joined
21:28 <monochrom> EvanR: Interesting.
21:28 <Athas> Has anyone here tried to use the cuda package on CUDA 8?
21:32 mstruebing joined
21:32 magneticduck joined
21:33 hagr joined
21:34 travv0 joined
21:34 <hagr> Hello, all. Is there a good case for using a Haskell compiler for DOM applications?
21:34 olivierw joined
21:35 <AWizzArd> When using foldl' on an extremly large input seq, then the code will eagerly go through the whole seq, yes? I can’t „abort” this process earlier, and there is no lazyness involved?
21:37 jan-sipr joined
21:38 kadoban joined
21:38 mstruebing joined
21:38 TxmszLou joined
21:39 <Tuplanolla> Basically so, but laziness is only uninvolved in the spine of the fold, AWizzArd.
21:40 mdarse joined
21:41 Apocalisp joined
21:41 travv0 left
21:41 <monochrom> hagr: Yes. Cale works with a company that uses reflex-dom.
21:42 <monochrom> Maybe also GHCJS, I forgot.
21:42 <hagr> monochrom: Ok, so people are using it in production.
21:42 stepcut joined
21:43 <hagr> I know GHCJS -> javascript and GHCJS-Dom has DOM bindings (among others), I just didn't know if the projects
21:43 mmachenry joined
21:43 <hagr> are mature enough to trust in production.
21:44 <stepcut> Is it possible to implement, showProxy :: (Show a) => Proxy a -> String, so that you could have, showProxy (Proxy :: Proxy True) == "Proxy :: Proxy True"
21:44 augur joined
21:44 iomonad joined
21:45 travv0 joined
21:45 <lyxia> stepcut: you'd want showProxy :: forall a (x :: a) :: Show a => Proxy x -> String, which is a dependent type.
21:45 <stepcut> I can do it using a type-class, class ShowProxy a where showProxy :: Proxy a -> String, instance ShowProxy True where showProxy _ = "Proxy :: Proxy True", but it would be nice to leverage the exist show instance
21:45 takle joined
21:46 <lyxia> and GHC doesn't have dependent types yet. I heard you can get pretty close with singletons.
21:46 whaletechno joined
21:46 <stepcut> lyxia: right.. I think I have to do this the ugly way for now
21:46 <lyxia> @hackage singletons
21:46 <lambdabot> http://hackage.haskell.org/package/singletons
21:47 <stepcut> I think I will just use the type class worka
21:48 <stepcut> workaround for now, I really only care about one type at the moment and it doesn't have that many constructors
21:48 <lyxia> good idea
21:48 patbecich left
21:49 bjz joined
21:50 <siddhu_> Athas: no, but it does support CUDA 8. Ping the author if you run into issues.
21:52 <Athas> siddhu_: you know for a fact that is supports CUDA 8? The hackage page mentions that it has only been tested up to 7.5. I'd be surprised if it didn't work, but I figured I'd fish around for experiences while I wait for it to build.
21:52 HappyEnte joined
21:53 hiratara joined
21:54 augur joined
21:54 iomonad joined
21:55 <siddhu_> Athas: actually, there's a github issue https://github.com/tmcdonell/cuda/issues/42
21:55 <Tuplanolla> This `ReaderT` idea turned out to be very good, because it also made me find a better solution to the `forkStateT` problem I mentioned a few days ago.
21:56 travv0`` joined
21:56 tsmish joined
21:57 Galoyz joined
21:57 <Athas> siddhu_: that looks like it's about supporting new features, which is not important to me.
21:57 <Athas> I just want to run on a machine with CUDA 8 drivers.
21:58 JagaJaga joined
21:58 freusque joined
21:58 Shou joined
21:58 wongphu joined
21:59 Shou joined
21:59 mr_sm1th1 joined
21:59 tomphp joined
21:59 oisdk joined
22:00 Bane^ joined
22:00 <siddhu_> Athas: I know the author merged some patches which allow compiling with CUDA 8. So it should work, but I haven't tried it myself.
22:01 <Athas> I'll try it out.
22:01 ubsan joined
22:02 jwynn6 joined
22:03 peschkaj joined
22:03 path[l]_ joined
22:06 janos joined
22:06 <hagr> monochrom: Is Cale a regular in this channel? Is Cale his nick?
22:07 <monochrom> Yes and yes.
22:07 <hagr> Ok, thanks!
22:07 biglama joined
22:07 egis joined
22:09 <jle`> stepcut: note that 'Show' there in your example isn't well-kinded
22:09 <jle`> stepcut: Show can only have instances that are kind *
22:09 <jle`> stepcut: but in your example, 'a' has kind Bool
22:09 juhp_ joined
22:09 <jle`> stepcut: that should be a hint that Show can't do what you need it to do in Haskell
22:10 snowalpaca joined
22:10 <Athas> Is there a way to get stack to tell me why it's trying to install some dependency?
22:10 <Athas> I tried to visualise with 'stack dot', but it's near-unreadable.
22:10 <stepcut> jle`: oh yeah
22:10 <Athas> I vaguely recall that'cabal-install could show the path, but stack --verbose doesn't seem to do it.
22:11 <monochrom> Oh, is that in the graphviz format?
22:11 <jle`> oh, i think that was the point that lyxia made earlier that i didn't read carefully :)
22:11 <stepcut> jle`: yup
22:12 <stepcut> This was all a lot easier when there was Idris and pre-DataKinds Haskell. Back then it was easier to remember what you could or could not do in Haskell
22:12 <stepcut> now.. you have to think a lot harder
22:12 <monochrom> There is still Idris. :)
22:12 <stepcut> yeah
22:13 <nitrix> Is there a better idiom for something inline similar to: (fix $ \loop n -> print n; foo; loop (n+1))) 0
22:13 <stepcut> But, implementing my class-based solution was faster than porting this to Idris
22:13 <monochrom> Also, type-level list is so much less gymnastics in Idris than in Haskell.
22:13 <stepcut> yeah
22:13 <jle`> stepcut: you might have also been able to leverage singleton's TH to get something like this automatically
22:13 <nitrix> Wheareas, you can have an infinite loop with an incrementable variable with a default value? Or am I just re-inventing runST ?
22:14 <monochrom> No, runST would be bad at this.
22:14 <Tuplanolla> You can define `fix1 a f = fix f a` to make it look a bit nicer, but that's about it, nitrix.
22:14 juhp_ joined
22:14 <nitrix> Tuplanolla: :(
22:14 <stepcut> I think I figured out how to abuse Haskell enough so that you can do, pHttpVersion :: Parser [abnf| "HTTP" "/" 1*DIGIT "." 1*DIGIT|] (Int,Int), and get a compile type 'proof' that your parser conforms to the ABNF spec :p
22:15 <stepcut> which would also be a lot less messy in Idris
22:15 <jle`> yea but if you are going to use TH might as well just do compiletime validation using TH right
22:15 <jle`> TH can throw compile errors arbitrarily
22:16 tromp joined
22:16 <stepcut> jle`: sure.. but at compile time
22:16 meoblast001 joined
22:16 bjz_ joined
22:16 <stepcut> anyway, my solution only requires QuasiQuotes -- TH's less evil sister
22:16 <jle`> isn't your case at compile time, too?
22:17 <stepcut> yes
22:17 Bane^ joined
22:17 <nitrix> Tuplanolla: monochrom: I came up with fix $ 0 & \n loop -> do ...
22:17 <nitrix> It's not terribly bad, is it :/
22:17 <stepcut> perhaps I am unclear why you brought up TH and compile time errors
22:17 <monochrom> Cunning!
22:17 <jle`> stepcut: compiletime validation is 'easy' if you bring in TH
22:17 <Tuplanolla> How does it generalize for more arguments, nitrix?
22:18 janos joined
22:18 <jle`> s/easy/trivial
22:18 <stepcut> jle`: perhaps
22:18 <monochrom> I needed what you need now 10 years go, and back then there was no &.
22:18 <jle`> so you don't even need to bring in a type system thing
22:18 <monochrom> s/go/ago/
22:18 <nitrix> Tuplanolla: Actually, crap, you're right, `loop` will have the wrong type.
22:18 <nitrix> Tuplanolla: I wont be able to pass new `n`'s.
22:18 pleax joined
22:18 <Tuplanolla> So that's just `flip fix`, nitrix.
22:19 <nitrix> Yeah which isn't good enough. Alright, I'll just extract it as a function I suppose.
22:19 <exio4> nitrix: let go n = ... go (f n) ... in go start
22:20 <lpaste_> Tuplanolla pasted “Flipped Fixes” at http://lpaste.net/352673
22:20 <Tuplanolla> ...to save you some effort, nitrix.
22:20 <monochrom> "flip fix" is less reliant on operatoer precedence
22:22 mr_sm1th joined
22:22 mmn80 joined
22:22 gawen joined
22:23 <stepcut> jle`: I am not entirely clear on what the TH solution would look like
22:24 ihradek joined
22:25 fizbin joined
22:29 JoshS joined
22:30 hackebeilchen joined
22:31 jwynn6 joined
22:31 hiratara joined
22:32 iomonad joined
22:34 Itkovian joined
22:35 rgrinberg joined
22:37 ramzifu joined
22:40 <ezyang> This is very puzzling: as far as I can tell, it looks like hPutStr on Windows is truncating the string I'm outputting D:
22:41 Voldenet joined
22:41 Voldenet joined
22:41 <`Guest05> how does fromException work?
22:42 <ezyang> `Guest05: internally, you mean?
22:42 <ezyang> it makes use of Typeable
22:42 <`Guest05> i look at sources and see that it pattern matches
22:43 <`Guest05> i try to repeat this same thing and GHCi says that
22:43 <`Guest05> * Couldn't match expected type `a0' with actual type `n'
22:43 <`Guest05> because type variable `n' would escape its scope
22:43 <`Guest05> This (rigid, skolem) type variable is bound by
22:43 <`Guest05> a pattern with constructor:
22:43 <ezyang> wait, no, it doesn't use Typeable
22:43 athan joined
22:44 <ezyang> `Guest05: It's a type class method, so when you have SomeException e =>, you implicitly have a function that says how to get out the appropriate type from e
22:44 <`Guest05> how *does* that function work?
22:44 iulian joined
22:45 <implementation> there is no single function, there is a whole family of functions, one for each instance of the Exception typeclass
22:45 <ezyang> oh, actually, it does use Typeable \o/
22:45 <ezyang> fromException (SomeException e) = cast e is the magic
22:46 <implementation> where do you see that?
22:46 janos joined
22:46 <`Guest05> so..
22:46 <monochrom> ezyang: It is possible that the default locale dislikes certain non-ASCII characters. chcp 65001 to ensure UTF-8.
22:47 <`Guest05> if i do it exactly as in source for fromException
22:47 <`Guest05> by defining a function
22:47 <monochrom> There are also per-handle functions to just set this per handle.
22:47 <`Guest05> it works
22:47 <`Guest05> but if i make a lambda or a case
22:47 <ezyang> monochrom: Hmm
22:47 <mniip> SomeException stores the Typeable instance of the type
22:47 <ezyang> ok, I'll give that a try
22:47 <`Guest05> it complains about "(rigid,skolem)"s
22:47 <monochrom> `Guest05, the intention is that you don't implement your own fromException, you just use the default, i.e., you write no code.
22:47 <mniip> so that you don't impose a restriction on a skolem tyvar
22:47 aries_liuxueyang joined
22:47 eschnett joined
22:47 <mniip> but still can derive type information and the validity of a cast from the Typeable dictionary
22:48 <monochrom> But if you do need to write custom code for whatever reason, you will need to know existential types.
22:48 <ezyang> but I'm pretty sure there are no non-ASCII characters in my output
22:48 <`Guest05> monochrom: hackage documentation says that i do implement fromException if i want to make hierarchy
22:48 <monochrom> Yes but it is unusual to want a hierarchy. Even the OOP people are growing out of it.
22:49 <`Guest05> i want to make assertions with user messages and have catchable AssertFailed...
22:49 <ezyang> oooh, I didn't even realize that we could define hierarchies!
22:49 <monochrom> 5 hours of abstract hierarchy can be saved by 5 minutes of sum type.
22:50 <monochrom> Take for example AsyncException.
22:50 <ezyang> If I want to create an exception that masquerades as an IOException can I do it with the hierarchy mechanisms?
22:51 <MarcelineVQ> is the only way to distinguish between 'too many open files' and 'device is out of space' with an IOException of ioe_type ResourceExhausted to examine the ioe_description string? worded more directly, or if that string doesn't contain that info, how can I discern between the two?
22:51 <monochrom> No, you need a type class first.
22:51 <ezyang> :(
22:51 <ezyang> MarcelineVQ: If you look under the covers of IOException there are a number of fields that you can access via functions
22:51 <monochrom> Actually let me double-check.
22:52 <ezyang> If all of them are the same you're outta luck
22:52 <monochrom> Yeah you need a type class first.
22:52 bollu joined
22:52 <ezyang> Sigh
22:52 <MarcelineVQ> yes, I've yet to investigate fully, but the pretty printed error is distinct for the two so I wanted to ask ahead of exploring to see if there was something common
22:53 <ezyang> the relevant info should be squirreled away in one of the other fields
22:53 <monochrom> But why masquerade as IOException when you can masquerade as SomeException :)
22:53 <ezyang> monochrom: Because some end user who I don't have control over used catchIO and now I am sad
22:54 <monochrom> Approximately you have to use the String argument of userError.
22:55 amiri joined
22:55 <ezyang> yeah, that's what we ended up doing
22:55 <jle`> ezyang: (error "hey" :: IOException)
22:55 <jle`> hehe
22:55 <MarcelineVQ> ezyang: mostly I was hoping for something other than english language strings to be basing my error classifying off of :>
22:55 <monochrom> Put Gödel numbering in the string so your catcher can decode it and find a whole hierarchy.
22:55 <MarcelineVQ> does anyone know if errno here http://hackage.haskell.org/package/base- is well defined anywhere?
22:55 <`Guest05> * My brain just exploded
22:55 <`Guest05> I can't handle pattern bindings for existential or GADT data constructors.
22:56 <ezyang> There should be errnos
22:56 <`Guest05> what a wording...
22:56 <ezyang> `Guest05: don't let-bind: case
22:56 <monochrom> Unfortunately no errnos for the Windows people.
22:56 <`Guest05> i was startled
22:56 <monochrom> Double negative elimination: errnono -> err
22:57 ublubu joined
22:58 cpup joined
22:58 <monochrom> `Guest05: See how this is a whole rabbit hole right inside a pandora box. Is it simpler to just use a sum type?
22:58 <mniip> wait
22:59 <mniip> you can't let-bind gadts?
22:59 <monochrom> Right.
22:59 <mniip> oh I suppose that might be a problem with recursive bindings?
22:59 <monochrom> I don't actually know the issue.
22:59 <MarcelineVQ> ezyang, monochrom: thank you for your responses
22:59 <monochrom> Somewhere on the GHC trac someone may have discussed it.
23:00 <`Guest05> monochrom: how do i make assertions with user messages convertible to AssertionFailed with sum types?
23:00 <jle`> maybe it has to do with let polymorphism
23:00 <mniip> maybe it's maybelline
23:00 justicefries joined
23:01 <monochrom> :)
23:01 <MarcelineVQ> maybe it's read, maybe it's haskeline
23:01 dhil joined
23:01 <monochrom> haha great
23:01 nxtr joined
23:02 tsmish joined
23:04 path[l] joined
23:04 buttons840 joined
23:04 <monochrom> Either use AssertionFailed directly (via "assert"), or forget AssertionFailed altogether and just write your own type.
23:04 <monochrom> Conversion is a lost cause.
23:04 architeuthis joined
23:05 <monochrom> Two cases:
23:05 MrWoohoo joined
23:06 <monochrom> Either the user uses "assert", which will not use the hierarchy you endeavoured to build.
23:06 <monochrom> Or the user uses your hierarchy and your nice thrower functions, in which case why invite AssertionFailed to the party?
23:07 <monochrom> The thing is so-called "conversion" will have to lose the user message you have.
23:07 texasmynsted joined
23:07 <`Guest05> i don't know
23:07 <`Guest05> i just waant it, it seems nice
23:07 <`Guest05> want *
23:08 yrdz` joined
23:08 alx741_ joined
23:10 snowalpaca joined
23:11 <`Guest05> poor AssertionFailed, it wasn't invited
23:11 Noldorin joined
23:12 Shatnerz0 joined
23:13 pasukon joined
23:13 prohobo joined
23:15 canta joined
23:16 prohobo left
23:16 lambdamu joined
23:17 tromp joined
23:17 shayan_ joined
23:19 oisdk joined
23:19 mkoenig joined
23:19 codesoup joined
23:20 <monochrom> Re: pattern bindings and GADTs. "The reason for this restriction is really an implementation one. Type-checking binding groups is already a nightmare without existentials complicating the picture. Also an existential pattern binding at the top level of a module doesn’t make sense, because it’s not clear how to prevent the existentially-quantified type “escaping”. So for now, there’s a simple-to-state restriction. We’ll see how
23:20 <monochrom> annoying it is."
23:21 TxmszLou joined
23:22 zennist joined
23:22 tlahtoani joined
23:23 nwf_ joined
23:24 P1RATEZ joined
23:24 <buttons840> in ghci I will do `let f = 'x'` but then whenever I do `:r` all my let bindings are gone from ghci; is there a way to avoid this?
23:24 tromp joined
23:26 <dolio> EvanR: That talk was pretty awesome.
23:27 <dolio> As an IEEE754 hater, at least.
23:27 pasukon joined
23:29 refold joined
23:29 EvanR_ joined
23:29 <EvanR_> i am somewhat more convinced now that the unum guy is not a crackpot
23:30 sssilver joined
23:31 <monochrom> err, s/GADTs/existential/
23:31 MrJazz_ joined
23:32 <monochrom> buttons840: Put it in a file, and :r that file.
23:32 dhil joined
23:32 dan_f joined
23:33 <dolio> There are non-typechecking reasons.
23:33 fcpga_te joined
23:34 mdarse joined
23:34 prohobo joined
23:35 prohobo left
23:35 ramzifu joined
23:36 lep-delete joined
23:39 fcpga_te joined
23:40 doomlord joined
23:41 `Guest05 joined
23:41 Lord_of_Life joined
23:46 alx741 joined
23:46 twanvl joined
23:49 ishmael joined
23:50 <ishmael> is myFunction :: a -> b an expression? or what is it?
23:50 <haasn> I have a function :: Double -> Double. What's the easiest/quickest way to visualize it, over a given input range?
23:50 <haasn> e.g. plot :: Double -> Double -> (Double -> Double) -> IO ()
23:51 <`Guest05> it's impossible to make a value `cast`able to two types right?
23:51 <haasn> I don't want to concern myself with setting up axes
23:51 <jle`> ishmael: depends on the context
23:51 <EvanR> cast ?
23:51 <jle`> ishmael: but at the top level, it's a type signature
23:51 ali_bush joined
23:51 ali_bush joined
23:51 <jle`> if it'as associated with a definition of 'myFunction', then it's a type signature
23:52 <haasn> ah https://hackage.haskell.org/package/easyplot-1.0/docs/Graphics-EasyPlot.html seems like my best bet
23:52 <jle`> but the same syntax also shows up in usage as an expression
23:52 <buttons840> I have a question about parsing with Trifecta -- if I have two parsers, p1 and p2, is "try (p1 <|> p2)" equivalent to "(try p1) <|> (try p2)" ?
23:52 <ishmael> jle`: im trying to understand that line of code in the context of a purely functional language
23:52 <ishmael> and i mean it as a type signature
23:52 <jle`> ishmael: it can show up as an expression too
23:52 <`Guest05> e. g. cast x :: Maybe A === Just something1 and cast x :: Maybe B === Just something2
23:52 <jle`> oh, ok
23:52 ExcelTronic joined
23:52 <jle`> ishmael: in that case, yes, it's a part of declaration syntax
23:53 <jle`> i'm assuming you don't mean something like (succ :: Int -> Int) 10
23:53 <geekosaur> ishmael: it's a type assertion. attached to a definition, it asserts the type of that definition; attached to an expression, it asserts that the expression must have that type
23:53 <jle`> where (succ :: Int -> Int) is an expression, 'succ' with a type annotation
23:53 <EvanR> `Guest05: what is the type of cast
23:53 <jle`> buttons840: i don't think it is
23:53 <jle`> i'm pretty sure it's not
23:53 <jle`> depending on p1 and p2
23:53 <geekosaur> (asserting the type of an expression may affect typeclass resolution, leading to an effect similar to "casting"; but it is not, itself, a cast)
23:53 systemfault joined
23:54 <`Guest05> haasn: plot a b f = print $ f <$> [a,a+0.05..b]
23:54 <jle`> ishmael: in the context of a purely functional language, your program might simply be a bunch of (immutable) definitions/declarations
23:54 <buttons840> jle`: i think you are right, because i have experienced them behaving differently, but I'm not sure I understand why?
23:54 <jle`> ishmael: a type signature like that is a part of the syntax for defining/declaring somything
23:54 <jle`> it describes the declaration
23:54 mmachenry joined
23:55 <jle`> ishmael: similar to saying sin : R -> R; sin(x) = x - x^3/3! + x^5/5! + ...
23:55 <jle`> buttons840: 'p1 <|> p2' will try p2 if p1 fails, but it'll start parsing from when p1 left off
23:55 raichoo joined
23:55 <dolio> No, that is not what happens.
23:56 <jle`> aw
23:56 <buttons840> jle`: oh, good to know
23:56 <`Guest05> haasn: or if you need to make it *visual*, plot f = print $ (/ 0.05) . (+ 1) . f <$> [-1,-0.95..1]
23:56 <buttons840> jle`: i figured "choose [p1, p2]" was the same as "p1 <|> p2", but it sounds like that's not the case?
23:57 <ishmael> jle`: ah, i see, so it's not really an expression on its own when it's part of a type signature, but it's part of the definition of the function
23:57 <dolio> try allows backtracking arbitrarily far.
23:57 <jle`> if p1 consumes input and then fails after consuming stuff, the, for p1 <|> p2, trifecta will start "running" p2 on the input that's already consumed
23:57 <ishmael> and the definition of the function is a function, right? one that returns the fuction?
23:57 <`Guest05> haasn: correction, plotVisual f = print $ (`replicate` '*') . truncate . (/ 0.05) . (+ 1) . f <$> [-1,-0.95..1]
23:57 <dolio> So, `try (p1 <|> p2)` is not able to do as much p1 backtracking as `(try p1) <|> (try p2)`.
23:58 <jle`> buttons840: choose [p1, p2] should be the same as p1 <|> p2, but i'm not 100% sure i remember the exact definition of choose
23:58 <jle`> but asum [p1,p2] is indeed p1 <|> p2
23:58 <haasn> `Guest05: it's alright, I already found my solution
23:58 <haasn> and I need this as a PNG for a blog post :)
23:58 <haasn> visual means visual
23:58 <jle`> ishmael: yes, it's a part of the syntax of defining something
23:59 <ishmael> jle`: and the definition is a function which returns itself?
23:59 <jle`> definition is not a function
23:59 <jle`> at least not in Haskell
23:59 <buttons840> choose = asum if I remember -- i'm not supper familiar with asum though
23:59 <jle`> it might be considered a function in a homoiconic language like lisp?
23:59 zv joined