<    June 2018     >
Su Mo Tu We Th Fr Sa  
                1  2  
 3  4  5  6  7  8  9  
10 11 12 13 14 15 16  
17 18 19 20 21 22 _2_3  
24 25 26 27 28 29 30
00:01 <nshepperd> butterthebuddha: my guess is a nested invocation of parseAtom inside of parseVector has broken the parse by eating too many characters
00:01 <butterthebuddha> nshepperd: My test case was [1 2 3]
00:01 <butterthebuddha> So the parser should break out by parsing an int :/
00:01 tabemann joined
00:01 <nshepperd> butterthebuddha: i don't see ']' in your list of badChars
00:02 <mreh> angerman, thx
00:02 <mreh> I'll give it a go
00:03 <mreh> angerman, would iconv be part of the built library if I was just doing SDL stuff?
00:03 <butterthebuddha> nshepperd: A symbol should be allowed to have "[]" in it; a '[' starts a vector if and only if there is a space preceding it
00:03 <butterthebuddha> Or at least that's what I'd like
00:03 <butterthebuddha> is there any way to print all the function calls and outputs?
00:04 <nshepperd> butterthebuddha: ok, but what stops it from parsing the ] that terminates the list as another list entry then
00:04 <nshepperd> namely a symbol consisting only of ]
00:04 amirpro joined
00:05 <butterthebuddha> True, I guess there are some messy edge cases with that
00:05 <butterthebuddha> Perhaps it's best to add "[]" to the badChars; that's probably what I'll do
00:06 <nshepperd> do that and test if it fixes the parse
00:06 <butterthebuddha> that does fix it
00:10 amirpro joined
00:10 <nshepperd> one way you could have debugged this is by running parseVector directly on the test case and looking at the parse error
00:11 tam1138 joined
00:13 hive-mind joined
00:13 <nshepperd> this kind of thing is also why parsec made the right decision in having committed choice imo
00:15 <nshepperd> you want the parser to be committed to parsing a list once it encounters [ so that you get the proper error message about a missing ] instead of having it move onto the next possibility and complain that it's not a number or something
00:16 <Solonarv> isn't it also more performant?
00:16 <Solonarv> and, there's always `try` when you do need to backtrack
00:18 nitaigao joined
00:18 <nshepperd> yeah, it lets you discard the completely used input as you go
00:18 <Gurkenglas> Shouldn't the error message instead give you a complete tree of failed choices?
00:19 <tam1138> i'm building the haskell platform from scratch (for funsies). i believe i've followed all the instructions correctly, but it fails. hptool requires hastache, which requires base<4.11, but current platform provides base=4.11 (and build docs say they have to be the same version), so i'm confused as to how this ever built correctly for anybody. any insight?
00:20 <Solonarv> are you building "the haskell platform", or "all of hackage"?
00:20 <tam1138> the haskell platform
00:20 <erisco> what is happening?
00:20 <Gurkenglas> (And then maybe one should give weights to choices in order to show the most probably relevant error message. Is SearchT applicable?)
00:20 <nshepperd> I suppose that would be another way to handle it
00:22 <tam1138> here is what's happening: https://lpaste.net/332095487031115776
00:23 <tam1138> hptool depends on hastache, which has been deprecated for a while: http://hackage.haskell.org/package/hastache
00:23 <Solonarv> in that case I have no idea - I haven't even looked at the haskell platform in a long time, I just use stack
00:23 <pally> > [ last ["all", "removed", "except", "the", "last"] ]
00:23 <lambdabot> ["last"]
00:23 <tam1138> which also confuses me, because afaict, there does not exist a version of hastache that will work with the current platform
00:23 <pally> any better way?
00:24 caryoscelus joined
00:24 weird_error joined
00:25 <Solonarv> what are you trying to accomplish?
00:26 <tam1138> i'm trying to build a single package for ArchLinux that duplicates the Minimal Haskell Platform
00:26 <Solonarv> sorry, not you tam1138; I have no idea how to help you
00:26 <tam1138> ah, np
00:26 MoarSpaceFi joined
00:27 taumuon joined
00:29 johnvonneumann joined
00:29 <Solonarv> pally what is your goal? what are you trying to do?
00:31 andyhoang1 joined
00:31 <pally> Solonarv, it's illustrated in the example
00:31 <pally> I want to drop all items except the last
00:32 <Solonarv> what's wrong with just using last? that's what it does
00:34 <pally> nvm, I can always cons (:) it with the results list in my algorithm
00:34 Linter joined
00:34 sw1nn_ joined
00:35 <Solonarv> in general I would caution against using `last` unless you know that its input cannot be empty
00:35 <pally> yes, I know the input will not be empty
00:37 <Solonarv> in that case it's fine
00:37 <Solonarv> otherwise, you should probably use a function that forces you to handle the empty-list case
00:37 <Solonarv> and doesn't throw an error
00:38 <maerwald> anyone knows how ghc is on FreeBSD these days?
00:44 weird_error joined
00:44 progfun joined
00:45 tzemanovic joined
00:45 blonkhart joined
00:48 <Cale> @tell mreh yes, Obelisk specifically is definitely set up for web applications, but there's stuff in there for building Android apps (but most of that is in reflex-platform and jsaddle)
00:48 <lambdabot> Consider it noted.
00:48 roconnor joined
00:50 Unhammerd joined
00:51 saurabhnanda joined
00:53 antsanto joined
00:57 nous1024 joined
00:58 blankhart joined
01:00 erratic joined
01:01 tzemanovic joined
01:01 jollygood2 joined
01:02 ammazza joined
01:05 ericsagn1 joined
01:05 progfun joined
01:11 andyhoang1 joined
01:12 <dmwit> > take 1 . reverse $ ["all", "removed", "except", "the", "last"]
01:12 <lambdabot> ["last"]
01:12 <dmwit> > (take 1 . reverse $ [], [last []])
01:12 <lambdabot> ([],[*Exception: Prelude.last: empty list
01:12 fragamus joined
01:12 rexb0t joined
01:12 <infinisil> ??
01:12 DSM joined
01:13 <dmwit> Responding to a question from an hour ago. =P
01:13 <infinisil> Ohh
01:13 <infinisil> They left about 30 minutes ago heh
01:13 <Solonarv> @let lastMay = foldl' (const Just) Nothing
01:13 <lambdabot> Defined.
01:13 <dmwit> So they did.
01:14 <Solonarv> > (lastMay [], lastMay [1, 2, 3])
01:14 <lambdabot> (Nothing,Just 3)
01:16 pranz2 joined
01:21 lainon joined
01:24 mounty joined
01:26 camsbury joined
01:27 diwo joined
01:32 caryoscelus joined
01:34 <rotaerk> :t maybe
01:34 <lambdabot> b -> (a -> b) -> Maybe a -> b
01:35 <rotaerk> what would the list analogue of that be? fold?
01:35 <angerman> mreh, I believe the rts links against it.
01:36 <dmwit> rotaerk: foldr
01:37 <dmwit> Well. Since there's no recursion in Maybe, the question is a bit underspecified. There are many possible analogs.
01:38 <rotaerk> k
01:38 <dmwit> Another possible one would have type `b -> (a -> [a] -> b) -> [a] -> b`, for example.
01:38 <rotaerk> makes sense
01:38 superguest joined
01:38 oisdk joined
01:39 superguest left
01:40 philippD joined
01:41 <Solonarv> foldr is the "correct" answer in that it's the church encoding of [], much like maybe is the church encoding of Maybe
01:41 <Solonarv> (up to argument order)
01:42 kmae joined
01:42 leifm joined
01:43 <taumuon> is it possible to short circuit a recursive list operation? does the compiler do any short circuiting automatically?
01:44 <Solonarv> yes and sort-of-yes (it's not done by the compiler)
01:44 <Solonarv> haskell is a lazily-evaluated language, which means a value isn't computed unless it's actually needed
01:44 <dmwit> > foldr (||) False (True:undefined)
01:44 <butterthebuddha> Is there a way of representing subtype relationships?
01:44 <Solonarv> if you're applying a function to a list that doesn't require the tail of the list, the tail won't be evaluated
01:45 <lambdabot> True
01:45 <taumuon> as an example, say I'm searching for the first true in a list of bools, and I want to stop after the first true is encountered
01:46 <jollygood2> :t any
01:46 <lambdabot> Foldable t => (a -> Bool) -> t a -> Bool
01:46 <dmwit> taumuon: Great example. It's exactly the one I posted above.
01:46 <rotaerk> haha
01:46 <taumuon> LOL
01:46 <taumuon> sorry dmwit, got it!
01:46 <jollygood2> > any id (repeat True)
01:47 <lambdabot> True
01:47 <jollygood2> > repeat True
01:47 <lambdabot> [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,...
01:47 <dmwit> `any id` can be spelled `or`.
01:47 <jollygood2> yeah, couldn't remember the name
01:48 <butterthebuddha> :t any
01:48 <lambdabot> Foldable t => (a -> Bool) -> t a -> Bool
01:48 <butterthebuddha> > any (>2) [1,2,3,4]
01:48 <lambdabot> True
01:48 <butterthebuddha> > any (>2) [1]
01:48 <lambdabot> False
01:48 <butterthebuddha> Neat
01:49 roconnor joined
01:49 <Solonarv> > any (>42) [1..]
01:49 <lambdabot> True
01:49 perspectival joined
01:49 <Solonarv> > [1..]
01:49 <lambdabot> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,...
01:49 <taumuon> are there many situations where you have to "manually" code in recursive breaks?
01:50 <butterthebuddha> taumuon: what does that mean?
01:50 <butterthebuddha> breaks?
01:50 tcsiwula joined
01:50 <Solonarv> what is a "recursive break"?
01:50 <butterthebuddha> do you mean a base case?
01:51 fishythefish joined
01:53 dan_f joined
01:53 <taumuon> so I was thinking, like a accumulator variable that you could use as a flag to short circuit things if needed.. But i guess that's analagous to a pattern matched base case
01:53 <taumuon> ok i think i've got that straightened out in my head
01:55 <jollygood2> in most situations you don't have to manually recurse in haskell at all
01:56 tsaka__ joined
01:59 <blonkhart> right just use an elgot coalgebra! http://blog.vmchale.com/article/elgot-performance
02:00 hucksy joined
02:02 <rotaerk> cocreature, https://gist.github.com/Rotaerk/68a88c0456bb4286bdd137a2446200ec
02:02 figurehe4d joined
02:03 <rotaerk> (added some exception collection during finalization)
02:04 <rotaerk> anyway, now to actually use/test it >_>
02:05 oisdk joined
02:07 <tcsiwula> mmmm Elgot algebras <3
02:17 banc joined
02:20 hamishmack joined
02:20 conal joined
02:22 lortabac joined
02:23 cdepillabout joined
02:25 vitali joined
02:25 <jollygood2> > let takeLast n = reverse . take n . reverse in takeLast 2 "hi there"
02:25 <lambdabot> "re"
02:25 <jollygood2> I could swear there was a function like this in prelude?
02:26 <glguy> Not that I'm aware of
02:27 <* hackage> ip 1.3.0 - Library for IP and MAC addresses http://hackage.haskell.org/package/ip-1.3.0 (andrewthad)
02:29 dreamer_ joined
02:29 <dreamer_> Hey
02:29 lagothrix joined
02:29 <dreamer_> I'm making a chess game and every time a player makes a move I store the state of the whole game in a stack
02:30 <dreamer_> the state includes the functions that give where pieces can go
02:31 <dreamer_> is the compiler smart enough to implicitly reuse the already made functions if they've been called once even if they're deeper in the stack ?
02:31 <dreamer_> not well worded sorry
02:31 <dreamer_> hope you get the idea
02:32 <Solonarv> I'm rather confused by your explanation, could you post your code?
02:32 <glguy> https://gist.github.com
02:33 andyhoang1 joined
02:33 <erisco> hoping for compiler smartness is probably a mistake
02:33 <Solonarv> not if what you think is "compiler smartness" is actually just a language feature
02:34 <Solonarv> e.g. laziness, which makes `take 3 [1..]` not blow up
02:35 aarvar joined
02:35 <dreamer_> no I think just compiler smartness but I realize now it woulndt work most of the time because if a function gets evaluated but not used
02:35 <dreamer_> it means the stack has been popped and thus
02:35 <dreamer_> function no longer available
02:36 <dreamer_> even if the compiler could magically say "hey I remember this function being called with the exact same parameters" there's no result of the evaluation in memory or there shouldnt be
02:36 <dreamer_> maybe Im wrong
02:36 roconnor joined
02:39 <dreamer_> Ok, just a snippet here sorry haven't uploaded to git yet
02:39 <dreamer_> https://lpaste.net/5717884931758096384
02:39 MindlessDrone joined
02:39 <hastuur> any monitoring systems in haskell?
02:39 <dreamer_> the functions I would like to be able to "reuse" are the legalMoves functions
02:40 <dreamer_> the results of the functions I would like to be able to reuse*
02:42 fragamus joined
02:42 pally joined
02:42 <hastuur> www.happstack.com looks cool
02:42 <hastuur> needs 1 big box tho probly
02:42 <Solonarv> ah, you're looking for memoization?
02:42 <hastuur> maybe with 40g network
02:43 <hastuur> is haskell more fun than other languages?
02:43 <hastuur> I dont know anything but bash
02:43 <hastuur> I tried lisp and forth a bit
02:43 <hastuur> didnt get far
02:44 <dreamer_> yeah Solonarv exactly =)
02:44 <dreamer_> its more for learning
02:45 <dreamer_> I dont think its necessary in this case
02:45 <Solonarv> you'll have to do that explicitly, the compiler doesn't memoize functions by itself
02:45 <dreamer_> the functions are not computer intensive
02:45 <pally> ?let list = [[1,2,3], [4,5,6], [7,8]]
02:45 <lambdabot> Defined.
02:45 <* erisco> *computing intensifies*
02:46 <pally> is there a function to concatentate the lists within the list?
02:46 <dreamer_> hastuur : I love haskell but it feels a bit constraining some times
02:46 <dreamer_> and at others, allows you to do stuff you coulndt even dream of
02:46 <pally> so I get [1..8]
02:46 <dreamer_> concat
02:46 <erisco> the constraints only exist in your mind
02:46 <dreamer_> of course
02:47 <Solonarv> > concat list
02:47 <lambdabot> [1,2,3,4,5,6,7,8]
02:47 <Solonarv> :t concat
02:47 <lambdabot> Foldable t => t [a] -> [a]
02:47 <Solonarv> :t concat @[]
02:47 <lambdabot> error:
02:47 <lambdabot> Pattern syntax in expression context: concat@[]
02:47 <lambdabot> Did you mean to enable TypeApplications?
02:49 <pally> I would think the type signature would be something like => t [[a]] -> [a]
02:49 <dreamer_> [[a]] -> [a] is a specific case of it
02:50 <Solonarv> :set -XTypeApplications
02:50 <Solonarv> :t concat :: [[a]] -> [a]
02:50 <lambdabot> [[a]] -> [a]
02:51 vitali joined
02:51 <geekosaur> you can't turn on TypeApplications in lambdabot
02:51 <geekosaur> but there;s another bot
02:51 <geekosaur> % :t concat @[]
02:51 <yahb> geekosaur: [[a]] -> [a]
02:51 <Solonarv> ah thank you
02:52 gabiruh joined
02:55 caryoscelus joined
02:56 xlei joined
02:58 <pally> I still don't understand.
02:58 theDon joined
02:59 altjsus joined
02:59 dmwit joined
02:59 <Solonarv> the `t` in `Foldable t => t [a] -> [a]` can become `[]`
03:00 <Solonarv> so you replace `t` by `[]` and get `Foldable [] => [[a]] -> [a]`
03:00 phreedom joined
03:00 <pally> oh....
03:00 <pally> Solonarv, now I understand :-)
03:00 <Solonarv> `Foldable []` is given, so the end result is `[[a]] -> [a]`
03:02 ctag joined
03:03 <pally> it says type signature says: "type variable t has an instance of Foldable", right?
03:04 caryoscelus joined
03:04 <pally> s/it says//
03:05 <Solonarv> yes
03:06 codesoup joined
03:09 hydroacoustic joined
03:10 matt179 joined
03:10 amar joined
03:11 hydroacoustic joined
03:12 tsaka__ joined
03:13 <geekosaur> might help to note that you can write [a] as ([] a) (or [Int] as ([] Int))
03:13 <geekosaur> so it behaves like Maybe, etc.
03:14 matt179 joined
03:14 sjakobi joined
03:15 elfets joined
03:17 roconnor joined
03:17 figurehe4d joined
03:19 lassulus_ joined
03:22 pavolzetor joined
03:23 f1gurehead joined
03:23 gentauro joined
03:24 <pavolzetor> hello, I am strugling to figure out how to access IO inside the Foundation.Parser
03:24 <pavolzetor> I want to write single pass codegen without generating AST
03:24 f1gurehead joined
03:25 <glguy> You don't access IO inside the parser. You can have the result of a successful parse be an IO (), though
03:26 scottschmidt1 joined
03:27 manila[m] joined
03:28 <pavolzetor> Would I the have to manually sequence those?
03:28 <pavolzetor> eg do {a <- parseLhs; b <- parseRhs; pure (a >> b)}
03:29 rprije joined
03:29 <* hackage> shake-ats - Utilities for building ATS projects with shake http://hackage.haskell.org/package/shake-ats- (vmchale)
03:30 otto_s_ joined
03:31 <pavolzetor> tested it and it seems so, that is annoying
03:32 <pavolzetor> thanks though, at least I can proceed :)
03:32 beauby joined
03:32 <glguy> With megaparsec you could accumulate that implicitly by using a WriterT around the parser
03:33 <glguy> and everything is generalized to use the MonadParsec typeclass
03:33 <glguy> and theres: instance (Monoid w, MonadParsec e s m) => MonadParsec e s (WriterT w m)Source
03:34 fragamus joined
03:34 <pavolzetor> I will look at megaparsec
03:35 bahamas joined
03:35 <Solonarv> I thought WriterT was plagued by horrible space leaks?
03:37 <glguy> Depends what you're doing with it
03:37 <glguy> in this case it's no worse than doing it manually
03:38 Linter joined
03:40 justanotheruser joined
03:41 spear2 joined
03:41 <Solonarv> I've kinda unlearned transformers that aren't ReaderT so I wasn't sure
03:43 <* hackage> shake-c - Library for building C code with shake http://hackage.haskell.org/package/shake-c- (vmchale)
03:44 oisdk joined
03:45 mizu_no_oto joined
03:47 danso joined
03:48 figurehe4d joined
03:49 mnoonan_ joined
03:50 <taumuon> say i wanted to look up the implementation of a function in base, like Data.Maybe.catMaybes - How would I do so?
03:50 <glguy> hackage has source links
03:51 <glguy> look on the right-hand side of the type signature in the documentation
03:52 <taumuon> fantastic, thanks.
03:53 gabiruh joined
03:53 carlomagno1 joined
03:56 carlomagno joined
03:57 scottschmidt1 joined
03:58 carlomagno joined
04:02 qtfy joined
04:03 tzemanovic joined
04:05 jimmyrcom joined
04:06 oisdk joined
04:08 scottschmidt1 joined
04:10 nitaigao joined
04:10 hastuur joined
04:10 roconnor joined
04:10 <rotaerk> cocreature, Scope in action: https://github.com/Rotaerk/vulkanTest/blob/master/main/src/Control/Monad/Catch/Scope.hs
04:11 <rotaerk> https://github.com/Rotaerk/vulkanTest/blob/master/main/src/Main.hs
04:11 <rotaerk> it could use some sort of improvements for usage...
04:12 <rotaerk> it works, but it doesn't seem right having to always be explicit about scope ... seems like there should be a default/current scope, and only require you to be explicit when using something else
04:15 roconnor joined
04:15 <hololeap> is there a name for something that is both a monad and a comonad?
04:15 <glguy> Identity
04:16 <Solonarv> do something like `newtype ScopeT m a = ScopeT { runScopeT :: Scope m -> m a }`
04:16 scottschmidt1 joined
04:17 fmixing joined
04:17 <hololeap> glguy: what about ((,) e) ?
04:17 <glguy> That's a good one, too
04:18 <Solonarv> that's only a monad with Monoid e right?
04:18 <hololeap> right, Monoid e => ((,) e)
04:18 <hololeap> is there a name for those?
04:18 saurabhnanda joined
04:18 Linter joined
04:18 <Solonarv> I remember reading that any f which is both monad and comonad must be isomorphic to ((,) e) for some e
04:18 saurabhnanda joined
04:18 xpycm joined
04:19 <Solonarv> not sure where I saw that though
04:19 <Solonarv> rotaerk: why not resourcet? https://www.stackage.org/package/resourcet
04:20 <rotaerk> I just replaced my usage of resourcet with that
04:20 <hololeap> i guess i should have searched first :/ https://stackoverflow.com/questions/27171960/is-there-a-term-for-a-monad-that-is-also-a-comonad
04:20 DTZUZO joined
04:21 <rotaerk> and the reason is because with resourceT, you clean up resources before the end of the runResourceT by getting their key and explicitly releasing them, which then leaves some dangling references to released resources
04:22 <rotaerk> whereas the Scope-based approach I implemented allows interleaving of scopes while allowing language scoping to drive release, rather than calling explicit release
04:23 <rotaerk> I just need to look for ways to polish it
04:23 <* hackage> relational-schemas - RDBMSs' schema templates for relational-query http://hackage.haskell.org/package/relational-schemas- (KeiHibino)
04:24 <Solonarv> from looking at the source, runResourceT seems to release resources: 1) when you explicitly free them, 2) if runResourceT's argument throws an exception, 3) if runResourceT's argument finishes
04:25 <rotaerk> right
04:26 <rotaerk> withScope does #2 and #3 and avoids #1
04:27 Unhammerd joined
04:27 <rotaerk> you might be able to nest runResourceT to achieve the same effect, but it will complicate the type like ResourceT (ResourceT (ResourceT IO)) etc
04:27 <Solonarv> so you're saying withScope is the same as runResourceT but the user can't explicitly free a resource?
04:27 <Solonarv> that doesn't sound like an advantage to me
04:27 <rotaerk> yeah, you don't need to explicitly free
04:28 <Solonarv> you don't *need* to do that in resourceT either!
04:29 pranz3 joined
04:30 <rotaerk> I think you can achieve the same thing with nested runResourceTs, but that changes the type for every nesting of scope
04:30 <rotaerk> which might not be too bad, I guess; I'll need to think about it
04:30 <rotaerk> I can just imagine tons of lifting
04:33 <Solonarv> you can nest runResourceTs or you can do (thingKey, thing) <- allocate ...; use thing; release thingKey
04:33 <Solonarv> or you can have one big runResourceT and wait for everything to be freed automatically at the end
04:34 <rotaerk> right, explicit releasing is what I'm trying to avoid, waiting for everything to be freed at the end is really bad, from a runtime behavior perspective
04:34 <rotaerk> so if nesting of runResourceT works well, then I might just do that instead of my scope thing
04:36 blankhart joined
04:36 znack joined
04:36 <Solonarv> I'm not sure where you get this idea that being able to explicitly release early is a bad thing
04:36 <Solonarv> in fact, hold on a minute
04:37 <Solonarv> if you didn't hide the IORef behind Scope you could implement explicit frees for that as well
04:38 <Solonarv> your code is just resourcet but you're hiding the ioref in a closure
04:39 <rotaerk> explicit frees are unnecessary, and they have the downside of leaving dangling references
04:40 <rotaerk> instead free by letting a scope end
04:40 <rotaerk> it also complicates the code a little by having to capture keys
04:41 qwertydvorak joined
04:42 <Solonarv> so define allocate' :: MonadResource m => IO a -> (a -> IO ()) -> m a; allocate' create free = snd <$> allocate create free
04:42 <Solonarv> and use that
04:42 <rotaerk> yeah I did that
04:43 <rotaerk> I'm saying when you DO want to release things, you have to deal with keys ... unless nesting runResourceT works
04:43 <Solonarv> nesting does work
04:43 <Solonarv> and how would you do it without dealing with keys?
04:44 <* hackage> text-postgresql - Parser and Printer of PostgreSQL extended types http://hackage.haskell.org/package/text-postgresql- (KeiHibino)
04:45 <rotaerk> Solonarv, here's the version of my code using resourceT: https://github.com/Rotaerk/vulkanTest/blob/6cfdd345bd858852972477f3dafe2356d2921a20/main/src/Main.hs#L908-L922
04:45 <rotaerk> currently with explicit releases ... lemme try rewriting this using nested runResourceT
04:47 oisdk joined
04:48 scottschmidt1 joined
04:49 fujiy joined
04:49 <rotaerk> Solonarv, un-tested but something like: https://gist.github.com/Rotaerk/b71258897ca80eb36ff1e404212b3dd4
04:50 <Solonarv> yeah that looks about right to me
04:50 pranz4 joined
04:50 <rotaerk> if that works as expected then I might drop this Scope thing
04:50 <rotaerk> oops, didn't indent the final line
04:51 <Solonarv> as far as I can tell your Scope thing is just a primordial resourceT anyway
04:52 <* hackage> persistable-types-HDBC-pg - HDBC and Relational-Record instances of PostgreSQL extended types http://hackage.haskell.org/package/persistable-types-HDBC-pg- (KeiHibino)
04:52 <rotaerk> one "advantage" the scope thing has is that scopes are passed explicitly, so you can provide a scope an arbitrary number of levels out
04:52 <rotaerk> whereas with runResourceT, I have to lift N times
04:52 <rotaerk> but that's probably not that useful of an advantage
04:52 <Solonarv> that just means you unwrapped the ReaderT
04:52 <Solonarv> you can do that with ResourceT if you really want
04:53 <Solonarv> https://www.stackage.org/haddock/lts-11.14/resourcet-1.2.1/Control-Monad-Trans-Resource.html#g:10
04:53 seizo joined
04:53 gabiruh joined
04:53 <rotaerk> I'm not sure how that would achieve what I'm talking about
04:54 pranz joined
04:54 scottschmidt1 joined
04:54 <rotaerk> note that the type of line 4 in my code snippet is ResourceT ResIO Handle
04:55 <rotaerk> and theoretically I could have a ResourceT (ResourceT (ResourceT ResIO)) Handle
04:55 <rotaerk> and to access the innermost one, I would have to lift 3 times
04:55 <Solonarv> instead of hiding the `IORef [m ()]` in a closure, you can do newtype Scope m a = Scope { scopeFinalizers :: IORef [m ()] }
04:56 <rotaerk> I hid it in a closure because I implement that closure differently in withScopeLiftedTo
04:56 <rotaerk> I used to store the IORef inside of Scope
04:57 <Solonarv> now InternalState is Scope, ReleaseKey is Int, and you've got a ResourceT
04:57 <Solonarv> ah, yes
04:57 muddywatt joined
04:57 <Solonarv> if m is not an instance of MonadUnliftIO then whatever you're doing risks being unsound anyway
04:58 mjrosenb joined
04:58 <Solonarv> so you can just use an IORef [IO ()] and use unliftio methods to convert your handlers into IO ()
04:59 <rotaerk> the purpose of withScopeLiftedTo is, for instance, to turn a `Scoped IO a` into a `MonadIO io => Scoped io a`
04:59 <Solonarv> anyway I'd love to stick around but tiredness is eroding my already questionable expertise
04:59 <Solonarv> yeah you can't do that soundly for a general MonadIO
05:00 <Solonarv> because exception safety
05:00 <rotaerk> could you give an example of how it colud be misused?
05:01 antsanto joined
05:02 <Solonarv> uh just go look up some examples of why you can't bracket a StateT
05:02 <Solonarv> sorry, tired
05:02 ericsagn1 joined
05:03 <rotaerk> withScopeLiftedTo someMonadIOScope liftIO $ scoped someIOCreate someIORelease
05:03 robstr joined
05:04 <rotaerk> I would think that if it was unsound, there wouldn't be a lifting function that could be passed in to the second parameter
05:04 <rotaerk> anyway, bed time for me too
05:05 scottschmidt1 joined
05:07 osa1 joined
05:07 fishythefish joined
05:09 spear2 joined
05:10 maddybutt joined
05:12 inad922 joined
05:16 enterprisey joined
05:16 louispan joined
05:20 spoon16 joined
05:22 davr0s joined
05:22 ming joined
05:22 drets joined
05:24 darjeeling_ joined
05:25 scottschmidt1 joined
05:28 spoon16 joined
05:29 bhadram joined
05:30 bhadram left
05:30 spoon16 joined
05:33 mariatsji joined
05:39 jimmyrcom joined
05:39 tauta joined
05:43 FreeBirdLjj joined
05:44 FreeBirdLjj joined
05:45 language_agnosti joined
05:45 saurabhnanda joined
05:45 dan_f joined
05:46 Linter joined
05:48 FreeBird_ joined
05:49 drets joined
05:49 mnoonan joined
05:53 scottschmidt1 joined
05:54 gabiruh joined
05:59 danvet joined
05:59 slomo joined
06:04 oish joined
06:07 <pally> As a someone who is new to Haskell, I find myself using list comprehension most.
06:08 <rotaerk> I can't remember ever using it
06:08 <rotaerk> I usually forget it exists
06:09 tzemanovic joined
06:10 <pally> I like the syntax, and I've grown to use it more than `filter` when I need to any filtering.
06:10 <pally> err, need to *do
06:15 pio_ joined
06:15 fmixing joined
06:17 acidjnk joined
06:18 scottschmidt1 joined
06:20 UnChallengeD joined
06:21 <wz1000> Is there a wrapper for Map with instance (Ord k, Semigroup a) => Semigroup (Map k a)?
06:24 <wz1000> ok, found the discussion
06:24 <wz1000> https://mail.haskell.org/pipermail/libraries/2018-February/028519.html
06:24 saurabhnanda joined
06:25 scottschmidt1 joined
06:25 vonfry joined
06:26 darkJedi joined
06:29 FreeBirdLjj joined
06:33 <darkJedi> Hi! I had a doubt in Maybe Monad. https://lpaste.net/8585096319930990592
06:34 amar joined
06:34 <darkJedi> What is MonadPlus instance?
06:34 <cocreature> wz1000: when I read these discussions I sometimes hope for some kind of benevolent dictator for core libraries so not all of them end in a ton of bikeshedding :/
06:35 <cocreature> darkJedi: what exactly do you mean? you have already defined the instance, so I’m not sure what you are asking?
06:37 <darkJedi> cocreature: I'm sorry. It's not my code. I have taken the code from the course Functional Programming in Haskell by University of Glasgow.
06:37 <cocreature> darkJedi: so are you asking about the purpose of the MonadPlus typeclass?
06:37 <darkJedi> cocreature: Yes
06:38 <cocreature> darkJedi: are you familiar with Alternative?
06:38 <darkJedi> cocreature: No I'm not familiar with Alternative.
06:38 <pally> I want to test a list contains an element that safisties a condition, and immediately returns `True` if one is found
06:38 <pally> I know there's `find`
06:39 tzemanovic joined
06:39 <fishythefish> :t any
06:39 <pally> but that gives me a Maybe
06:39 <lambdabot> Foldable t => (a -> Bool) -> t a -> Bool
06:39 <cocreature> darkJedi: alright, so just so you won’t get confused later: Alternative and MonadPlus are basically the same typeclass. the reason why we have both is mostly historical
06:39 <cocreature> darkJedi: now MonadPlus (https://hackage.haskell.org/package/base- gives you two methods: mzero and mplus
06:40 <cocreature> darkJedi: are you familiar with the Monoid typeclass?
06:40 takuan joined
06:41 <fishythefish> > any even [1, 3 .. 99]
06:41 <darkJedi> cocreature: One doubt! The use of instance is to create something be combining the properties of whatever we are adding in ```instance Monad Maybe where``` right?
06:41 <lambdabot> False
06:41 <fishythefish> > any (== 22) [1..]
06:41 <lambdabot> True
06:41 <fishythefish> pally ^
06:41 <darkJedi> cocreature: Is it the correct way to think about instance?
06:41 <cocreature> darkJedi: sry I don’t understand the question, can you perhaps try rephrasing it?
06:42 <cocreature> `mplus` is useful for getting the first `Just` value
06:42 <pally> fishythefish, thanks pal; illustrates lazy too.
06:42 <cocreature> mzero is the identity for mplus so mzero `mplus` x = x and x `mplus` mzero = x
06:42 <taumuon> pally: thanks for asking about that, i wanted to know too.
06:42 sternmull joined
06:42 <darkJedi> cocreature: What is the use of instance?
06:43 <cocreature> > Nothing `mplus` Nothing `mplus` Just 1 `mplus` Nothing
06:43 <lambdabot> Just 1
06:43 <cocreature> > Just 3 `mplus` Nothing `mplus` Just 1 `mplus` Nothing
06:43 <lambdabot> Just 3
06:43 <cocreature> so it always gives you the first Just value
06:43 <fishythefish> darkJedi: typeclasses/instances give you a way to constrain polymorphism
06:44 <fishythefish> for instance, we want (==) to be polymorphic so we don't have a separate operator for each type
06:44 <fishythefish> but not every type supports equality
06:44 <fishythefish> :t (==) -- so we use the Eq typeclass
06:44 <lambdabot> Eq a => a -> a -> Bool
06:45 yasshek joined
06:47 SpinTensor joined
06:47 <darkJedi> fishythefish: How do we specify which types are instance of the class Eq ?
06:47 <fishythefish> darkJedi: by writing `instance Eq MyType where ...`
06:47 connrs joined
06:47 <yasshek> Hi trying to learn new language and many haskell a good try
06:47 <jle`> yasshek: welcome to haskell :D
06:47 <darkJedi> fishythefish: Thanks :) I will read more about it from https://www.haskell.org/tutorial/classes.html
06:48 <fishythefish> darkJedi: as a result, this lets me substitute `MyType` in places where `Eq a => a` is expected
06:48 <yasshek> jle`:D
06:48 <yasshek> https://www.haskell.org/tutorial/ should I start here ?
06:48 <yasshek> one thing I found haskell not staright
06:49 <jle`> @where learnhaskell
06:49 <lambdabot> https://github.com/bitemyapp/learnhaskell
06:49 vlatkoB joined
06:49 <jle`> but to be honest i had never seen that tutorial before you sent it
06:49 <jle`> it doesn't look like it has any exercises though
06:50 <taumuon> jle: i read that was the go to tutorial for a while back in the day
06:50 <taumuon> mostly because it was one of the only ones :)
06:52 <* hackage> starter 0.3.0 - Develop applications without restarts http://hackage.haskell.org/package/starter-0.3.0 (rkaippully)
06:53 <taumuon> yasshek, have you done any graphics programming before?
06:53 <yasshek> taumuon: never why ?
06:53 <yasshek> taumuon: is it important ?
06:54 <taumuon> no, i just thought I'd ask you, as this course starts you out with some graphics programming http://seas.upenn.edu/~cis194/fall16/
06:54 <taumuon> it's a fun way to start if you like that kind of thing
06:55 gabiruh joined
06:55 <yasshek> taumuon: started now :)
06:55 Tordek joined
06:56 tzemanovic joined
06:57 <yasshek> Instead of following the instructions on Haskell.org, get Stack. why ?
06:58 <yasshek> what is stack is it something like virtualenv ?
07:00 <yasshek> what is haskell stack and haskell platform ?
07:01 <cocreature> yasshek: we have two main build tools in Haskell, cabal-install (the executable is called "cabal") and stack
07:01 <cocreature> some people prefer one, some the other :)
07:01 <cocreature> the haskell platform ships with both
07:01 <yasshek> cocreature: I am beginner which one should I use
07:02 <yasshek> and which one is famous or helpful
07:02 <cocreature> depends on who you ask but currently, I tend to recommend stack to beginners
07:02 <cocreature> (whether you should use cabal or stack tends to result in somewhat heated discussions which is why I’m cautious to take a strong stance here)
07:03 <systemfault> As a beginner, cabal has given me so much trouble, it's not even funny.
07:03 <systemfault> Stack has been a painless experience.
07:04 <yasshek> I see
07:04 language_agnosti joined
07:04 <yasshek> can we compare thse build tools to other language ?
07:04 <yasshek> like :
07:04 <sclv> As someone experienced, i have found the opposite
07:05 <taumuon> also as a beginner, you probably won't need a cli tool to get going. you can use haskell's REPL called ghci.
07:05 <yasshek> I work only with cli
07:05 <taumuon> you'll be spending a lot of time in ghci tinkering about
07:05 <cocreature> even beginners tend to want to use libraries fairly soon ime and at that point you want to use stack or cabal
07:05 <sclv> yasshek: someone just wrote a good article on different build tools that maybe can be a starting point
07:05 <sclv> https://kowainik.github.io/posts/2018-06-21-haskell-build-tools.html
07:06 drummyfish joined
07:08 drummyfish joined
07:08 <cocreature> just pick one and stick to it for a while. I don’t think it’s useful to spend too much time trying to figure out which build tool works best for you as a beginner since that’s really something that only experience can tell you
07:08 <cocreature> once you’ve used it for a while you can try the other one and then see what you prefer
07:09 drummyfish joined
07:09 <cocreature> (or switch between both as I do)
07:09 <yasshek> Yup I will follow some tuturial cis194 and see what he says
07:09 <yasshek> https://github.com/bitemyapp/learnhaskell
07:10 Linter joined
07:13 frakkin_toaster joined
07:14 <frakkin_toaster> hello?
07:14 <cocreature> hey frakkin_toaster
07:14 <frakkin_toaster> hi
07:14 scottschmidt1 joined
07:15 <frakkin_toaster> what is this place?
07:15 <cocreature> it’s a channel about the Haskell programming language
07:16 <frakkin_toaster> ah,
07:16 <frakkin_toaster> can I be here if I don't know haskell?
07:16 <yasshek> frakkin_toaster: no i guess
07:17 beauby joined
07:17 detrumi joined
07:17 <frakkin_toaster> :(
07:17 <yasshek> I am learning haskell to stay here just started :D
07:18 kvda joined
07:18 <frakkin_toaster> putStrLn "Hello World"
07:19 <frakkin_toaster> does that count?
07:19 <cocreature> frakkin_toaster: ofc you can be here if you don’t know Haskell as long as you are interested in Haskell :)
07:19 <frakkin_toaster> cool.
07:19 <leifm> > putStrLn "Hello World"
07:19 <cocreature> this channel is mostly about helping people when they have Haskell questions, so it’s perfect for learning Haskell
07:19 <lambdabot> <IO ()>
07:19 <zfnmxt> What's the name of the offtopic Haskell channel again?
07:19 <fishythefish> #haskell-offtopic?
07:20 <fishythefish> it's in channel topic
07:20 <fishythefish> there's also #haskell-blah
07:20 supp1 joined
07:20 <zfnmxt> fishythefish: I figured it might be but then I couldn't figure out how to get weechat to actually print the full topic >.<
07:20 <zfnmxt> Thanks.
07:21 <cocreature> zfnmxt: you can scroll with f9 and f8
07:22 <taumuon> f9 f10*
07:22 <taumuon> sorry for the pedantry
07:22 <cocreature> oh right
07:22 <cocreature> off-by-one :)
07:24 <wz1000> cocreature: one Simon to rule them all? :P
07:24 <zfnmxt> Have you guys ever seen a language where if-then expressions never produce values, but if-then-else expressions do? (i.e. the if-then is only evaluated for its side-effects)
07:24 <cocreature> wz1000: yeah :)
07:24 matt179 joined
07:24 <zfnmxt> The language I'm writing my compiler for has that specification. Seems so strange to me.
07:24 valdyn joined
07:25 Saizan joined
07:25 valentinbuza joined
07:25 <leifm> what language is that?
07:25 <zfnmxt> leifm: http://www.cs.columbia.edu/~sedwards/classes/2002/w4115/tiger.pdf
07:25 <zfnmxt> Just a toy language
07:25 asheshambasta joined
07:25 <jesyspa> zfnmxt: Well, it makes some sense: what value would you get in the else case?
07:26 <jesyspa> I mean, in the false case, if you have no else.
07:26 <zfnmxt> leifm: But I think that pdf actually doesn't specify what I just said, but the original textbook does.
07:26 <leifm> jesyspa: A maybe?
07:26 <fishythefish> zfnmxt: ocaml does this
07:26 <yasshek> I think people here know 10-20languages amazing
07:26 <fishythefish> well, if you fudge the distinction between () and no value
07:26 <yasshek> tiger language what a nowledge
07:26 <zfnmxt> jesyspa: Ah, of course.
07:26 <yasshek> no one even know that languge
07:27 <zfnmxt> fishythefish: I actually have been using () as my "no value"
07:27 <zfnmxt> I'm not sure if it's going to bite me later...
07:27 mnoonan_ joined
07:27 <jesyspa> leifm: It could, but many languages lack sum types and it does mean you're either making Maybe a builtin construction or adding a dependency from a language feature to a library type.
07:28 yazmir8azyr joined
07:28 <yasshek> rust language easier than haskell language, I just see haskell very old compared to rust and rust developed by firefox
07:28 big joined
07:29 <fishythefish> jesyspa: to be fair, if/then/else already depends on Bool
07:29 <fishythefish> yasshek: older doesn't necessarily mean worse, and haskell was designed by plenty of smart people too ;)
07:30 <jesyspa> fishythefish: That is fair, but Bool is a builtin much more often than Maybe.
07:30 <fishythefish> "easier" is subjective, but you don't fight the borrow checker in haskell
07:30 <fishythefish> jesyspa: yes, absolutely
07:30 osa1_ joined
07:30 frakkin_toaster joined
07:31 <fishythefish> although even languages without proper sum types may have optional types as language feature
07:31 <leifm> How do languages deal with functions that may fail without a maybe type?
07:31 yasshek left
07:31 <fishythefish> exceptions, straight-up crashing
07:32 kuribas joined
07:32 <fishythefish> programmers may implement their own sentinel values
07:32 <jle`> zfnmxt: it seems like if/then and if/then/else are completely different things then
07:33 <jle`> they have different "types"
07:36 <fishythefish> i wouldn't say completely different, you can look at if/then as a restricted variant of if/then/else
07:36 <fishythefish> if cond then body == if cond then body else ()
07:37 illabout joined
07:38 ericsagnes joined
07:39 <fishythefish> i suppose you could even make it syntactic sugar with ^ as the rewrite rule
07:39 deepfire` joined
07:40 scottschmidt1 joined
07:40 <kuribas> It's kind of sad how haskell sucks for scientific computation.
07:40 <kuribas> It would be a great language for it, but the libraries are fragmented and incomplete.
07:43 knupfer joined
07:45 kapil___ joined
07:47 Tspoon_ joined
07:49 connrs joined
07:51 <asheshambasta> whats the recommended way to upgrade stack LTS?
07:51 forell joined
07:52 <asheshambasta> I changed to lts-11.14 and I seem to have entered Stack hell :-)
07:52 Tspoon_ joined
07:55 <Rembane> asheshambasta: What happened?
07:55 <Rembane> asheshambasta: What do you want it to do, and what does it do?
07:55 <c50a326> is there a haskell book that's nice and gentle like LYAH but also has exercises? LYAH doesn't have exercises :(
07:56 gabiruh joined
07:56 reactormonk joined
07:56 danso joined
07:57 <asheshambasta> I'm seeing this: https://pastebin.com/nEcfMytd
07:57 klugez joined
07:57 <asheshambasta> doing what the error tells me to do doesn't solve the problem, and what does that error even mean?
07:57 osa1 joined
07:57 XMunkki joined
07:57 <Rembane> c50a326: If you have some money to spare http://haskellbook.com/ is quite good.
07:58 <c50a326> c50a326: I'm allergic to money
07:58 <Rembane> asheshambasta: Interesting. Have you specified the version of esqueleto?
07:58 hrk joined
07:58 <Rembane> asheshambasta: ...in your cabal file?
08:00 <asheshambasta> Rembane: no -- I'm editing the package.yaml file in the project, not the cabal file. My package.yaml: https://pastebin.com/aZgcYEKV
08:01 <Rembane> asheshambasta: Good, specify a version range for esqueleto and see if you get a better error message.
08:04 <Rembane> c50a326: http://bitemyapp.com/posts/2014-12-31-functional-education.html
08:04 <hrk> Could someone please help me understand this weird behavior of Applicative instance of MaybeT []?
08:04 <hrk> https://gist.github.com/jhrcek/76212171f8625a3636ebc28a3b77a998
08:05 borkr joined
08:05 <asheshambasta> Rembane: ` esqueleto must match >=2.5.3, but the stack configuration has no specified version (latest matching version is 2.5.3)`
08:06 matt179 joined
08:06 nickolay_ joined
08:06 <asheshambasta> IMHO, that error message doesn't help. If the latest matching version is within my constraints, what is the problem exactly? :-)
08:06 connrs joined
08:10 fmixing joined
08:11 pally left
08:12 language_agnosti joined
08:13 mreh joined
08:13 acidjnk joined
08:13 scottschmidt1 joined
08:13 osa1 joined
08:15 Linter joined
08:15 FreeBirdLjj joined
08:16 <mreh> angerman, Hmm, seems like this script depends on your NDK being in "$HOME/Library/Android/sdk" https://github.com/zw3rk/ghc-build-scripts/blob/master/build-libiconv, could I put in a flag for NDK location?
08:17 <angerman> mreh: sure! It's mostly my build scripts that I used on macOS.
08:18 beauby joined
08:18 <mreh> angerman, it could be the start of a nice open source framework for bootstrapping android apps in Haskell
08:18 <mreh> if that interests you
08:18 <mreh> it's not really easy right now
08:18 amar joined
08:18 <angerman> mreh: I'm all for contributions!
08:19 <angerman> mreh: there is also https://github.com/mobilehaskell/user-guide, which is available from http://mobile-haskell-user-guide.readthedocs.io/en/latest/
08:20 kuttifunk joined
08:22 <mreh> angerman, ah yes, thanks
08:23 taumuon joined
08:23 fmixing joined
08:26 scottschmidt1 joined
08:31 apoc joined
08:31 <Rembane> asheshambasta: I have no idea. It's superweird. I hope that people with more stack-skillz show up. :)
08:31 FreeBirdLjj joined
08:33 <apoc> hi! when i do stack build it needs the exe directory/sources, is it possible to just download/build the dependencies of the .cabal file of the executable? I want to separate this so that i don't have to rebuild the deps when the executable changes
08:33 <Rembane> asheshambasta: I think I found out. I'm not sure yet, but I have a theory. esqueleto isn't on stack. Try to add it to your extra-deps.
08:34 <asheshambasta> Rembane: I've tried that
08:34 <asheshambasta> it just leads to more such proposed fixes until it asks me to add a specific version in extra-deps of a particular package, and then another version
08:34 <asheshambasta> after which I get an error about 2 differing versions of the same pacakge.
08:34 <asheshambasta> package*
08:35 <asheshambasta> `stack solver` warns me about a 'newer' version of cabal-install than the version it has been tested with -- but the version isn't newer per se, its just different
08:35 <asheshambasta> as per https://docs.haskellstack.org/en/stable/ChangeLog/#v171 I'm supposed to be using 2.2
08:35 <asheshambasta> but I'm using
08:36 riotluigi[m] joined
08:36 saurabhnanda joined
08:36 <asheshambasta> … so, then I tried to upgrade cabal using the instructions at https://www.haskell.org/cabal/download.html but the `cabal install` command as suggested on this page doesn't work for me
08:37 taumuon joined
08:37 <asheshambasta> basically, `cabal install cabal cabal-install` leads to a cryptic error message that is `trying: cabal- (user goal)
08:37 <asheshambasta> unknown package: youProbablyWantCapitalCabal (dependency of cabal-`
08:37 louispan joined
08:40 <* hackage> relational-query - Typeful, Modular, Relational, algebraic query engine http://hackage.haskell.org/package/relational-query- (KeiHibino)
08:40 lainon joined
08:43 FreeBirdLjj joined
08:43 keepLearning512 joined
08:45 <asheshambasta> Rembane: funnily, `cabal install Cabal` does the trick
08:46 malorie joined
08:47 vukasink joined
08:49 mreh joined
08:54 ammazza joined
08:55 rprije joined
08:56 gabiruh joined
08:57 hamishmack joined
08:58 keepLearning512 joined
08:59 matt179 joined
09:00 <Rembane> asheshambasta: That was interesting.
09:00 altjsus_ joined
09:00 <Rembane> asheshambasta: The error messages gave absolutely no clue to that.
09:00 <asheshambasta> Rembane: yeah, and pretty painful
09:02 <asheshambasta> Rembane: I think its crazy the amount of time I've spent fighting Haskell's tooling.
09:02 <kuribas> mreh: do you know about eta language? It allows you to create jvm android apps.
09:03 <mreh> kuribas, yeah, I did look into it
09:03 <mreh> kuribas, it's yet another ecosystem to learn :\
09:03 <Rembane> asheshambasta: Indeed. My experience so far is that it either works 100% smoothly or not at all.
09:03 <mreh> nix etc
09:04 tsaka__ joined
09:04 <asheshambasta> Rembane: also, this warning from Stack is totally useless, I reckon adding more data there should be pretty simple; `Warning: Installed version of cabal-install ( is newer than stack has been tested with. If you run into difficulties, consider downgrading.`
09:04 <Rembane> asheshambasta: Indeed. If you want to make the world a better place, create an issue.
09:04 <asheshambasta> also /s/newer/different & /s/downgrading/correcting-the-version
09:04 <kuribas> Rembane: my solution to build problems was mostly to nuke .ghc and .cabal, and usually that solves it. I also have less problems since I use the hvr ppa.
09:04 <Rembane> kuribas: Nice! What's hvr ppa?
09:05 tomphp joined
09:05 <kuribas> Rembane: it's a ppa with all the ghc versions. And cabal, happy, etc...
09:05 <Rembane> kuribas: I run Arch Linux, so everything wrt Haskell is painful. :)
09:05 <Rembane> kuribas: Nice!
09:05 <kuribas> Rembane: for debian like systems only I am afraid.
09:05 <kuribas> Rembane: yeah, it's a blessing :)
09:06 <kuribas> messing with local builds is painful.
09:06 <Rembane> kuribas: Yeah. Debian like systems are a bit less crazy than Arch, but in all other regards Arch works amazing for me, so I do all my Haskell work using stack and nix.
09:06 pally joined
09:08 <pally> Okay, I want to know if someone can propose a clean way (if there's a function that will help, that's even better) to do the following:
09:10 philippD joined
09:11 pagnol joined
09:11 <pally> [ ["student", "alan", "peter"], ["student", "ronald", "sally"], ["instructor", "bob", "michell"], ["instructor", "Jane", "May"]]
09:12 scottschmidt1 joined
09:13 <pagnol> I created a new project by running `stack new`, added a package to extra-deps, and ran `stack solver` ... but the latter wants to delete the package I just added?
09:13 sdothum joined
09:14 <pavonia> pally: Do what?
09:14 <pally> return the list containing lists, group by the first element of the list in each each of input lists.
09:15 lumm joined
09:16 <pally> [ [ ["student", "alan", "peter"], ["studnet", "ronald", "sally"]], [["instructor", "bob", "michelle"], ["instructor", "Jane", "May"]]]
09:17 <pavonia> So the latter two strings of each list have to be kept together?
09:17 <kuribas> pally: sort?
09:17 <mreh> angerman, am I supposed to run this build of iconv through the toolchain wrapper? it seems like it's using my locally installed version of cpp
09:17 thc202 joined
09:17 <kuribas> :t groupBy
09:17 <lambdabot> (a -> a -> Bool) -> [a] -> [[a]]
09:17 <pally> kuribas, very nice.
09:17 <kuribas> :t groupBy (compare `on` head) . sort
09:18 <lambdabot> error:
09:18 <lambdabot> • Couldn't match type ‘Ordering’ with ‘Bool’
09:18 <lambdabot> Expected type: [a] -> [a] -> Bool
09:18 <pagnol> ah... I'm supposed to add it to the cabal file
09:18 <mreh> I'm so out of my depth haha
09:18 <pally> kuribas, not sure why I'd need sort tho
09:18 <kuribas> pally: is it already sorted?
09:19 <kuribas> :t groupBy ((==) `on` head)
09:19 <lambdabot> Eq a => [[a]] -> [[[a]]]
09:19 rzp joined
09:19 <kuribas> > groupBy ((==) `on` head) [ ["student", "alan", "peter"], ["student", "ronald", "sally"], ["instructor", "bob", "michell"], ["instructor", "Jane", "May"]]
09:19 <lambdabot> [[["student","alan","peter"],["student","ronald","sally"]],[["instructor","b...
09:19 perebor joined
09:19 <pally> kuribas, does it have to be? O_o
09:20 Sampuka joined
09:20 <kuribas> pally: groupBy only works on adjacent elements
09:22 slomo_ joined
09:23 potong joined
09:24 <potong> @free fmap :: (a -> b) -> (F a -> F b)
09:24 <lambdabot> g . h = k . f => $map_F g . fmap h = fmap k . $map_F f
09:25 cybai joined
09:26 <kuribas> > map read . filter (all isDigit) . groupBy ((==) `on` isDigit) $ "123abc524def3145" :: [Int]
09:26 <lambdabot> [123,524,3145]
09:26 Unhammerd joined
09:26 <pally> kuribas, can we talk about your solution a lil bit more?
09:26 <pally> I know it works
09:27 <kuribas> pally: nope, it's finished.
09:27 <kuribas> Done. Basta
09:27 <kuribas> pally: of course :)
09:27 <kuribas> pally: what do you want to know?
09:27 <asheshambasta> Rembane: I'll report this as an issue
09:27 <c50a326> can why is pattern matching called pattern matching
09:28 <c50a326> [a+b | (a,b) <- xs]
09:28 <pally> ` ((==) `on` head)` is the first argument you passed to `groupBy`
09:28 <c50a326> apparently this involves "pattern matching" ... does it though? :\
09:28 <asheshambasta> but I'll just live on an older LTS that worked -- I'm tired of this and I've spent far too much time getting things to work in Haskell
09:28 gabiruh joined
09:28 <asheshambasta> as compared to actually writing useful code
09:28 <pally> but if we look at the type signature:
09:28 <pally> :t groupBy
09:28 <lambdabot> (a -> a -> Bool) -> [a] -> [[a]]
09:28 <asheshambasta> Rembane: basically, every instruction out there that I follow leads to more errors and then some more, and I end up staring down this rabbit hole from one issue to another.
09:29 <pally> the first paramter is a function that expects two arguments
09:29 <c50a326> asheshambasta: I heard the recommended way to install haskell is to use a nixos docker container
09:29 <kuribas> :t ((==) `on` head)
09:29 <lambdabot> Eq a => [a] -> [a] -> Bool
09:29 <potong> > map (+1) [1..10]
09:29 klntsky joined
09:30 <kuribas> pally: note that those a's are not the same
09:30 <pally> (==) is one, `on` is two, and head is three, no?
09:30 <potong> @type contramap
09:30 <lambdabot> Contravariant f => (a -> b) -> f b -> f a
09:31 <kuribas> pally: think of that as Eq b => [b] -> [b] -> Bool, where [b] ~ a
09:31 Linter joined
09:31 catsup joined
09:31 scottschmidt1 joined
09:31 <asheshambasta> c50a326: on a mac that would mean running a VM
09:32 <kuribas> pally: ((==) `on` head) is the same as (on (==) head). It's the result of applying (==) and head to on.
09:32 orphean joined
09:32 catsup joined
09:33 <kuribas> pally: it's a function that transforms into another function.
09:34 <pally> this is one of the reasons why Haskell is so difficult.
09:34 <kuribas> :t \f -> f `on` head
09:34 <lambdabot> (b -> b -> c) -> [b] -> [b] -> c
09:34 <kuribas> pally: do you see what on does?
09:34 <kuribas> pally: in particular what (`on` head) does?
09:34 <potong> @run map (+1) [1..10]
09:35 <kuribas> pally: it's easier formatted like this: (b -> b -> c) -> ([b] -> [b] -> c)
09:36 <c50a326> why is "pattern matching" called "pattern matching"
09:36 <c50a326> no "patterns" are being "matched" are they...
09:36 <Rembane> asheshambasta: Sweet! Then it really needs fixing.
09:36 <pally> it's a function that accepts two parameters and spits out a functions that accepts two wrapped arguments of type b
09:37 <kuribas> pally: [b] is a list of b
09:37 <kuribas> pally: so it will apply "head" to both arguments first, then use the original function (comparison).
09:37 dddddd joined
09:38 <pally> kuribas, `on` is harder to locate since a search on Data.List documentation will highlight a lot of results
09:38 <kuribas> pally: it's in Data.Function
09:39 <kuribas> @hoogle on
09:39 <lambdabot> Data.Function on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
09:39 <lambdabot> System.Glib.Signals on :: object -> Signal object callback -> callback -> IO (ConnectId object)
09:39 <lambdabot> Text.Regex.TDFA.Common on :: (t1 -> t1 -> t2) -> (t -> t1) -> t -> t -> t2
09:40 <kuribas> > (==) [1, 2] [1, 4] -- pally
09:40 <pally> (b -> b -> c) -> (a -> b) -> a -> a -> c is too much
09:40 <lambdabot> False
09:40 <kuribas> > ((==) `on` head) [1, 2] [1, 4] -- pally
09:41 <lambdabot> True
09:41 <kuribas> pally: see the difference?
09:41 <pally> from `(b -> b -> c) -> (a -> b) -> a -> a -> c` how do you read how many arguments `on` accepts?
09:42 <kuribas> pally: you don't
09:42 <pally> Oh Haskell.
09:42 <kuribas> pally: do you have an intuition what on does?
09:43 spietz joined
09:43 fmixing joined
09:43 <pally> I am trying to find handle, but haskell got spikes on it at every spot,.
09:43 <pally> that's how I am feeling right now.
09:44 RegEchse joined
09:44 emilypi joined
09:44 Sp4rrowh4wk joined
09:45 <kuribas> pally: forget the signature, just look at the example
09:45 <kuribas> pally: do you see what it did?
09:45 louispan joined
09:45 <kuribas> on is a quite complicated combinator
09:47 <malorie> I'm trying to write a simple regex, using regex-applicative, but my solution seems a bit tedious: https://lpaste.net/3178453116764815360 is there anything I could do better, or is this how regex-applicative is supposed to be used?
09:47 <kuribas> pally: (==) `on` head does compare the two values, it compares them after applying head to both arguments.
09:47 <pally> kuribas, I will, bear with me for 1 sec. I want to pull up a useful documentation, record our discussion, re-read the log and tackle again.
09:47 <pagnol> so when I create a new project with stack I get three config files... what a putrid mess
09:49 andreabedini joined
09:49 <kuribas> pally: sorry I mean't doesn't compare the two values
09:50 <kuribas> pally: it compares the "head" of the two values
09:50 <kuribas> pally: in other words, it compares "on the head".
09:50 <Rembane> pagnol: https://xkcd.com/927/
09:50 scottschmidt1 joined
09:50 <kuribas> pally: you can read it like english :)
09:51 amar joined
09:51 <pally> kuribas, you know what's even tougher, I've looked for documentations on several authoritative sites, there's literaelly no english description for it.http://hackage.haskell.org/package/base-
09:51 <pally> zero
09:52 <kuribas> pally: file a bug :)
09:53 <kuribas> pally: anyway, I gave you a lengthly explanation
09:53 <c50a326> hey if I try to do a type definition for a function in ghci it moans. I'm trying: sum' :: (Num a) => [a] -> a
09:53 <c50a326> and it says Variable not in scope: sum' :: [a1] -> a1
09:54 <kuribas> pally: just forget about the type signature of on
09:54 caryoscelus joined
09:55 <pally> kuribas, okay. I will now re-read the log. I am sorry for the delay and have wasted your time. I thought it'd make sense have something doc opened for easy reference.
09:55 <malorie> c50a326: let sum' :: Num a => [a] -> a ; sum' = sum
09:55 <kuribas> pally: you still haven't answered my question about the examples
09:55 <c50a326> The type signature for ‘sum'’ lacks an accompanying binding
09:56 <c50a326> oh if I do ; and then the function definition on the same line it works
09:56 <kuribas> pally: <kuribas> pally: see the difference?
09:56 <* pally> looking
09:56 <c50a326> :sum' :: (Num a) => [a] -> a; sum' [] = 0; sum' (x:xs) = x + sum' xs; sum' [5, 4, 3]
09:57 <c50a326> This works but if I leave out the type definition bit at the beginning it says: Non-exhaustive patterns in function sum'
09:57 <pally> kuribas, yes I do.
09:57 <kuribas> pally: so you see what it does?
10:00 <pally> ues
10:00 <pally> yes
10:00 <pally> just like you said. "it compares on-the-head"
10:01 <kuribas> pally: there isn't more to it.
10:01 <kuribas> now have a beer :)
10:03 <c50a326> if I declare the function type of sum' as sum' :: (Num a) => [a] -> a then that's the function type, but if I don't explicitly declare the function type then the type is sum' :: Num a => [a] -> a
10:03 <c50a326> and apparently this difference causes an error: Non-exhaustive patterns in function sum'
10:03 <c50a326> the only difference is Num a being in the ()s
10:03 <c50a326> So what difference does that make?
10:04 <pally> kuribas, let's review what you said earlier:
10:05 <pally> <kuribas> pally: ((==) `on` head) is the same as (on (==) head). It's the result of applying (==) and head to on.
10:05 <kuribas> yes
10:05 <kuribas> `f` is infix syntax
10:05 <c50a326> it sounds like you guys are beating a dead horse
10:05 rprije joined
10:05 <pally> let's look at the standard prefix notation
10:06 <pally> (on (==) head)
10:06 <pally> since evaluation is from left to right
10:06 <kuribas> c50a326: that's exactly the same. The error will be elsewhere.
10:06 <pally> should it instead be "the result of apllying `on` to `(==)`
10:07 brocoli joined
10:07 <asheshambasta> if I have a package in my extra-deps (stack) I'm supposed to find it during imports right?
10:07 <c50a326> wtf
10:07 <c50a326> I just tried it again and now it works without the type signature declaration thing
10:08 <c50a326> I must have mistyped something
10:08 vilu joined
10:08 <c50a326> oh wait no I put sum instead of sum', I didn't mistype something until now so the problem is still real. Hang on I'll paste something.
10:09 <kuribas> pally: so if we unify the variables we get: "head :: [a] -> a", "(==) :: Eq a => a -> a -> Bool", and on :: (a -> a -> Bool) -> ([a] -> a) -> ([a] -> [a] -> Bool)"
10:09 <asheshambasta> having ```extra-deps:
10:09 <asheshambasta> - monad-log-
10:09 <asheshambasta> - aeson-
10:09 <asheshambasta> - esqueleto-2.5.3``` but Database.Esqueleto in imports not found
10:10 <kuribas> pally: see how everything fits?
10:10 <asheshambasta> this is giving me a headache
10:10 tomphp joined
10:10 <pally> asheshambasta, you are not alone.
10:10 scottschmidt1 joined
10:11 <c50a326> here https://lpaste.net/6313430216622473216
10:11 <kuribas> c50a326: that's because you are redifining sum', not making new clauses.
10:12 <c50a326> ohhhh...
10:12 <kuribas> asheshambasta: sorry, I don't use stack...
10:13 <kuribas> asheshambasta: if we can meet in Brussel, I can have a look at it...
10:13 <c50a326> with stack runghc it works with linebreaks
10:13 <c50a326> maybe I should stop using ghci
10:14 jeltsch joined
10:14 <kuribas> c50a326: in new ghci's you can do multiple lines
10:14 <c50a326> kuribas: with \ or something?
10:14 <kuribas> c50a326: or separate with ;
10:14 <c50a326> yeah I already used ; in the paste so I know that lol
10:15 <kuribas> c50a326: :{ multiline code :}
10:15 <c50a326> oh, juicy
10:16 louispan joined
10:16 <taumuon> there's also the :set +m command
10:17 knupfer joined
10:17 <asheshambasta> kuribas: I'll let you know about next week, thanks!
10:17 <asheshambasta> we should catch up indeed.
10:18 beauby joined
10:18 <c50a326> asheshambasta: apparently you can use nix on mac
10:19 <c50a326> without a VM... I was just being facetious about a nix docker container tho :p
10:23 Ariakenom joined
10:23 louispan joined
10:24 psychicist__ joined
10:25 <asheshambasta> c50a326: gives me shivers to even think of using yet another tool for Haskell after I've finally gotten HIE to play nicely with emacs
10:25 saurabhnanda joined
10:26 Gurkenglas joined
10:26 <asheshambasta> Rembane: after further analysis of this, it looks like the versions of persistent are just too new for Esqueleto (a library I've also been using in the project)
10:26 <Rembane> asheshambasta: Oh. So a bit of dependency hell too?
10:27 <asheshambasta> Rembane: yeah, thats what it looks like. Apparently, Spock uses Conduit (guessing) but a newer version as per the Spock version on LTS-11.14
10:28 <asheshambasta> and so does Persistent, so downgrading persistent will also need downgrading Conduit
10:28 <asheshambasta> and that won't play nice -- so this is a dependency stalemate as I'd term it
10:28 Majiir joined
10:28 <Rembane> asheshambasta: Dang. It just can't end well.
10:28 <pally> > ((==) `on` head) [1, 2] [1, 4]
10:29 <lambdabot> True
10:29 <pally> > ((==) `on` head) [1, 2] [1, 4] [1,5]
10:29 <lambdabot> error:
10:29 <lambdabot> • Couldn't match expected type ‘[Integer] -> t’
10:29 <lambdabot> with actual type ‘Bool’
10:29 <asheshambasta> Rembane: the only way out of this (from what it seems) is to move away from Esqueleto and use something else for nicer db queries with joins and stuff.
10:30 <pagnol> is anyone here using json-ld from haskell?
10:30 ammazza joined
10:31 mortum5 joined
10:31 <kuribas> > let l = [[1, 2], [1, 4], [1,5]] in all (((==) `on` head) (head l)) l
10:31 <lambdabot> True
10:32 <kuribas> pally ^^
10:35 louispan joined
10:38 oo_miguel joined
10:38 <pally> > groupBy ((==) `on` head) [ ["student", "1"], ["student", "2"], ["instructor", "3], ["student", "4"], ["instructor", "5"]]
10:38 <lambdabot> <hint>:1:122: error:
10:38 <lambdabot> lexical error in string/character literal at end of input
10:38 <pally> > groupBy ((==) `on` head) [ ["student", "1"], ["student", "2"], ["instructor", "3"], ["student", "4"], ["instructor", "5"]]
10:38 <lambdabot> [[["student","1"],["student","2"]],[["instructor","3"]],[["student","4"]],[[...
10:39 matt179 joined
10:39 <pally> kuribas, I see what you mean when you said they need to be sorted now
10:40 scottschmidt1 joined
10:49 fendor joined
10:52 errst joined
10:56 louispan joined
11:00 <fendor> is it possible that i can not obtain profiling information when the program has been terminated with `exitWith ExitSuccess`?
11:00 philippD joined
11:01 lumm joined
11:04 kritzefitz joined
11:06 scottschmidt1 joined
11:07 __monty__ joined
11:09 yqt joined
11:11 brocoli joined
11:12 scottschmidt1 joined
11:14 tomphp joined
11:15 pfurla joined
11:15 encodes joined
11:15 <encodes> another error; https://lpaste.net/4873430800143482880
11:16 pio_ joined
11:17 antsanto joined
11:18 scottschmidt1 joined
11:21 silver joined
11:23 matt179 joined
11:24 acidjnk joined
11:26 tsaka__ joined
11:27 <c50a326> is a list comprehension an expression?
11:27 <c50a326> it is isn't it?
11:28 asheshambasta joined
11:28 <pavonia> Yes
11:28 <iron_houzi> What's a good way to build unicode strings in haskell? My natural way of doing this would be to assign numeric values for each character in an alphabet and join to strings: k = 0x040; n = 0x053; [k, n] :: String ---> error: No instance for (Num Char) arising from a use of ‘k’
11:28 sjakobi joined
11:28 <c50a326> what about the `x <- xs` bit that is inside a list comprehension? is that an expression? it's not is it?
11:28 <c50a326> is it just "sugar" ?
11:29 <iron_houzi> oh wait, maybe I have to map the numbers with chr
11:29 <pavonia> It's syntax
11:29 <c50a326> is it bad to use list comprehensions as a beginner because they're just "sugar" ?
11:29 errst_ joined
11:29 <pavonia> No
11:29 <c50a326> pavonia: but it's not a command using a monad is it?
11:29 <c50a326> even though it has the <-
11:30 <pavonia> They are for lists only, not arbitrary monads (if this is what you're asking)
11:30 <iron_houzi> .. no not ASCII, so to/fromEnum
11:31 <pavonia> iron_houzi: ord/chr work for all Unicode characters
11:31 <c50a326> pavonia: so it's a list monad?
11:31 <pavonia> [a] has a Monad instance, yes
11:33 <pavonia> iron_houzi: What is your aim? Perhaps String isn't the proper data type for your need
11:34 <jbetz> From an old reddit thread about why haskell doesn't have row polymorphism: "There is no consensus that row polymorphism is the best way to implement records and variants." What exactly are the alternative implementations?
11:35 thunderrd joined
11:37 <encodes> c50a326: more importantly it implements; class DifferenceT f where differenceT :: Applicative g => (a -> g b) -> (f a -> (g (f b -> f b),f a)).
11:37 <iron_houzi> pavonia: Thanks, I figured it out now. I want to convert Tibetan text written in latin script to native Tibetan unicode script. Tibetan script is written both horizontal and vertical, so at some point I need to determine axis and shift accordingly, which is why I want to represent each letter as an int, so I can +50 for vertical shift before converting to unicode character
11:39 louispan joined
11:40 fmixing joined
11:40 megaTherion joined
11:42 Gurkenglas joined
11:45 scottschmidt1 joined
11:47 kvda joined
11:49 byorgey joined
11:51 antsanto joined
11:52 p0lyph3m joined
11:52 <encodes> Either the error is something to do with line 20, or the approach is fundamentally flawed.. something to do with Lift2 having too many arguments perhaps? https://lpaste.net/4873430800143482880
11:53 vonfry joined
11:55 <nowhereman_> how come the result of forever can be unified with any monadic type?
11:55 vonfry_ joined
11:56 kvda joined
11:56 <nowhereman_> like (forever $ getLine :: IO Int)
11:57 <phadej> :t forever
11:57 <lambdabot> Applicative f => f a -> f b
11:58 saurabhnanda joined
11:59 asheshambasta joined
12:00 nitaigao joined
12:00 Linter joined
12:01 jao joined
12:01 <asheshambasta> So; I upgraded my Stack LTS to 11.14 in a project that uses Persistent and Esqueleto. Esqueleto, for some reason, isn't available on this resolver (probably due to compat. issues with the Persistent version on this resolver) so I added it to my extra-deps in stack.yaml. Now, the Persistent version on this resolver is 2.8.2 but persistent, as required by Esqueleto, must match < 2.8. So this is a bit of a soup. Wha
12:01 <asheshambasta> to go about this? Downgrading the resolver?
12:02 <maerwald> use cabal xD
12:02 tomsen joined
12:02 mbwgh joined
12:02 <asheshambasta> maerwald: how likely is that to solve this problem? :-)
12:03 <kuribas> iron_houzi: string is already unicode
12:03 <maerwald> you don't have to deal with stack then
12:03 djtyml joined
12:03 <asheshambasta> maerwald: I've heard scary things about Cabal too
12:03 <maerwald> I haven't
12:04 <iron_houzi> kuribas: Thank you, I know.
12:04 djtyml_ joined
12:04 tzemanovic joined
12:05 <kuribas> iron_houzi: are you looking for chr or ord?
12:05 <kuribas> :t chr
12:05 <lambdabot> Int -> Char
12:05 danso joined
12:06 <kuribas> :t ord
12:06 <lambdabot> Char -> Int
12:06 <iron_houzi> kuribas: I was looking for chr, it didn't seem to be working i ghci, but I just had to import it with correct namespacing
12:06 djtyml__ joined
12:06 <int-e> > toEnum 48 :: Char
12:06 <lambdabot> '0'
12:06 <iron_houzi> > chr 0x040
12:06 <lambdabot> '@'
12:07 <kuribas> oh, pavonia already mentioned it...
12:07 <iron_houzi> > chr 0x0f40
12:07 <lambdabot> '\3904'
12:07 <iron_houzi> > putStrlLn chr 0x0f40
12:07 <lambdabot> error:
12:07 <lambdabot> • Variable not in scope: putStrlLn :: (Int -> Char) -> Integer -> t
12:07 <lambdabot> • Perhaps you meant one of these:
12:08 louispan joined
12:08 <gonz_> maerwald: If you've never heard scary things about cabal you either have never paid attention or you are new.
12:08 <iron_houzi> > putStrLn $ map chr [0x0f40]
12:08 <lambdabot> <IO ()>
12:08 connrs joined
12:08 <maerwald> gonz_: I'm neither
12:09 <iron_houzi> the bot doesn't to IO??
12:09 <iron_houzi> *do
12:10 <mbwgh> Is there a portable and performant way to traverse directories only? Currently, I Conduit's `sourceDirectory`, and `filterMC (liftIO . doesDirectoryExist)`, but this is dog slow. There are things like the unix package of course. But is it possible to get something more efficient than "get everything and then filter by file type"?
12:10 <maerwald> I feel it's mostly people who don't know much about cabal who keep saying it's scary
12:10 <maerwald> which is a result of advertisement imo
12:11 detrumi left
12:11 <int-e> :t text
12:11 <lambdabot> String -> Doc
12:11 <int-e> > text [chr 0x0f40]
12:11 <lambdabot>
12:12 Yoaninator joined
12:13 <* hackage> cdeps - Extract dependencies from C code. http://hackage.haskell.org/package/cdeps- (vmchale)
12:13 hiratara joined
12:15 <int-e> iron_houzi: Anyway, using the type system as a mechanism for preventing IO is one of the main ideas behind lambdabot. The bot might not exist without this idea.
12:15 scottschmidt1 joined
12:16 <iron_houzi> int-e: Wow! What does the type Doc represent? Is it only used by the lambdabot, or is this a common type in haskell?
12:16 <maerwald> gonz_: you can also check out https://www.haskell.org/cabal/users-guide/nix-local-build-overview.html and https://www.stackage.org/lts-11.14/cabal.config
12:16 <int-e> % print 123 -- yahb has a different philosophy
12:16 <yahb> int-e: 123
12:17 <int-e> iron_houzi: http://hackage.haskell.org/package/pretty-
12:19 beauby joined
12:21 <iron_houzi> int-e: This is very interesting. Not sure I can use it entirely, as I am using a language where these rules would not fully apply, but it's hard to be 100% sure due to the sparse information on the page you linked to
12:22 <iron_houzi> Very inspirational to say the least
12:23 amar joined
12:23 <iron_houzi> > text $ map chr [0x0f40, 0x0f53]
12:23 <lambdabot> ཀན
12:23 <iron_houzi> Nice
12:24 malorie joined
12:26 <int-e> > (show (show "äöü"), show (text "äöü")) -- what lambdabot uses for output is the result of "show" applied to the given value
12:26 <lambdabot> ("\"\\\"\\\\228\\\\246\\\\252\\\"\"","\228\246\252")
12:27 <int-e> uhm
12:27 logzet joined
12:27 FreeBirdLjj joined
12:27 <int-e> > (show "äöü", show (text "äöü")) -- that was one 'show' too many
12:27 <lambdabot> ("\"\\228\\246\\252\"","\228\246\252")
12:27 davr0s joined
12:27 <int-e> > fix show
12:27 <lambdabot> "\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\...
12:30 Kacia joined
12:31 JuanDaugherty joined
12:31 brocoli joined
12:32 saurabhnanda joined
12:32 hololeap joined
12:33 bas080 joined
12:34 <encodes> there was a mistake before, this gives an error which it might be easier to help with; https://lpaste.net/972356191810224128
12:35 FreeBirdLjj joined
12:36 tomphp joined
12:37 Anthony_Bourdain joined
12:38 darkJedi joined
12:43 thunderrd joined
12:43 <infinisil> fix show is magical..
12:44 valentinbuza joined
12:44 ammazza joined
12:45 <infinisil> > elemIndices '"' $ fix show
12:45 <lambdabot> mueval-core: Time limit exceeded
12:45 mreh joined
12:45 <infinisil> > take 15 . elemIndices '"' $ fix show
12:45 <lambdabot> [0,2,6,14,30,62,126,254,510,1022,2046,4094,8190,16382,32766]
12:47 agander joined
12:49 Anthony_Bourdain joined
12:49 Kacia joined
12:50 ni291187 joined
12:51 <Ariakenom> > (\xs -> zipWith (-) (tail xs) xs) $ take 15 . elemIndices '"' $ fix show
12:51 ni291187 left
12:51 asheshambasta joined
12:51 <lambdabot> [2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384]
12:51 <int-e> > [2^i - 2 | i <- [1..]]
12:51 <lambdabot> [0,2,6,14,30,62,126,254,510,1022,2046,4094,8190,16382,32766,65534,131070,262...
12:54 phenoble joined
12:55 <rzmt> i have a list of urls and i want to make exactly 30 HTTP requests for those in a minute, how would i throttle the requests using conduit?
12:55 thunderrd joined
12:57 Ariakenom joined
13:00 patlv joined
13:01 reggie_ joined
13:03 tomsen joined
13:04 lnostdal joined
13:05 detrumi joined
13:06 <mbwgh> rzmt: https://hackage.haskell.org/package/conduit-throttle ?
13:07 gabiruh joined
13:07 fmixing_ joined
13:07 Linter joined
13:08 djtyml joined
13:09 AWizzArd joined
13:10 djtyml_ joined
13:11 lantti joined
13:11 djtyml__ joined
13:13 <rzmt> thanks, ill check this soon
13:13 Deide joined
13:14 ammazza joined
13:18 malorie joined
13:18 darkJedi joined
13:18 djtyml joined
13:19 justanotheruser joined
13:19 SpinTensor joined
13:20 thunderrd joined
13:21 <encodes> is it because reflect expects 's' as the last argument to Lift2 but Functor expects 'a'?
13:21 reanimator joined
13:22 <ij> is it possible to run hspec in ghci?
13:22 saurabhnanda joined
13:23 <reanimator> hey, I am having trouble with do notation..I have this piece of code
13:23 <reanimator> https://gist.github.com/rastko1996/f4a136f20ee0b7ade8f43d85acf556fb
13:23 mreh joined
13:23 djtyml_ joined
13:23 <reanimator> tried writing it in two different ways, nothing works, parse error either on return or let
13:23 albertus1 joined
13:23 matt179 joined
13:25 <encodes> so that a Functor over type 'a' (x :: (Functor (f s) => (f s) a)) is not a proxy over type 's' as required to call 'reflect x'. how then can a proxy for 's' be obtained from 'x'?
13:26 whowillcode joined
13:27 <encodes> with reference to; https://lpaste.net/972356191810224128
13:29 kvda joined
13:30 emilypi joined
13:30 tomphp joined
13:31 wildsebastian_ joined
13:31 mbwgh joined
13:31 nuncanada joined
13:34 malorie joined
13:39 <c50a326> hey this is my first attempt at a sorting algorithm and it's giving me a headache, I don't think this approach is even viable. In any case, I'd like to understand the error: https://lpaste.net/31288866816131072
13:39 <c50a326> cannot construct the infinite type: a ~ [a]
13:39 <c50a326> what's the tilda in the error dialogue for?
13:40 theelous3 joined
13:41 amirpro joined
13:42 agander_ joined
13:42 saurabhnanda joined
13:44 language_agnosti joined
13:44 amirpro joined
13:45 <encodes> > [1,2]:[3]
13:45 <lambdabot> error:
13:45 <lambdabot> • No instance for (Num [Integer]) arising from a use of ‘e_1123’
13:45 <lambdabot> • In the expression: e_1123
13:45 <encodes> > [1,2]++[3]
13:45 matsurago joined
13:45 <lambdabot> [1,2,3]
13:46 <encodes> > :t ((:),(++))
13:46 <lambdabot> <hint>:1:1: error: parse error on input ‘:’
13:46 <encodes> :t ((:),(++))
13:46 cynapse joined
13:46 <lambdabot> (a1 -> [a1] -> [a1], [a2] -> [a2] -> [a2])
13:47 <encodes> the ~ is trying to say that the types are equal
13:47 <encodes> https://downloads.haskell.org/~ghc/7.4.1/docs/html/users_guide/equality-constraints.html
13:47 <c50a326> oh yeah ++ sorry
13:48 bahamas joined
13:48 <fendor> when should i prefer TQueue over TChan?
13:49 nkaretnikov joined
13:49 blackandblue joined
13:50 detrumi left
13:52 vitali joined
13:53 carlomagno joined
13:53 gabiruh joined
13:54 brocoli joined
13:54 justanotheruser joined
13:57 alx741 joined
13:58 antsanto joined
13:58 ericsagnes joined
13:58 <* hackage> tasty - Modern and extensible testing framework http://hackage.haskell.org/package/tasty- (RomanCheplyaka)
13:58 <c50a326> okay what about this one? https://lpaste.net/6707562172622307328
13:59 Folkol joined
13:59 <c50a326> it wants me to do a type declaration, why?
14:00 <c50a326> I guess it could be anything that could go in a list, what type is that? Fold or Ord or something?
14:01 <c50a326> take' :: Int -> Fold -> Fold isn't right lol
14:01 <c50a326> I guess I can look at :t take
14:01 <blackandblue> can you do AI with haskell or python better?
14:02 xkapastel joined
14:02 tomboy64 joined
14:02 <c50a326> oh that works
14:03 Voldenet joined
14:03 Voldenet joined
14:04 <maerwald> python might have more libraries
14:06 <c50a326> ah I did it!
14:06 patlv joined
14:07 Folkol joined
14:08 nitaigao joined
14:08 <encodes> ok, this works. https://lpaste.net/2492316960059031552
14:08 <encodes> is it in a library somewhere already?
14:09 <c50a326> this works too https://lpaste.net/3733163579155677184 I managed to write some haskell to do something that I wanted it to do, woot
14:09 efeuska joined
14:09 <nkaretnikov> how do i implement short-circuiting for something like this? `for [1..10] \x -> for [1..10] \y -> if (x,y) == (5,5) then (act :: IO a) else return ()` where `for` is something like `forM`. the problem here is that the expression returns different types depending on the result of `if`. i was thinking about using `foldl` similar to `let xs = foldl1 (\x y -> traceShow y $ if y == 5 then 42 else x) [1..10]` which goes from 1
14:09 <nkaretnikov> to 5 and then prints 42. but i can't figure out how to apply this to my problem. any ideas?
14:10 gehmehgeh joined
14:10 <lyxia> nkaretnikov: do you mean to replace return by something that shortcircuits
14:11 <nkaretnikov> to stop evaluating lists as soon as the condition holds
14:11 <nkaretnikov> i guess i could rely on laziness here too
14:11 <nkaretnikov> and just add another pass later looking for a marker in the list or something
14:12 <nkaretnikov> so just do something like foldl1 ... $ for ... $ for
14:13 <lyxia> there are ways to add a short-circuiting feature to a monad with ExceptT or ContT
14:13 acidjnk joined
14:13 nitaigao joined
14:13 beefjoe joined
14:14 nitaigao joined
14:14 the_2nd joined
14:14 <nkaretnikov> any examples?
14:14 <nkaretnikov> i used both a long time ago
14:15 <the_2nd> Is it possible to read two multi-line string from stdin? I tried calling getContents twice, but that seems to create some sort of endless loop / error state
14:16 davr0s joined
14:16 <mniip> the_2nd, how would you find where the first string ends
14:16 tangmou joined
14:17 <apoc> i have a Data.Text (i think) but putStrLn can't print it, Couldn't match type ‘Text’ with ‘[Char]’, how can i print it?
14:17 codesoup joined
14:17 <the_2nd> unsure :D Maybe two "getline" where "\n" has to be used for multi line might work
14:17 whowillcode joined
14:18 <Boreeas> `/log
14:19 gabiruh joined
14:20 beauby joined
14:23 vilu joined
14:24 JuanMiguel joined
14:24 reggie_ joined
14:26 agander_ joined
14:27 <p0lyph3m> nkaretnikov : https://lpaste.net/8514759117993148416
14:28 <p0lyph3m> use list monad + guard to filter the cases when to act , then map over them
14:29 agander__ joined
14:29 zero_byte joined
14:31 <apoc> Text.unpack was what I was looking for ;)
14:31 <apoc> is there no etcdv3 client library for haskell yet?
14:33 <p0lyph3m> > mapM_ print [(x,y) | x <- [1..10],y <- [1..10] , x == y ]
14:33 <lambdabot> <IO ()>
14:36 whowillcode joined
14:36 matt179 joined
14:37 <p0lyph3m> nkaretnikov: to short circuit just take 1 element
14:38 <p0lyph3m> mapM_ print $ take 1 [(x,y) | x <- [1..10] , y <- [1..10] , x == y ]
14:39 <gonz_> johnw: Do you have a write-up or something about your machinery to cache (parts of) hackage on a home server and use that to pull to your dev machine?
14:40 <gonz_> I'm curious about the server bit. I'm running `nix-serve` right now, but I'm not sure exactly how automated the bit that pulls certain packages can be.
14:42 <gonz_> A cron job that basically just updates the channel and installs a list of packages should work, but people also have a tendency to make nicer stuff for things like this.
14:45 korans joined
14:46 urodna joined
14:47 tangmou joined
14:47 lanelet joined
14:48 codesoup joined
14:48 blackandblue joined
14:49 patlv joined
14:49 chowie joined
14:51 <* hackage> script-monad 0.0.1 - Transformer stack of error, reader, writer, state, and prompt monads http://hackage.haskell.org/package/script-monad-0.0.1 (nbloomf)
14:52 <* hackage> ats-pkg - A build tool for ATS http://hackage.haskell.org/package/ats-pkg- (vmchale)
14:52 language_agnosti joined
14:54 ekrion joined
14:57 fendor_ joined
14:57 FreeBirdLjj joined
14:59 tzemanovic joined
15:04 slomo_ joined
15:04 slomo_ joined
15:08 connrs joined
15:09 blankhart joined
15:11 epsilonhalbe joined
15:11 tzemanovic joined
15:12 hastuur_ joined
15:13 languag__ joined
15:13 mreh joined
15:13 epsilonhalbe left
15:17 eschnett joined
15:18 p0lyph3m joined
15:19 language_agnosti joined
15:20 tomsen joined
15:20 ratschance joined
15:21 cfricke joined
15:22 jmcarthur joined
15:25 firc4730ada5 joined
15:25 tzemanovic joined
15:31 djbeau joined
15:32 alex`` joined
15:34 oish joined
15:34 firc35cb2642 joined
15:38 tzemanovic joined
15:39 detrumi joined
15:41 firc43d39b92 joined
15:41 tsoernes joined
15:42 saurabhnanda joined
15:43 manek joined
15:44 oisdk joined
15:46 <manek> Hi guys! Let's consider I've got a data type `data T = A | B` and `class Foo (t :: T) where foo :: Int -> Int` and `type family X (a :: Type) :: T`. When I use it as follow `myVar = foo @(X a) 5` I got constraint `Foo (X a)`, which is clear, however is it possible to somehow hide this constraint and tell GHC
15:46 tomphp joined
15:46 <manek> that I've implemented all possible instances, namely `Foo 'A` and `Foo 'B` ?
15:47 <manek> because these are the only instances that could be matched, I've provided them, so could we somehow tell GHC that as soon as it knows what `X a` is, the constraint `Foo` will be met and we dont need to provide it in the context?
15:48 <mniip> no
15:48 <mniip> the haskell typesystem is constructive
15:49 <mniip> much like having two terms of types P A and P B wouldn't let you write a term of type forall a. P a
15:49 firc5e1e4308 joined
15:52 ijks joined
15:52 Khisanth joined
15:53 Kacia joined
15:53 moei joined
15:54 t7 joined
15:57 language_agnosti joined
15:57 raichoo joined
15:58 son0p joined
16:00 darkJedi joined
16:01 roconnor joined
16:03 <glguy> manek: Keep in mind that the types get erased at compile time, and it's not enough to know that there must be an instance, you have to know *which* instance is needed at runtime
16:06 pera joined
16:06 beefjoe joined
16:14 danso joined
16:14 tomphp joined
16:15 tomphp joined
16:16 Tops2 joined
16:18 language_agnosti joined
16:18 <encodes> are "with" or "using" part of any library?
16:19 TornjV joined
16:19 <cocreature> :t Foreign.Marshal.Utils.with
16:19 <lambdabot> Foreign.Storable.Storable a => a -> (GHC.Ptr.Ptr a -> IO b) -> IO b
16:19 <cocreature> "using" exists in various libs but not in base afaik
16:21 beauby joined
16:21 <encodes> is that the same as the version here; https://lpaste.net/6834688991220989952 ?
16:22 <cocreature> no? it has a completely different type?
16:22 <rotaerk> cocreature, what I was trying to do with Scope is achievable with resourcet (i.e. avoiding explicit releases), so I'm dropping it
16:22 <rotaerk> can just do nested runResourceT >_>
16:22 <cocreature> rotaerk: oh yeah I guess that works
16:23 <encodes> so is *that* version part of some library?
16:23 <encodes> possibly under a different name...
16:25 agander joined
16:26 malorie joined
16:27 FreeBirdLjj joined
16:27 eschnett joined
16:28 malorie joined
16:28 matt179 joined
16:29 agander_ joined
16:29 <domenkozar> could someone help me explain this: https://gist.github.com/domenkozar/30e4a02028bc00cfae95f78953bed8b1
16:29 <domenkozar> I'd expect GHC not to emit a warning
16:30 <malorie> I'm trying to write a simple regex, using regex-applicative, but my solution seems a bit tedious: https://lpaste.net/3178453116764815360 is there anything I could do better, or is this how regex-applicative is supposed to be used?
16:30 renais joined
16:32 Yuras joined
16:33 brocoli joined
16:34 <monochrom> domenkozar: The compiler does not yet know that "a" and "not a" cover all cases.
16:35 <domenkozar> it says it's missing False
16:35 <domenkozar> so it doesn't know about "not a"
16:36 <monochrom> I bet you it doesn't know about "a" either. There is a way to make it say "missing Foo True"
16:37 supitto joined
16:37 rschm joined
16:38 languag__ joined
16:40 <monochrom> Hrm, I can't make it say "missing Foo True".
16:42 <glguy> domenkozar: Your choices are either to guard on: a, otherwise; or to case a of True -> ...; False -> ...; or if a then ... else ...
16:42 nomeata joined
16:43 <glguy> I think GHC has special knowledge that otherwise from base is defined as True which allows it to know the pattern is complete if that's the last guard
16:43 <monochrom> I guess it knows about "a" but not "not a".
16:44 <domenkozar> glguy: that's pretty limited :)
16:45 <glguy> :)
16:47 agander_ joined
16:48 lainon joined
16:49 <c50a326> how is this not a merge sort https://lpaste.net/8053164770645245952
16:49 <mniip> it's a quicksort
16:49 <monochrom> So much for "meaningful" function names, eh?
16:49 <c50a326> what's the difference
16:50 <c50a326> it divides and conquers and sorts
16:50 <monochrom> But merge sort does not simply need ++ for the merge stage.
16:50 <monochrom> Both quicksort and mergesort are divide and conquer.
16:50 <mniip> so you don't know the difference between a quicksort and a mergesort?
16:51 <monochrom> Please don't speak like "what's the difference between the empty string and the empty set? both are empty"
16:51 <c50a326> no I don't
16:52 <mniip> well the quicksort first splits an array into two subarrays that definitely come one before another in the sorted array, and then recursively sorts each
16:52 lain0n joined
16:52 themagician joined
16:53 <mniip> (then you can concatenate the sorted results)
16:53 <monochrom> There are multitudes of mergesort presentations on the web so you can take a look.
16:53 <mniip> mergesort on the other hand splits arbitrarily, then recursively invokes sorting and then does a merge of two sorted arrays
16:53 <monochrom> But if you just work at the coarse level of "oh so it's just divide and conquer" and not look at the particulars, you will never improve.
16:54 psychicist__ joined
16:54 <monochrom> At which point insertion sort is divide and conquer, too.
16:54 <supitto> Another think to keep in mind is that quick sort is not açwa
16:54 brocoli joined
16:54 <supitto> *always n log
16:54 <mniip> supitto, it can be made to be
16:55 <supitto> you may use the pivot in a intelligent way so it get pretty difficult to fall on a n^2 case
16:56 <supitto> but I never saw a failproof approach
16:56 <monochrom> There is a linear-time algorithm for finding the median.
16:56 <supitto> That makes sense
16:57 <monochrom> If you use that to choose your pivot, you get n lg n worst case.
16:57 <mniip> supitto, median of medians
16:57 davr0s joined
16:57 <monochrom> People don't always do that because the constant multiplier is bigger.
16:58 <mniip> it does invoke quickselect recursively, but the complexities work out
16:59 tomphp joined
17:00 toovs joined
17:00 <monochrom> So, no one wants to say "teach the controversy! if you are not using a mutable array, it is not quicksort" ? >:)
17:01 tzemanovic joined
17:01 <supitto> That made me laugh hard
17:01 spoon16 joined
17:01 quobo joined
17:02 rschm joined
17:02 errst_ joined
17:04 shubham joined
17:04 fex joined
17:05 <nshepperd_> Apparently a paper came out last year that improves the constant factors of median of medians http://erdani.com/research/sea2017.pdf
17:05 <monochrom> Nice.
17:06 fex joined
17:07 Jobava joined
17:07 fex joined
17:09 fexna joined
17:09 sim590 joined
17:10 theelous3 joined
17:11 <hololeap> @let newtype Thing d a = Thing { runThing :: (a -> a -> d) -> a }
17:11 <lambdabot> Defined.
17:11 _cyril_ joined
17:11 <hololeap> how would fmap be written for this?
17:12 <geekosaur> that looks wrong. it never gets an a
17:13 <hololeap> i figured it out for newtype Thing d a = Thing { runThing :: (a -> d) -> a }
17:14 <firc5e1e4308> fmap f (Thing g) = \ a b -> f (g a b)
17:15 <phadej> the latter Thing is Cont
17:15 <firc5e1e4308> fmap f (Thing g) = \ a b -> Thing $ f (g a b)
17:16 <phadej> wait, it's not
17:16 <phadej> Select: http://hackage.haskell.org/package/transformers-
17:16 kapil___ joined
17:17 tzemanovic joined
17:17 <nshepperd_> @djinn (a -> b) -> ((a -> a -> d) -> a) -> ((b -> b -> d) -> b)
17:17 <lambdabot> f a b c = a (b (\ d _ -> c (a d) (a d)))
17:18 potong joined
17:20 brocoli joined
17:20 <potong> @help
17:20 <lambdabot> help <command>. Ask for help for <command>. Try 'list' for all commands
17:20 <hololeap> nshepperd_: thanks
17:20 <hololeap> useful tool.
17:20 <potong> @help list
17:20 <lambdabot> list [module|command]. Show commands for [module] or the module providing [command].
17:20 <nshepperd_> Note that djinn gave up before realizing that it could use both of the arguments to the inner function
17:21 <geekosaur> :exf "(a -> b) -> ((a -> a -> d) -> a) -> ((b -> b -> d) -> b)"
17:21 <potong> @help free
17:21 <lambdabot> free <ident>. Generate theorems for free
17:21 <exferenceBot> \ f1 f2 f3 -> f1 (f2 (\ g -> f3 (f1 g) . f1))
17:21 <exferenceBot> \ f1 f2 f3 -> f1 (f2 (\ g -> \ h -> f3 (f1 h) (f1 g)))
17:22 <nshepperd_> It should be (\d e -> c (a d) (a e))
17:22 khilan joined
17:23 tzemanovic joined
17:23 <potong> @list
17:23 <lambdabot> What module? Try @listmodules for some ideas.
17:25 <potong> > sum [1..10]
17:25 <lambdabot> 55
17:26 zakora joined
17:28 cybai joined
17:28 <potong> @listmodules
17:28 <lambdabot> activity base bf check compose dice dict djinn dummy elite eval filter free fresh haddock help hoogle instances irc karma localtime metar more oeis offlineRC pl pointful poll pretty quote search
17:28 <lambdabot> slap source spell system tell ticker todo topic type undo unlambda unmtl version where
17:28 XorSwap joined
17:29 vitali joined
17:29 renais joined
17:30 nitaigao joined
17:31 language_agnosti joined
17:31 gentauro joined
17:38 JimmyRcom_ joined
17:41 eschnett joined
17:43 desperek joined
17:45 nicknight joined
17:47 <* hackage> iso8601-duration - Types and parser for ISO8601 durations http://hackage.haskell.org/package/iso8601-duration- (albertov)
17:48 urdh joined
17:52 <encodes> This version achieves the same as the last but without needing to define a new version of reify for kind *->* types. if the comments around using2 are removed, there are many errors; https://lpaste.net/7690765987238379520
17:53 <encodes> this can be compared against the kind * case; https://lpaste.net/6834688991220989952
17:54 <* hackage> tintin 1.9.1 - A softer alternative to Haddock http://hackage.haskell.org/package/tintin-1.9.1 (NickSeagull)
17:55 darkJedi joined
17:56 mnoonan_ joined
17:57 w77 joined
17:58 <encodes> how can using be written properly for the kind *->* case?
17:59 cybai joined
18:00 <encodes> also, reifiedIns2 on line 22 might not be correct...
18:00 cybai joined
18:01 ming joined
18:02 nitaigao joined
18:04 ming joined
18:05 ming1 joined
18:06 jmcarthur joined
18:07 ming1 joined
18:07 pipahask joined
18:08 ming1 joined
18:08 JuanMiguel joined
18:09 hastuur joined
18:09 connrs joined
18:09 ming1 joined
18:10 ming12 joined
18:11 tomphp joined
18:12 saurabhnanda joined
18:15 canaria joined
18:18 darkJedi left
18:18 haasn joined
18:18 <haasn> Is it possible to implement Data.Data for an existential data type?
18:19 carry joined
18:21 <glguy> haasn: I would think so assuming you had the right Data constraints on the quantified type variables, at least in some cases
18:21 <haasn> i.e. data SomeData = forall a. Data a => SomeData a
18:21 keepLearning512 joined
18:21 <haasn> the standard derived case gunfold k z _ = k (z SomeData) fails type checking
18:22 Linter joined
18:22 beauby joined
18:22 darkJedi joined
18:22 matt179 joined
18:22 <glguy> Oh yeah, maybe not. I'd have to actually play with it :-/
18:22 darkJedi left
18:23 <haasn> even though you'd think it should since `k` also requires a Data constraint on the same parameter
18:24 <haasn> Actually it's more subtle than that, even `z SomeData` fails because it's ambiguous which type you're using
18:24 <haasn> Maybe I need scoped type variables or something
18:25 tzemanovic joined
18:26 <dmj`> Anyone used BFNC ?
18:26 elfets joined
18:26 <dmj`> BNFC*
18:27 chaosmasttter joined
18:28 <encodes> this version gives a more meaningful error; https://lpaste.net/8889766800099639296
18:28 roconnor joined
18:30 <encodes> meaningful/difficult
18:31 connrs joined
18:31 liamd joined
18:34 FreeBirdLjj joined
18:35 <dmj`> nvm
18:36 JuanMiguel joined
18:37 ijks joined
18:38 <encodes> oh, it was a stray forall a.
18:39 jao joined
18:40 <simon> https://gist.github.com/sshine/e02c202c2045fc711f0bd9e619f7e882 -- is there any way I can make this piece of code work without listing all the remaining constructors? (in this case it's only one, but for my AST it's like 20 where only 3 have the parameter.)
18:42 <monochrom> There is an extension DeriveFunctor for this.
18:43 <simon> monochrom, excellent, thanks.
18:44 zachk joined
18:44 zachk joined
18:45 dxld joined
18:45 the_2nd joined
18:46 tomphp joined
18:46 <the_2nd> If I want to make my program fail in IO with output to stderr and error code, what should I do? error "foo" ?
18:47 <cocreature> the_2nd: if you really want a fatal error and you are writing an application rather than a library, then you can use hPutStrLn stderr and exitFailure
18:47 xkapastel joined
18:48 amirpro_ joined
18:48 <roconnor> Yep. System.Exit.exitFailure or if you have a specific code in mind, System.Exit.exitWith exitcode
18:49 <the_2nd> yeah I want it to be used e.g. when piping on linux
18:49 <roconnor> (must be called from the main thread if you are multithreaded)
18:52 language_agnosti joined
18:54 RegEchse joined
18:54 amirpro joined
18:54 davr0s joined
18:55 fryguybob joined
18:58 nitaigao joined
18:58 92AADFGZ4 joined
19:00 Kacia joined
19:01 andyhoang1 joined
19:03 IAMfeelings joined
19:04 toppler joined
19:05 chaosmasttter joined
19:05 Lokathor joined
19:05 IAMfeelings left
19:06 armyriad joined
19:09 <* hackage> dwergaz - A minimal testing library http://hackage.haskell.org/package/dwergaz- (henrytill)
19:10 saml joined
19:12 language_agnosti joined
19:14 <dmwit> the_2nd: `die "foo"` puts `foo` to stderr and exits with code 1.
19:14 <* hackage> webdriver-w3c 0.0.1 - Bindings to the WebDriver API http://hackage.haskell.org/package/webdriver-w3c-0.0.1 (nbloomf)
19:14 <dmwit> the_2nd: Pretty convenient shortcut for the steps other folks are describing here.
19:14 <dmwit> (`die` is available from `System.Exit`.)
19:15 XorSwap joined
19:17 gxt joined
19:18 matt179 joined
19:19 sdothum joined
19:19 sclltr joined
19:21 <geekosaur> with a sufficiently recent ghc, at least
19:21 tzemanovic joined
19:23 sdothum joined
19:23 tomphp joined
19:24 <roconnor> dmwit: nice.
19:25 fmixing joined
19:25 fmixing joined
19:25 kazoo_keygen joined
19:27 Linter joined
19:27 plugin joined
19:28 Linter joined
19:31 canaria joined
19:34 efeuska joined
19:35 language_agnosti joined
19:37 beauby joined
19:37 <dmwit> Sufficiently recent, yes -- but "sufficient" in this case is pretty lax. It's been three years.
19:39 blackandblue joined
19:40 <Unode> I'm trying to build a static binary with ghc. This has worked in the past but recently a package that depends on cairo was included and is now failing during linking due to missing references to the pixman lib. All relevant libs are in the system but I'm having a hard time figuring out how to pass -lpixman-1 to ghc to ensure references are picked up correctly. The static build (failing) log can be seen here:
19:40 <Unode> https://gitlab.com/ngless/ngless/-/jobs/76940825 and a non-static build (succeeding) is: https://gitlab.com/ngless/ngless/-/jobs/76939863
19:40 <Unode> Does anyone know how to do this correctly?
19:42 <Unode> or can provide any guidance...
19:42 sps4 joined
19:43 <c50a326> hey if functions are pure is there an easy way to make the inverse without having to write it?
19:43 malorie joined
19:44 <encodes> here it is working; https://lpaste.net/8843645233662001152
19:44 <c50a326> oh actually no that doesn't work does it... like if you've got 4 it's impossible to say if it was 2+2 or 3+1
19:44 WhatisRT joined
19:45 <the_2nd> when having mulitple executables in a .cabal
19:46 <the_2nd> is there a way to define some sort of parent dependency?
19:46 <the_2nd> e.g. currently both might depend on the same 100 files / packages
19:46 <the_2nd> and only differ in 2
19:46 <cocreature> the_2nd: make a library that contains the 100 files
19:47 mreh joined
19:47 <cocreature> since cabal 2.0 you can also have multiple internal libraries which can be convenient if you want to do this just to organize and share things within your package
19:49 <sps4> I have a function createReport :: Info -> Maybe Report. Given a [Info], I want to generate two lists, [Report] and a [Info] that produced a Nothing.
19:51 <roconnor> compose createReport with a function that map Maybe Report to Either () Report.
19:51 zero_byte joined
19:51 <roconnor> er rather
19:51 <roconnor> compose createReport with a function that map Maybe Report to Either Info Report.
19:52 <roconnor> anyhow then map that function over [Report] and use partitionEithers.
19:52 <cocreature> :t \f xs -> partitionEithers (map (\x -> maybe (Left x) Right (f x)) xs)
19:52 <lambdabot> (a -> Maybe b) -> [a] -> ([a], [b])
19:53 <sps4> roconnor: I see. thanks.
19:54 danso joined
19:55 Foritus joined
19:55 <roconnor> cocreature has spelled out an implementation.
19:56 UnChallengeD joined
19:57 <cocreature> although I would probably just use "case" rather than "maybe" here
19:58 Icewing joined
19:58 wootie11 joined
19:59 dddddd joined
19:59 v0d1ch_ joined
20:00 Nd-69-m joined
20:02 altjsus_ joined
20:03 nitaigao joined
20:03 andyhoang1 joined
20:04 codesoup joined
20:05 wootie11 left
20:06 detectiveaoi joined
20:07 Wamanuz joined
20:07 roconnor joined
20:11 bluepixe1 joined
20:11 v0d1ch_ joined
20:11 Wamanuz2 joined
20:13 Foritus joined
20:18 kryptonunited joined
20:19 Yaargh left
20:20 Natch joined
20:21 tomphp joined
20:21 diwo joined
20:23 duncan^ joined
20:24 ijks joined
20:25 plugin joined
20:25 valentinbuza joined
20:27 nec joined
20:27 <nec> how can i get the most general unifier for a type equation ?
20:29 <statusfailed> can I write class instances like this?: instance (forall a . FromJSON (f a)) => FromJSON (MyType f) where ...
20:29 Linter joined
20:29 <c_wraith> nec: I'm not sure what you're asking. Can you give an example of the process you want?
20:30 <statusfailed> (I mean, I'm getting an error "illegal polymorphic type", but I wonder if I can achieve something similar?)
20:30 <c_wraith> statusfailed: not yet, but it's coming soon. QuantifiedContexts, or something like that
20:30 <statusfailed> aw durnit
20:30 <statusfailed> maybe in case I'm X/Ying, MyType is a record, where I want to have some fields optional, and sometimes they should be mandatory
20:30 <c_wraith> statusfailed: the current state of doing things would be to create a FromJSON1 class that you can put the constraint on.
20:30 <statusfailed> so I thought to parametrise by a functor f
20:30 <statusfailed> not sure if there's a better way
20:31 <c_wraith> (maybe that class already exists?)
20:31 <statusfailed> "this has been merged" - seems possible :D
20:32 <nec> c_wraith: i have this type equation: {Int → α = β → Bool → β, γ → Int = α} , now i need to get the most general unifier
20:34 <encodes> !?
20:34 <c_wraith> that looks like two equations to me...
20:35 <nec> c_wraith: exactly, i need the mgu for these two equations
20:36 <c_wraith> I suppose that's pretty close to on-topic for this channel, though it's a rather unusual vocabulary for the context of haskell.
20:37 <encodes> how to return type 's' of reify rather than providing it?
20:37 agander__ joined
20:37 <Tuplanolla> You can follow algorithm W to discover that the system of equations has no free variables, nec.
20:37 <Tuplanolla> Is that what you're asking?
20:37 <c_wraith> pretty sure "algorithm W" is the answer.
20:38 <* hackage> pomaps - Maps and sets of partial orders http://hackage.haskell.org/package/pomaps- (sgraf812)
20:38 <dysfun> it's a shitty question if the answer isn't either algorithm W or algorithm M
20:39 <nec> Tuplanolla: i think its about the algorithm of robinson ?
20:39 tzemanovic joined
20:41 tomphp joined
20:42 <encodes> i.e. expressing '(i,a) -> b' as Refies i (Def Is (a->b)), what would 'a->(i,b)' be?
20:42 malorie joined
20:42 <statusfailed> hm, I'm a bit confused how I can use FromJSON1 to write my instance
20:43 <statusfailed> I assumed instance FromJSON1 f => FromJSON (MyType f)
20:43 <statusfailed> but I get lots of errors like "Could not deduce (ToJSON (f SomeFieldType))"
20:46 amirpro joined
20:47 <nec> Tuplanolla: c_wraith: Example: A1 = ( X, Y, f(b) ). A2 = ( a, b, Z ). now with unification i make them the same with sigma(A1) = (a, b, f(b) ) , sigma(A2) = (a, b, f(b) ). where sigma = (X -> a, Y -> b, Z -> f(b) )
20:47 <c_wraith> statusfailed: hmm, that looks basically right. The error suggests the problem is in the other direction somewhere, like you called ToJSON on it
20:48 quobo joined
20:48 agander_ joined
20:49 <statusfailed> c_wraith: hm, I think you're right - I need to pare down my example a bit
20:51 <nec> Tuplanolla: c_wraith: and because there are many unifications possible, i need find the most general unifier for the two equations posted before
20:52 brocoli joined
20:52 simukis joined
20:54 amirpro joined
20:54 rschm joined
20:55 dpyro joined
20:55 tomphp joined
20:56 jmcarthur joined
20:57 <nec> Tuplanolla: the answer is it has no free variables ?
20:58 paidnode joined
21:00 fmixing joined
21:00 refold joined
21:00 gabiruh joined
21:02 rschm_ joined
21:04 ljhms joined
21:05 Cthalupa joined
21:05 conal joined
21:05 tomphp joined
21:08 Solonarv joined
21:08 brocoli joined
21:09 rschm joined
21:10 detrumi left
21:10 lynn joined
21:10 lynn joined
21:11 Noldorin joined
21:14 jb55 joined
21:15 <lukelau> Are there any libraries for mechanically/programtically editing a .cabal file?
21:15 <lukelau> Same with package.yaml
21:16 tomphp joined
21:17 <dmj`> lukelau: Cabal
21:20 matt179 joined
21:20 <statusfailed> c_wraith: couldn't figure it out with pared down example, so I posted to SO: https://stackoverflow.com/questions/51005138/
21:21 <rotaerk> hmm is there some emacs plugin that would let you hit a keybinding, and it will generate a type declaration above the symbol at the cursor
21:21 <rotaerk> as in if you have foo = 5, it will generate foo :: Num a => a
21:22 <c_wraith> statusfailed: oh, that looks like the default instance is written in terms of ToJSON, rather than ToJSON1
21:23 Zipheir joined
21:23 <c_wraith> statusfailed: try defining toJSON as toJSON1 in the instance.
21:23 Kacia joined
21:23 <dmj`> lukelau: https://gist.github.com/53e1e130e20c6c49691b97379a519b9e
21:23 <c_wraith> statusfailed: oh, that's not quite right either. But it's something like that. :)
21:24 <lukelau> dmj`: Awesome
21:25 tzemanovic joined
21:26 brocoli joined
21:29 vitali joined
21:29 tomphp joined
21:29 canaria joined
21:29 <Solonarv> rotaerk: I don't know if there is a ready-to-use emacs plugin for it, but at least one of the haskell editor backends has a way to insert a type decl
21:29 <statusfailed> c_wraith: haha :D
21:29 <statusfailed> I'm sure it's going to be something simple
21:30 <statusfailed> either that or it's impossible :-P
21:30 blankhart joined
21:31 <rotaerk> Solonarv, ah
21:31 <rotaerk> Solonarv, btw, I got what I wanted working with nested runResourceTs, so I dropped Scope
21:31 <Solonarv> well this is pretty much exactly what the new QuantifiedConstraints language extension is for
21:31 <Solonarv> rotaerk: great!
21:32 <butterthebuddha> Can I get GHC to print every function call?
21:32 <butterthebuddha> One of my functions is running really slowly and I suspect that it's because it's getting caught in too many recursive calls
21:32 <rotaerk> use a profiler
21:32 <Solonarv> *every* call on every function? no
21:32 <Solonarv> not in any practical way that I know of
21:33 <Solonarv> but yes, use a profiler
21:33 <Solonarv> that's what they're for
21:33 andyhoang1 joined
21:34 <dmj`> butterthebuddha: there’s Debug.Trace.traceStack
21:34 <Solonarv> butterthebuddha: with GHC HEAD you can write instance (forall x. ToJSON x => ToJSON (f x)) => ToJSON (MyType f)
21:35 <Solonarv> ah sorry wrong ping, I meant statusfailed
21:35 <Solonarv> this will also be in GHC 8.6.1 afaik, which will be released soon-ish
21:36 Goplat joined
21:37 <Solonarv> with current GHC I think you could do something like instance (ToJSON (f Int), ToJSON (f String)) => ToJSON (MyType f)
21:43 AndiK joined
21:43 amar joined