<    April 2017    >
Su Mo Tu We Th Fr Sa  
 2  3  4  5  6  7  8  
 9 10 11 12 13 14 15  
16 17 18 19 20 21 22  
23 24 25 26 27 28 29  
00:00 mjz19910 joined
00:00 <Tuplanolla> :t fetch -- Would you like it if everything looked like this, hpc?
00:00 <lambdabot> (Checked 'EPERM a, Checked 'EPROTO a, Checked 'EOPNOTSUPP a, Checked 'ENOTSOCK a, Checked 'ENOMEM a, Checked 'ENOBUFS a, Checked 'ENFILE a, Checked 'EMFILE a, Checked 'EINVAL a, Checked 'EINTR a,
00:00 <lambdabot> Checked 'EFAULT a, Checked 'ECONNABORTED a, Checked 'EBADF a, Checked 'EAGAIN a, Checked 'EWOULDBLOCK a) => String -> a
00:00 <* monochrom> jaw-drops
00:01 <monochrom> Oh haha I see what you did there.
00:01 orhan89 joined
00:01 orhan89_ joined
00:01 revprez_atlanta joined
00:01 <monochrom> Exception is approximately the only case I would like a subtype/subclass system. :)
00:01 <Tuplanolla> Oh, the kernel changed its implementation! We need to add `Checked 'EINVAL a` to it now.
00:02 <monochrom> No wait, a co-row polymorphism system is better.
00:02 <hpc> heh
00:02 anuxivm left
00:04 <monochrom> Idris's version would be a bit nicer, (Checked [EPERM, EPROTO, ...] a) => String -> a, or something like that.
00:04 systemfault joined
00:04 <monochrom> The gist being a type-level list so you only need an n-length list rather than n Checked clauses.
00:05 <Axman6> you can do that in Haskell too
00:05 <ij> Should "fromException (SomeException ThreadKilled) :: Maybe SomeException" work?
00:06 <monochrom> No. I can encoding that in Haskell.
00:06 Cale joined
00:06 <monochrom> @type fromException
00:06 <lambdabot> Exception e => SomeException -> Maybe e
00:06 <monochrom> Yes.
00:07 <monochrom> Err, no.
00:07 <ij> errr, «:: Maybe AsyncException». It returns "Nothing"
00:07 <ij> And the «show … :: Maybe SomeException» returns «Just thread killed».
00:07 <monochrom> You want fromException (SomeException ThreadKilled) :: Maybe AsyncException
00:08 <ij> This is what happens: http://sprunge.us/PPKX
00:08 <monochrom> But you want neither. Just let "try" and "tryJust" do it, will ya?
00:08 <ij> But I want all except ThreadKilled.
00:09 <monochrom> Then use Maybe AsyncException, then patch-match against Just ThreadKilled.
00:11 <ij> But there's nothing to pattern match against, as you see — it's Nothing in the case of Maybe AsyncException.
00:12 <ij> > (\(ThreadKilled) -> 1) <$> (fromException (SomeException ThreadKilled) :: Maybe AsyncException)
00:12 <lambdabot> Nothing
00:12 <* ij> squints. Is that pattern matching?
00:12 <ij> Yeah, should be.
00:14 afarmer joined
00:16 <monochrom> That's odd.
00:16 codesoup joined
00:16 orhan89 joined
00:16 orhan89_ joined
00:16 <ij> I should really get some sleep. Tomorrow's the first work day after easter.
00:17 <ij> I've a bouncer, so I'll receive anything if you happen to stumble upon anything. Night night.
00:17 <sveit> sorry to bump, but maybe i can be more specific. Does a list work well as a FIFO queue, with push queue e = queue ++ [e]; since (++) is lazy if i only ever pop from the list it shouldn't do the O(n) append, right? so in this sense push would be O(1), as would pop?
00:18 nicknovitski joined
00:18 <geekosaur> sveit, FIFO? no, it must traverse the list. you do not have a direct pointer to the end, so even if the push is lazy the pop will force both the push and the pop
00:19 <geekosaur> if you want to use a list as FIFO, use (:)
00:19 dylukes joined
00:20 <sveit> sorry, i'm a bit confused. if i have push queue e = queue ++ [e], and pop = head, this is a FIFO queue, right?
00:20 robertkennedy joined
00:21 <geekosaur> no, that's LIFO because anything you push onto the end will only be accessed after the stuff in front of it
00:21 benl23 joined
00:21 <geekosaur> your "push" is [a,b,c,d,e] ++ [f], your "pop" is a : [b,c,d,e]
00:21 <geekosaur> er
00:21 <geekosaur> your "push" is [a,b,c,d,e] ++ [f], your "pop" is a : [b,c,d,e,f]
00:21 abel-abel joined
00:22 <geekosaur> oh wait I am confused now :/
00:22 <geekosaur> no, I think you're right, fifo feeds through like that
00:22 <geekosaur> my nap ws clearly a failure :/
00:22 <sveit> i think you're confused about what fifo means :)
00:22 <kadoban> That should be a FIFO, but it's not a very performant one, is it?
00:22 <geekosaur> yes, I had to stop and think. now I hgave to see what I can do about my head
00:23 <sveit> geekosaur: thanks for the help anyway :)
00:23 <geekosaur> well, with laziness it's a bunch of thunks that get forced eventually, it's not as bad as a strict one would be but it's not as good as it could be
00:23 <geekosaur> anyway having rethought you are correct but it's not as simple as you are suggesting
00:24 <geekosaur> but I should not try to work out the actual asymptotics until I figure out wha;s up with my brain tonight :/
00:24 <sveit> why is it not as simple as I am suggeting?
00:25 Wuzzy3 joined
00:25 <geekosaur> because every append is a thunk that gets forced at pop time instead of happening at push time; you get to avoid traversal at the price of all pops taking a bit longer
00:25 <kadoban> If you have a list of length N, and you add to the back of it like you're suggesting, that one add requires \Theta(N) work, once you evaluate far enough to get to the end. Each addition to the end adds O(1) work for each thing you take from the front. Unless I'm massively confused somehow.
00:26 <geekosaur> ^ roughly that
00:26 <kadoban> So adding a bunch of stuff and then removing all of it should be \Theta(n^2)
00:27 kfish joined
00:27 <kadoban> (where "adding" and "removing" are using the queue operations)
00:29 <sveit> really? (x:xs) ++ ys = x : (xs ++ ys) and [] ++ ys = ys, so where is the extra work happening?
00:29 <sveit> suppose i have [a,b] and push e, then i have ([a,b] ++ [e])
00:29 <sveit> first pop takes O(1) work, right?
00:30 <sveit> second pop takes O(1) work too?
00:30 <sveit> so where does extra work come in?
00:30 <geekosaur> not at the level you are looking at
00:30 <geekosaur> because that level does not show thunks
00:30 <kadoban> sveit: The (x:xs) ++ ys = x : (xs ++ ys) thing happens for *every* thing in the original xs.
00:32 <Cale> sveit: It costs O(1) *additional* work per element of xs whenever you compute xs ++ ys. That is, getting the first element of xs ++ ys is O(1) + whatever the cost of getting the first element of xs was
00:32 <Cale> sveit: and you continue paying that cost all throughout the elements which belonged to xs
00:32 systemfault joined
00:32 <EvanR> sveit: it might help to work through the ++ expressions as they evaluate
00:33 <monochrom> ij: "SomeException ThreadKilled" is no longer a good test since base "fromException (toException ThreadKilled) :: Maybe AsyncException" works, and is a more realistic test. Regardless of what you believe, the only standard is working for an actually killed thread, as opposed to your own emulation of ThreadKilled.
00:33 <Cale> If you end up evaluating the whole list, you'll have expended a total of O(n) additional work for that (++), with n being the length of xs
00:33 richi235 joined
00:34 <EvanR> (([a] ++ [b]) ++ [c]) ++ [d] is what youre asking about, what kind of time performance you get
00:34 HoierM joined
00:34 <sveit> Cale: so you're saying if i process the whole list, by the end i'll have done O(n) extra work?
00:34 <EvanR> note if the parens were nested the other direction it would be efficient
00:34 <EvanR> but its not because youre using it as a queue
00:34 <kadoban> sveit: Purely Functional Data Structures has a few useful queues, by the way. And has one of the few descriptions of how to work through figuring out the costs of haskell expressions that ever made any sense to me
00:34 <EvanR> appending stuff incrementally
00:34 lambda-11235 joined
00:35 <EvanR> @src (++)
00:35 <lambdabot> [] ++ ys = ys
00:35 <lambdabot> (x:xs) ++ ys = x : (xs ++ ys)
00:35 <lambdabot> -- OR
00:35 <lambdabot> xs ++ ys = foldr (:) ys xs
00:35 plutoniix joined
00:35 <EvanR> the top one should help
00:35 orhan89 joined
00:35 orhan89_ joined
00:36 plutoniix joined
00:36 <Axman6> yeah Okasaki's O(1) append queue is pretty cool, spreading out the cost of doing a reverse over every append (been a while since I looked at it though and can't remember exactly how it works).
00:36 <sveit> EvanR: that's exactly why i'm confused. that suggests if i append then take head that's O(1), right?
00:36 ludat joined
00:37 <geekosaur> no, becuase it doesn;t do any of that strictly
00:37 <Axman6> I implemented it for use as a Queue behind the Par monad which allows interchangable schedulers, but it performed way worse than the one which was already there which just used lists IIRC
00:37 <geekosaur> every time you append an item you add a (_ : _) onto the had
00:37 <Cale> sveit: It's O(1), yes, for each time you use (++)
00:37 <geekosaur> every time you pop an item you have to traverse all of those
00:37 <geekosaur> for eveyrthing pushed since the last time you did a pop
00:37 <geekosaur> iirc
00:38 <Cale> sveit: So if you use (++) m times by building up a list in the wrong direction one element at a time, it will be O(m) to get the head of the list
00:38 <sveit> btw just for discussion's sake i'm familiar with the amortized queue, where you accumulate elements in reverse and then reverse your accumulating list when you run out of elements, i'm trying to understand this "dumber" queue in the presence of laziness
00:39 <Axman6> yeah it's O(n) where n is the number of (++) calls made before the inspection of the head of the list
00:39 <EvanR> before you can get even one thing out of (([a] ++ [b]) ++ [c]) ++ [d] you will have to do all the ++'s
00:39 <EvanR> because the first thing to evaluate is the last ++
00:39 <EvanR> its at the top of the expr
00:39 <Cale> Well, you have to do O(1) work for each of the (++)'s
00:39 <Cale> you don't have to do the entire O(n^2) amount of work
00:39 <EvanR> yes you have to do one step of the ++ algorithm to get the head of each result
00:40 <Cale> but, if you eventually work your way through the queue, you will end up doing quadratic work
00:40 richi235 joined
00:40 <EvanR> but you cant zip right to the very first (deepest) element a
00:40 <Axman6> and then the next head does O(m) work too
00:40 conal joined
00:40 <abel-abel> Hello, I think the function name `fromChunks` in Data.ByteString.Lazy module is not that proper. It takes a list a ByteString and return a lazy bytestring which is manipulated by chunks. maybe it should be called toChunks?
00:40 eacameron joined
00:40 ilyaigpetrov joined
00:40 <Axman6> abel-abel: why? it takes a list of chunks which form the lazy bytestring
00:40 <Cale> abel-abel: It takes a list of strict chunks and builds a lazy ByteString having those as its chunks
00:40 <Axman6> a lazy bytestring is made up of chunks
00:42 <Axman6> remember that a lazy bytestring is just a specialised list of strict byte strings, it's essentiially: data ByteString = Chunk Strict.ByteString ByteString | End
00:42 <sveit> ah, i think i am starting to understand, thanks very much! so if I only have O(1) appends of O(n) size lists then i still do O(n) work to process the whole thing, right?
00:42 vydd joined
00:42 <sveit> i know that's not my queue case, just checking that i understand
00:42 <EvanR> to process the whole thing its n^2
00:43 <EvanR> and you only have addressed time so far
00:43 <monochrom> Right, Ω(n) for just one item. Now multiply by another n for the whole list.
00:43 <Axman6> sveit: it's worth going through the exercise of evaluating an expression like ([a] ++ [b]) ++ [c]) ++ [d] by hand, one step at a time, and counting how mant times you have to perform a : ...
00:43 <EvanR> each time you append then pop, you will have to copy the whole list again
00:43 <EvanR> its really rather terrible
00:44 <monochrom> Much duplicate work.
00:44 <sveit> wait. (xs ++ xs) takes O(n^2) to traverse? if so i'm confused again
00:44 <EvanR> ((((([a] ++ [b]) ++ [c]) ++ ... es
00:44 <Cale> no
00:44 <EvanR> yes
00:45 <Cale> (xs ++ ys) takes O(length xs) more work than evaluating xs and ys on their own
00:45 eacameron joined
00:45 <EvanR> where evaluate means force the spine here
00:45 <abel-abel> Axman6, Cale yep, I'm just curious about that. Yes, I can think of the function in your way. Thank you!
00:45 <Cale> but if you keep appending to the end, you incur 1 + 2 + 3 + 4 + ... + n = (n^2 + n) / 2 additional steps
00:46 <Cale> which is O(n^2)
00:46 conal joined
00:46 <Cale> (appending one element at a time to the end of an initially empty list, until you've built up a list of length n)
00:47 jgt1 joined
00:48 <sveit> that i understand now. i was just checking that (xs ++ xs) still takes O(length xs) to compute. or xs ++ xs ++ xs, or any O(1) number of appends (for long xs), right? thanks for all the detailed responses btw!
00:48 <monochrom> Yes.
00:48 <Cale> Yeah
00:48 <Cale> xs ++ xs ++ xs will take 3 * length xs additional steps
00:49 <Cale> er, sorry, (xs ++ xs) ++ xs will
00:49 <Axman6> sveit: it's important to get the associativity correct though, ([a] ++ [b]) ++ [c] is quite different to [a] ++ ([b] ++ [c])
00:49 <Cale> (++) is defined to associate to the right, so it would only be 2 * length xs steps written that way
00:50 hybrid joined
00:50 <Cale> and ((xs ++ xs) ++ xs) ++ xs will take about (1 + 2 + 3) * length xs extra steps
00:50 orhan89 joined
00:50 orhan89_ joined
00:51 crobbins joined
00:52 <Cale> But if you associate it the other way, it will behave better
00:52 <Cale> xs ++ (xs ++ (xs ++ xs)) will only take about 3 * length xs steps
00:52 HoierM_ joined
00:52 safe joined
00:53 Krymise joined
00:53 <Cale> (I'm ignoring the steps at the end for matching the empty list)
00:53 <Cale> i.e. it's really length xs + 1, because [] ++ xs still takes a step to reduce
00:54 tathougies joined
00:54 Denommus joined
00:56 <sveit> thanks a lot! is Okasaki's book the canonical reference on reasoning about performance in Haskell, or are there other resources popele use?
00:59 biglambda joined
00:59 Stanley00 joined
00:59 <kadoban> If there are other good references, I'd definitely be interested in them, heh.
01:01 fakenerd joined
01:01 juhp joined
01:01 <Axman6> there are many aspects of performance which aren't covered in okasaki's book (it's relatively old and IIRC doesn't focus on any of the modern means of improving performance, avoiding laziness when it's not useful etc)
01:02 nighty-- joined
01:03 manjaro-kde5 joined
01:03 morphit joined
01:04 <kadoban> Sure. The part that I haven't seen well done elsewhere is just the basic computational model of evaluation in a non-strict setting
01:05 Guest63334 joined
01:09 <monochrom> Try my http://www.vex.net/~trebla/haskell/lazy.xhtml
01:09 orhan89 joined
01:09 orhan89_ joined
01:09 ebsen joined
01:10 <Axman6> I was searching for an interactive evaluator for haskell expressions but couldn't find one :(
01:10 Wuzzy3 joined
01:11 nicknovitski joined
01:11 <monochrom> There used to be one but all good things come to an end.
01:13 Spondyl joined
01:13 edmundsecho joined
01:13 <monochrom> Hrm, it lives again. http://bm380.user.srcf.net/cgi-bin/stepeval.cgi
01:15 watabou joined
01:17 Dunearhp__ joined
01:23 ebzzry joined
01:24 dylukes joined
01:24 soniku joined
01:25 orhan89 joined
01:25 orhan89_ joined
01:25 peterbec` joined
01:25 biglambda joined
01:27 Dunearhp_ joined
01:27 ubsan_ joined
01:30 Krymise joined
01:30 pera joined
01:31 Dunearhp___ joined
01:35 coltfred joined
01:38 mmalone joined
01:39 filterfish_ joined
01:40 <Axman6> "step _: Not implemented: List [Lit (Int 4)]" o.O
01:40 splanch joined
01:41 <Squarism> Anyone know how to get Network.Mail.SMTP work with SSL/TLS?
01:41 <Squarism> or should one use another package for that?
01:42 Supersonic112_ joined
01:42 {emptyset} joined
01:43 orhan89 joined
01:43 <Axman6> hmm, I thought I used something else to send email last time I needed to... thought it was written by Bos
01:43 orhan89_ joined
01:44 <Squarism> Axman6, oh ok
01:46 <Squarism> Axman6, HaskellNet?
01:48 <bsima> how do I crash a Haskell program? I'm loading a config file, and if it fails to parse, I want the program to crash
01:48 <bsima> like `throw` or something similar
01:48 <geekosaur> > error "oops"
01:48 <lambdabot> *Exception: oops
01:48 <Axman6> Squarism: I think I used https://hackage.haskell.org/package/mime-mail- which uses sendmail
01:49 ebsen joined
01:50 <Squarism> ah ok
01:50 chichou joined
01:53 jorj joined
01:54 <bsima> geekosaur: thx
01:55 <Axman6> it is generally a good idea to not crash like that if possible though, just exit if the config is incorrect
01:55 ExpHP joined
01:56 <bsima> right, I'm thinking thru how is best to do that with my code
01:56 <bsima> just wanted to get it working before I refactor tho :)
01:56 <geekosaur> often prefered is something like Either String MyConfig
01:56 <Axman6> return a Maybe or Either, then pattern match on that and if it's Nothing or Left, print an error and exit with a non-zero status code
01:56 <geekosaur> then it's Left "description of error" or Right theConfig
01:57 danthemyth joined
01:57 mac10688 joined
01:58 ddere joined
01:59 orhan89 joined
01:59 orhan89_ joined
01:59 Rodya_ joined
01:59 <bsima> ah yes, this is it http://hackage.haskell.org/package/base-
02:00 <bsima> the module I need
02:00 hucksy joined
02:00 <ExpHP> Is it possible to import qualified "at a distance"? Like, through a reexport?
02:00 <ExpHP> like, erm, hang on
02:01 <lpaste> ExpHP pasted “importing qualified "at a distance", he said” at http://lpaste.net/354698
02:02 <ChaiTRex> ExpHP: I don't think that works, since it would mess things up when the qualified names collide.
02:02 blender joined
02:02 <ExpHP> ChaiTRex collide with what?
02:03 <ChaiTRex> ExpHP: With other "at a distance" qualified names and local qualified names.
02:03 <ChaiTRex> ExpHP: It would be something of a mess.
02:03 <ExpHP> that's why I'm doing it in a prelude. you can only have one!
02:04 <ChaiTRex> ExpHP: The point of qualified names is to avoid name collisions.
02:04 <ExpHP> but okay yeah if people were doing it all over the place it could be bad >_>
02:05 <ExpHP> maybe the folks at ClassyPrelude ARE onto something
02:05 <bsima> what's the difference between importing "qualified" and using "as"
02:06 <ChaiTRex> bsima: With as, you can use the names unqualified or qualified (https://wiki.haskell.org/Import)
02:07 <bsima> I usually do `import Mod as Mod`
02:07 <geekosaur> 'qualified' means the name is only available qualified
02:07 <geekosaur> 'as' lets you specify what qualification to use, defaulting to the module name
02:07 <geekosaur> so 'import Foo (gunk) as Bar' lets you use gunk or Bar.gunk
02:07 <ExpHP> bsima: the way you are doing it, all the names are also being imported without the module name prefix
02:08 <geekosaur> sorry orderring there
02:08 <bsima> ohhhh
02:08 <geekosaur> import Foo as Bar (gunk)
02:08 <geekosaur> but import qualified Foo as Bar (gunk) only permits Bar.gunk
02:08 <bsima> okay I much prefer qualified, gotta go add that to my codebase
02:08 <sleblanc> bsima, as an example, type "import Data.Map" in your ghci interpreter and see what "lookup" now means
02:09 <ExpHP> (good thing nobody needs lookup)
02:09 <sleblanc> unless you import it qualified, GHCi will tell you the name "lookup" is ambiguous
02:09 <ExpHP> (...I mean, the one in prelude)
02:10 <bsima> yeah I get it now, thanks folks
02:12 pwnz0r joined
02:12 takle joined
02:12 <ExpHP> Hm, I was really hoping making a custom prelude would help cut down on my import lists, but it looks like I really can only cut down a small portion. There's too many things I need qualified...
02:13 <ExpHP> haskell's modules break my heart once again </3
02:14 <rotaerk> I often, unless feeling lazy, prefer to explicitly import every symbol I use
02:14 <sleblanc> ExpHP, would having something like "import MyPrelude.Map as Map" work?
02:14 <rotaerk> unless it's an extremely common thing
02:14 <rotaerk> import as, or explicitly list the things I'm importing from a given module
02:14 brynedwardz joined
02:14 <rotaerk> simply so that it's clear, when reading the code, where a given symbol came from
02:14 <ExpHP> sleblanc: Nope, I'm trying to cut down imports of Map, Set, ByteString, Text, and blah-de-blah all in one import
02:15 revprez_atlanta joined
02:16 <ExpHP> a prelude is able to import the data type names, but if I ever want to *use* one of them I gotta import something for the functions
02:16 <Cale> ExpHP: Yeah, for quite a long time, I've thought it would be nice if modules could re-export things qualified in particular ways.
02:17 orhan89 joined
02:17 orhan89_ joined
02:17 <ExpHP> rotaerk: I understand the benefits, but it seems like so much work and tedium. I suspect every other line I write needs a new function from somewhere
02:17 sleffy joined
02:18 <sleblanc> Are all types instances of the Eq class? Are there common types that do not have an instance for Eq?
02:18 <ExpHP> sleblanc: IO
02:18 <sleblanc> oh, sure
02:18 <sleblanc> duh
02:18 darjeeling_ joined
02:18 <Cale> Function types
02:19 <ExpHP> newtypes where somebody forgot to derive Eq
02:19 <Cale> heh
02:22 mjz19910 joined
02:23 flatmap13 joined
02:23 <bsima> Does anyone use Flow? https://hackage.haskell.org/package/flow
02:23 <Cale> no
02:23 robkennedy joined
02:24 <Cale> "Flow provides operators for writing more understandable Haskell." -- lies
02:24 juhp joined
02:24 <bsima> hm, I really like it
02:24 <ExpHP> 17 downloads in the last 30 days
02:24 <bsima> I had been defining my own operators like |> and <| for a while before I learned about Flow
02:25 Rodya_ joined
02:25 filterfish__ joined
02:25 <jmcarthur> I never understood this need some people have for function application to be flipped.
02:25 <ExpHP> I like how it accuses base of providing two function application operators, and then proceeds to define six
02:25 cdk joined
02:26 <Cale> jmcarthur: Yeah, it's terrible ;__;
02:26 <jmcarthur> Same for composition.
02:27 sleffy joined
02:27 watabou joined
02:28 raycoll joined
02:28 <thimoteus> "Read as 'compose backward'" pffft
02:29 <lyxia> (\v -> ...v ...) (some big argument) or let v = some big argument in ....v... in both cases v is separated from either its definition or it's usage
02:29 <jmcarthur> I don't understand it even with lenses. this & backward . style just doesn't feel right to me compared to (this . forward) style
02:29 Laney joined
02:29 <bsima> I like to think of the Flow operators as being onomatopoeic
02:29 <bsima> they kinda point in the direction that the data flow in the function composition
02:30 <lyxia> so flipping application doesn't have that inconvenient
02:30 <ExpHP> jmcarthur: I believe it can be summed up in one word: (Parenthephobia)
02:30 takle joined
02:30 <* ExpHP> goes to make sure that isn't actually a word
02:30 <bsima> well I do clojure for my day job..
02:30 <jmcarthur> ExpHP: We even have ($) for that! (But I don't much care for ($), either.)
02:30 adeohluwa joined
02:31 gcross_ joined
02:31 <lyxia> you still need brackets with $ applied to a lambda
02:31 <jmcarthur> The way I see it, if I can't express it with (.), I might as well just use parens.
02:32 <jmcarthur> Heh, I don't care much for lambdas either, but I definitely use them more often than I use ($).
02:32 jameseb joined
02:32 bartavelle joined
02:32 dpn` joined
02:32 <Cale> I never rely on the manner in which $ has been defined to be right-associative
02:32 <peddie> bsima: (.) is the same as in mathematics, f . g . h, which even schoolchildren learn :)
02:32 <jmcarthur> It's not clear to me why I would use ($) to immediately apply a lambda.
02:32 <Cale> Apart from that, I don't mind using it.
02:32 codesoup joined
02:33 <monochrom> Use both ($) and (&) in mixed style to elucidate data flow.
02:33 Vbitz joined
02:33 <Cale> jmcarthur: You would use $ to immediately apply some other function to a lambda which spans multiple lines
02:33 pita joined
02:33 <ski> .. in some ways, it would make more sense for function type arrow, and function abstraction, to be flipped
02:33 <jmcarthur> Cale: Right, but that some other function wouldn't be a lambda, which I think is what lyxia was talking about.
02:34 zgrepc joined
02:34 <jmcarthur> I would just make a let/where binding in that case.
02:34 <monochrom> "sin x < 5 where x is a parameter" <--- lambda flipped
02:34 <lyxia> yeah my point here isn't very good
02:34 <jmcarthur> ski: Bird style is kind of nice, indeed.
02:35 <monochrom> Well, I guess it is more seriously (sin x < 5 <- x/)
02:35 <Cale> sin x < 5 <- x/
02:35 <Cale> lol
02:35 <lyxia> but I think there is value in having the variable being just between its definition and its use site
02:35 <* ski> often writes in that way, in paper notes
02:35 <ski> monochrom,Cale : .. btdt :)
02:35 Lord_of_Life joined
02:35 <jmcarthur> I'd probably pass on reverse lambda, but reverse function type arrow is nice anyway.
02:35 <jmcarthur> Not sure I'd be able to get over the lambda.
02:36 <jmcarthur> Maybe I'd just remove lambdas, but then everybody would hate me.
02:36 manjaro-kde5 joined
02:36 GGMethos joined
02:36 dylukes joined
02:36 <monochrom> \o-> sin o < 5 <-o/ (Two persons waving at you, both pointing at an expression between them)
02:36 <Cale> lol, surroundfix lambda, as a compromise
02:36 <jmcarthur> Wow.
02:37 <iqubic> Why are we writinting lambdas backwards?
02:37 <ski> (or sometimes ⌜λ ⋯x⋯ ↤ x⌝)
02:37 flatmap13 joined
02:37 augur joined
02:37 <ski> monochrom : that's almost how you write an infix abstraction :)
02:37 eyen joined
02:37 <iqubic> Also, what's a surroundfix lambda?
02:38 <Cale> What monochrom did
02:38 <iqubic> Is that even valid in Haskell?
02:38 <ski> (.. obviously the type of `++' is `[a] -> [a] <- [a]')
02:38 <Cale> no
02:38 <monochrom> Haha I like that
02:38 <iqubic> Why are we talking about it then?
02:38 <jmcarthur> With surroundfix you could loosen the nesting rules so that you can terminate the scopes of variables out of order, like in adbmal.
02:38 <jmcarthur> Oh not out of order
02:38 <jmcarthur> That would be weird.
02:38 <iqubic> What's the point of surround fix?
02:38 <Cale> iqubic: It's hideous, and funny
02:39 <monochrom> What's the point of this line of interrogations?
02:39 <iqubic> Clearly the type of Max it (Num a) => a -> a <- a
02:39 <monochrom> But anyway adding types to the formal parameters is going to be an issue. \o::Double -> sin o < 5 <- Double::o/ ?
02:39 <Cale> Or is it a -> a <- a <= (Num a)
02:39 <Cale> ?
02:40 <iqubic> Cale, I'm not too sure.
02:40 <monochrom> "In Soviet Russia, Double types you"?
02:40 <iqubic> LOL
02:40 <ski> yes, a major problem is that the colon is horizontally symmetric
02:40 sellout- joined
02:40 <iqubic> In Soviet Russia Functions call you.
02:40 bobjason[m] joined
02:40 hakan[m] joined
02:40 jascot[m] joined
02:40 M-krsiehl joined
02:40 nick2000 joined
02:40 hendrik[m] joined
02:41 M-BostonEnginerd joined
02:41 TylerCecil[m] joined
02:41 travisr joined
02:41 rdesfo[m] joined
02:41 MatrixTraveler[m joined
02:41 <iqubic> I want someone to write a Language Extension for surround fix, and get it passed and made official.
02:42 <sellout-> Is there a derivative parsing library with the improvements from the 2016 paper?
02:42 <sleblanc> April's Fools 2018 ?
02:42 takle joined
02:42 <iqubic> sleblanc: Sure.
02:42 <ski> (`[a] -> [a] <- [a]' can be conceived of either as `[a] -> ([a] <- [a])' or as `([a] -> [a]) <- [a]', being associated with the two kinds of operator section)
02:42 e14 joined
02:42 my joined
02:42 <iqubic> ski, in that case it doesn't really matter, does it?
02:42 <monochrom> My thesis supervisor suggested this notation ⟨x| sin x < 5 |x⟩. The idea being the redundancy on the right reminds you whose the bound variable in case the expression is so long you forgot.
02:42 <ski> iqubic : exactly
02:43 <monochrom> And also symmetry I guess.
02:43 <jmcarthur> Cale: The nice thing about (f :: a <- b <- c) (c :: c) (b :: b) :: a is that the last type in the function type syntax is the type of the first argument, so they appear right next to each other.
02:43 vydd joined
02:43 <monochrom> I guess s/whose/who's/
02:43 <* monochrom> doesn't mix up you're-your but mixes up who's-whose
02:43 <sleblanc> monochrom, what's next? Having to type a function twice to make sure you understood the implementation?
02:43 <ski> jmcarthur : yes, and in `(..x.. <-| x/) v' the formal and the actual parameter occur next to each other
02:44 dan_f joined
02:44 <iqubic> Why are we discussing this stuff if it doesn't exist in Haskell proper?
02:44 <monochrom> Yes sleblanc, preferably the second time is a mirror image of the first time.
02:44 <jmcarthur> ski: Yeah, that does seem nice. I'm less familiar with it, is all.
02:44 <monochrom> I'm just kidding!
02:44 <sleblanc> monochrom, what if you can come up with a palindromic function?
02:44 <monochrom> Neato
02:44 dramforever joined
02:45 <iqubic> I want to see someone write a palindromic function in Haskell.
02:45 watabou joined
02:45 <sleblanc> x = x
02:45 <sleblanc> done
02:46 <Cale> jmcarthur: right
02:46 <iqubic> sleblanc: what is the type of that function?
02:46 <sleblanc> :t x = x
02:46 <lambdabot> error:
02:46 <lambdabot> parse error on input ‘=’
02:46 <lambdabot> Perhaps you need a 'let' in a 'do' block?
02:46 <sleblanc> let x = x
02:46 <sleblanc> :t x
02:46 <lambdabot> Expr
02:46 <sleblanc> @let x = x
02:46 <lambdabot> .L.hs:188:5: error:
02:46 <lambdabot> Ambiguous occurrence ‘x’
02:46 <lambdabot> It could refer to either ‘Debug.SimpleReflect.x’,
02:47 <glguy> Instead of generating lambdabot error messages you could write: "a -> b"
02:47 <sleblanc> :<
02:48 <sleblanc> my ghci says: x :: t
02:48 <glguy> Well, you said it was a function, so you probably meant a -> b!
02:48 robertkennedy joined
02:48 <geekosaur> :t let x = x in x
02:48 <lambdabot> t
02:49 takle joined
02:49 <glguy> See, ask lambdabot and get the wrong answer
02:49 jchia joined
02:49 zcourts joined
02:50 <bsima> what idiot called it functional programming and not "logic hacking"?
02:50 <jmcarthur> > x
02:50 roconnor joined
02:50 <lambdabot> x
02:50 <jmcarthur> sleblanc: ^^ there's your problem!
02:50 raycoll joined
02:51 <jmcarthur> > map f [a, b, c] -- sleblanc: it's for stuff like this
02:51 <lambdabot> error:
02:51 <lambdabot> • Ambiguous type variable ‘b0’ arising from a use of ‘show_M655573486729...
02:51 <lambdabot> prevents the constraint ‘(Show b0)’ from being solved.
02:51 <jmcarthur> bah
02:51 <ski> > map f [a,b,c] :: [Expr]
02:51 <lambdabot> [f a,f b,f c]
02:51 pavonia joined
02:51 <jmcarthur> ^^ sleblanc: like that, I mean
02:51 conal joined
02:51 hybrid joined
02:52 skeuomorf joined
02:52 <sleblanc> wow, cool feat
02:52 <sleblanc> > snd (a,b) :: [Expr]
02:52 <lambdabot> error:
02:52 <lambdabot> • Couldn't match expected type ‘[Expr]’ with actual type ‘Expr’
02:52 <lambdabot> • In the expression: snd (a, b) :: [Expr]
02:53 <sleblanc> > snd (a,b) :: Expr
02:53 <lambdabot> b
02:53 <ski> no type ascription needed there
02:53 ib1s joined
02:53 <monochrom> "logic hacking" would be Prolog and friends. But I'm OK with "equational hacking".
02:54 <jmcarthur> sleblanc: https://hackage.haskell.org/package/simple-reflect if you want to play with it in ghci
02:54 <centril> monochrom: agda ?
02:55 ian-mi joined
02:55 <* ski> . o O ( Twelf )
02:55 <centril> agda == constructive propositional logic in type system
02:55 Sgeo_ joined
02:55 <ski> more like s/propositional/predicate/
02:55 <monochrom> That is distinguished enough to warrant a more specific name, Curry-Howard hacking.
02:55 <centril> ski: right - but not classical predicate logic
02:56 <centril> because no LEM
02:56 Sgeo__ joined
02:56 boxofdeath joined
02:56 <ski> you did say "constructive"
02:56 <centril> ski: I did =)
02:56 <centril> monochrom: I approve (TM) of your rewording
02:56 <monochrom> \∩/
02:57 <ski>
02:57 meandi_2 joined
02:57 <centril> monochrom: i have no idea what \n/ means
02:57 exferenceBot joined
02:57 <centril> not even google seems to know =)
02:58 <monochrom> Extending two arms high in celebration. And ∩ is a robotic head.
02:58 Goplat joined
02:58 <ski> the intersection of division-from-the-left and division-from-the-right
02:58 <monochrom> Humans would write \o/
02:58 takle joined
02:58 <centril> monochrom: oh - I usually take \x/ where x is something to be: "whatever"
02:59 flatmap13 joined
02:59 blender joined
02:59 <monochrom> Ah then you will like my new-fangled bidirectional \o::Double -> sin o < 5 <- Double::o/ lambda notation.
02:59 <MarcelineVQ> \o̦̹̩̺͕̹̞͎̅ͬͧ̇ͤ̽̈́/
02:59 <monochrom> (If it confuses you, "whatever" is a good response :)
03:00 <centril> monochrom: COOL!
03:00 xcmw joined
03:01 <centril> do you guys have any sources / talks on how to teach FP/Haskell to kids? like < 16 years old, or even < 12 years old
03:02 <centril> when do they start with functions and equations in school, hmm... like when you're 14 years old ?
03:02 hexagoxel joined
03:03 <sleblanc> centril, some will have played with algorithms at a very young age. think basic and logo/turtle
03:03 <centril> sleblanc: was thinking of logo/turtle (did that in an advanced fp course...) , but it's not very FP
03:03 <monochrom> Equation is earlier, but if you also need function then yeah 14 sounds right +/-1.
03:03 <centril> monochrom: what country?
03:04 <jle`> :t (\o/)
03:04 <lambdabot> error: parse error on input ‘/’
03:04 <monochrom> I have Hong Kong in mind.
03:05 <benzrf> :t 3 \o/ 4
03:05 <mniip> 1492484361 [05:59:21] <monochrom> Ah then you will like my new-fangled bidirectional \o::Double -> sin o < 5 <- Double::o/ lambda notation.
03:05 <lambdabot> error: parse error on input ‘\’
03:05 <mniip> you're just reinventing APL
03:05 <benzrf> hm
03:05 <benzrf> mniip: lol
03:05 takle joined
03:06 <monochrom> Although! When I was 10 or before, I took my father's calculator and pressed the sqrt button. That would be my initiation to functions.
03:06 <monochrom> Plus! I kept pressing it until the iterates converged to 1.
03:07 blender joined
03:07 <monochrom> This shows that I was meant for functional programming with fixed points.
03:07 <ib1s> Can someone decrypt this code? -> 05f8e434e2952475a9b2d74bf31ec4e6e28f293fd6c0f8908ed3ddd43d56f85670b26bbdfc7ebb4895081d3ed6ea9b6a155a052c74643022c844c773dbfee473
03:07 <MarcelineVQ> it's 20
03:07 <centril> monochrom: well, you didn't define your own functions, so it doesnt count :P
03:08 <monochrom> Ah, I think at 14 I wrote my first program for the Casio FX-3600P calculator.
03:08 nicknovitski joined
03:08 <monochrom> But it's a toy program. The calculator allowed a program of 38 instructions only.
03:09 <monochrom> Also, very restrictive conditional-looping facility. (Basically, if R0>0 then goto beginning. Something like that.)
03:09 splanch joined
03:10 <monochrom> But! I did prove it correct before entering it.
03:10 <monochrom> (But only because I didn't own such a calculator. I had to wait until going to school so I could try my classmates's. So at home I wrote and proved it correct on paper first.)
03:11 <Cale> ib1s: Does that question have anything to do with Haskell?
03:12 <ib1s> Cale what bro?
03:12 <Cale> You're in #haskell
03:12 <Cale> This is a channel about the programming language Haskell.
03:12 felixsch_ joined
03:12 splanch_ joined
03:13 <ib1s> Cale sorry bro
03:13 <ib1s> Do you know any channel where I can solve this question?
03:13 <Cale> It's fine, I was just wondering, given that it came out of the blue :)
03:13 <centril> monochrom: so this is the best I found: http://pedagog.stockholm.se/Pedagog/1%20Nya%20sajten/I%20undervisningen/LGR11/3.5%20MATEMATIK.pdf
03:13 <centril> https://www.skolverket.se/laroplaner-amnen-och-kurser/grundskoleutbildning/grundskola/matematik/subject.htm?webtos=GR&tos=GR&subjectCode=GRGRMAT01#anchor3
03:13 <centril> (Swedish)
03:13 <glguy> Sorry, this isn't a directory, it's for discussing Haskell
03:14 splanch joined
03:14 angelds joined
03:15 <centril> monochrom: "Meaning of the variable concept and it's usage in algebraic expressions, formulae and equations" <-- year 7-9 - which is like when you are 15 (year 8)
03:15 <monochrom> Some bad omen with "problemlösning" so close to "problem losing" :)
03:16 <centril> monochrom: translation: "problem solving" ;)
03:17 <ski> monochrom : Casio PB-100F here, around age seven .. 544 bytes available for programs, iirc
03:18 <monochrom> It used BASIC, didn't it? I think I saw one.
03:18 <centril> ski: btw, is your nickname for SKI combinators or for sking ?
03:18 <Cale> ib1s: There's 54 distinct bytes in that 64 bytes, so it's unlikely to be a substitution cipher. My guess is that nobody's likely to be successful without more context.
03:18 <ski> a version of BASIC, yes. no nested conditionals
03:18 <Cale> > length . map head . group . sort . map (fst . head . readHex . take 2) . takeWhile (not . null) . iterate (drop 2) $ "05f8e434e2952475a9b2d74bf31ec4e6e28f293fd6c0f8908ed3ddd43d56f85670b26bbdfc7ebb4895081d3ed6ea9b6a155a052c74643022c844c773dbfee473"
03:18 <lambdabot> 54
03:19 <* geekosaur> remembers a Sharp BASIC-programmable calculator. Radio Shack used to sell a branded version (you could feel the Sharp logo under the R/S logo)
03:19 <monochrom> That would be Sharp PC-1500. I had one too.
03:19 <Cale> Apparently this is #haskell-and-ciphers-and-old-programmable-calculators
03:19 <Cale> lol
03:20 <centril> Cale: no... it was a question about teaching FP to schoolchildren which went offtopic about calculators ;)
03:20 <monochrom> Plus its plotter. That's right, four-colour ink pens bloody vector graphics plotter
03:20 ib1s left
03:20 <monochrom> (Only 3-inch wide paper roll or something. Not big.)
03:20 <ski> Cale : says "Illegal channel name", when i try to join ..
03:21 <* ski> remembers printer plotters
03:22 <monochrom> had a lot of fun plotting the sine wave 3 times in the name of "biorhythm". and polar coordinate graphs.
03:23 zcourts_ joined
03:23 <monochrom> Yes, wouldn't it be nice to run Haskell on it...
03:23 <centril> monochrom: maybe idris ?
03:24 <centril> (could actually potentially work since runtime is way smaller...)
03:24 <monochrom> No, would not be nice. But I know what's nice.
03:24 <monochrom> On a modern Haskell-capable computer, run a cross-compiler that compiles Haskell to PC-1500 machine code.
03:25 <monochrom> Now here is the hilarious part. You wouldn't believe it.
03:25 <monochrom> Modulate that binary file to an audio WAV file such that the audio sound is right for the cassette interface for PC-1500.
03:26 Rodya_ joined
03:26 <monochrom> Play that audio to that cassette interface. Tell PC-1500 to load it.
03:26 peterbec` joined
03:27 takle joined
03:28 otto_s joined
03:29 angelds joined
03:33 <* ski> . o O ( <http://wav-prg.sourceforge.net/index.html> )
03:33 mizu_no_oto joined
03:35 <* geekosaur> suddenly wishes he still had the SuperBoard II around to play with that >.>
03:35 benl23 joined
03:37 <lordcirth> https://www.youtube.com/watch?v=uNjxe8ShM-8
03:37 <lordcirth> Turing-complete Powerpoint^
03:38 <monochrom> oh haha. But isn't it just because Visual BASIC?
03:38 <pacak> monochrom: Nope. It uses powerpoint animations only.
03:39 <monochrom> Yikes. That's neat.
03:39 <iqubic> What is this madness?
03:40 <monochrom> A system and method for running Haskell programs in Powerpoint.
03:40 <iqubic> HOW DOES THAT WORK??
03:42 takle joined
03:42 fakenerd joined
03:44 <iqubic> On a related note, can I write a Lisp parser in Haskell?
03:44 <iqubic> How hard would that be actually?
03:45 <Maxdamantus> I imagine there are multiple tutorials that involve writing a Lisp implementation in Haskell, including a parser.
03:45 <iqubic> What I want is an interactive Lisp Parser.
03:46 gigamonkey joined
03:46 <iqubic> So something like: main = forever $ interact parseLisp
03:46 <iqubic> :t forever
03:46 <lambdabot> Applicative f => f a -> f b
03:47 <iqubic> Why does forever have a type constraint of applicative? and does my skeleton of a program work?
03:47 mjora7 joined
03:47 <iqubic> :t interact
03:47 <lambdabot> (String -> String) -> IO ()
03:47 <jle`> iqubic: forever act = act *> forever act
03:47 <iqubic> :t act
03:47 <lambdabot> error:
03:47 <lambdabot> • Variable not in scope: act
03:47 <lambdabot> • Perhaps you meant one of these:
03:47 <jle`> that's a variable binding
03:47 <iqubic> Ah I see.
03:47 <jle`> forever x = x *> forever x
03:48 xcmw joined
03:48 <gigamonkey> I just wrote this function which I feel like must be a standard thing somewhere but Hoogle on the type isn't helping me:
03:48 <gigamonkey> finish fn x = if x' == x then x' else finish fn x' where x' = fn x
03:48 <iqubic> > interact $ print "hello\n"
03:48 <lambdabot> error:
03:48 <lambdabot> • Couldn't match expected type ‘String -> String’
03:48 <lambdabot> with actual type ‘IO ()’
03:48 <iqubic> > forever $ interact print "hello\n"
03:48 <lambdabot> error:
03:48 <lambdabot> • Couldn't match expected type ‘[Char] -> f a0’
03:48 <lambdabot> with actual type ‘IO ()’
03:49 <glguy> You can play with lambdabot in /msg
03:49 filterfish_ joined
03:49 takle joined
03:49 <iqubic> How do I message lambdabot?
03:49 <iqubic> I can't seem to get that to work well at all.
03:50 <glguy> iqubic: Type: /query lambdabot
03:51 filterfish__ joined
03:51 <centril> https://www.reddit.com/r/haskell/comments/j8ac0/haskell_for_kids_introduction_to_my_upcoming_class/
03:51 <iqubic> Wy doesn't lambdabot like this:
03:51 <iqubic> > forever $ interact id
03:51 <lambdabot> error:
03:51 <lambdabot> • No instance for (Typeable b0)
03:51 <lambdabot> arising from a use of ‘show_M331268573624747036026026’
03:52 <centril> haskell is the first programming course taught to Computer Engineering students at Chalmers University of Technology
03:52 <centril> mostly because no-one has used it before, so everyone starts at an equal footing
03:52 <glguy> iqubic: because it doesn't know what type your expression has
03:52 <iqubic> Why not?
03:53 <glguy> because it's ambiguous, there are multiple types it could have
03:53 <iqubic> What types could that have??
03:53 <glguy> :t forever $ interact id
03:53 <lambdabot> IO b
03:53 <pavonia> :t interact
03:53 <lambdabot> (String -> String) -> IO ()
03:53 <iqubic> Why is it IO b?
03:53 <iqubic> :t forever
03:53 <lambdabot> Applicative f => f a -> f b
03:54 <jle`> it's IO anything
03:54 splanch joined
03:54 <jle`> the result can be of any type
03:54 <jle`> IO Int, IO Bool, IO Void, etc.
03:54 <iqubic> No it can't. It has to be IO ()
03:54 <jle`> how come
03:54 <jle`> look at the type of forever...the result 'f b' isn't related to the input 'f a'
03:55 <jle`> forever :: IO () -> IO Void is valid
03:55 <iqubic> :t forever
03:55 <lambdabot> Applicative f => f a -> f b
03:55 <iqubic> Oh, I see.
03:55 <jle`> it's not f a -> f a
03:55 <iqubic> So how do I fix my little interact forever program?
03:55 infinity0_ joined
03:55 infinity0_ joined
03:55 <glguy> iqubic: interact already goes forever
03:55 <jle`> help GHC figure out what type you want
03:55 <glguy> You don't need to forever it
03:56 <iqubic> Wait, interact already goes forever?
03:56 <iqubic> > interact id
03:56 <lambdabot> <IO ()>
03:56 <jle`> interact f = forever (putStrLn . f =<< getLine)
03:56 <iqubic> What is lambdabot doing there?
03:56 <glguy> It's printing the type for you
03:56 a3Dman joined
03:56 <glguy> It's certainly not going to run 'interact id' for you
03:56 <jle`> iqubic: <IO ()> is ther esult of "show"-ing 'interact id'
03:56 <jle`> since remember what > does
03:56 <jle`> it takes an expression and evaluates it and prints out the result
03:57 <jle`> it shows the result of an evaluation
03:57 <ski> @help run
03:57 <lambdabot> run <expr>. You have Haskell, 3 seconds and no IO. Go nuts!
03:57 <iqubic> Oh. It doesn't actually run the command?
03:57 <jle`> and 'interact id' evaluates to an IO (), and 'showing' it in lambdabot gives you "<IO ()>"
03:57 <jle`> iqubic: it has never run any commands
03:57 conal joined
03:57 <jle`> it only evaluates things
03:57 <jle`> just like every other time you've used it :)
03:57 <iqubic> Right.
03:57 <iqubic> Looks like it has no IO either.
03:57 takle joined
03:57 <jle`> and interact id evaluates to something that lambdabot 'shows' as the string "<IO ()>"
03:58 <iqubic> I see.
03:58 <jle`> > show (interact id)
03:58 <lambdabot> "<IO ()>"
03:58 infinity0 joined
03:58 <iqubic> I see.
03:58 Sh4rPEYE joined
03:58 splanch joined
03:59 ebzzry joined
03:59 biglambda joined
03:59 <iqubic> Is there a way to stop a program written with interact?
03:59 <iqubic> Other than ^C?
04:01 infinity0 joined
04:01 ridho joined
04:02 <Cale> Ctrl-D
04:02 <Cale> Closing stdin will generally do it
04:03 <pacak> iqubic: The same way you close vim - reboot your computer.
04:03 <iqubic> Is there a way to modify interact so that an input of "quit" case insensitive will end the program.
04:03 <iqubic> ???
04:03 infinity0 joined
04:03 <iqubic> pacak: :wq
04:04 <pavonia> jle`: Where did you take that definition of interact from? The definition in System.IO is different
04:05 <pavonia> @src interact
04:05 <lambdabot> interact f = do s <- getContents; putStr (f s)
04:05 <Cale> ^^ that's the correct definition
04:05 <iqubic> Cale: That's not an infinite list.
04:05 <Cale> What's not an infinite list?
04:06 <iqubic> What I meant is: interact is not an infinit loop
04:06 <Axman6> ?
04:06 <Cale> getContents is magic
04:06 <Cale> It lazily obtains all of stdin
04:06 infinity0 joined
04:06 <Axman6> interact is an infinite loop if you never close stdin
04:06 eklavya joined
04:06 <iqubic> @src getContents
04:06 <lambdabot> getContents = hGetContents stdin
04:06 <iqubic> That's confusing.
04:07 <iqubic> @src hGetContents
04:07 <lambdabot> Source not found. You type like i drive.
04:07 <Cale> The s that you get from getContents is a magical string such that attempting to evaluate a character from that string will read a character from stdin.
04:07 <Cale> At the same time it gives that string to you, it semi-closes stdin, so that nothing else can read from it.
04:08 <pavonia> Are "forever getLine" and "getContents" semantically equivalent?
04:08 <glguy> Sure, you can quit interact early, just stop producing output
04:08 <Cale> no
04:08 <glguy> interact (unwords . takeWhile (/= "quit") . words)
04:09 <Cale> yes
04:09 <Cale> That's the difference
04:09 <glguy> forever getLine won't stop getting lines, and it doesn't let you do anything with the lines you've got
04:09 <iqubic> glguy: What is that program doing?
04:09 infinity0 joined
04:09 <Cale> iqubic: try it
04:09 xtreak joined
04:10 soniku joined
04:10 fakenerd joined
04:10 <iqubic> Alright, ghci doesn't like the interact function.
04:11 <iqubic> Are atleast it dislikes glguy's function
04:11 <c_wraith> interact wants to own stdin and stdout
04:11 <c_wraith> which doesn't play nicely with running inside ghci
04:11 <iqubic> So I should not try it in ghci?
04:11 takle joined
04:12 <c_wraith> yeah, it's not reliable
04:12 <Cale> You might also want to check the buffering mode -- it'll behave rather differently with line buffering vs. no buffering
04:13 <mjora7> Hey, can I ask what type of projects you guys using Haskell to do?
04:13 <iqubic> glguy: Your function is not compiling for me.
04:13 <iqubic> ./test.hs: line 1: syntax error near unexpected token `('
04:13 <iqubic> ./test.hs: line 1: `main = interact (unwords . takeWhile (/= "quit") . words)'
04:13 <Cale> mjora7: The company I work for builds web applications for various clients entirely in Haskell.
04:13 <iqubic> I literally only defined main. That's all I did.
04:14 fakenerd_ joined
04:14 <Maxdamantus> iqubic: sounds' like you're running the Haskell as bash.
04:14 <Maxdamantus> s/'//
04:14 <Cale> mjora7: For our frontends, we use GHCJS to compile for the web, and GHC's ARM support to compile for Android and iOS.
04:14 <Maxdamantus> try `ghc --make test.hs && ./test`
04:14 <MarcelineVQ> :t interact (unwords . takeWhile (/= "quit") . words)
04:14 <lambdabot> IO ()
04:15 <iqubic> Maxdamantus: What are you suggestion I do?
04:15 <mjora7> Cale: Can you elaborate a bit on what you do and why you guys use Haskell in particular? I'd love to see an example application if that's possible.
04:15 <geekosaur> iqubic, you have typed haskell code to a bash prompt, this does not work, bash is not haskell
04:15 <iqubic> Linking test is taking a while.
04:15 <Cale> mjora7: It's really quite nice to be able to share types and code between the frontend and backend of your web applications, and be able to start some refactoring on the backend, and have type errors filter through to the frontend code, and tell you everything that needs to be changed.
04:16 <iqubic> geekosaur: I put the code into a source file. I know that I did.
04:16 <Maxdamantus> iqubic: don't run it as bash (that's what will happen if you run `./test.hs` from bash where that file lacks a #!)
04:16 <iqubic> Ah.
04:16 <iqubic> How do I run haskell programs?
04:16 <glguy> o.O
04:16 <iqubic> Wait, it gave me a compiled version to run. I feel stupid
04:16 dan_f joined
04:16 <kadoban> For simple things, runhaskell works
04:17 <Cale> mjora7: Well, here's a talk by my boss explaining the library we use for frontend development and it explains a fair amount about why we like it https://www.youtube.com/watch?v=dOy7zIk3IUI
04:17 <kadoban> For more complicated, yeah either compile them yourself or stack's script interpreter thing or whatever.
04:17 darjeeling_ joined
04:17 <mjora7> Cale: Awesome, thanks for the info!
04:17 <iqubic> How the heck does glguy's interact thing work?
04:18 <Cale> mjora7: Basically the fact that the code is more maintainable and our productivity can be far higher than in basically anything else.
04:18 <athan> Would LinearTypes be useful for higher-order functions, maybe for resource {,de}allocation? Something like `\isRunOnce -> ...`
04:18 <Cale> mjora7: There are a lot of things which come together to make that be the case though.
04:20 biglambda joined
04:21 <athan> hmm... could you `case` match _only once_ on `x` in `(x :: a) o- ...`?
04:22 Xanather joined
04:23 arquebus joined
04:23 rblaze joined
04:28 Rodya_ joined
04:28 ninjazoete joined
04:28 peterbec` joined
04:30 tripped joined
04:30 terrorjack joined
04:32 thunderrd joined
04:33 zcourts joined
04:34 thunderrd joined
04:37 zcourts_ joined
04:37 takle joined
04:40 mjz19910 joined
04:40 dan_f joined
04:43 Destol joined
04:44 eklavya joined
04:44 sssilver joined
04:44 vydd joined
04:45 raycoll joined
04:45 mjz19910 joined
04:46 peterbecich joined
04:46 angelds joined
04:46 Jesin joined
04:49 Mutter joined
04:49 mjz19910 joined
04:52 connrs joined
04:54 splanch joined
04:56 Costar joined
04:56 Sh4rPEYE joined
04:56 zcourts joined
04:57 Durbley joined
04:57 mjz19910 joined
04:58 <Costar> hi all
04:58 zcourts__ joined
04:58 <pacak> o/
04:59 splanch joined
05:00 kody joined
05:02 xplat joined
05:03 splanch joined
05:06 dfeuer joined
05:06 Mutter joined
05:09 castlelore joined
05:09 castlelore joined
05:10 {emptyset} joined
05:11 soniku joined
05:15 frantelle joined
05:16 <frantelle> hey guys - new to haskell and currently trying to do something where I would typically do it in two for loops iterating over the entire list
05:17 <frantelle> basically I'm trying to compute how each element in a list effects every other element in the list
05:18 FjordPrefect joined
05:18 nuskin joined
05:20 <nuskin> so I don't repeat myself, did anything that (frantelle) said before come through?
05:20 <EvanR> frantelle: you can iterate through a list of pairs
05:20 <EvanR> where you have each pair of elements, or pairs where the elements arent the same
05:20 <EvanR> heres how to get one of those
05:20 zcourts joined
05:20 azahi joined
05:21 <EvanR> > let things = [1,2,3] in [(x,y) | x <- things, y <- things]
05:21 <lambdabot> [(1,1),(1,2),(1,3),(2,1),(2,2),(2,3),(3,1),(3,2),(3,3)]
05:21 <EvanR> > let things = [1,2,3] in [(x,y) | x <- things, y <- things, x /= y]
05:21 <lambdabot> [(1,2),(1,3),(2,1),(2,3),(3,1),(3,2)]
05:22 osa1 joined
05:22 augur joined
05:23 <EvanR> this strategy is efficient because of lazy evaluation
05:23 insitu joined
05:23 frantelle joined
05:23 vlatkoB joined
05:23 takle joined
05:23 <frantelle> sorry, internet dropped out
05:24 <* EvanR> facepalm
05:24 mbuf joined
05:24 <EvanR> > let things = [1,2,3] in [(x,y) | x <- things, y <- things, x /= y]
05:24 <lambdabot> [(1,2),(1,3),(2,1),(2,3),(3,1),(3,2)]
05:24 <EvanR> this strategy is efficient because of lazy evaluation
05:26 <frantelle> I see
05:26 blender joined
05:28 insitu_ joined
05:28 <frantelle> just thinking about it though, that doesn't really help with what I'm trying to do
05:28 Rodya_ joined
05:29 <frantelle> basically if I have [1,2,3,4] I want [myFunction(1 [1,2,3,4]), myFunction(2 [1,2,3,4]), ... ]
05:29 <frantelle> hence why I've been trying to use map
05:29 zcourts_ joined
05:29 <jle`> you mean myFunction 1 [1,2,3,4] ?
05:30 jhrcek joined
05:30 <frantelle> yes, sorry
05:30 <jle`> you can just map (\x -> myFunction x [1,2,3,4]) [1,2,3,4]
05:33 tnks joined
05:33 <frantelle> jle`: so that's just saying, let x individually take values from [1,2,3,4] and apply it to myFunction with the second argument of [1,2,3,4] ?
05:34 matt179 joined
05:34 <frantelle> and since the type of map is to return a list, it can't not be a list by the end of it
05:36 <pacak> > (*) <$> [1..4] <*> [1..4]
05:36 <Guest46> frantelle: i guess what you want is `fmap`
05:36 <lambdabot> [1,2,3,4,2,4,6,8,3,6,9,12,4,8,12,16]
05:36 <Guest46> > fmap (+2) [1, 2, 3]
05:36 <lambdabot> [3,4,5]
05:37 filterfish_ joined
05:37 <pacak> > ((*) <$>) . join (<*>) [1..4]
05:37 <lambdabot> error:
05:37 <lambdabot> • Couldn't match type ‘a1 -> a0’ with ‘[Integer]’
05:37 <lambdabot> Expected type: [Integer] -> a1 -> f a
05:37 <pacak> > ((*) <$>) . join (<*>) $ [1..4]
05:37 <lambdabot> error:
05:37 <lambdabot> • Couldn't match type ‘Integer’ with ‘Integer -> a’
05:37 <lambdabot> Expected type: [Integer] -> [Integer] -> [a]
05:37 <pacak> Hmmm...
05:37 <pacak> Dont do this anyway.
05:38 blender joined
05:41 <sssilver> studying Scheme using SICP... quite easy when you have decent knowledge of Haskell ^.^
05:41 <sssilver> but constantly feel like "I wish I just moved on to Haskell right now"
05:41 <jle`> frantelle: yes that's what it says
05:43 Gurkenglas joined
05:43 gigamonkey joined
05:46 <EvanR> sssilver: i learned scheme first using SICP, later on i found it much easier to learn haskell than it seemed like other people coming from e.g. python
05:47 <EvanR> it was essentially just a matter of learning how the type system worked
05:47 <EvanR> haskell + scheme, power couple
05:49 <sssilver> I guess scheme made sense in a world that didn't have Haskell, but now the world does have Haskell
05:49 <sssilver> so /shrug
05:49 <EvanR> pretty much </biased-as-hell>
05:50 ninjazoete joined
05:50 <sssilver> rofl
05:50 <EvanR> you could also say, ocaml makes sense in a world that didnt have haskell
05:51 <EvanR> etc
05:51 ThomasLocke joined
05:52 chichou joined
05:52 geekosaur joined
05:54 <EvanR> the etc = but we have haskell
05:54 ogrady joined
05:54 biglambda joined
05:55 mzf joined
05:55 thunderrd_ joined
05:56 danvet joined
05:56 <abel-abel> `catch` function is not in System.IO.Error module?
05:56 <EvanR> Control.Exception
05:56 <sssilver> EvanR well there are legitimate cases for some languages to exist. You can't render a billion vertices 60 times a second in a lazily evaluated abstract machine.
05:57 <EvanR> except you can
05:57 <* EvanR> digs up some ekmett shit
05:57 <abel-abel> EvanR, Thanks. It seems `http://learnyouahaskell.com/input-and-output#exceptions` is out of date?
05:57 <EvanR> https://github.com/ekmett/quine
05:57 <EvanR> abel-abel: i would not be surprised
05:58 <abel-abel> why?
05:58 MoALTz joined
05:58 <EvanR> learnyouahaskell is ancient
05:58 <abel-abel> I'm reading this book these days..
05:59 <abel-abel> any better recommendations?
05:59 <EvanR> i honestly dont know what the best freely available resource is
05:59 <sssilver> EvanR ehh that's a toy project
05:59 danthemyth joined
05:59 <EvanR> uhm
06:00 xtreak joined
06:00 <peddie> @where CIS194 -- abel-abel
06:00 <lambdabot> http://www.seas.upenn.edu/~cis194/spring13/
06:01 <EvanR> sssilver: that in no way has anything to do with "you cant render foo bar baz 60 times a second in a lazily evaluated language"
06:01 <sssilver> EvanR OK lazily evaluated language with a garbage collector
06:02 <EvanR> i saw a video of this but i dont thing its online
06:02 <abel-abel> peddie, Thank you! I'll check it out.
06:02 splanch joined
06:02 <EvanR> at a googlable location
06:02 <peddie> @where learnhaskell
06:02 <lambdabot> https://github.com/bitemyapp/learnhaskell
06:02 <peddie> abel-abel: ^
06:02 takle joined
06:02 mstruebing joined
06:02 <EvanR> sssilver: uhm...
06:02 <EvanR> something about quine has gone completely over your head ;)
06:02 <peddie> abel-abel: plenty of good free resources to learn haskell :)
06:03 <abel-abel> peddie, Thank you so much!
06:03 <peddie> abel-abel: good luck; I didn't make any of these, so thank the people that did!
06:03 freusque joined
06:04 insitu joined
06:04 DomPruss joined
06:08 connrs joined
06:08 hurkan joined
06:09 fakenerd joined
06:10 cobreadmonster joined
06:12 jer1 joined
06:13 ltielen joined
06:16 takuan joined
06:16 revprez_atlanta joined
06:17 fakenerd joined
06:20 raichoo joined
06:23 takle joined
06:23 ForgedPancake joined
06:24 <piyush-kurur> I have not found a satisfactory solution for this problem, I hope some one else though about it. Say I have a package foo
06:24 mszczygiel joined
06:24 <piyush-kurur> with the type Foo in it and there are some test cases for Foo in the tests directory of foo
06:25 <piyush-kurur> Now foo does not expose an Arbitrary instance for Foo (why should it) but uses an Arbirary instacne in the tests
06:25 quchen joined
06:25 balor joined
06:26 <piyush-kurur> Consider a situation where a package bar dependes on foo and wants to write some test cases for which invovles Foo. Is there any way to sneak in the instance from the test of foo
06:26 <peddie> piyush-kurur: it seems to me that you say "why should it [expose an Arbitrary instance]" and then immediately give a reason why it should expose one
06:27 <piyush-kurur> peddie: Exposing Arbitrary instace means depending on quick-check
06:27 <piyush-kurur> The author of foo might not want it for his non-developer users
06:27 <peddie> piyush-kurur: I agree that's a reason _not_ to :)
06:28 <peddie> piyush-kurur: you could hide it behind a cabal flag, but maybe someone else has a better idea
06:28 <piyush-kurur> for example UTCTime has no arbirary instance.
06:28 zeroed joined
06:29 <piyush-kurur> There is another thing that is also irritating about separate tests
06:29 Rodya_ joined
06:29 <piyush-kurur> Say I have a type Foo which is opaque for type safety reasons. However I might want to write an Arbirary instance for it in the test cases
06:30 peterbec` joined
06:30 <piyush-kurur> Which means I will have to expose an Internal module with all the constructors exposes and threaten my users to keep them from using it
06:31 <EvanR> its called Internal so they know not to use it normally
06:31 <glguy> having the Internal module is the way to go
06:31 <peddie> piyush-kurur: I don't know a better solution to this latter problem, but `.Internal` seems like a common thing to do which people understand
06:31 <glguy> packages that completely hide the constructors aren't worth using
06:31 <EvanR> not having it is a good way to piss off people who need to import it for some reason
06:32 <peddie> glguy: yeah, like that goddamn unordered-containers ;)
06:32 Mortomes|Work joined
06:32 <glguy> (obviously that's an exaggeration, but it's a serious issue)
06:32 <glguy> peddie: great example
06:33 <glguy> i had to fork that package because of that oversight
06:33 <peddie> glguy: did you need to write Arbitrary instances?
06:33 <peddie> (I'm still curious about piyush-kurur's first question)
06:34 <glguy> no, I needed an indexing operation it didn't provide
06:34 <peddie> I see
06:34 <EvanR> so this is the haskell version of monkey patching, fork the package ;)
06:35 <piyush-kurur> EvanR, glguy, peddie, some times the type Foo is really internal (not even supposed to be exported to the users) unfortunately it does not work
06:35 biglama joined
06:35 <piyush-kurur> It would be good if the test cases have access to the other-modules stanza of cabal
06:35 <glguy> that's whats the internal module is for
06:35 <EvanR> most haskell code is open source, you cant really hide its existence from people
06:35 <EvanR> you can only make it impossible for them to do their job
06:35 <EvanR> without forking
06:36 <piyush-kurur> EvanR: the idea is not hiding the type. It is just that you want better type safety
06:36 <EvanR> its perfectly safe
06:37 <cocreature> well, exposing the constructors is unsafe in the sense that now you don’t have control over all functions that produce values of that type and thereby can’t guarantee that specific invariants hold
06:37 <glguy> which is why it goes in the Internal module
06:37 <cocreature> yep
06:38 <EvanR> if someone imports the Internal module and messes around with it like a high voltage wire, its the same as if they forked it and messed around with it like a high voltage wire, only its a bigger pain in the ass
06:38 blender joined
06:38 <piyush-kurur> I am just saying if test suits can access the modules in other-modules then life would be easier
06:39 bvad joined
06:39 <piyush-kurur> currently test-suites are like external packages
06:39 sleffy joined
06:39 Dompruss joined
06:40 <peddie> piyush-kurur: seems like the answer is "there's no better solution right now, sorry"
06:40 <cocreature> cabal 2.0 has internal libs that are not exposed externally but can be accessed from test suites iirc
06:41 <piyush-kurur> cocreature: that looks interesting
06:41 <nshepperd> in the past I have used unsafeCoerce to pull out data from hidden constructors. because it seemed like less of a pain in the ass than forking the package >_>
06:41 <Dompruss> okay I have an odd question that will probably sound really simple/strange hopefully. So for one of my courses i'm supposed to "make sure to export the functions you implemented" does that just mean to import at the top of my .hs file?
06:41 takle joined
06:42 <Axman6> that means you write module MyModule (finctions, and, Types, you Want(To,Export)) where
06:42 <cocreature> piyush-kurur: here’s the corresponding changelog entry https://github.com/haskell/cabal/blob/master/Cabal/changelog#L8
06:43 <Axman6> so, if you want to make foo available from the module you've written called MyModule, you're write: module MyModule (foo) where ... <definitions of foo and other functions>
06:43 <geekosaur> note that the default if you have no export list is to export everything
06:44 <geekosaur> sometimes that's what you want, sometimes it isn't
06:44 laplacian joined
06:44 <geekosaur> also beware that if you export a type, you ant to export its data constructor(s) too: MyType(Constructor1, Constructor2) or MyType(..) to export all constructors
06:44 guiben joined
06:45 guiben joined
06:45 vydd joined
06:45 gigamonkey joined
06:46 <piyush-kurur> cocreature: there should also be a way to expose Arbirary instances for the test cases
06:46 <piyush-kurur> I was thinking whether it make sense to have two views of the package the normal view and the test view
06:47 <cocreature> piyush-kurur: that’s not how typeclasses work. you can’t make local instances (assuming you don’t use orphans)
06:47 <piyush-kurur> when bar depends on foo then the tests suits of bar should see the test view of foo
06:47 <* geekosaur> wonders if this is something backpack can help with...
06:47 <geekosaur> like have a Tests module and backpack foo to either include that module or not
06:48 <cocreature> but if you export a type you probably should export your Arbitrary instances as well. otherwise everyone that depends on your package needs to implement its own
06:48 <piyush-kurur> cocreature: An examples is UTCTime. I do not think it has an arbirary instance
06:50 jol joined
06:51 <piyush-kurur> So it looks like these irritating problems will exists with tests and no one really has any solution
06:53 Snircle joined
06:53 binaryplease joined
06:53 <piyush-kurur> till geekosaur figures out a way to handle it using backpack :-P
06:54 f32ff joined
06:55 <cocreature> piyush-kurur: alternatively use hedgehog which doesn’t rely on typeclasses and thereby avoids all those problems :)
06:56 ccomb joined
06:56 <nshepper1> Ideally there would be some magical solution that provides the instance when you import it, but only if quickcheck is also used
06:56 <biglambda> Is it easy to write a parser with parsec that replaces one occurance in a string with another?
06:57 <biglambda> I’m trying to fix a bug in cabal-macosx but I’ve never used this library before.
06:57 a3Dman joined
06:57 Denthir joined
06:57 <cocreature> biglambda: do you really need the capabilities of parsec? search-and-replace kind of tasks are usually easier using regex libraries
06:58 watabou joined
06:59 <biglambda> Yeah it’s just already using parsec so I wanted to see if there was a quick way to modify the parser.
07:00 <biglambda> Essentially the program reads the output from otool and copies the needed libraries into a mac-osx application bundle.
07:00 Sampuka joined
07:01 TheLemonMan joined
07:01 <nshepper1> A nice thing about lens is that the types are mostly type synonyms to common things, so you can provide lenses in your package without depending on lens
07:02 <biglambda> It looks like the command line tool it’s spawning is returning a path like @rpath/libcsfml-system.2.4.dylib and it needs to be /usr/local/lib/libcsfml-window.2.4.dylib
07:02 alfredo joined
07:02 edsko joined
07:02 mceier joined
07:02 takle joined
07:02 <biglambda> so I need to replace @rpath with /usr/local/lib/
07:03 <geekosaur> uh, why are you doing this?
07:04 <biglambda> https://github.com/danfran/cabal-macosx/blob/master/Distribution/MacOSX/Dependencies.hs#L153
07:04 <geekosaur> it's doing what building an app bundle is supposed to do
07:04 <biglambda> I need to build a mac app bundle that includes the SFML library.
07:04 dhil joined
07:05 <geekosaur> then you want @rpath and to copy those dylibs into the appropriate directory of the app bundle
07:05 <geekosaur> that's the *point* of app bundles
07:05 <biglambda> Yeah cabal-macosx is failing on the @rpath symbol
07:05 <biglambda> it’s expecting a vanilla path
07:05 Itkovian joined
07:07 detrumi joined
07:07 <geekosaur> hm. it should really be taught to process @rpath, then
07:08 iomonad joined
07:08 baldrick joined
07:08 afarmer joined
07:09 ventonegro joined
07:10 <biglambda> I see, maybe I need to find an option in the source command to just expand those out.
07:10 <geekosaur> which means using otool to dump the rpaths and then expanding @rpath by trying each rpath entry until it finds the library
07:10 <biglambda> Yeah, I need to figure out the otool options...
07:11 soniku joined
07:11 <geekosaur> otool -l and look for lines containing RPATH
07:12 laz joined
07:12 <geekosaur> http://stackoverflow.com/questions/12521802/print-rpath-of-executable-on-osx
07:13 <geekosaur> sorry, I have to dig on the web for this, my mac is sitting in a corner disconnected
07:14 fakenerd_ joined
07:15 edmundsecho joined
07:15 suppi joined
07:17 Hexxeh joined
07:17 vlatkoB joined
07:18 <biglambda> Yeah I put a little putStrLn in to see what otool was returning it’s here https://pastebin.com/b5ggyWSj
07:18 <geekosaur> oh, also note it needs to collect the LC_RPATH entries from the original executable as well
07:19 wlemuel joined
07:19 <biglambda> Sorry it’s this pass: https://pastebin.com/bXFUENaD
07:19 <geekosaur> and whatever libraries it traversed to find that dependency
07:21 aphorisme joined
07:21 <biglambda> This is a bit over my head. I basically was trying to see if SFML was going to work better than SDL for my needs so a “works on my computer” hack might suffice.
07:23 harfangk joined
07:26 bennofs joined
07:27 albertid joined
07:30 Rodya_ joined
07:31 peterbec` joined
07:32 LuckyRawApe joined
07:32 yoneda joined
07:35 connrs joined
07:35 thc202 joined
07:36 cyborg-one joined
07:40 filterfish joined
07:40 bollu joined
07:40 jgt1 joined
07:41 xtreak joined
07:41 Itkovian joined
07:45 gigamonkey joined
07:45 connrs joined
07:46 ali_bush joined
07:46 ebzzry joined
07:46 richi235 joined
07:48 eklavya joined
07:48 takle joined
07:48 xtreak joined
07:52 blender joined
07:53 mthek joined
07:55 slomo joined
07:56 xtreak joined
07:56 CurryWurst joined
07:57 yqt joined
07:57 soLucien joined
07:58 balor joined
08:00 bl0w3d_0ut joined
08:00 danthemyth joined
08:03 razi1 joined
08:03 Yuras joined
08:04 fotonzade joined
08:05 mfukar joined
08:08 baldrick joined
08:08 vydd joined
08:08 vydd joined
08:09 ventonegro joined
08:09 Gurkenglas joined
08:09 dc0de joined
08:09 infinity0 joined
08:13 fakenerd joined
08:14 mekeor joined
08:15 yellowj joined
08:15 <phz^revision> hey
08:15 <phz^revision> I’m having a very weird error with servant and DataKinds
08:16 <phz^revision> https://gist.github.com/phaazon/3343796d250b9fb6cc432fa33770a7b9
08:16 <phz^revision> any idea?
08:16 ragepandemic joined
08:17 <cocreature> phz^revision: have you enabled DataKinds?
08:17 <phz^revision> ye
08:17 <phz^revision> yes
08:17 <cocreature> also can you show us the full error?
08:17 <phz^revision> maybe the problem is that unit cannot be transformes to PlainText?
08:17 <phz^revision> cocreature: it’s the full error
08:17 <cocreature> no it isn’t. ghc will at least include line numbers and things like that
08:18 <cocreature> maybe try '['PlainText]
08:18 <phz^revision> that’s what I tried
08:19 <pavonia> Does that ' lift values or types? Because that module doesn't export a data constructor named PlainText
08:19 lep-delete joined
08:19 <phz^revision> it lifts ctors
08:19 Beetny joined
08:19 <phz^revision> pavonia: it does
08:20 <phz^revision> from Servant.API.ContentTypes
08:20 <cocreature> it doesn’t. it exports a type PlainText not a constructor
08:20 <cocreature> remove the '
08:20 <cocreature> and add it in front of []
08:20 <phz^revision> ah you’re right!
08:21 CurryWurst joined
08:21 coot joined
08:22 <phz^revision> cocreature: it works, thanks
08:22 <phz^revision> so there’s no instance for MimeUnrender * PlainText ()
08:22 <phz^revision> that’s weird
08:23 <cocreature> what would you use that instance for? just throwing away the mimetype doesn’t seem particularly useful
08:23 <phz^revision> cocreature: health checking in my case
08:23 <phz^revision> it’d be isomorphic to String and pure ""
08:24 <phz^revision> :)
08:24 <phz^revision> (empty body in the response)
08:25 <cocreature> just use the String or the Text instance?
08:25 zero_byte joined
08:25 <dysfun> what does ~ mean in a type signature?
08:26 <liste> dysfun: type equality
08:26 <dysfun> so a ~ Bool = a must be a bool?
08:26 brisbin_ joined
08:26 insitu joined
08:26 <liste> yes
08:26 <dysfun> okay. this is because you can't put concrete types in some places?
08:26 brennie joined
08:26 juhp joined
08:26 <cocreature> it’s also used internally for things like GADTs
08:26 brisbin_ joined
08:27 mattyw joined
08:27 <quchen> instance (a ~ String) => IsString (IO a) where fromString = putStrLn :-)
08:27 dhil joined
08:27 <quchen> main = "hello world"
08:27 Aruro joined
08:27 <dysfun> in particular http://hackage.haskell.org/package/megaparsec-5.2.0/docs/Text-Megaparsec.html#v:string-39- it is requiring the stream be of chars but it can't directly say so?
08:27 <dysfun> (without the ~)
08:28 Guest88_ joined
08:28 <liste> dysfun: it requires Token s to be Char
08:28 eklavya joined
08:28 brisbin_ joined
08:28 <liste> so yes
08:29 <dysfun> right, i thought so
08:29 <dysfun> http://hackage.haskell.org/package/megaparsec-5.2.0/docs/Text-Megaparsec-Prim.html#t:Token # here is where Token is defined
08:29 <liste> yes, it's the associated type of a type family
08:30 <dysfun> aha
08:30 Rodya_ joined
08:31 juhp joined
08:31 <dysfun> so i have been attempting to follow the directions at the top of http://hackage.haskell.org/package/megaparsec-5.2.0/docs/Text-Megaparsec.html in order to use megaparsec over a list (i learned yesterday parsec can do this, but my other parser is written in megaparsec)
08:31 zeroed joined
08:31 zeroed joined
08:32 <dysfun> so i copied the example they gave in the docs for 'token' and then removed the Char constraint and replaced it with some other type
08:32 peterbec` joined
08:33 <dysfun> but now the problem is that it wants a Token A -> Bool, not an A -> Bool which is what i have.
08:33 <dysfun> and i don't know how to do that
08:33 magneticduck joined
08:34 takle joined
08:35 inad922 joined
08:36 <dysfun> so how do i use this Token type to adapt my other function?
08:36 <phz^revision> hey, I’d like to be able to either return HTTP 200 or HTTP 202
08:36 <phz^revision> (in servant)
08:36 <phz^revision> I wonder how it works in terms of types
08:37 <phz^revision> :> Get '[PlainText] String
08:37 <phz^revision> :> (Get '[PlainText] String :<|> GetAccepted '[PlainText] String)
08:37 <phz^revision> something like that?
08:38 <opqdonut> I don't think the return codes are reflected in the types?
08:38 yogsototh joined
08:38 <phz^revision> they are
08:38 <phz^revision> https://hackage.haskell.org/package/servant-0.10/docs/src/Servant-API-Verbs.html#Get
08:39 <opqdonut> oh, indeed
08:39 <phz^revision> alpounet: get here! :D
08:39 <opqdonut> I don't think "Get '[PlainText] String :<|> GetAccepted '[PlainText] String" would work. You would need to define two handlers for that
08:39 <phz^revision> the return code depends upon an IO action
08:39 <opqdonut> instead of one that can return either
08:39 <phz^revision> ah
08:40 Iceland_jack joined
08:40 <phz^revision> well, two handlers pointing to the same endpoint?
08:40 sysecho joined
08:40 <phz^revision> "a" :> Get '[PlainText] String :<|> "a" :> GetAccepted '[PlainText] String
08:40 <phz^revision> seems weird
08:41 _sg joined
08:41 <phz^revision> so, is there a way to make a handler “skip” so that the next one is tested?
08:42 plutoniix joined
08:42 insitu joined
08:43 plutoniix joined
08:44 fizruk joined
08:45 eacameron joined
08:45 plutoniix joined
08:45 gigamonkey joined
08:46 oish joined
08:47 bjz joined
08:48 vaibhavsagar joined
08:49 benl23 joined
08:50 eacameron joined
08:51 Kreest__ joined
08:51 sphinxo joined
08:52 suppi joined
08:54 mitchty joined
08:55 insitu joined
08:55 eacameron joined
08:57 fakenerd joined
08:58 marr joined
08:59 redeemed joined
08:59 getost joined
08:59 Lokathor_ joined
09:00 <getost> Does anyone know where I can get 'Haskell Programming From First Principles' for free?
09:00 watabou joined
09:00 <dysfun> no
09:00 orhan89 joined
09:00 <frantelle> jle`: you still around?
09:01 Denthir joined
09:01 tv1 joined
09:01 <getost> Does anyone have a copy of haskellbook.com?
09:01 xall joined
09:01 <dysfun> this isn't a place to ask for warez
09:02 <getost> warez
09:02 zcourts joined
09:02 <getost> Where is ware?
09:02 <peddie> getost: if you really honestly can't afford the sticker price, try emailing the authors; I think they've given case-by-case discounts in the past
09:03 eacameron joined
09:03 fizruk joined
09:04 xtreak joined
09:04 tv joined
09:04 edmundsecho joined
09:05 splanch joined
09:05 fizruk joined
09:06 splanch_ joined
09:06 vikumar joined
09:11 Sampuka joined
09:13 xtreak joined
09:14 nick123__ joined
09:17 jaspervdj joined
09:18 filterfish joined
09:18 gigamonkey joined
09:18 cur8or joined
09:20 xall_ joined
09:21 mmn80 joined
09:23 mda1 joined
09:24 xtreak joined
09:28 bennofs joined
09:29 ph88 joined
09:30 eacameron joined
09:30 splanch joined
09:31 tazjin joined
09:31 Rodya_ joined
09:32 splanch_ joined
09:33 peterbec` joined
09:33 splanch__ joined
09:33 bollu joined
09:35 splanc___ joined
09:36 eacameron joined
09:37 zcourts joined
09:37 ventonegro joined
09:37 raycoll joined
09:37 yellowj joined
09:39 eacamero_ joined
09:39 hali joined
09:40 fiddlerwoaroof joined
09:41 <vikumar> hi there!
09:41 <vikumar> I'm new to Haskell (just managed to understand monads) and I was a bit confused about monad transformers
09:42 <vikumar> Could any one recommend a good resource?
09:42 sepp2k joined
09:42 <vikumar> The few things I've pulled up on google haven't really made sense to me.
09:42 kiltzman joined
09:43 kiltzman joined
09:45 kiltzman joined
09:45 gigamonkey joined
09:47 kiltzman joined
09:48 Guest88_ joined
09:48 kiltzman joined
09:49 kiltzman joined
09:49 cur8or joined
09:51 <vaibhavsagar> vikumar: #haskell-beginners is a good channel to join
09:51 <vikumar> sweet!
09:51 <vikumar> will ask the question there.
09:52 <vikumar> \join #haskell-beginners
09:52 <vaibhavsagar> ahahaha
09:52 eacameron joined
09:52 <vikumar> wrong window
09:52 <vikumar> woops
09:52 locallycompact joined
09:53 mda1 joined
09:53 chichou joined
09:54 oisdk joined
09:55 xtreak joined
09:56 eacameron joined
09:57 bjz joined
09:57 orhan89 joined
10:00 Spondyl joined
10:02 danthemyth joined
10:02 xtreak joined
10:02 oisdk joined
10:03 fakenerd_ joined
10:04 Icewing joined
10:04 kuribas joined
10:05 filterfish joined
10:05 netheranthem joined
10:06 bollu joined
10:06 tnks joined
10:06 splanch joined
10:06 oisdk joined
10:07 fakenerd joined
10:07 eklavya joined
10:07 fizruk joined
10:08 kritzcreek joined
10:09 eacameron joined
10:09 mathk joined
10:09 cheater joined
10:09 <mathk> @pl f n (g n)
10:09 <lambdabot> f n (g n)
10:09 sphinxo joined
10:09 orhan89 joined
10:10 <mathk> @pl f n n
10:10 <lambdabot> f n n
10:10 tomboy64 joined
10:10 MrLawrence joined
10:10 MrLawrence joined
10:11 <ski> @pointless \n -> f n (g n)
10:11 <lambdabot> ap f g
10:11 oisdk joined
10:12 <mathk> :)
10:13 govg joined
10:13 juhp joined
10:13 eacameron joined
10:13 fendor joined
10:13 Boomerang joined
10:14 <mathk> @pl \n -> f (g n) n
10:14 <lambdabot> f =<< g
10:16 AnonymousEnthusi joined
10:16 Kreest_ joined
10:18 jeauxlb joined
10:18 <jeauxlb> join #mutt
10:18 dcoutts_ joined
10:19 jeauxlb left
10:20 danthemyth joined
10:21 jeauxlb joined
10:21 danthemyth joined
10:23 mda1 joined
10:24 mthek joined
10:24 eacameron joined
10:25 zeroed joined
10:26 splanch joined
10:27 Aruro joined
10:27 jeauxlb left
10:28 biglambda joined
10:29 nighty-- joined
10:29 eacameron joined
10:30 splanch_ joined
10:31 bollu joined
10:32 cfricke joined
10:32 Rodya_ joined
10:32 ridho joined
10:33 coot joined
10:33 eacamero_ joined
10:33 mou joined
10:33 splanch joined
10:34 iHack13 left
10:37 ft3 joined
10:37 magthe joined
10:38 blender joined
10:39 ziocroc joined
10:42 eacameron joined
10:44 blender joined
10:44 etehtsea joined
10:47 BartAdv joined
10:47 grayjoc joined
10:47 biglambda joined
10:48 eacameron joined
10:50 blender joined
10:51 Kreest__ joined
10:52 spatial joined
10:54 edmundsecho joined
10:55 <spatial> lpaste.net/354703 should state be managed only like this ? What about returning this value from a function instead ?
10:55 eacameron joined
10:55 <cocreature> :t modify -- spatial: you might want to use that instead
10:55 <lambdabot> MonadState s m => (s -> s) -> m ()
10:56 <cocreature> at least for store
10:56 <cocreature> and maybe "gets" for the second function
10:57 <spatial> Didn'the get it.
10:57 <cocreature> @src modify
10:57 <lambdabot> Source not found. It can only be attributed to human error.
10:58 <cocreature> spatial: store x value = modify (Map.insert x value)
10:58 <cocreature> retrieve karmbandit = gets (Map.lookup karmbandit)
10:58 spatial_ joined
10:59 lexi-lambda joined
11:00 spatial__ joined
11:00 fakenerd_ joined
11:01 <spatial__> I didn't get that.
11:01 watabou joined
11:02 fakener__ joined
11:02 ilyaigpetrov joined
11:02 eacameron joined
11:03 ebzzry joined
11:03 Snircle joined
11:04 <spatial__> Using mobile as proxy stops orc.
11:07 eacamero_ joined
11:07 ragepandemic joined
11:07 tomboy64 joined
11:08 sdothum joined
11:12 Sampuka joined
11:12 fendor joined
11:13 eacameron joined
11:18 shivansh joined
11:18 tomboy64 joined
11:19 burtons joined
11:20 ccomb joined
11:20 soniku joined
11:22 roconnor joined
11:23 NyanPasu joined
11:23 biglambda joined
11:24 al-damiri joined
11:26 mekeor joined
11:26 eacameron joined
11:26 kiltzman joined
11:26 slomo joined
11:27 akfp joined
11:27 TCZ joined
11:27 xtreak joined
11:29 jer1 joined
11:29 seveg joined
11:29 bollu joined
11:31 burtons_ joined
11:31 kaeluka joined
11:33 Rodya_ joined
11:33 akfp joined
11:33 eacameron joined
11:35 peterbec` joined
11:37 baldrick joined
11:39 jer1 joined
11:40 rcat joined
11:41 eacameron joined
11:43 descender joined
11:47 fotonzade joined
11:47 raichoo joined
11:48 bvad joined
11:48 eacameron joined
11:48 asmyers joined
11:48 tlaxkit joined
11:50 m00n joined
11:52 AfC joined
11:53 acarrico joined
11:54 eklavya joined
11:55 joncfoo joined
11:56 <tibbe> Could someone help me with a type families + type class instance type error: http://lpaste.net/354706
11:56 <tibbe> Basically I have a Show-like class and when I write an instance: instance Pretty (Component l) => Pretty (WholeThing l) where
11:57 <tibbe> I get ambiguity on the `l`
11:57 Wizek_ joined
11:57 <tibbe> probably something about injective type families
11:58 splanch joined
11:58 <cocreature> tibbe: what’s the type of ppr?
11:59 danthemyth joined
11:59 splanch_ joined
11:59 <tibbe> cocreature, it's `a -> Doc` from http://hackage.haskell.org/package/mainland-pretty-
11:59 danthemyth joined
12:00 <cocreature> tibbe: alright, so the problem is that in "IntTy b" has type "PrimType l" but GHC doesn’t know which l you want (any would work)
12:01 <tibbe> cocreature, how can I say "same l as the other one"
12:01 <cocreature> tibbe: add a type signature and use ScopedTypeVariables
12:01 <cocreature> asTypeOf should also work
12:02 <tibbe> ppr (LitInt n b) = integer (fromIntegral n) <> ppr (IntTy b :: PrimType l)
12:02 splanch__ joined
12:02 <tibbe> still the same error
12:02 <tibbe> instance forall l. Pretty (Type l) => Pretty (PrimLit l) where
12:02 <tibbe> ppr (LitInt n b) = integer (fromIntegral n) <> ppr (IntTy b :: PrimType l)
12:02 <tibbe> cocreature, ^^
12:03 <quchen> o/ Tibbe
12:03 <tibbe> :)
12:03 <quchen> Nice to see you around! It’s been almost years ;-)
12:03 <tibbe> i know
12:03 splanch joined
12:03 <tibbe> i took a break
12:03 <quchen> I know
12:03 <quchen> Take a break from the break and come to ZuriHac :-)
12:03 oisdk joined
12:04 <tibbe> I live in Sydney now
12:04 cheater joined
12:04 Khisanth joined
12:04 <tibbe> cocreature, any idea?
12:04 <quchen> Ooohh. Guess not then.
12:04 <tibbe> cocreature, it worked for the Pretty instance for Type l itself, which was recursive in the same manner
12:04 <cocreature> tibbe: have you enabled ScopedTypeVariables? also try removing the forall, it should not be necessary for class instances afaik
12:05 <tibbe> cocreature, that worked, I guess i thought RankNTypes brought in the scoping
12:05 <tibbe> through the forall
12:06 ExpHP joined
12:06 vaibhavsagar joined
12:08 eacameron joined
12:10 jer1 joined
12:10 mr_sm1th joined
12:10 mthek joined
12:10 Yuras joined
12:10 descender joined
12:11 nomicflux joined
12:13 quoboo joined
12:13 <joncfoo> If I have N streams that produce data continuously at varying intervals, and I want to trigger an action when data is available from all the streams at any interval, what data structures and libraries should I look into?
12:13 chlong joined
12:14 fendor joined
12:15 eacameron joined
12:15 litchblade joined
12:18 tomboy65 joined
12:19 revprez_atlanta joined
12:19 <joncfoo> I think what I'm looking for is to be able to zip the values of the streams but to allow the faster ones to push through instead of accumulating and building up a backlog/buffer
12:19 balor joined
12:19 eacameron joined
12:20 unK_ joined
12:20 <AfC> stupid question, but I've been out of the game for a while. Is there anything you need to do to force (or suppress) criterion from running benchmarks multithreaded?
12:21 lidenbrock joined
12:22 orhan89 joined
12:26 eacameron joined
12:26 mkoenig joined
12:28 jer1 joined
12:30 ubsan joined
12:31 akfp joined
12:32 locallycompact joined
12:32 Boomerang joined
12:32 sergiu joined
12:34 Rodya_ joined
12:35 beerdrop joined
12:35 dsh joined
12:36 nomicflux joined
12:36 splanch joined
12:36 peterbec` joined
12:38 atec joined
12:39 splanch_ joined
12:43 marfoldi joined
12:44 azahi joined
12:44 AntiSpamMeta joined
12:44 ExpHP joined
12:44 splanch joined
12:44 marfoldi joined
12:45 Yuras joined
12:46 jer1 joined
12:46 asmyers joined
12:48 coot joined
12:50 eschnett joined
12:51 raycoll joined
12:51 slumshady joined
12:53 jeltsch joined
12:56 beerdrop joined
12:57 vizay joined
12:58 eklavya joined
12:58 etehtsea joined
12:58 Yuras joined
13:00 dhil joined
13:00 harfangk joined
13:00 splanch joined
13:00 zeroed joined
13:01 eacameron joined
13:02 <quchen> AfC: You mean non-concurrently?
13:03 <quchen> No multithreading can easily be achieved by running with +RTS -N1, giving GHC only one capability to run things on.
13:03 <quchen> It will still schedule them for apparent concurrency though.
13:03 watabou joined
13:04 <quchen> Or you could link it without -threaded.
13:04 <quchen> But then you’d still get scheduling and what not
13:05 vizay left
13:07 int-e joined
13:07 mlehmk joined
13:07 Nikolas joined
13:07 darlan joined
13:08 jer1 joined
13:08 msko joined
13:08 Aruro joined
13:08 zcourts_ joined
13:09 soniku joined
13:10 fakenerd joined
13:10 ChristopherBurg joined
13:10 eacameron joined
13:11 kody joined
13:13 bl0w3d_0ut joined
13:13 <phz_> anyone knows about a filterM for Traversable?
13:14 <phz_> (Applicative f, Traversable t) => (a -> f Bool) -> t a -> f (t a)
13:14 bl0w3d_0ut joined
13:15 _sg joined
13:15 xificurC joined
13:20 asmyers joined
13:22 eacameron joined
13:23 orhan89 joined
13:24 Rodya_ joined
13:25 plutoniix joined
13:26 <glguy> phz_: can't exist
13:27 <phz_> yeah I came to the same conclusion actually
13:27 <glguy> https://hackage.haskell.org/package
13:27 Micamo joined
13:27 <phz_> Traversable can’t be “filtered”
13:27 <glguy> https://hackage.haskell.org/package/witherable
13:28 <glguy> that's related
13:28 <phz_> hoho
13:28 jathan joined
13:28 <phz_> thanks
13:29 Iceland_jack joined
13:30 bennofs joined
13:30 yogsototh joined
13:30 jer1 joined
13:31 richi235 joined
13:32 gottcha joined
13:32 skeuomorf joined
13:32 splanch joined
13:33 mda1 joined
13:33 fakenerd joined
13:34 umib0zu joined
13:35 ebzzry joined
13:36 grayjoc joined
13:36 splanch_ joined
13:37 oisdk joined
13:37 wroathe joined
13:37 <AfC> quchen: I was more asking whether I *should* be (attempting) to give a criterion benchmark lots of capabilities, or rigourously doing the tricks to ensure it's only got one. [I usually turn -threading on as a matter of course]
13:38 burtons joined
13:38 peterbec` joined
13:38 mada joined
13:39 meba joined
13:39 vlatkoB joined
13:39 hoppfull joined
13:40 acarrico joined
13:41 <hoppfull> Hello, I'm having problems with generics. I'm trying to define a union type like this: "data Shape = Line Floating | Rectangle Floating Floating" but I can't seem to get it to work
13:42 eacameron joined
13:42 <ski> `Floating' is not a type. it's a type class
13:42 <hoppfull> "data Shape Floating a => a = Line a | Rectangle a" doesn't work
13:42 <ski> did you mean `Float' ?
13:42 <Iceland_jack> hoppfull: Just define it "data Shape a = Line a | Rectangle a a"
13:42 <ski> you could do `data Shape a = Line a | Rectangle a a', then add `Floating a' as a constraint to operations using `Shape a'
13:43 <hoppfull> Iceland_jack: But then someone would be able to use any type, right?
13:43 revtintin joined
13:43 coltfred joined
13:43 <Iceland_jack> hoppfull: yes, and that's fine. the operations that require a Floating constraint will have a Floating constraint
13:43 <ski> if your operation requires `Floating a', then a user of that operation has to satisfy that constraint
13:44 <hoppfull> Iceland_jack: I guess that makes sense.
13:44 <hoppfull> Thanks guys!
13:44 <Iceland_jack> hoppfull: This may feel counterintuitive, but in Haskell you might define a 2D vector as "data V2 a = V2 a a"
13:45 `^_^v joined
13:45 <* ski> hoppas det hjälper
13:46 <Iceland_jack> Then if you define a function that requires the (a)s to be numbers (like cross product), you add a (Num a) constraint
13:46 <hoppfull> ski: Jag är hoppfull iallafall
13:46 <Iceland_jack> crossZ :: Num a => V2 a -> V2 a -> a
13:46 <Iceland_jack> crossZ :: Num a => V2 a -> V2 a -> a
13:46 <Iceland_jack> crossZ :: Num a => V2 a -> V2 a -> a
13:46 <Iceland_jack> crossZ (V2 x1 y1) (V2 x2 y2) = x1*y2 - y1*x2
13:46 <Iceland_jack> Sorry for the repeated type
13:46 <* ski> looks at Sigyn
13:46 <Iceland_jack> I mean..... repeated for emphasis!
13:46 <hoppfull> Iceland_jack: Yeah, makes sense.
13:47 splanch joined
13:47 <hoppfull> : )
13:47 <Iceland_jack> hoppfull: This allows you to make your types instances of Functor (Foldable, Traversable, ...) if you are familiar with those
13:47 {emptyset} joined
13:48 <Iceland_jack> data V2 a = V2 a a deriving (Functor, Foldable, Traversable) and you get all sorts of functions for **free**
13:48 <Iceland_jack> Functions you couldn't get for free if it had constraints
13:48 <ski> > length (2,5)
13:48 <lambdabot> 1
13:48 <hoppfull> Iceland_jack: Interesting
13:48 simukis__ joined
13:48 <Iceland_jack> food for thought if you like free things
13:48 <Iceland_jack> sum (V2 a b) = a + b
13:49 ystael joined
13:50 <hoppfull> Can you do this: "(+) v1 v2 = V2 (a v1 + a v2) (b v1 + b v2)"?
13:50 jer1 joined
13:51 <hoppfull> I mean, can you define + to work with other types than num?
13:51 Aruro joined
13:51 <Iceland_jack> hoppfull: You can *define* V2 to be num
13:51 splanch joined
13:51 <Iceland_jack> See: https://hackage.haskell.org/package/linear-1.20.5/docs/src/Linear.V2.html#line-166
13:52 <* ski> . o O ( "declare" )
13:52 <Iceland_jack> instance Num a => Num (V2 a) where V2 a b + V2 a' b' = V2 (a + a') (b + b')
13:53 splanch_ joined
13:53 <hoppfull> Interesting
13:53 <hoppfull> Alright, thanks guys!
13:53 asmyers joined
13:54 benl23 joined
13:54 <ski> `Num' includes other operations as well, of course, that you'd presumably want defined
13:55 chichou joined
13:55 <bennofs> Is there any way to have pkg-config dependencies in cabal files while falling back to some hardcoded values if pkg-config is not available?
13:55 <* Iceland_jack> has discovered a truly marvelous instance of Num, which this IRC is too narrow to contain
13:55 carlomagno joined
13:55 petrus joined
13:57 TheQuietCoder joined
13:58 <hvr> bennofs: what kind of hardocded value?
13:58 osa1 joined
13:58 osa1 joined
13:58 <TheQuietCoder> Hieveryone newbie here
13:58 mizu_no_oto_work joined
13:58 <bennofs> hvr: something like extra-libraries. https://github.com/ivanperez-keera/hcwiid/pull/4 is an example
13:59 <hvr> bennofs: do you really mean if pkg-config(1) is missing,
13:59 <bennofs> hvr: oh, right
13:59 <hvr> or rather if pkg-config doesn't know about the specified dep?
13:59 <Iceland_jack> Hey TheQuietCoder
13:59 <Iceland_jack> Are you here via ssh? :)
13:59 <bennofs> hvr: would be nice if it worked in both cases
14:00 <hvr> bennofs: well, you can have cabal fallback to extra-libraries if pkg-depends cannot be satisfied
14:00 xtreak joined
14:00 <hvr> bennofs: but the trouble is that it doesn't allow the cabal solver to fail
14:01 gehmehgeh joined
14:01 <bennofs> hvr: ah. is there a way to have a fallback if pkg-config is not available at all?
14:01 <hvr> extra-libraries is checked long after the solver has run
14:01 <hvr> bennofs: I'm not sure, but I'm afraid you can't check for the presence of pkg-config(1)
14:02 <hvr> (at solver time)
14:02 ccomb joined
14:02 <bennofs> hvr: the fallback to extra-libraries if pkg-depends cannot be found is automatic, right?
14:02 <hvr> bennofs: I don't think so... how should cabal know that you want either/or rather than 'and'?
14:02 <bennofs> hvr: I don't need this at solver time, I only want to be able to configure the package and not fail with "The program 'pkg-config' version >=0.9.0 is required but it could not
14:03 <bennofs> be found."
14:03 BlueRavenGT joined
14:03 <bennofs> hvr: how does this fallback work then?
14:03 <hvr> via automatic cabal flags, just as it works for every other dependency
14:03 <TheQuietCoder> I have a very simple question, can someone breakdown for a function def that I can get my head around?
14:04 <hvr> but it's slightly fragile, as there's no guarantee that there's enough pressure for the solver to prefer the pkg-config dependency
14:04 <TheQuietCoder> -- 4.Using foldl, define a function dec2int :: [Int] -> Int
14:04 <TheQuietCoder> -- define a function dec2int that converts a decimal to an integer.
14:04 <TheQuietCoder> dec2int :: [Int] -> Int
14:04 <TheQuietCoder> dec2int = foldl (\x y -> 10*x + y) 0
14:04 <TheQuietCoder> --
14:04 <TheQuietCoder> -- > dec2int [1,2,3]
14:04 <TheQuietCoder> -- > 123
14:04 <bennofs> hvr: if it defaults to True, it should try the flag first no?
14:04 abrar joined
14:04 <cocreature> TheQuietCoder: are you familiar with what foldl does?
14:04 <TheQuietCoder> yup
14:04 etehtsea joined
14:05 <hvr> bennofs: in theory yes, but strictly speaking the solver has no obligation to honor it (it currently does so -- but a different impl may not)
14:05 <cocreature> TheQuietCoder: cool, so let’s start with the basecase, what should "dec2int []" return
14:05 <hvr> bennofs: I'm just pointing it out... as it may break at some point in the future :-)
14:05 <bennofs> hvr: everyone relies on that one though :)
14:05 <TheQuietCoder> []
14:06 <hvr> bennofs: that's a bad assumption then :-)
14:06 <cocreature> TheQuietCoder: no, your type signature says that it should return an Int. [] is not an Int. which Int should it return?
14:06 <TheQuietCoder> ok
14:07 <TheQuietCoder> sorry.
14:07 <bennofs> hvr: hmm, i find it slightly surprising that cabal checks for pkg-config-deps during solving but not if pkg-config is available at all? How does that make sense? o.o
14:07 <TheQuietCoder> 0
14:07 <hvr> bennofs: ideally, each branch in an automatic-flag conditional should have mutually exclusive conditions
14:07 <cocreature> TheQuietCoder: exactly! that’s the 0 you see in "dec2int = foldl … 0"
14:07 sgflt joined
14:07 <hvr> bennofs: I need to check the code tbh... but even if it did; what difference would it make? :)
14:08 <bennofs> hvr: then I could use an automatic flag ?
14:08 <hvr> if pkg-config is missing, all pkg-config deps would autoamtically fail
14:08 <hvr> i.e. be unsatisfiable
14:08 <bennofs> hvr: then the flag would be set to false and cabal configure should success
14:08 <hvr> yes
14:08 plutoniix joined
14:08 <bennofs> hvr: but that's not what happens
14:08 <hvr> but you have no version checking
14:08 takle joined
14:09 <hvr> it doesn't?
14:09 <kosmikus> bennofs: the solver doesn't have a good and precise semantics for "soft" preferences. at the moment, defaults are tried first *when the solver tries to solver for this flag*, but the order in which the solver tries to solve goals may influence whether that choice succeeds or fails in practice.
14:09 <* shapr> hugs kosmikus
14:09 <kosmikus> shapr!
14:09 <* hvr> realise that he should be careful what he claims about the solver... otherwise kosmikus will be summoned
14:09 <shapr> long time no see!
14:10 <bennofs> hvr: i believe I tried this. I put pkgconfig-depends behind an if-conditional based on an automatic flag (Manual: false) and cabal configure still failed if pkg-config (the command) could not be found
14:10 <cocreature> TheQuietCoder: so let’s say you know the value of dec2int xs, let’s call that "x" and you are given an integer y and you want to know the value of "dec2int (xs ++ [y])". how can you combine "x" and "y" to get that?
14:10 <hvr> bennofs: could be... tbh, I don't have a system w/o pkg-config...
14:10 <hvr> so I never really had that situation
14:10 <bennofs> hvr: I uninstalled it to test :)
14:10 <kosmikus> bennofs: I'm not sure about the absence of pkg-config. It's entirely possible the solver could behave better in such a scenario.
14:11 <TheQuietCoder> x is bening the head right?
14:11 soniku joined
14:11 jer1 joined
14:11 <TheQuietCoder> the problem i dont where the y comes from
14:11 <TheQuietCoder> :)
14:11 <cocreature> “bening”?
14:11 <cocreature> x = dec2int xs
14:12 <TheQuietCoder> keep on going
14:12 xtreak joined
14:12 <cocreature> you’re supposed to tell me how you can combine x and y to get the value of "dec2int (xs ++ [y])" :)
14:12 <bennofs> hvr, kosmikus: https://hastebin.com/yosepadoto.cabal and cabal configure errors with "pkg-config could not be found"
14:13 <bennofs> hvr, kosmikus: and flags chosen is no-pkgconfig=False
14:13 sssilver joined
14:13 <kosmikus> bennofs: I don't think cabal configure uses the solver.
14:14 <TheQuietCoder> I understand the principle at work behing foldly its just in this instance Idon seem to get how decimal notation principle is used to turn [1,2,3] into 123
14:14 <bennofs> kosmikus: how does it resolve flags then?
14:14 <TheQuietCoder> sorry
14:14 <kosmikus> bennofs: in some ad-hoc way.
14:15 danthemyth joined
14:15 <ski> > 1 * 10^2 + 2 * 10^1 + 3 ^ 10^0
14:15 <lambdabot> 123
14:15 eacameron joined
14:15 <TheQuietCoder> yes throught the ++ operator
14:15 <bennofs> kosmikus: wait, so the flag assignment chosen by cabal configure and cabal install may be different? o.o
14:15 <kosmikus> bennofs: but it's possible it uses the solver these days.
14:15 <cocreature> that’s not ++, that’s + and *
14:15 <hvr> bennofs: how can I download the raw version of that .cabal file?
14:15 <ski> > 1 + 10 * (2 + 10 * (3 + 10 * 0))
14:15 <lambdabot> 321
14:16 <bennofs> hvr: curl http://ix.io/r2Y
14:16 <hvr> bennofs: nevermind, got it... https://hastebin.com/raw/yosepadoto
14:16 <bennofs> ah, I haven't used hastebin much
14:17 hsk3 joined
14:17 <hsk3> Why is Stack aware of Docker? I was expecting it to be unaware of Docker - that it would be just a program that we happen to be running inside of a Docker image. Instead, it turns out Stack even has its own docker command ("stack docker ..."). Why did Stack choose to do this extra coupling?
14:17 <TheQuietCoder> lambadot, ski: I got it, base 10 notation it is just i couldnt see it in the syntax of the fun def
14:18 <hvr> bennofs: fwiw, new-build does the right thing here
14:18 <TheQuietCoder> the variable y being the next iteratiuon?
14:18 <hvr> bennofs: so kosmikus' comment seems to apply that the old 'configure' doesn't use the full solver
14:18 <bennofs> hvr: hmm, so if I had another package depend on hcwiid, then it would work? that's *really* surprising!
14:19 HarveyPwca joined
14:19 <* hvr> doesn't disagree... but points out that w/ cabal new-build it's more consistent
14:20 robkennedy joined
14:20 eacameron joined
14:20 <bennofs> hvr: even with cabal new-build I get an error when I actually run it (new-configure does not error though)
14:20 <* hvr> tries again locally
14:20 <ski> > snd (foldr (\d (i,n) -> (i+1,d * 10^i + n)) (0,0) [9,4,5])
14:20 <lambdabot> 945
14:21 <kosmikus> bennofs, hvr: I've just looked into the sources. If pkg-config is not present, then the solver currently assumes that all libraries are available.
14:21 <TheQuietCoder> thx ski now I can PICTURE it
14:21 coot joined
14:21 augur joined
14:21 <maerwald> hsk3: it does a lot of weird things
14:21 <ski> TheQuietCoder : can you do it with `foldl' ?
14:21 <* hvr> gets Failed to query pkg-config, Cabal will continue without solving for pkg-config
14:21 <TheQuietCoder> thx komikus for your help!
14:22 <bennofs> hvr: what cabal version are you using?
14:22 <hvr> kosmikus: so it does fallback to extra-libs semantics?
14:22 <hvr> bennofs: cabal 2.1.x from Git
14:22 <kosmikus> hvr: what's extra-libs semantics?
14:22 <bennofs> hvr: oh, I was using 1.24.2 (Cabal) and (cabal-install), so perhaps it changed since then
14:22 <hvr> kosmikus: extra-libraries: <name>
14:23 augur_ joined
14:23 <ski> oh, you already had a `foldl' version
14:23 <hvr> kosmikus: i.e. as you say, not solving, just assuming that you can pass -l<name> as linker option
14:23 <kosmikus> hvr: does the solver do anything with them?
14:23 <kosmikus> hvr: I don't think so.
14:23 <ski> > foldl (\n d -> d + 10 * n) 0 [9,4,5] :: Expr
14:23 <lambdabot> 5 + 10 * (4 + 10 * (9 + 10 * 0))
14:23 <kosmikus> hvr: so afaics, if pkg-config is not found, then no pkg-config database is passed to the solver.
14:23 <ski> > snd (foldr (\d (i,n) -> (i+1,d * 10^i + n)) (0,0) [9,4,5]) :: Expr
14:23 <lambdabot> 9 * (10 * 10) + (4 * 10 + (5 * 1 + 0))
14:24 <hvr> kosmikus: that's weird then... cause pkg-config provides us w/ C & linker flags
14:24 <kosmikus> hvr: and then the solver will just treat all pkg-config libraries as present.
14:24 asmyers joined
14:24 <kosmikus> hvr: oh, but that's probably done post-solver.
14:24 <kosmikus> hvr: I mean, afaik, cabal had pkg-config support before the solver had any.
14:24 <TheQuietCoder> ski, lambdabot: thx i will now play around with this a bit...
14:25 <hvr> bennofs: ok, since I only got the .cabal file, I didn't actually try to build the package... I only solved for the .cabal file ....
14:26 <hvr> so there's a good chance it would fail lateron
14:26 eacameron joined
14:26 <bennofs> hvr: how do I get new config to show me flag assignments?
14:26 <hvr> bennofs: look at dist-newstyle/cache/plan.json
14:26 <hvr> it contains all flag assignments
14:27 <hvr> (and this reminds me I wanted to get the pkg-config deps in there as well)
14:27 <bennofs> hvr: hmm, "no-pkgconfig": false
14:27 <kosmikus> bennofs, hvr: anyway, what's the conjecture here. that the solver should consider all pkg-config library to be absent if pkg-config is missing/broken (rather than all of them to be present)?
14:27 crobbins joined
14:27 <hvr> kosmikus: yes, IMO yes
14:27 <kosmikus> hvr: that sounds sane to me as well.
14:28 <maerwald> why?
14:28 <hvr> kosmikus: especially given pkg-config provides the required CFLAGS/LDFLAGS
14:28 <hvr> kosmikus: otherwise we'd have to guess those, which there isn't a good heuristic for IMHO
14:28 <maerwald> hvr: note that some distros create pkg-config files downstream where there is no actual pkg-config file upstream, which means there is no 100% consistent set of equal pkg-config files across distros
14:29 <kosmikus> maerwald: yes, exactly this is what I suppose may have been the reason for choosing the default as it is
14:29 <hvr> maerwald: sure, but pkgconfig provides essential meta-data we need
14:29 <maerwald> it isn't the only way though (see perl, python, sdl-config and so forth)
14:30 <kosmikus> I mean, from the solver perspective, it's rather simple to offer both behaviours (all pkg-config deps considered to be present, all pkg-config deps considered to be absent)
14:30 guampa joined
14:30 <kosmikus> but then there'd be a UI issue again as to how and when to choose what behaviour
14:30 okuu joined
14:30 <hvr> kosmikus: the point is: would the build have any chance to succceed w/o the needed meta-data?
14:31 <maerwald> often times yes
14:31 <hvr> maerwald: how does it work?
14:31 Wuzzy joined
14:31 <hvr> do you have an example?
14:31 <maerwald> hvr: libpng
14:32 jer1 joined
14:32 <maerwald> there's no overly useful metadata there
14:32 <hvr> maerwald: the relevant meta-data is: -lpng12
14:32 <maerwald> just -lpng
14:32 <maerwald> which is easy to assume if pkg-config --libs libpng fails
14:33 Gentilhomme joined
14:33 <bennofs> hvr, kosmikus: there may be packages that depend on the current behaviour by providing *both* extra-libraries and pkgconfig-depends without a flag
14:33 <hvr> how should cabal know that 'libpng' translates to -lpng ?
14:33 <kosmikus> maerwald, hvr, bennofs: actually, the code in the solver currently says: "If we could not read the pkg-config database successfully we allow the check to succeed. The plan found by the solver may fail to be executed later on, but we have no grounds for rejecting the plan at this stage."
14:33 <kosmikus> so it seems to have been a conscious choice
14:34 etehtsea joined
14:34 <hvr> bennofs: those are in real trouble though; as they'll break if you have a working pkg-config
14:34 <bennofs> hvr, kosmikus: or wait, I don't think that a package with any missing pkgconfig-depends can compile with current cabal
14:35 <bennofs> because configuring fails for such packages if either a pkgconfig-depends is missing or pkg-config itself is missing
14:35 <maerwald> hvr: pretty much like cmake modules do it
14:35 <maerwald> so yes, it's work
14:35 cdg joined
14:35 Guest82161 joined
14:36 <hvr> maerwald: how does cmake do it? :-) (I never used it - being biased towards autotools)
14:36 eacameron joined
14:36 <maerwald> hvr: filename and location hints
14:36 Wuzzy joined
14:36 <maerwald> "png" would just be enough for it to find it in the standard search paths
14:37 tabaqui joined
14:37 <hvr> maerwald: ok, but that only applies if pkg-config doesn't exist, right?
14:37 <maerwald> well, cmake sucks, so basically the answer is: depends on the module author :P
14:37 <maerwald> but that's how I would write a module, yes
14:38 <hvr> cause, if we have a pkg-config depends, we use to specify which version range we're compatible with
14:38 <hvr> which is the big benefit of pkg-config (besides getting the real LDFLAGS/CFLAGS)
14:38 des_ joined
14:39 Walkman joined
14:39 <kosmikus> hvr, maerwald, bennofs: for reference, the PR that added this functionality to the solver is https://github.com/haskell/cabal/pull/3023 ; there may be some discussion regarding this issue somewhere
14:39 peterbec` joined
14:39 zcourts joined
14:39 <jchia_1> stack build is running ghc one process at a time despite the availability of many cores on my machine. Is there a way to tell it how the level of concurrency to use?
14:39 mkoenig_ joined
14:40 ozgura joined
14:40 <jchia_1> Does stack build even do parallel builds?
14:40 <bennofs> jchia_1: are you building a single package or multiple packages?
14:40 <cocreature> jchia_1: there is -j but it should use the number of cores your machines has by default. are you sure there are no dependencies between the different ghc processes?
14:40 <maerwald> hvr: I'd just ignore version range if we fall back to non-pkgconfig. Then it's just about "hope it works" anyway
14:40 eacameron joined
14:40 <jchia_1> bennofs: My stack.yaml has multiple packages. I'm doing one stack build for the whole project.
14:40 <kosmikus> hvr, maerwald, bennofs: in particular, there is https://github.com/haskell/cabal/commit/d46e3636bb731b2494180bf706b67d3163c28413
14:41 <hvr> maerwald: well, I'm ok-ish with that... cause I always make sure I have pkg-config installed anyway =)
14:41 <maerwald> hvr: on the other hand, stuff like "sdl-config" emit version as well
14:41 <jchia_1> bennofs: I also have extra-dep packages in the packages section in the stack.yaml, so I don't think there's a serial chain of dependency.
14:42 <hvr> maerwald: sure... but unfortunately pkg-config is easy to batch-query at startup
14:42 <bennofs> jchia_1: stack/cabal call GHC once to build all modules in a package afaik, so you'd need GHC to be parallel in this case
14:42 <maerwald> I'd just make sure there is some kind of API that let's people write modules for non-pkg-config cases
14:42 <hvr> maerwald: we'd have to add explicit support for sdl-config and <whatever>-config
14:42 <hvr> etc
14:42 <hvr> the nice thing about pkg-config is that it's modular
14:43 <maerwald> hvr: currently, people often do such logic in Setup.hs and so on, but I think it would be nicer if that were part of cabal, like cmake modules
14:43 <hvr> maerwald: Setup.hs is too late
14:43 <maerwald> yes
14:43 Aune joined
14:43 <hvr> maerwald: we need it pre-solver
14:43 <maerwald> exactly
14:44 <kosmikus> sorry, have to go
14:44 <hvr> kosmikus: cu!
14:44 ebzzry joined
14:44 raycoll joined
14:44 Wuzzy joined
14:46 <maerwald> hvr: also mind wxGTK doesn't seem to have pkg-config files, but just wx-config
14:46 <maerwald> and there are more
14:46 nepiktaz joined
14:47 <maerwald> it's sadly not a consistent standard
14:47 <jchia_1> cocreature, bennofs: I'm building multiple packages and 4 of them are extra-dep packages, so I hope to see at least 4 ghc's running in the beginning even if stack build doesn't know how to parallelize building one package. Is stack build known to parallelize any part of the build?
14:47 <shapr> if it doesn't I really want it to
14:48 <bennofs> jchia_1: it should build multiple independent packages in parallel i think
14:48 <bennofs> jchia_1: try stack -j4 build or something
14:49 eacameron joined
14:50 fizruk joined
14:51 Sh4rPEYE joined
14:51 coltfred joined
14:51 <jchia_1> bennofs: When I just -j4, the most I saw was two ghc process running concurrently, fewer than I expected.
14:51 <jchia_1> bennofs: When I just used -j4, the most I saw was two ghc process running concurrently, fewer than I expected.
14:52 <cocreature> jchia_1: maybe the extra-deps depend on each other?
14:52 jer1 joined
14:53 <jchia_1> cocreature: Good point. clang-pure, lzma-conduit, haskell-cpython and one more than depends only on haskell-cpython. I should see 3.
14:54 <jchia_1> cocreature: OK, I noticed that clang-pure finished building quite fast. So, maybe there's an explanation.
14:55 bvad joined
14:55 <jchia_1> But does stack know how to parallelize building one package?
14:55 eacameron joined
14:55 bockmabe joined
14:56 Xanather joined
14:56 <bennofs> jchia_1: you could try stack build --ghc-option -j4
14:57 <cocreature> jchia_1: it does know how to parallelize building one package and it definitely does so for the package you’re working on. I’m not sure if it tries to do that for dependencies
14:58 flatmap13 joined
14:58 robotroll joined
14:58 <jchia_1> With --ghc-options -j4, I see that most of the time there are two ghc processes, an improvement.
14:59 mmachenry joined
15:00 eacameron joined
15:00 uglyfigurine joined
15:00 boombanana joined
15:01 <michalrus> Can I have git-based versioning in a Cabal project? E.g. using the output of `git-describe` as version.
15:03 <bennofs> michalrus: pretty sure that the answer is "no"
15:04 <* michalrus> sobs…
15:04 osa1 joined
15:04 <bennofs> michalrus: you may be able to auto-edit the .cabal during the release process, or perhaps hpack already supports it though
15:04 <michalrus> Mhm. =) I’ll read hpack’s docs, thank you!
15:05 <bennofs> michalrus: no idea if it does support it, so don't be surprised if it doesn't :/
15:05 watabou joined
15:05 dhil joined
15:05 steeze joined
15:06 <michalrus> OK. :)
15:06 <sm> there's things like http://hackage.haskell.org/package/vcs-revision
15:06 eacameron joined
15:08 <sm> and http://hackage.haskell.org/package/cabal-file-th
15:09 <michalrus> Nice! :) Thank you.
15:09 nobodyzxc joined
15:11 Rodya_ joined
15:12 nighty-- joined
15:12 iAmerikan joined
15:13 jer1 joined
15:13 nahra joined
15:13 ertes joined
15:14 osa1_ joined
15:14 nicknovitski joined
15:16 vikumar joined
15:16 <vikumar> Hey there!
15:16 user21 joined
15:16 cordawyn joined
15:19 Noldorin joined
15:19 JagaJaga joined
15:20 Kreest_ joined
15:21 raycoll joined
15:22 ertes joined
15:23 nahra joined
15:24 guampa joined
15:26 jsgrant_ joined
15:26 zeroed joined
15:28 kadoban joined
15:29 flatmap1_ joined
15:31 nahra joined
15:31 xuinkrbin joined
15:32 leat joined
15:32 CaptainProton joined
15:32 <AWizzArd> > return (*2)
15:32 <lambdabot> error:
15:32 <lambdabot> • Ambiguous type variables ‘m0’, ‘a0’ arising from a use of ‘show_M14503...
15:32 <lambdabot> prevents the constraint ‘(Show (m0 (a0 -> a0)))’ from being solved.
15:33 <AWizzArd> When I try this in my ghci it shows no reaction. No error message. Nothing printed.
15:33 nepiktaz joined
15:33 sleffy joined
15:33 <Iceland_jack> It gets defaulted to (return (* 2) :: IO (Integer -> Integer))
15:34 jer1 joined
15:34 pera joined
15:34 <Iceland_jack> After running (return (* 2)) you should check the type of "it"
15:34 <AWizzArd> And because this IO action has no visible effect – this is why I apparently see nothing?
15:34 <Iceland_jack> Yes
15:34 <AWizzArd> Ok, thx.
15:35 <Iceland_jack> If you "import Text.Show.Functions" it will display "<function>"
15:36 CaptainProton joined
15:36 <Iceland_jack> It's confusing behaviour
15:37 splanch joined
15:37 augur joined
15:39 soLucien joined
15:39 beerdrop joined
15:40 peterbec` joined
15:43 jmelesky joined
15:44 cdg joined
15:46 afldcr joined
15:46 unknown1 joined
15:47 cchalmers joined
15:49 S1 joined
15:49 yogsototh joined
15:50 spatial joined
15:52 <spatial> http://lpaste.net/354703 I was asking about alternative ways to maintain state. Do I need this code for all immutable data ?
15:53 phyrex1an joined
15:54 jer1 joined
15:54 trism joined
15:55 ninjazoete joined
15:55 JagaJaga joined
15:56 <spatial> Can I not return the value from a function ?
15:56 sssilver joined
15:57 etehtsea joined
15:58 Walkman joined
15:58 electrostat joined
16:00 <glguy> returning a value is all a function can do
16:02 Nikolas joined
16:02 forgottenone joined
16:04 SpinTensor joined
16:05 quchen joined
16:06 azahi joined
16:06 govg joined
16:06 umib0zu joined
16:06 eazar001 joined
16:06 Sampuka joined
16:07 <spatial> Are states even for simple immutable data maintained like that ?
16:07 <davean> sometimes, sometimes not
16:07 bodisiw joined
16:07 <davean> I rarely, if ever, use a state monad
16:07 <davean> also, you've got multiple tihngs named "fun", I think you're possibly confused
16:08 <spatial> You mean the bindings can be anything ?
16:08 <davean> ?
16:08 <spatial> I didn't get you.
16:09 <EvanR> state monad by itself has never really helped me
16:10 <davean> Yah, what EvanR said
16:10 sssilver joined
16:10 <EvanR> if you would use a state monad, then just passing and returning updated structures ends up being a lot easier
16:10 a3Dman joined
16:11 soniku joined
16:11 <EvanR> at least in haskell
16:11 <vikumar> huh, that's interesting
16:11 revprez_atlanta joined
16:12 <vikumar> why do you not use the state monad?
16:12 <davean> Why would you?
16:12 danthemyth joined
16:12 <davean> Its kinda a silly way to think of post things IMO
16:12 <EvanR> its a pain in the ass, especially if you have multiple "variables"
16:12 <davean> well, lens fixes most of the multiple part
16:13 <vikumar> huh, sweet
16:13 <EvanR> theres a lot of bureauratic overhead with State for complex things, and if its simple things, its even worse
16:13 <vikumar> I've never needed to use the state monad myself. Was rather curious about your opinion.
16:13 <EvanR> and if youre going to need lenses to deal with it...
16:13 <EvanR> jeez
16:14 <vikumar> honestly, can't think of a program that required you to worry about all the calculations you do.
16:14 <spatial> What do you do with such simple state ?
16:14 <EvanR> thing nasa engineering team to develop space pen when russians use the pencil
16:14 <EvanR> think*
16:14 <davean> EvanR: Talk about a false history
16:14 <EvanR> haha
16:15 jer1 joined
16:15 <quchen> You can see the actual pen in DC.
16:15 <davean> quchen: NASA used pencils initially
16:15 <davean> Turns out pencils are a bad idea in space
16:16 <vikumar> yeah, the graphite messed up the electronics
16:16 <davean> Among other issues
16:16 <davean> Which is a lot like lens
16:16 <davean> So thank you EvanR for such an accurate analogy ;)
16:17 <EvanR> the total amount of code for State code seems to decreases once you remove State, i have found.
16:17 <davean> This I agree with
16:17 <quchen> Same for Reader.
16:17 <davean> also few computations are really very stateful
16:17 <quchen> Not so much for StateT and ReaderT.
16:17 <EvanR> yeah Reader by itself is really silly
16:18 insitu joined
16:18 <EvanR> however, heres a situation where Reader or passing params would be annoying
16:19 <vikumar> alright, time to clear up my head when it comes to monads.
16:19 <vikumar> what do you use the state, reader and writer monads for in real life
16:19 <vikumar> I've never really understood
16:19 <vikumar> I get monads but I can't think of used for the mentioned monads
16:20 <vikumar> I get error handling, but I don't think the said monads are really helpful
16:20 <quchen> Reader: for configuration data, database connections, file handles.
16:20 <EvanR> on running the program you pass in flags that determine system wide configuration parameters that dont change, and are pervasive, such as units of measure, scale, sample rate, audio buffer size, numeric precision size, integer modulus
16:20 <quchen> I mostly use State like Reader, except that sometimes the configuration might change.
16:21 <EvanR> since it would be used so much, passing it to each calculation would be too explicit
16:21 <vikumar> quchen, could you give me an example? Pseudo-code could help me out
16:21 <sm> ..or, you pass that around as a parameter. Which is often simpler
16:21 <vikumar> EvanR, so passing a parameter throughout the entire program?
16:21 <quchen> vikumar: If you have a program that passes a parameter through to lots of functions, then Reader lets you do that implicitly.
16:21 <EvanR> not just that
16:22 plutoniix joined
16:22 a3Dman joined
16:22 baldrick joined
16:22 <vikumar> honestly, that sounds suspiciously like a global variable
16:22 <vikumar> well, one that can't change
16:22 <quchen> handle <- openFile; doThis handle; doThat handle; close handle
16:22 <vikumar> but still dependent on that variable
16:22 <EvanR> a global constant that is needed by a whole framework, like crypto key size, physics precision, etc
16:22 <quchen> Reader style: (doThis; doThat; close) openFile
16:22 <EvanR> you could do it with modules, but haskell doesnt have that
16:23 <vikumar> huh
16:23 <EvanR> the best way ive seen to deal with this is the reflection trick
16:23 <vikumar> reflection trick?
16:23 <EvanR> yeah
16:23 <maerwald> we need more tricks
16:23 <maerwald> so code becomes more difficult to understand
16:24 <vikumar> sounds like GHC hackery to me. What is it?
16:24 <maerwald> it works without GHC hacks too
16:24 <EvanR> i say this because having that parameter in every binary operation as another param will make the code harder to read
16:24 <maerwald> but less fast
16:24 <EvanR> in math, the equivalent situation is an implicit context youre just supposed to know about
16:24 <vikumar> hmmm
16:24 <EvanR> "when it wouldnt cause confusion"
16:25 <vikumar> that feels familiar
16:25 <EvanR> and that happens a lot
16:25 <quchen> There’s also the HuuuuugeWhereBlock pattern in Haskell.
16:25 <EvanR> a lot of dependent type systems, much work is putting in ways to get implicit like that
16:25 <vikumar> alright, so i can use the state, reader and writer monads to keep useful parameter with me wherever I go
16:25 <vikumar> why not use dependent type systems?
16:26 <EvanR> agda... yep
16:26 <EvanR> has modules
16:26 raichoo joined
16:26 <quchen> vikumar: You can’t infer types in general, for example
16:26 <EvanR> but its not a programming language
16:26 <quchen> vikumar: Implicit invariants AKA dirty hacks are much harder to do
16:26 <vikumar> huh, fair point.
16:27 <EvanR> you wouldnt need dirty hacks in that case
16:27 jer1 joined
16:27 <maerwald> dependent types is a can of worms too, because it's yet another level of "reasoning" you as a programmer have to know and think about etc.
16:27 <quchen> Halts : (A -> Bool) -> Bool :-)
16:27 <EvanR> also i was trying to argue the use case shouldnt be thought of as a dirty situation
16:27 <dolio> You can't infer Haskell types in general, either. :P
16:28 <quchen> Hm, that’s less of a dependent example rather than a strongly normalizing one. Meh, ignore me
16:28 `^_^v joined
16:28 <angryMonk> Thanks a lot!
16:28 <quchen> dolio: At least it’s decidable.
16:28 Guest51282 joined
16:29 <dolio> Huh?
16:29 <quchen> quchen: Is it not?
16:29 <dolio> I'm not sure what you mean that wouldn't hold for dependent types.
16:29 oisdk joined
16:30 <EvanR> rankN types cant be reconstructed
16:30 <quchen> dolio: If you have general dependent types you can just lift the halting problem to the type level. Is there a term in Haskell that takes forever to typecheck?
16:31 edmundsecho joined
16:31 <Hafydd> I think the typechecker gives up after a certain number of operations...
16:31 <Hafydd> Configurable per program.
16:31 mizu_no_oto_work joined
16:31 <dolio> If you mean that the language has dependent types and is not total, then that's a difference, I guess, although people have worked on systems where that isn't a problem.
16:31 <quchen> Sure, cutting off computation time is a fairly robust way of making things terminate.
16:31 raynold joined
16:32 <quchen> Oh sure, in a total language you get typechecking back.
16:32 <EvanR> i havent tried dependent types without totalness
16:32 <EvanR> seems scary
16:33 <quchen> Idris?
16:33 coot joined
16:33 <dolio> Well, it's coming to a GHC near you, maybe. :)
16:33 <EvanR> in idris type level code refuses to run without being total
16:33 <quchen> Oh, right.
16:33 <quchen> Agda with NoTerminationCheck :-D
16:35 sssilver joined
16:36 <EvanR> termination and non termination ... why are you so pervasive in pretty much everything ever
16:36 bhiliyam joined
16:37 Birdman joined
16:37 <thoughtpolice> Cayenne used to just have a literal fixed time limit for compile-time programs to halt, not even specified in terms of number of reductions, IIRC?
16:37 <EvanR> like, 5 seconds? ;)
16:37 <thoughtpolice> (Well, not 'fixed' in the sense you couldn't change it, just in the sense it was in units-of-time, I think, maybe)
16:37 Jesin joined
16:37 <EvanR> ah
16:38 <EvanR> thatd be an annoying thing to introduce to a pure compiler
16:38 Gurkenglas joined
16:39 <thoughtpolice> Ah no, it was reduction steps: https://github.com/csgordon/cayenne/blob/master/cayenne.hs#L405
16:39 conal joined
16:40 magneticduck joined
16:41 peterbec` joined
16:43 <adamCS> generics-sop/typelist question: The NP type in generics-sop is a product type, a list of values parameterized by a functor f and a typelist xs. E.g., f 1 :* f "Hello" :* Nil :: NP f '[Int,Text]. I am trying to figure out if, given a functor which is a composition of other functors, so, using genereics-sop notation, NP (f :.: g) xs I can "move" the functor from the functor parameter to the typelist and the inverse of that.
16:43 <adamCS> I think I can manage the former, but I'm stuck on the latter.
16:43 <OnkelTem> Hi all
16:43 <adamCS> Here's a paste with code to do the "uncomposing": https://pastebin.com/DRUsPA4N
16:43 edsko joined
16:44 <adamCS> but all attempts at "recomposing" have run aground.
16:44 <davean> quchen: There is UndecidableInstances
16:44 danthemyth joined
16:44 <OnkelTem> How to install ghc-mod? Isn't ghc-pkg a program for installing such things?
16:45 jsgrant__ joined
16:46 <davean> OnkelTem: huh?
16:46 <davean> OnkelTem: ghc-pkg installs nothing
16:46 <davean> OnkelTem: perhaps you want cabal-install?
16:47 kamyar joined
16:47 <kamyar> Hello all
16:47 <kamyar> please help me:
16:47 <OnkelTem> davean: honestly, I don't know. I try to get something
16:47 <OnkelTem> davean: and I want it in PHPStorm :)(
16:47 <kamyar> I need a binary serialization library in Haskell which can be deserialized using Python
16:47 <davean> OnkelTem: ... I'll leave you to that
16:48 <OnkelTem> And it has some paths... like "cabal executable", "ghc-mod" executable
16:48 <kamyar> Apparently MessagePack is not well-documented and I can not use it. CBOR is nor production ready
16:48 <EvanR> json, s-expressins
16:48 <EvanR> expressions
16:48 <OnkelTem> davean: it isn't gonna work?
16:48 <EvanR> XML
16:48 <EvanR> hmm why binary
16:49 <EvanR> also doesnt python have a way to parse arbitrary binary
16:49 <davean> OnkelTem: Oh, I have no idea, but PHPStorm, your experience level? You're wanting a lot of very specific things, well outside what the commuity uses, and don't have the background knowlege to put it together.
16:49 <davean> OnkelTem: I'm sure someone can get it to work
16:49 gillesmajor joined
16:50 <OnkelTem> davean: well, PHPStorm is not a panacea. What IDE can I use instead for Haskell programming?
16:50 gillesmajor left
16:50 <EvanR> atom, sublime
16:50 <EvanR> vim, emacs
16:50 <OnkelTem> davean: as for my experience level - it's about zero if you mean Haskell
16:50 splanch joined
16:51 <OnkelTem> and I think that's obvious from my qs
16:51 <kamyar> EvanR: I need a fast and small packet
16:51 <davean> I'd say emacs is the most used for Haskell, but theres a number of integrations
16:51 <EvanR> then you ought to use binary and custom instances to get very small size
16:51 <davean> OnkelTem: Yah, which is exactly the problem. Wanting things setup "your way" becomes reasonable once you know enough to have informed oppions about the way things are setup :)
16:51 <EvanR> on python side, use their binary parsing features
16:51 <kamyar> EvanR: Yes it does but you know binary format in languages differ
16:51 <davean> OnkelTem: so when you wanted weird, specific things with zero knowlege I ran :-p
16:51 dbeacham joined
16:52 <EvanR> kamyar: the format is up to you with Binary
16:52 <EvanR> its not a language thing
16:52 oisdk joined
16:52 <kamyar> EvanR: What u mean is writing a serializer
16:52 <EvanR> if you want very small size yes
16:52 <OnkelTem> davean: of that I'm aware and agree. Asking a proper question needs background
16:53 <kamyar> EvanR: Can I use cereal and deserialize using Python for example>
16:53 <EvanR> as i understand it, binary is more popular now
16:53 <kamyar> EvanR: I tried to use MessagePack but the libraries are not well documented and here no one could answer my ambigution
16:53 <EvanR> in which case, yes
16:53 <davean> OnkelTem: https://github.com/commercialhaskell/intero is commonly used for example, atom and sublime have some support
16:53 <EvanR> how you do it with python, youll have to ask somebody/somewhere else
16:54 jer1 joined
16:54 <kamyar> EvanR: I am a python expert and Haskell newbie!
16:54 <davean> OnkelTem: I know leksah exists but nothing about it really
16:54 <EvanR> kamyar: so, to control the binary output you write Binary instances for your data types
16:54 <davean> kamyar: maybe you want to play with pickle then ;) (this is a joke)
16:55 <kamyar> EvanR: Yes I know but then I have to write Pickle deserializer in Haskell
16:55 <EvanR> it control it on a byte by byte level with the Put monad
16:55 <EvanR> wait...
16:55 <kamyar> EvanR: I just would rather a standard format
16:55 <EvanR> i guess im totally backwards on what you wanted
16:55 <kosmikus> adamCS: there's currently no official function for doing that, but it's more or less an "FAQ", and I have some gists that do this
16:55 <davean> kamyar: I know little about it, but there is already a pickle library
16:55 <EvanR> a format you can *de*serialize in python? or
16:55 <davean> kamyar: though pickle is probably a bad choice :)
16:55 <OnkelTem> davean: (let me first finish my thought) but you see, I have PHPStorm and it claims to support Haskell development. So I opened the plugin's settings and saw paths: to cabal and to ghc-mod. I'm usign official Docker image with Haskell so I expected things like 'ghc-mod' should be there already which apparently is not the case.
16:56 <EvanR> meh
16:56 <davean> OnkelTem: ghc-mod is hardly an "official haskell" thing, whatever that would mean
16:56 <OnkelTem> okay
16:56 <kamyar> davean: Exactly! I prefer a standard format
16:56 <davean> OnkelTem: you'd want "cabal install ghc-mod"
16:56 <EvanR> pickle is by far not a standard format, neither is Binary default instances, and neither is ESD
16:56 <davean> cabal is about as official as things get
16:56 <EvanR> theres no real standard binary formats
16:57 <kamyar> EvanR: But MessagePack and CBOR are!
16:57 <davean> EvanR: well, theres RFC defined ones
16:57 muesli4 joined
16:57 <EvanR> CBOR looks cool
16:57 <kamyar> EvanR: What about BSON?
16:57 <mizu_no_oto_work> kamyar: https://github.com/well-typed/binary-serialise-cbor
16:57 <adamCS> kosmikus: Cool. Where can I find them?
16:57 <EvanR> but how do you say thats a standard format
16:57 <kosmikus> adamCS: this is one straight-forward way of doing it: https://gist.github.com/kosmikus/11523015ed5224de165354af9a40bec7
16:57 <bennofs> kamyar: what was the problem with msgpack? http://hackage.haskell.org/package/msgpack
16:57 <EvanR> kamyar: if the goal is a standardish, then write the deserializer for that in python
16:57 <kosmikus> adamCS: I think I have another approach somewhere, but I currently cannot find it.
16:57 <EvanR> if the goal is ease, then do what i said
16:58 <davean> kamyar: Hum, perhaps I missed it, but why do you care about "binary" (and I point out *any* format on a modern computer is binary0
16:58 <kamyar> bennofs: I a using GHC-8.0.2 and msgpack lib is not compatible
16:58 <bennofs> kamyar: oh I see that lib looks pretty low-level
16:58 <EvanR> the fact that you have to write the deserializer for a standard in python means... it cant really be that standard
16:58 <adamCS> kosmikus: That looks much like what I tried but I'll look again. Should it work for any two functors, not just something and identity?
16:58 <EvanR> things arent really adding up
16:58 <kamyar> EvanR: I have good libs in Python for msgpack CBOR and BSON
16:58 <EvanR> then use CBOR?
16:59 <kosmikus> adamCS: no, I don't think it works for any two, but you should be able to make it work for composition
16:59 <kamyar> EvanR: CBOR package is not production ready in Haskell and has no docs
16:59 <bennofs> kamyar: https://www.stackage.org/haddock/lts-8.9/messagepack-0.5.4/Data-MessagePack.html looks pretty straightforward
16:59 <EvanR> its already outperforming Binary in haskell
16:59 <adamCS> kosmikus: Ah. I see what may be different. Explicit SList argument to go in the from function.
16:59 <adamCS> kosmikus: Thanks!
16:59 <kosmikus> adamCS: i.e., toNPI :: NP (f :.: g) xs -> NP f (Map g xs)
16:59 <kamyar> bennofs: Yes I installed it but I am unable to use since has no docs
16:59 <kosmikus> adamCS: that should work, I think
16:59 <EvanR> kamyar: are you then, asking for help using the library?
16:59 <EvanR> it seems like a silly reason not to use an entire format
16:59 <kosmikus> adamCS: of course, you have to slightly adapt the definitions then
17:00 <Gurkenglas> auf = coerce makes me wonder if we could refactor towards auf = id, and then have "_Wrapping StateT", "_Wrapping MaybeT" etcetera gain their own names and become the primary points of interaction with those newtypes
17:00 <mizu_no_oto_work> kamyar: https://www.youtube.com/watch?v=Mj2cXQXgyWE
17:00 <OnkelTem> davean: haha thanks! cabal update && cabal install ghc-mod is now downloading the internet
17:00 <kamyar> EvanR: Yes I asked here many times and even emailed the author
17:00 <EvanR> kamyar: so are you trying to output CBOR from haskell, or read it?
17:00 fizruk joined
17:00 <kamyar> EvanR: No answer yet
17:00 <kosmikus> adamCS: this is also requested often enough that it should probably either go into the library, or into a dedicated extra library that depends on generics-sop
17:00 plutoniix joined
17:00 <bennofs> kamyar: to use it, you build your msgpack `Object` with its constructors and the use cereal's https://www.stackage.org/haddock/lts-8.9/cereal- encode/decode
17:00 <davean> OnkelTem: it'll be installed into $SOMEWHERE/.cabal/bin
17:00 <davean> where $SOMEWHERE is usually ~, but fuck if I know in a docker image
17:01 <EvanR> kamyar: it seems straight forward to me, so if you need help...
17:01 <OnkelTem> davean: it's not a problem, Dockerfiles are text files so it's clear what goes where :)
17:01 <kosmikus> adamCS: this is the other version: https://gist.github.com/kosmikus/1b40cbc4f0e6abf3f47991f2b22bfaf8 but it's not self-contained, as the definition of All_2 is not given there; but you could probably figure that out yourself :)
17:01 <kamyar> bennofs: Can u give me a sample?
17:01 <bennofs> kamyar: do you want to deserialize or serialize?
17:01 <davean> OnkelTem: this has to do with cabal's configuration though
17:02 <kamyar> bennofs: Serialize! the data would be saved in redis and then deserialized in Python
17:02 azahi joined
17:02 <kosmikus> adamCS: anyway, it's not really "better", but it defines toNPI and fromNPI as instances of a single conversion function (transNP)
17:02 t7 joined
17:02 ragepandemic joined
17:02 <kosmikus> adamCS: so in that way, it's a bit nicer, perhaps
17:02 <EvanR> kamyar: you construct a CBOR object then pass it to putCBOR to get a Put, then use that with Binary to serialize
17:02 <EvanR> to get a ByteString
17:02 <adamCS> kosmikus: I can see how it's FAQ. But it might only come up when interfacing with another library so I can also why it's not clear where it should go.
17:03 <EvanR> then send the ByteString to redis
17:03 <kamyar> EvanR: Just give me a sample I am newbie!
17:03 <EvanR> do you have the docs pulled up?
17:03 <EvanR> (no docs seems incredibly wrong here)
17:03 <kamyar> EvanR: I have used Redis successfully but the binary format..
17:03 <EvanR> https://hackage.haskell.org/package/CBOR-
17:04 <EvanR> they have examples
17:04 sssilver joined
17:04 <mizu_no_oto_work> kamyar: https://github.com/well-typed/binary-serialise-cbor/blob/master/demos/Simple.hs
17:04 <kamyar> EvanR: Where is the sample?
17:04 <EvanR> in the docs for Data.Binary.CBOR
17:04 <EvanR> see the putCBOR snippet
17:05 <EvanR> you may have not gotten anyresponse because it seems like a straightforward task to just look at the docs
17:05 <EvanR> and responding with that would be annoying ;)
17:06 allenj12 joined
17:06 <kamyar> EvanR: No! I was trying to use msgpack but it did not success. I can send my code in pastebin!
17:06 <kamyar> EvanR: and I did not find the sample u say!
17:06 <kamyar> EvanR: Anyway CBOR is not production ready as the author says
17:06 <EvanR> in what way
17:07 afarmer joined
17:07 <davean> Perhaps he means the "Alpha, interface subject to change!"
17:07 <cocreature> binary-serialise-cbor has seen production use (although for some reason it still hasn’t made it on hackage)
17:08 <davean> which pretty much describes half the Haskell ecosystem, we generally like improving things over keeping things the same
17:08 <kamyar> EvanR: The author has stated
17:08 <cocreature> or “Warning, this package is very alpha quality right now. I've attempted to implement a useful subset of the CBOR standard, but the interface is still being refined and subject to change. Do not use this for anything important! ”
17:08 watabou joined
17:08 <EvanR> oh this is a different CBOR package
17:08 <EvanR> anyway, you dont need the whole CBOR standard if youre sending your data to python
17:09 <EvanR> and whether the producing lib is subjet to change shouldnt deter you from using the format, since youre requirements are more about the format than anything else
17:09 Wuzzy joined
17:10 <kamyar> EvanR: You mean this code: let x = CBOR_Array [CBOR_UInt 42, CBOR_Float 3.14]
17:10 <EvanR> let x = CBOR_Array [CBOR_UInt 42, CBOR_Float 3.14] in runPut (putCBOR x)
17:10 <EvanR> gives you a bytestring, yes
17:10 <kamyar> EvanR: It is not what I want! I want a automated serialization which can be used with haskell records
17:10 <EvanR> you dont want to decide how its represented?
17:11 <kamyar> EvanR: BTW I need the names to extract
17:11 <kamyar> EvanR: It is standaard in CBOR!
17:11 <kamyar> EvanR: Python CBOR lib does it
17:11 <cocreature> the cbor standard does not define how to serialize haskell records
17:12 jer1 joined
17:12 <davean> cbor allows rather a large number of ways to serialize the same data
17:12 alx741 joined
17:12 <bennofs> kamyar: here is a msgpack example: https://gist.github.com/1e9c395a09257cb3c6bd46418ae0596e
17:13 <EvanR> same issue there
17:13 <cocreature> iirc binary-serialize-cbor actually provides a generics based way to serialize Haskell values
17:14 <cocreature> but if you care about the format (which you do if you want to deserialize from python) you probably want to avoid that
17:14 <kamyar> bennofs: See this then: https://pastebin.com/9JzGzaxK
17:14 insitu joined
17:14 <kamyar> bennofs: I have a GPS location object not an array
17:15 connrs joined
17:15 <bennofs> kamyar: first, that example looks completely different from my code. second, then you will need to use the ObjectMap constructor..
17:16 <bennofs> kamyar: sry, have to go now
17:16 bvad joined
17:17 <EvanR> kamyar: right, generics would help there
17:17 <EvanR> to get field names
17:17 <kamyar> EvanR: Can u help me seeing the code?
17:17 <kamyar> EvanR: Exactly! But when I used Generics, the msgpack packages give a wrong bytestring!
17:18 <EvanR> i was still thinking of CBOR
17:18 <EvanR> wrong?
17:18 <EvanR> i thought you didnt care what it looked like
17:18 <kamyar> EvanR: When I leave the mapping to GHC Generics, the extracted msgpack is [1,2],3,4]!
17:18 <kamyar> EvanR: [[1,2],3,4]
17:18 <EvanR> thats not a bytestring
17:18 zcourts_ joined
17:18 <kamyar> EvanR: an odd format! 1 is lat, 2 is long,..
17:19 <kamyar> EvanR: Hey I know< I mean when deserialized in Python
17:19 hackebeilchen joined
17:19 <kamyar> EvanR: msgpack wrongly converts is to an array without property names!
17:19 LiaoTao joined
17:19 <kamyar> EvanR: And the worse thing is that it makes a nested array!
17:19 <EvanR> when the lib doesnt do what you want
17:20 <kamyar> EvanR: So I started trying to gice the mapping manually, with no success
17:20 <EvanR> you have to do it yourself
17:20 uglyfigurine joined
17:20 <kamyar> EvanR: At last, what do u think about BSON?
17:20 dhil joined
17:20 <EvanR> i tend to ignore bson since its associated with mongo
17:21 <kamyar> EvanR: thanks anyway
17:21 <EvanR> unraveling the 19 arbitary requirements, i would have gone with a text format
17:21 <EvanR> like json
17:21 <EvanR> or s-expression
17:22 <EvanR> you can gzip json or an s-expression to save space
17:22 codesoup joined
17:22 <okuu> Let me see if I actually understand this Jacobian thing: an invertible change of variables is locally a change of basis?
17:22 <t7> is there a lispy name for init?
17:22 <okuu> Opos.
17:22 <okuu> Oops.
17:22 <cocreature> EvanR: I tend to stick with text-based formats until I want to have binary data in one of the fields. I just can’t get myself to base64 encode things if I could just use cbor or something like that
17:23 <okuu> Wrong channel.
17:23 <kamyar> EvanR: Thanks fellow!
17:23 <EvanR> cocreature: heh, binary data. array-of-integers for the win!
17:23 <EvanR> now its not base64
17:24 <cocreature> I’m not sure if I should be impressed that you came up with this or disgusted
17:24 mmachenry joined
17:24 <EvanR> cocreature: youre right, if this were real life i would "just use CBOR"
17:24 baldrick joined
17:24 ozgura joined
17:24 <EvanR> apparently theres an issue with that in this case, though not sure what
17:28 XorSwap joined
17:29 Berra joined
17:29 <tippenein> why would ghcid exit unexpectedly for ghcid --command 'cabal build' inside a nix-shell ?
17:30 <srhb> tippenein: Presumably because cabal build exits?
17:30 <srhb> tippenein: The command is usually assumed to be ghci or cabal repl or something like that, which doesn't just exit.
17:30 <srhb> (I'm just guessing though)
17:30 <tippenein> ah yes. you're right
17:31 <tippenein> ghci doesn't work in ghcjs
17:31 <tippenein> is why I was using cabal build (incorrectly) in the first place
17:31 <srhb> tippenein: Why not develop "interactively" using ghc, then switching afterwards?
17:33 <tippenein> seems possible. Not sure how to do that with the nix shell I have rn
17:33 jer1 joined
17:33 <srhb> tippenein: Parameterize the ghc.
17:34 <srhb> tippenein: So you can use either pkgs.haskell.compiler.ghc802.callPackage or the ghcjs equivalent
17:34 <srhb> tippenein: (or whichever paths you're using)
17:35 mizu_no_oto_work joined
17:35 be5invis joined
17:36 peanuts5566 joined
17:37 <adamCS> kosmikus: So that all compiled, which is good. But now, trying to use it, I get GHC complaining, basically, that it can't deduce that (Map f xs) is an instance of SListI. Which makes sense, since it's not. And I can't make an instance for a type family due to lack of injectivity, right? So this functor shifting has some limits to its usefulness?
17:37 <srhb> tippenein: Or maybe in shell.nix: `if pkgs.lib.inNixShell then (ghc.callPackage file.nix {}).env else ghcjs.callPackage file.nix {}
17:37 peanuts5566 left
17:37 <srhb> (Though i suppose that's really needless if you're already using both a default.nix or shell.nix...)
17:38 blender joined
17:38 JonReed joined
17:39 takle joined
17:40 Wuzzy2 joined
17:42 peterbec` joined
17:44 replay joined
17:46 <kosmikus> adamCS: you can just add the constraint to the functions that use it. once xs becomes known, GHC can resolve it all.
17:46 albertid joined
17:46 yellowj joined
17:47 <kosmikus> adamCS: if that's not acceptable, you should be able to use the functions in Generics.SOP.Dict to compute a dictionary at run-time and make that available by pattern matching on it.
17:50 <ExpHP> huh. looks like the "Turtle with Stdout" wrapper I wrote last month was basically reinventing "ConduitM () String IO"
17:50 <ExpHP> Heck, Shell itself seems to just be "ConduitM () Void IO"
17:50 ft3 joined
17:51 <ExpHP> wellImeanonceyoulookpasttheimplementation
17:51 zcourts joined
17:52 <EvanR> i dont see implementations anymore, just blond, brunette, redhead
17:53 <cocreature> EvanR: obviously pipes has red hair but does machines have brunette or blond hair?
17:53 <ExpHP> now that my Eggshell is useless I can't make any more egg-related puns ;_;
17:54 <EvanR> spoon
17:54 <ExpHP> is noops backwards
17:56 jer1 joined
17:56 chichou joined
17:58 barua joined
18:00 uglyfigurine joined
18:00 afarmer joined
18:00 gawen joined
18:01 <ExpHP> ah, and look at that, the conduit tutorial links to the foldl package when discussing the space complexity of ZipSink
18:01 <ExpHP> (the foldl package, of course, being the basis of turtle shells)
18:02 Wuzzy2 joined
18:02 leat joined
18:02 zcourts_ joined
18:03 crobbins joined
18:03 jstnndrsn joined
18:03 jstnndrsn left
18:03 nycs joined
18:04 ragepandemic joined
18:06 phaji joined
18:08 watabou joined
18:10 zcourts joined
18:10 {emptyset} joined
18:11 cdg_ joined
18:12 <tippenein> srhb: I passed ghc as an input, but the package depends on ghcjs-base and such, so there's no chance it'll build with ghc afaik
18:13 oeuhrcy joined
18:13 raichoo joined
18:14 oeuhrcy left
18:14 <srhb> tippenein: Ah :/
18:14 takle joined
18:15 biglambda joined
18:15 leu joined
18:15 <leu> hi
18:15 leu left
18:16 barua joined
18:16 Itkovian joined
18:16 <tippenein> actually.. ghcjs-base should be available in ghc because it'll compile to webkitgtk or something
18:16 carlosda1 joined
18:16 jer1 joined
18:16 dcoutts_ joined
18:17 govg joined
18:21 hsk3 joined
18:22 sepp2k joined
18:22 slomo joined
18:24 nilton joined
18:25 laplacian joined
18:25 nmdanny joined
18:26 zcourts_ joined
18:26 <nmdanny> does anyone know how to force stack to use a patched ghc distro (the ones from here https://mail.haskell.org/pipermail/ghc-devs/2017-April/014131.html) ?
18:26 phaji joined
18:27 <bennofs> nmdanny: I don't know how it works exactly, but you can tell stack to use a different bindist for the compiler
18:27 nomotif joined
18:27 <bennofs> nmdanny: https://github.com/commercialhaskell/stack/blob/master/doc/yaml_configuration.md#setup-info looks like it
18:27 <nmdanny> I tried setting a custom setup-info and ghc-variant, but according to the logs it keeps downloading from commericalhaskell
18:27 pungi-man joined
18:27 locallycompact joined
18:28 angryMonk left
18:28 <bennofs> oh, that's what I would have done as well. no idea then, sorry :/
18:28 maarhart joined
18:29 <nmdanny> do the custom setup-info and ghc-variant have to be on my global project stack yaml?
18:30 <nmdanny> aka C:\sr\global-project\stack.yaml
18:31 magneticduck joined
18:32 zcourts joined
18:32 <nmdanny> because it seems it just ignores the settings from that file
18:33 osa1_ joined
18:34 <bennofs> nmdanny: i think it needs to be in your project yaml
18:34 <bennofs> nmdanny: not global one
18:35 kamyar joined
18:36 <kamyar> Hey please fix my code
18:36 cyborg-one joined
18:36 <kamyar> http://lpaste.net/354708
18:37 <pikajude> > let mycode = undefined in fix mycode
18:37 <lambdabot> *Exception: Prelude.undefined
18:37 <pikajude> oh dear
18:37 bhiliyam joined
18:37 jer1 joined
18:37 <nmdanny> weird, even in my project yaml, it just ignores my settings
18:37 augur joined
18:37 <kamyar> pikajude: I pasted it.
18:38 revprez_atlanta joined
18:38 <kamyar> What is wrong with my code?
18:39 <kamyar> I get parsing error
18:39 <hexagoxel> you are using tabs.
18:39 <kamyar> hexagoxel: thnx!
18:40 <hexagoxel> replace each tab with 4 spaces, might already fix it.
18:40 Guest55 joined
18:41 <kamyar> hexagoxel: I did! It fixed!
18:42 <nmdanny> seems like I can install the patched ghc with the following command: "stack setup --ghc-bindist "https://downloads.haskell.org/~ghc/8.0.2/ghc-8.0.2-x86_64-unknown-mingw32-win10.tar.xz" --ghc-variant windows64"
18:43 <hexagoxel> good, now configure your editor to insert spaces on tab so this does not happen again :p
18:43 <nmdanny> but it still ignores the global yaml
18:43 peterbec` joined
18:44 MrWoohoo joined
18:45 somewone joined
18:45 osa1 joined
18:46 Berra left
18:47 <geekosaur> if you have a local stack.yaml then it does not use the global one
18:48 Sh4rPEYE joined
18:48 <nmdanny> yes but it seems like even when running globally (not in a project folder) it just ignores those settings
18:51 Berra joined
18:51 jao joined
18:55 pandabo joined
18:56 unK_ joined
18:58 jer1 joined
19:00 ubsan_ joined
19:01 dcoutts_ joined
19:01 <adamCS> kosmikus: Thanks! I will need to fiddle some with how I planned to use it in order to make that possible. We'll see how it goes...
19:02 `^_^v joined
19:04 connrs joined
19:04 Zemyla joined
19:05 ragepandemic joined
19:07 maarhart joined
19:09 <Zemyla> Oh, you know the whole trick to only reduce a value to root normal form once, right?
19:10 vektorweg11 joined
19:10 watabou joined
19:10 <Zemyla> data Once a = Once () a; once :: NFData a => a -> Once a; once a = Once (rnf a) a; instance NFData (Once a) where rnf (Once () _) = ();
19:13 ericmath1son joined
19:14 biglambda joined
19:15 blender joined
19:15 fgaz joined
19:17 slomo joined
19:17 slomo joined
19:18 jer1 joined
19:19 hackebeilchen1 joined
19:20 fgaz_ joined
19:21 darjeeling_ joined
19:21 tapirus_ joined
19:21 oisdk joined
19:21 veshhij joined
19:22 Destol joined
19:22 conal joined
19:22 takle joined
19:22 <veshhij> #lambdabot
19:23 veshhij left
19:25 <edwardk> i remember writing that trick
19:26 <adamCS> kosmikus: Any pointers on deriving the dictionary? The functions in Generics.SOP.Dict are all about constraints on items in the typelists but not much about proving that things are, in fact, typelists. But I'm sure I'm missing something.
19:27 afarmer_ joined
19:27 Sh4rPEYE joined
19:29 s_spiff joined
19:30 PennyNeko joined
19:31 fgaz_ joined
19:31 pandabo joined
19:31 takle joined
19:32 kosorith joined
19:33 Itkovian joined
19:34 biglambda joined
19:35 mda1 joined
19:38 revprez_atlanta joined
19:40 hackebeilchen joined
19:40 baldrick joined
19:41 balor joined
19:42 marfoldi joined
19:42 jer1 joined
19:43 akr[m] joined
19:43 s_spiff joined
19:43 <dmj`> adamCS: you’re playing with GHC.Generics?
19:43 <adamCS> dmj': Yes, but via generics-sop
19:43 muesli4 joined
19:44 <adamCS> dmj`: ^
19:44 <akr[m]> hi guys, just a quick question: can it ever happen that calling `show` on a value of type `Int` returns the empty string?
19:44 <dmj`> adamCS: I see, just curious, what are you trying to do
19:45 <kadoban> akr[m]: I don't see how it could, no.
19:45 peterbec` joined
19:45 nschoe joined
19:45 <akr[m]> kadoban: yeah I think so as well
19:45 Wuzzy2 joined
19:45 <akr[m]> thank you
19:45 <dmj`> akr[m]: no, that wouldn’t be possible
19:46 coot joined
19:46 <dmj`> > map show [maxBound :: Int, minBound, 0]
19:46 <lambdabot> ["9223372036854775807","-9223372036854775808","0"]
19:46 carlosda1 joined
19:47 <adamCS> dmj`: That's a long story! The short version is that I am trying to take a product type with a Generic instance (Generics.SOP version of Generic, but that is derivable from GHC.Generics.Generic), convert it into the generic product form which generics-sop provides, a list paramterized by a functor and typelist and then "sequence" the functor out. I can do that easily enough withing generics-sop for an applicative functor.
19:47 <adamCS> However...
19:47 jeltsch joined
19:47 <akr[m]> dmj`: cool :) just a few more values to check… ;)
19:47 <akr[m]> hm I wonder how long would it actually take
19:47 <adamCS> In my particular case, I have a more efficient sequence function available but it acts on DMap (dependent-map).
19:48 hackebeilchen joined
19:48 <kadoban> akr[m]: 2^64 operations is not in the fun zone of computing. That's towards "brute-force solve crypto" zone.
19:49 <akr[m]> > yeah
19:49 <dmj`> akr[m]: how long what would take?
19:49 <akr[m]> I'll let the bot be :)
19:49 akfp left
19:49 <dmj`> any null . map show . enumFromTo minBound $ (maxBound :: Int) ?
19:50 <adamCS> Which would still be fine. I can convert NP f xs into DMap k f where k is some DMap key that is made for the TypeList xs. But, I have a functor which is a composition of the thing I want to sequence and something else. But my DMap function (from a library) only works for the functor uncomposed. SO I am trying to shift the composed functor into the typelist, do the sequencing via DMap, and then shift it back.
19:50 CoderPuppy joined
19:50 ompaul joined
19:51 dijonmustard1231 joined
19:51 <akr[m]> dmj`: bonus points for making it run parallel with map-reduce
19:51 <adamCS> dmj`: Which might be the long way round but, for now, seems more likely than re-writing the library. I've almost got it except for a constraint that I am having trouble satisfying at the call site.
19:52 <dmj`> adamCS: could you paste code :)
19:53 <adamCS> dmj`: https://pastebin.com/gdWtwCd0
19:54 Wuzzy3 joined
19:54 <adamCS> which all compiles (except for the incomplete proof near the botttom). But I want the last function to work without the explicit "SListI (AddFunctor g xs) constraint"
19:54 dpren joined
19:55 cdg joined
19:56 boombanana joined
19:56 <adamCS> and I think what kosmikus suggested above is that I ought to be able to construct that proof and thus not need the explicit SListI (AddFunctor g xs) constraint. But I don't know how.
19:57 statusbot joined
19:59 Itkovian joined
20:00 uglyfigurine joined
20:00 burtons joined
20:00 sleffy joined
20:01 flatmap13 joined
20:01 jer1 joined
20:01 uglyfigurine joined
20:03 statusbot joined
20:04 cpup joined
20:04 takle joined
20:06 ragepandemic joined
20:06 mada joined
20:08 hackebeilchen1 joined
20:09 nahra joined
20:10 takle joined
20:10 <kosmikus> adamCS: https://gist.github.com/kosmikus/0bedbd1b3eb1c5037bc8bcb8d35a56ba
20:10 peterbecich joined
20:11 watabou joined
20:13 <adamCS> kosmikus: Thanks! I will give that a tryr!
20:13 <adamCS> try!
20:13 beanbagu1 joined
20:14 uglyfigurine joined
20:15 twanvl joined
20:15 <shapr> Igloo: remember your idea about making lambda frisbee/boomerangs? Did you ever find a boomerang that's close to a lambda?
20:15 <dmj`> akr[m]: it still takes a while, even with parallelism
20:15 <dmj`> think it’s due to allocating all those strings
20:15 ertes joined
20:16 <ertes> helo again
20:16 hackebeilchen joined
20:16 <ski> ehlo ertes@2a02:8070:249d:9a00:7eb0:c2ff:fe8c:3228
20:16 <shapr> VRFY ski
20:17 <Tuplanolla> Can you help me understand this lambda obsession some functional programmers have, shapr? It's not like imperative programmers want everything to look like register machines.
20:17 sleffy joined
20:17 mr_sm1th joined
20:17 <* ski> is rusty about SMTP
20:17 <ertes> BLUB
20:17 meoblast001 joined
20:17 <ertes> Tuplanolla: "lambda obsession"?
20:17 <shapr> Tuplanolla: my first thought is that people like icons/symbols that identify them as part of a group.
20:18 <ertes> as in "FP is about lambdas"?
20:18 <shapr> Tuplanolla: although imperative code makes so much money it should be a cash register symbol :-P
20:18 Wuzzy joined
20:18 <Tuplanolla> Good one.
20:19 acarrico joined
20:19 <shapr> Tuplanolla: what do you think about my theory that it's about belonging to a group with an identifying icon?
20:19 <Igloo> shapr: I don't remember that at all, I'm afraid
20:20 <Tuplanolla> I don't think much, shapr.
20:20 mizu_no_oto_work joined
20:20 amf joined
20:20 <shapr> Igloo: fair enough, I think we discussed it the last time we met in person.
20:20 <shapr> What was that, ten or twelve years ago?
20:20 <cocreature> Tuplanolla: thinking is quite powerful. I can highly recommend it
20:20 <shapr> Sometimes I remember too much
20:20 <dmj`> akr[m]: https://gist.github.com/dmjio/fb34311de75dd9e4d5c9d8a19545b454
20:20 <Tuplanolla> I wouldn't want to end up with a thinking problem like my uncle did, cocreature.
20:21 <shapr> oookay, I want to hear that story
20:21 <Zemyla> I have a quick question.
20:21 <cocreature> he thought too much and then his brain exploded?
20:21 <shapr> Zemyla: ooh, ask a slow one instead!
20:21 <Zemyla> Why is tail [] not [], like drop 1 [] be?
20:21 <Zemyla> *woudl be
20:21 <Zemyla> *would
20:22 <cocreature> Zemyla: I don’t think there is any fundamental reason. it just happens to be defined like that
20:22 jer1 joined
20:22 <Tuplanolla> It has nicer algebraic properties for the cases it's defined at all, Zemyla.
20:23 beanbagula joined
20:23 moth joined
20:24 <* ski> . o O ( "In the Lambda Order they are all first-class. / One Thing to name them all, One Thing to define them, / One Thing to place them in environments and bind them, / In the Lambda Order they are all first-class." )
20:26 ChaiTRex joined
20:27 <Igloo> shapr: Was that at ICFP Uppsala? If so, 2003 it looks like
20:27 <ertes> Zemyla: i guess it's supposed to reflect a field of the (:) constructor
20:28 <ertes> just like a field of a sum type is partial, unless it occurs in every constructor
20:28 <shapr> Igloo: ok, maybe it was 14 years ago
20:28 <shapr> I was ... vaguely close?
20:28 <EvanR> field of a sum type doesnt really make sense
20:28 <ertes> Zemyla: like that: data [a] = [] | (:) { head :: a, tail :: [a] }
20:28 <shapr> Igloo: I haven't seen you in forever! Want to come to HacBoston in July?
20:28 <EvanR> records are not sums
20:28 <ertes> in fact i wish it were defined like that
20:29 <ertes> EvanR: haskell allows it though
20:29 Wuzzy2 joined
20:29 <EvanR> yeah and PHP allows you to modify a variable variable
20:29 <ertes> @let List a = Nil | Cons { lhead :: a, ltail :: List a } deriving (Eq, Foldable, Functor, Ord, Show, Traversable)
20:29 <Igloo> shapr: Don't fancy your odds there. But if you're going to ICFP this year then I'll be pretty close by ;-)
20:29 <ertes> @let data List a = Nil | Cons { lhead :: a, ltail :: List a } deriving (Eq, Foldable, Functor, Ord, Show, Traversable)
20:29 <ertes> oh
20:30 <ertes> tsunderebot is gone
20:30 <EvanR> can do it -/-> should do it
20:30 <shapr> Igloo: ok, I'll sign up for ICFP
20:30 Eduard_Munteanu joined
20:30 <shapr> would be nice to see you again
20:31 preyalone joined
20:31 mmachenry joined
20:34 HarveyPwca joined
20:34 raichoo joined
20:34 <ski> tsunderebot ?
20:35 <ChaiTRex> lambdabot isn't here.
20:35 <* ski> thought it was lambdabot who was napping
20:35 <ski> aye
20:37 <sm> quick, now we can plot the overthrow of lambdabot
20:37 Itkovian joined
20:37 <ertes> ski: tsu… lambdabot has insulted more than any human on IRC
20:38 <ertes> *insulted me
20:38 bhiliyam joined
20:38 <akr[m]> dmj`: hey that's pretty cool, I hadn't seen that monad before
20:38 <sm> it's drunk on power!
20:38 <ski> .. but who is tsunderebot ?
20:38 <ski> a backup lambdabot ?
20:39 WarmCookie joined
20:41 <Jinxit> a joke
20:42 Wuzzy2 joined
20:43 jer1 joined
20:46 peterbec` joined
20:49 hybrid joined
20:49 cdg joined
20:50 jsgrant__ left
20:51 Itkovian joined
20:51 cdg joined
20:52 CoderPuppy joined
20:53 cdg joined
20:53 fizruk joined
20:55 zeroed joined
20:57 sssilver joined
20:57 flatmap13 joined
21:00 flatmap1_ joined
21:00 biglambda joined
21:00 cdg_ joined
21:03 cpup joined
21:03 pandabo joined
21:03 jer1 joined
21:04 ft3 joined
21:05 Wuzzy2 joined
21:06 pera joined
21:06 xaturn joined
21:06 ragepandemic joined
21:06 Boomerang joined
21:08 Iceland_jack joined
21:09 pandabo joined
21:09 sssilver joined
21:09 cdg joined
21:09 danthemy_ joined
21:11 danthemy_ joined
21:12 danthemy_ joined
21:12 Wuzzy3 joined
21:13 biglambda joined
21:14 darjeeling_ joined
21:14 obadz joined
21:19 zcourts_ joined
21:20 biglambda joined
21:21 umib0zu left
21:23 angryMonk joined
21:24 <ertes> does anyone a library to resolve relative URLs against an absolute URL?
21:24 jer1 joined
21:24 <ertes> something like: absoluteAt "https://myhost/blah?blubb=x" "//myhost/y" = "https://myhost/y"
21:25 markasoftware joined
21:25 shesek joined
21:26 <ertes> ah, network-uri can do it apparently
21:26 dfeuer joined
21:26 locallycompact joined
21:29 Spondyl joined
21:30 MP2E joined
21:32 epsilonhalbe joined
21:32 <OnkelTem> Guys, 'cabal install' when launched under root installs everything fine into /root/.cabal/*. But when I run it under user - it doesn't create directories under ~/.cabal except of 'packages' directory
21:32 <OnkelTem> Any ideas why?
21:32 <ezyang> post your logs?
21:33 <angryMonk> huh
21:33 <angryMonk> that's odd
21:33 <angryMonk> what system you're using?
21:33 zcourts joined
21:33 <angryMonk> also, why are you installing as root
21:33 nerarith joined
21:33 <angryMonk> pretty sure cabal doesn't require root access
21:33 fmmarques joined
21:34 <angryMonk> OnkelTem
21:34 sigmundv joined
21:34 <OnkelTem> http://paste.adyax.com/6c2383f
21:35 <OnkelTem> system is debian jessie
21:35 Wuzzy3 joined
21:35 <angryMonk> huh
21:35 <sternenseemann> Zemyla: also if tail was drop 1, you couldn't tell if the list l was empty or of length 1, if tail l == []
21:36 <Zemyla> And having tail [x] = [], tail [] = _|_ is better?
21:37 <angryMonk> OnkelTem, the only reason I can think of is the fact you're using root
21:37 <angryMonk> is there a specific reason?
21:38 <angryMonk> look like everything installed properly
21:38 <angryMonk> the only benefit you have for using root is the ability to use it for other accounts
21:38 <sternenseemann> Zemyla: I guess so, but not optimal, best would be having head :: [a] -> Maybe a and tail :: [a] -> Maybe [a]
21:38 <angryMonk> as for the packages, they're usally user-specific
21:39 <angryMonk> try using another username
21:41 Wuzzy2 joined
21:42 <OnkelTem> let me try
21:44 <OnkelTem> angryMonk: lol, I've created another user (test123) and now it runs fine, haven't finished yet though
21:45 jer1 joined
21:45 <angryMonk> sweet
21:45 <angryMonk> well, enjoy your weird build
21:45 <OnkelTem> how that could be? damn it
21:45 <OnkelTem> and my build is... a moment
21:46 akr[m] left
21:47 peterbec` joined
21:49 muesli4 joined
21:49 <OnkelTem> I'm installing from this repo: https://launchpad.net/~hvr/+archive/ubuntu/ghc
21:50 <OnkelTem> it's actually a dockerfile, this one: https://github.com/freebroccolo/docker-haskell/blob/5f1ae82bd27501322100b915c9ae6cc9f9aea129/8.0/Dockerfile
21:51 <OnkelTem> Which is a part of this distribution: https://hub.docker.com/_/haskell/
21:51 <OnkelTem> called an "official"
21:52 zero_byte joined
21:52 sleffy joined
21:53 hiratara joined
21:53 tigerfinch joined
21:58 revprez_atlanta joined
21:58 |DM| joined
21:59 mjhoy joined
22:00 msko joined
22:02 chichou joined
22:02 e14 joined
22:04 epsilonhalbe left
22:04 iqubic joined
22:04 <iqubic> Has anyone written 99 Bottles of Beer in Haskell.
22:05 ft3 joined
22:05 <iqubic> Takes no input. Output the song "99 Bottles of Beer" to either a text file, or stdout.
22:05 zcourts joined
22:05 <glguy> Yeah, that'll be pretty easy to find with Google
22:05 jer1 joined
22:06 sigmundv_ joined
22:07 ExpHP joined
22:07 isenmann joined
22:07 ragepandemic joined
22:07 oisdk joined
22:08 <hpc> iqubic: might i interest you in https://hackage.haskell.org/package/acme-hq9plus
22:09 flatmap13 joined
22:09 <iqubic> What is that???
22:09 zero_byte joined
22:10 beerdrop joined
22:10 mjora7 joined
22:10 <glguy> It's a URL. If you activate it your default web browser should open it
22:10 <hpc> haha
22:10 <hpc> it is among other things, a DSL for writing 99 bottles of beer
22:10 <iqubic> No, I mean, how does the code work???
22:11 <hpc> well you run it, and your machine interprets the bytes as opcodes for the processor
22:11 <iqubic> http://www.99-bottles-of-beer.net/language-haskell-1070.html
22:11 <iqubic> I like that version better.
22:11 <glguy> iqubic: How does it work?
22:12 <iqubic> glguy: Well, you put it in a .hs file and you compile it with ghc.
22:12 <iqubic> Then you run it.
22:13 <glguy> Oh, I meant: How does it work???
22:13 <hpc> lol
22:14 twanvl joined
22:14 watabou joined
22:15 soniku joined
22:16 locallycompact joined
22:16 <Tuplanolla> That's one up from "just fine; thanks for asking".
22:18 dcoutts joined
22:18 anuxivm joined
22:18 chichou joined
22:18 SchwarzeLocke1 joined
22:18 netheranthem joined
22:18 <dfeuer> iqubic: the bottles of beer should use mapM_ or traverse_, not mapM.
22:19 <dfeuer> Efficiency isn't key when drinking, but there's no reason to waste *that* much.
22:19 chichou left
22:20 e14 joined
22:20 aib joined
22:20 <mjora7> Could a Haskell whiz show me the most efficient program that counts the number of primes between 1 and 1,000,000? I can do it, but slowly... Looking for some efficiency tricks.
22:21 <mjora7> Actually I have a more nuanced question... Let me just paste some code first.
22:22 <kadoban> A sieve should be able to do it quite quickly. https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes , if you want to implement it in haskell you can use strict arrays like STUArray or something, or something cute like https://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf
22:22 <ChaiTRex> There's also a primes section on the Haskell wiki.
22:22 amut joined
22:22 <Tuplanolla> :t Data.Vector.create -- I recommend this function, mjora7.
22:23 <ChaiTRex> Kind of hard to get things working because they throw functions in random places, but it's here: https://wiki.haskell.org/Prime_numbers
22:24 jmcarthur joined
22:24 <Tuplanolla> Or is it `Data.Vector.Unboxed.create`? Our robotic maid isn't around to tell.
22:25 <ChaiTRex> Are there unboxed vectors?
22:25 <ChaiTRex> Oh, never mind.
22:25 urodna joined
22:26 jer1 joined
22:26 <ertes> anyone have an idea how to figure out the maximum file name length for the current platform without brute-forcing exceptions?
22:26 <mjhoy> is it possible to use a lens to update a structure only when given a Just value, and to leave it unchanged with a Nothing?
22:26 lambdabot joined
22:27 <ertes> @let given True = id; given False = const pure
22:28 <lambdabot> Defined.
22:28 <davean> ertes: PATH_MAX?
22:28 <ertes> > (_1 . given True +~ 5) (10, 20)
22:28 <AWizzArd> > do a <- randomR (1,10); return a; $ (mkStdGen 0)
22:28 <lambdabot> (15,20)
22:28 <ertes> > (_1 . given False +~ 5) (10, 20)
22:28 <lambdabot> (4,40014 40692)
22:28 <lambdabot> (10,20)
22:29 <ertes> mjhoy: would that be good enough?
22:29 <AWizzArd> How can I make this return an Int?
22:29 <AWizzArd> Where should the type annotation go?
22:29 <ertes> AWizzArd: (1, 10 :: Int)
22:29 <mjhoy> ertes: interesting, thanks, will have to study that (very new to lens)
22:29 <AWizzArd> > do a <- randomR (1,10 :: Int); return a; $ (mkStdGen 0)
22:29 <lambdabot> (4,40014 40692)
22:30 AfC joined
22:30 <nshepperd> mjhoy: what does "when given a Just value" mean? you mean the initial value of the field?
22:30 <AWizzArd> Hmm. Still double.
22:30 <davean> ertes: although, its not like two different paths will necissarily have the same limits ...
22:30 <ertes> mjhoy: it's a traversal that points to the whole thing, if True or nothing, if False
22:30 <davean> ertes: So, you can't even real brute force it, since "it" isn't some actual value
22:30 <mjora7> So I realize that using a Sieve is a better way to compute primes. I'm doing it here in a brute force way, is this just the wrong way to tackle the problem in Haskell? https://gist.github.com/aryaforghani/cda8601b2350d68fea1dd325767c1ec6#file-primes-hs
22:31 <ertes> davean: yeah… unfortunately it's annoyingly difficult to catch this particular exception, and in fact i'd prefer not to have it thrown at me in the first place
22:31 <mjora7> Also any naming convention suggestions would be much appreciated.
22:31 hiratara joined
22:31 <davean> ertes: well, at least POSIX specifies a min value for the max path length?
22:31 <mjhoy> nshepperd: this doesn't make sense in terms of types i think, but i was thinking of:
22:31 <mjhoy> (2,2) & _1 <something> (Just 1) == (1,2)
22:32 <ertes> mjora7: well, a sieve is MUCH MUCH MUCH faster
22:32 <mjhoy> (2,2) & _1 <something> Nothing == (2,2)
22:32 <mjhoy> where <something> does what I want.
22:32 <ertes> mjora7: trial division will find like the first few thousand primes in a second, while a sieve will easily find millions
22:32 torgdor joined
22:32 <kadoban> mjora7: Well, it's wrong in that it's slow to do it that way, but that's not specific to haskell. It's slow to do it that way in any language I know of.
22:32 <davean> ertes: What makes it so hard to catch?
22:32 Wuzzy2 joined
22:33 netheranthem joined
22:34 <nshepperd> mjhoy: I see. Yes, implementing your <something> certainly seems possible
22:34 <kadoban> There's a few simple ways to speed up what you're doing a bit, like not trying to divide by every odd number, only the primes you found so far, stopping earlier than x-1, etc., but they won't make it pleasant to do for large numbers anyway.
22:34 <ertes> davean: i'd probably have to take apart the generic IOException, get the errno value and match it… then i'd need to make the filename shorter and try again in a loop
22:34 <ChaiTRex> There's wheel factorization or whatever it's called as well.
22:35 <kadoban> Yeah, that'll also help a bit, but not that much relatively.
22:35 <davean> ertes: catchJust?
22:35 <ertes> wheel factoring is actually a kind of sieve… it uses sieving to eliminate many trial divisions, while gives a constant-factor boost in speed
22:35 <ertes> but the factor is typically somewhere around 10 and 100
22:35 <ertes> still way slower than a full sieve
22:35 <ertes> davean: sure
22:35 Engen joined
22:36 <ertes> s/while/which/
22:36 <ertes> mjora7: BTW, here is an implementation of a completely pure sieve: https://github.com/esoeylemez/snippets/blob/master/PurePrimeSieve.hs
22:36 <ChaiTRex> Does sieving exclusively involve using an array (or equivalent) of booleans for each number?
22:37 <davean> ertes: I guess I'm not seeing the challenge
22:37 <ertes> it's not much faster than trial division unfortunately, because to get the real advantages of a sieve you need mutability
22:37 <ertes> davean: it's just inconvenient
22:37 <ertes> ChaiTRex: yes
22:37 torgdor joined
22:38 <ij> Why does «stack image container» add a Dockerfile inside the image's root?
22:38 {emptyset} joined
22:38 <ertes> here is an actual sieve: http://lpaste.net/101980
22:38 <ertes> one that uses a compact mutable vector
22:38 bhiliyam joined
22:39 <nshepperd> > (1,1) & _1 `setMaybe` (Just 22) & _2 `setMaybe` Nothing -- mjhoy
22:39 <lambdabot> (22,1)
22:39 <nshepperd> (setMaybe l (Just x) = l .~ x; setMaybe l Nothing = id)
22:39 <ChaiTRex> Have there been any Haskell implementations of the Sieve of Atkin?
22:40 torgdor joined
22:40 <kadoban> ertes: The one o'neill came up with isn't exactly blazing fast comparatively, but it's way better than trial division at least, and doesn't use what I'd call mutability.
22:40 <ertes> ChaiTRex: the arithmoi library might use it
22:40 <mjhoy> nshepperd: hehe I just wrote that out!! found the definition for set' which was helpful.
22:40 <mjora7> Ok thanks for the suggestions.
22:41 <ChaiTRex> ertes: Ahh, unfortunately not yet: "Currently, an enhanced sieve of Eratosthenes is used, switching to an Atkin sieve is planned (if I get around to implementing it and it's not slower)."
22:41 eschnett joined
22:41 <ertes> kadoban: i'd consider that an implementation detail… write a super-fast sieve once, test it will, then reuse it forever
22:41 flatmap13 joined
22:42 <ertes> kadoban: the mutability doesn't need to be exposed (see e.g. arithmoi)
22:42 Koterpillar joined
22:43 <mjhoy> nshepperd: that was much simpler than I thought. Thanks!
22:43 <kadoban> True. I found it interesting though regardless, though not really for practical reasons.
22:43 flatmap13 joined
22:43 <ertes> wow, i suck at typing these days
22:43 <ertes> s/will/well/
22:44 <* ertes> should get more sleep
22:44 <kadoban> Heh, didn't even notice that one.
22:44 <ertes> your brain kindly auto-corrects my mistakes =)
22:44 <kadoban> Indeed :)
22:47 jer1 joined
22:50 jimmyrcom joined
22:52 e14 joined
22:52 sleffy joined
22:57 Iceland_jack joined
22:58 <benzrf> life goals: se On GP live
22:58 <benzrf> oops wrong channel :(
22:58 indi_ joined
22:59 <EvanR> nice password
22:59 dan_f joined
23:00 ragepandemic joined
23:00 <benzrf> not a password
23:00 biglambda joined
23:00 prophile joined
23:01 uglyfigurine joined
23:01 NoCreativity joined
23:01 abel-abel joined
23:03 nakal joined
23:03 Wuzzy3 joined
23:03 bhiliyam joined
23:03 carlosda1 joined
23:05 taktoa_ joined
23:05 markus1209 joined
23:05 soniku joined
23:05 markus1219 joined
23:06 bjz joined
23:06 moth joined
23:07 MindlessDrone joined
23:07 jer1 joined
23:09 theDon_ joined
23:12 Jesin joined
23:12 abel-abel joined
23:13 zcourts_ joined
23:14 shesek joined
23:14 Wuzzy3 joined
23:15 watabou joined
23:16 nicknovitski joined
23:18 sellout- joined
23:18 eacameron joined
23:20 epta joined
23:20 ystael joined
23:20 myme joined
23:21 e14 joined
23:23 xcin joined
23:23 Wuzzy3 joined
23:23 zcourts joined
23:24 bennofs joined
23:24 gugah joined
23:27 darlan joined
23:28 phyrex1an joined
23:28 jer1 joined
23:28 le_frogballs joined
23:29 youmu_ joined
23:30 phyrex1an joined
23:32 Sam__ joined
23:34 e14 joined
23:47 dubois joined
23:48 alunduil joined
23:49 jer1 joined
23:49 peterbec` joined
23:50 texasmynsted joined
23:50 tennix joined
23:50 jophish joined
23:52 noan joined
23:55 eschnett joined
23:55 dubois joined
23:56 YongJoon joined
23:57 le_frogb_ joined
23:58 ddere joined
23:59 tennix joined