<    March 2017    >
Su Mo Tu We Th Fr Sa  
          1  2  3  4  
 5  6  7  8  9 10 11  
12 13 14 15 16 17 18  
19 20 21 22 23 24 25  
26 27 28 29 30 31
00:05 <erisco> without constructing the AST I can see strangeness
00:07 lambda-11235 joined
00:09 t0by joined
00:10 <erisco> my bad, confused line numbers for the s* variables lol
00:10 <erisco> they accidentally lined up kind of
00:13 e14 joined
00:13 a3Dman joined
00:13 cpennington joined
00:14 beerdrop joined
00:14 xcmw joined
00:15 <erisco> well, from what I can tell, the result I get is inconsistent with the smt2 file
00:15 <erisco> so now I just need to figure out how to tell z3 to give me the models
00:15 <erisco> maybe they are being read back in incorrectly
00:15 <zv> (get-model)?
00:16 <erisco> thank-you
00:16 <zv> you can also use my z3 interaction major mode: https://github.com/zv/z3-mode
00:16 <zv> C-c C-c there
00:18 nakal_ joined
00:18 <xcmw> Does a function with this type signature exist anywhere? I already checked on hoogle and stackage. (Maybe a -> Maybe b -> Maybe c) -> Map k a -> Map k b -> Map k c
00:19 Rainb joined
00:20 <ChaiTRex> xcmw: What would it do?
00:20 <pacak> I don't think this can be efficiently implemented
00:20 <pacak> ChaiTRex: It will intersect two maps by key making a third one
00:21 <pacak> xcmw: I think your best bet would be to go through list
00:21 <erisco> I know what has happened
00:21 <xcmw> pacak: Thanks
00:21 <erisco> the variables are being ordered incorrectly
00:22 takle joined
00:22 <erisco> explains perfectly why the problem only occurs when the problem becomes larger
00:23 <erisco> thoughtpolice, here is what is happening
00:23 <erisco> the variables are named s1, s2, s3, and so on
00:23 silver_ joined
00:23 spacedog82 joined
00:24 <erisco> the problem for me is they are being ordered lexicographically by SBV
00:24 <erisco> rather than numerically (ignoring the "s" prefix)
00:25 <erisco> so it comes s0, s1, s10, s11, s12, s13, s14, s15, s2, s3, s4 ...
00:25 <erisco> I assumed the order would be the same as instantiated
00:25 capisce joined
00:25 <erisco> I mean, it kind of has to be, otherwise how do I know which variable is which
00:26 beerdrop joined
00:26 _sras_ joined
00:27 plutoniix joined
00:27 Rotaerk joined
00:28 <erisco> ah, looking back at the guts a bit here
00:28 <erisco> so I call getModelDictionaries which returns a Map String CW
00:28 Putonlalla left
00:28 <erisco> this is where the lexicographic order comes from
00:28 <erisco> so it is my oversight after all
00:28 <erisco> not so surprising :P
00:29 Welkin joined
00:29 plutoniix joined
00:31 brombutane joined
00:32 NeverDie joined
00:33 <erisco> woo hoo, no more crashes :)
00:33 <* erisco> generates a puzzle for a 8x8 board
00:34 <Welkin> what game?
00:34 <erisco> a puzzle game
00:34 <Welkin> 4D tetris?
00:34 <erisco> that's so elementary
00:35 <Welkin> the pieces fall toward the center of mass
00:35 <Welkin> and pop in from other dimensions
00:36 butane joined
00:37 takle joined
00:37 <erisco> hm, it is poor at saturating the CPU and it is taking a long time
00:37 eacameron joined
00:38 kvda joined
00:43 tromp joined
00:44 Guest21 joined
00:44 markus1189 joined
00:44 takle joined
00:44 <rafaelcgs10> hey humans, here is a good place to talk about type systems, like hindley-milner, or there is better place for that?
00:46 <Welkin> yes
00:47 nighty- joined
00:47 bobjones joined
00:48 eacameron joined
00:49 markus1199 joined
00:49 jao joined
00:50 JeanCarloMachado joined
00:51 Levex joined
00:51 <bobjones> hey all. Say I have a type: data Degree = Na Int | Fl Int | Sh Int. Is there an elegant way to extract the Int values in this case, other than creating a function and pattern matching each (Constructor i) and returning i?
00:51 nomicflux joined
00:52 <Koterpillar> the question is do you want to make this possible?
00:52 <Koterpillar> data Temperature = Kelvin Int | Celsius Int -- here extracting just the Int is dangerous
00:52 <bobjones> Koterpillar: yeah ok I see what you mean here
00:52 theDon_ joined
00:52 takle joined
00:52 <bobjones> Koterpillar: and it's a fair point indeed
00:53 <Koterpillar> if you have just one type like that, go ahead and write the function
00:53 <Koterpillar> give it a meaningful name, too (if you can't, why are you writing it in the first place?)
00:53 <augur> uh
00:53 <augur> mystery behavior from uninstall-hs:
00:53 <augur> ghc --version says i have 7.10.2
00:54 <augur> when i do uninstall-hs thru 7.10.2, i get an error saying there's nothing to remove
00:54 <bobjones> Koterpillar: ok thanks this is helpful - I guess I was just curious to see if this was possible. I tried 'pattern matching' the constructor but obviously that doesn't work
00:54 <augur> what does this even mean
00:54 Gurkenglas_ joined
00:55 kav joined
00:55 papermachine joined
00:55 <Koterpillar> bobjones: it is possible, wide-scale, if you really want - look up GHC.Generics for an example
00:56 <adarqui> should I update to haskell 8.x on osx sierra? or will everything be broken?
00:56 <pacak> bobjones: You can change it to data Degree a = Na a | Fl a | Sh a and ask ghc to derive foldable/traversable
00:57 <bobjones> Koterpillar: ok cools thanks for the help!
00:57 <bobjones> pacak: Ok cool that would indeed be another option - thanks!
00:58 kvda_ joined
00:59 <Welkin> adarqui: last I heard sierra breaks things
00:59 benl23 joined
00:59 <adarqui> ya, sierra broke my ghc 7.10.x setup
00:59 <adarqui> i'm probably doomed
01:00 <Welkin> either use linux, or avoid updating macos
01:00 robertkennedy joined
01:00 <adarqui> ya i have linux boxes, they are fine
01:00 <adarqui> i avoided updating mac for quite some time, then finally did it
01:01 <adarqui> boom destroyed
01:01 nshepperd_ joined
01:01 Jackoe joined
01:02 patbecich joined
01:02 andyhuzhill joined
01:03 benl23 joined
01:03 butane joined
01:04 <rafaelcgs10> I'm reading Wadler's paper called "How to make adhoc polymorphism less ad hoc". - Btw, I have some basic experience with Hindley-Milner system - . My problem is in the appendix, more precisily in page 15 in Inference rules. I'm trying to understand the given rules for function overload (over and inst), I want to create a small example of proof tree using them. The rule over is said to be a "adding rul
01:04 <rafaelcgs10> e", but if you read top-down (what I think is usual) looks like a "deleting rule", like lambda abstraction. Plus, I don't know how to create the needed assumptions to proof some overloaded function (say over ID::: a-> a in inst id :: ID a = \x.x in id). Anyone could give me some enlightenment in how to construct such proof?
01:05 grayjoc joined
01:05 Jackoe joined
01:05 <rafaelcgs10> hope this question is not in a wrong place!
01:06 <pacak> Edward is here so this place is as good as any other.
01:06 <rafaelcgs10> sorry, who is Edward?
01:07 <Welkin> Scissorhands
01:07 <rafaelcgs10> oh boy
01:08 <lyxia> rafaelcgs10: it is adding if you read bottom up, lambda abstractions introduce variables in the environment.
01:09 xcmw joined
01:09 ChaiTRex joined
01:12 xaviergmail joined
01:13 <rafaelcgs10> true, but I find weird and don't help much my brain in this quest. Maybe I need other brain :( I really wish I could see a example of what I want.
01:14 <rafaelcgs10> sorry if I repeated the last message
01:14 <lyxia> rafaelcgs10: take the example in figure 6
01:14 <lyxia> it starts with "over ... in ..."
01:14 <lyxia> so you apply the over rule
01:16 <_sras_> Is there anyway I can hook into Servant's log system? I want to add more details to it...
01:17 Jackoe joined
01:17 tom7942 joined
01:17 <lyxia> rafaelcgs10: or your example, it's shorter so it's easier to write the derivation
01:19 gugah joined
01:20 systadmin joined
01:24 <_sras_> What is the concept of a "Context" in the api of Servant web framework?
01:27 xcmw joined
01:30 mgg4 joined
01:32 raycoll joined
01:33 FreeBirdLjj joined
01:33 <rafaelcgs10> \quit
01:34 <rafaelcgs10> derp me
01:34 <ChaiTRex> rafaelcgs10: You can't tell me what to do!
01:36 rafaelcgs10 joined
01:40 tom7942 joined
01:40 h3nnn4n joined
01:41 nomicflux joined
01:41 <rafaelcgs10> lyxia: I made some progress :)
01:42 dawehner joined
01:44 Textmode joined
01:44 <augur> anyone know what this cabal error means?
01:44 conal joined
01:44 <augur> <command line>: cannot satisfy -package-id hashable-
01:44 takle joined
01:45 JeanCarloMachado joined
01:47 <dmwit> augur: ghc-pkg check?
01:48 <dmwit> Sounds like the constraint solver picked hashable-, but then when it came time to use that package GHC said it didn't know about it.
01:50 newbie joined
01:50 Jeanne-Kamikaze joined
01:50 newbie joined
01:51 takle joined
01:54 juhp joined
01:54 patbecich joined
01:55 halogenandtoast joined
01:55 <halogenandtoast> If I want to call a Haskell library from Ruby, are the FFI bindings up to snuff?
01:55 tromp joined
01:56 <peddie> halogenandtoast: it's very easy to call into Haskell from C . . . not sure what you will have to do on the Ruby end to go via C in the middle
01:57 e14 joined
01:58 FreeBirdLjj joined
01:59 <peddie> halogenandtoast: it might be easier to send messages back and forth, depending on what kind of call you are making
02:01 systadmin joined
02:02 <dmwit> embed the ruby interpreter in a quasiquoter https://i.ytimg.com/vi/TyAAWwevJnI/maxresdefault.jpg
02:02 <peddie> dmwit++
02:03 <pchiusano> is there any point to FreeT?
02:03 <halogenandtoast> peddie: thanks
02:04 <pchiusano> seems like FreeT f m a can be mechanically translated to Free (Sum f m) a
02:06 <lyxia> they don't seem quite equivalent...
02:08 takle joined
02:08 <pchiusano> they aren't quite isomorphic i don't think, no, but I can't really think of any situation where you'd care
02:08 <tobiasBora> Hello,
02:08 <tobiasBora> I'd like to know,
02:08 <pchiusano> FreeT forces there to be an `m` effect after each step
02:08 wtetzner joined
02:09 <tobiasBora> between this: "simpleHttp "http://www.haskell.org/" >>= L.putStr" and this "simpleHttp "http://www.haskell.org/" >>= putStrLn", which one is the quicker?
02:09 <peddie> tobiasBora: I suggest you measure it yourself ;)
02:09 <dmwit> ...but they do different things.
02:09 Stanley00 joined
02:10 <dmwit> Which is faster, `head -10000 /dev/urandom` or `mpv my_favorite_music_video.mp4`?
02:10 MarioBranco joined
02:10 <tobiasBora> Hum sorry
02:11 <tobiasBora> it's a bit stream so I can't use putStrLn?
02:11 <_sras_> Is there any way to log the matched route in Servant?
02:11 <dmwit> tobiasBora: I think that's probably right. But HTML is complicated; you can specify an encoding.
02:12 <dmwit> Well, HTTP is complicated. And HTML is complicated.
02:12 <dmwit> Probably it is safest to use `ByteString` and only deal with headers+HTML parsing if that turns out to actually be necessary.
02:15 <lyxia> pchiusano: does Free (Sum f m) a also satisfy the characterization of a free monad
02:15 <pchiusano> lyxia: wdym
02:16 mmachenry joined
02:16 marsam joined
02:17 <lyxia> "A Monad n is a free Monad for f if every monad homomorphism from n to another monad m is equivalent to a natural transformation from f to m.", I assume there is something similar for free monad transformers
02:18 acidjnk22 joined
02:18 <lyxia> but we can first take m = Identity and see whether this gives a free monad
02:18 <tobiasBora> dmwit: ok thank you. And I'd like to do some parsing/grep on my chain like "takes only the line that begins with... But I'm two problems:
02:18 <tobiasBora> 1) I don't know how to unline ByteString
02:18 <lyxia> and I guess it doesn't. Free (Sum f Identity) is not the free monad for f.
02:19 <tobiasBora> 2) I saw that I can use Parsec to do parsing, but I'm wondering if it's not overkilled for what I want...
02:19 <lyxia> or is it?
02:19 <tobiasBora> (and I'd like to have the most effecient version)
02:19 farrioth joined
02:19 sleffy joined
02:21 <Cale> lyxia: It's the free monad for Sum f Identity
02:22 <louispvb> is fp in scala still a good book today
02:24 <Welkin> scala is never good
02:24 <Cale> http://www.seas.upenn.edu/~sweirich/papers/systemd-submission.pdf -- neat paper :)
02:25 <Welkin> lol systemd
02:27 <Welkin> Cale: regarding CSS in haskell, do you create everything yourself, or do you pull in css libraries (that would require setting class names, like bootstrap). Or are there new tools I am not aware of for ghcjs projects?
02:27 <lyxia> Cale: do you know how to characterize "free monad transformers"
02:27 <Cale> We used to use some bits of bootstrap, but lately we've just been building all our own CSS
02:28 aarvar joined
02:29 <Cale> We just use Clay to generate our CSS, whether we're compiling with GHC or GHCJS, and whether we're generating an external .css file (useful with ghcid to interact with the CSS), or baking it into the generated program
02:29 <dmwit> tobiasBora: Sounds like you will have to pay attention to headers and do real parsing, then.
02:29 badlands joined
02:29 midrya joined
02:30 <dmwit> tobiasBora: I don't know enough to make good recommendations about detecting the right encodings (sorry), but once you have decoded I've had good luck with tagsoup for HTML parsing.
02:31 <tobiasBora> dmwit: The prolem with HTML parsing is that the info I want are inside a javascript code in my pdf page, and I'm not sure it's take into account by tagsoup-like tools. Usually they deal with Html or JSON, but not JSON inside Html. So I think I will need to do it by hand
02:32 <Cale> lyxia: Well, first we need to be able to characterize monad transformer homomorphisms, which I think is doable. But then you need to say what category you're forgetting down to.
02:32 <dmwit> tobiasBora: I think you will, too. =(
02:33 kvda joined
02:33 <dmwit> tobiasBora: Depending on your needs, you may be able to use an existing parser as a first pass and extract the javascript for a second pass.
02:33 uglyfigurine joined
02:33 <dmwit> You say PDF, though... I don't know of a good PDF parser for Haskell, really.
02:34 <dmwit> There might be bindings to poppler or similar somewhere?
02:34 <Cale> lyxia: Free things are the images of left adjoint functors, but in general, you'll need to say what the right adjoint functor is meant to be.
02:34 <tobiasBora> dmwit: And here is the point: for now, I convert my lazy Bytestream into lazy text, and then I lines it, and do a filter on it using isPrefixOf
02:34 <tobiasBora> is it the better way to proceed?
02:35 <lyxia> Cale: Thanks. I'll stare at what you said for a while and then it'll tilt.
02:35 roconnor joined
02:36 capisce joined
02:36 <Cale> lyxia: e.g. The free monad construction is a functor from the category of endofunctors on C (with natural transformations between them) to the category of monads on C (with monad homomorphisms between them)
02:36 <dmwit> tobiasBora: Well, if it's actually text, and you know the encoding, I don't see a problem. But I don't think PDFs are actually text, right? They can have binary data inside.
02:36 <tobiasBora> dmwit: Dit I talk about pdf? I just have Html here
02:36 <dmwit> tobiasBora: It is a tradeoff, of course. If I were going to run this as a script one or two times by hand and could easily see it going wrong, I'd probably do that and call it a day. But if this is going to be used a lot... might want to be more careful.
02:37 <tobiasBora> dmwit: yeah it's going to be used a lot
02:37 <dmwit> tobiasBora: Yeah, you did: "the info I want are inside a javascript code in my pdf page"
02:37 Faucelme joined
02:37 <tobiasBora> ohh sorry
02:37 <tobiasBora> I'm tired
02:37 Goplat joined
02:37 <tobiasBora> I meant in my html page
02:37 <Cale> lyxia: Call it F, and in the opposite direction, let's define the functor G from the category of monads on C to the category of endofunctors on C which does the obvious thing and forgets that the thing was a monad
02:38 <dmwit> tobiasBora: I am sorry you are in this mess. =)
02:39 <tobiasBora> dmwit: I think I'll go to sleep and think later :P
02:39 <dmwit> That is often a wise move.
02:39 <Cale> lyxia: Then for any monad M, and any endofunctor X, there is a bijection between monad homomorphisms FX -> M, and natural transformations X -> GM
02:39 <lyxia> ohhh
02:40 <Cale> (and it's natural in the choice of X and M)
02:41 FreeBirdLjj joined
02:41 Destol joined
02:43 capisce joined
02:44 <lyxia> Okay so for a free monad transformer I need a "forgetful" functor from transformers to functors...
02:44 FreeBirdLjj joined
02:44 <Cale> From monad transformers to ... something
02:45 <Cale> It's not clear exactly what that something ought to be
02:45 <Cale> Well, perhaps it should be functors
02:45 <lyxia> I mean, doesn't the FreeT in the free package map functors to transformers?
02:46 <Cale> yeah
02:46 <Cale> I don't know if it's actually free
02:46 <lyxia> That's the context of my question.
02:46 <Cale> But we could attempt to check
02:47 <Cale> For any natural transformation f -> g, we should obtain a "monad transformer homomorphism" FreeT f -> FreeT g
02:48 mkoenig joined
02:49 <Cale> That is, we ought to be able to write something with type (forall t. f t -> g t) -> FreeT f m a -> FreeT g m a
02:49 <lyxia> transFreeT "Lift a natural transformation from f to g into a monad homomorphism from FreeT f m to FreeT g m"
02:49 <Cale> yep
02:49 capisce joined
02:49 <Cale> and moreover, if this is going to be a monad transformer homomorphism, it should preserve lift
02:50 <Cale> Well, also the resulting map FreeT f m a -> FreeT g m a should be a monad homomorphism
02:50 JoshS joined
02:51 Swizec joined
02:51 takle joined
02:52 ChaiTRex joined
02:52 <Cale> But yeah, the extra bit we'd want would be that transFreeT h (lift f) = lift f
02:52 andyo joined
02:52 mmachenry joined
02:52 <Cale> (for any choice of h and f)
02:52 <Cale> I'd say there's a pretty good chance that's true
02:53 <lyxia> Yeah
02:53 <lyxia> maybe you even get it by parametricity
02:54 <lyxia> Anyway, I guess we have F now?
02:55 <Cale> Yeah
02:56 <lyxia> And I would guess the right adjoint, if any, is obtained by transforming the identity functor
02:58 dmwit joined
02:58 <Cale> Seems likely, yeah.
02:58 <Cale> Kind of a weird thing to be a right adjoint.
02:59 sssilver joined
02:59 systadmin joined
03:00 <lyxia> Because it doesn't quite fit the usual idea of "forgetting" structure?
03:00 hucksy_ joined
03:01 bbcue joined
03:01 rekahsoft joined
03:03 <Cale> Well, if that's really our right adjoint, we should have a correspondence between natural transformations f -> t Identity and monad transformer homomorphisms FreeT f -> t
03:03 bbcue joined
03:03 FreeBird_ joined
03:04 <Cale> So there ought to be a function (forall x. f x -> t Identity x) -> FreeT f m a -> t m a
03:05 mizu_no_oto joined
03:05 a3Dman joined
03:05 MarioBranco joined
03:06 <pchiusano> lyxia and Cale am not totally following this discussion, but my reasoning for thinking FreeT superflous is it just adds an `m` effect, but the `m` effect can be rolled into the `f` in plain old `Free f`
03:07 ramzifu joined
03:08 takle joined
03:09 <pchiusano> actually, seems like you could just write a function `FreeT f t a -> Free (f :+: t) a` straightforwardly...
03:10 xtreak joined
03:10 <lyxia> Sure.
03:10 anuxivm left
03:10 <Cale> seems likely
03:11 SAL9000 joined
03:11 <Cale> But remember, there can be a point in Haskell to defining data types which are easily derived from others
03:11 <Cale> You couldn't write an instance of MonadTrans for the latter
03:11 <pchiusano> Cale: can you elaborate (on the first point)
03:12 <lyxia> Also, FreeT is a "free" something in a sense that Free is not
03:12 <Cale> pchiusano: Well, there's an instance MonadTrans (FreeT f)
03:12 Jackoe joined
03:13 <pchiusano> Cale: but if we already have `Monad (Free f)`, why do we care?
03:14 <dmwit> Presumably you care because it gives you `lift :: t a -> FreeT f t a`.
03:14 <pchiusano> i guess you can use MonadTrans.lift instead of some custom function
03:14 <Cale> right
03:14 <pchiusano> ha
03:14 systemfault joined
03:16 <pchiusano> but I could just as easily define Free.lift :: f a -> Free (g :+: f) a
03:18 <pchiusano> same amount of code as giving the MonadTrans instance for FreeT... I guess the advantage is it can still be nice having a MonadTrans instance
03:18 StoneToad joined
03:18 <lyxia> I think the real motivation behind the definition of FreeT is that it is the "free monad transformer".
03:18 <pchiusano> this sort of gets into algebraic effects vs monad transformers I suppose
03:18 nomicflux joined
03:19 sleffy joined
03:19 <pchiusano> you can sum together a bunch of effects in Free and compose your effects in that way
03:19 <pchiusano> and/or you can use monad transformers
03:20 Tertiary joined
03:20 _sg joined
03:21 <Cale> One of which might be optimised half decently.
03:22 <lyxia> At the end of the day you're free to not use FreeT.
03:22 <Cale> (of course, FreeT won't)
03:22 <pchiusano> yeah
03:25 takle joined
03:29 wjm joined
03:30 mrpavo joined
03:30 <tobiasBora> Hum...
03:31 <tobiasBora> I tried to compare two "implementations" of getting an information in a page. First a script bash/sed/grep:
03:31 conal joined
03:31 <tobiasBora> time (wget -O- https://mapageweb/ | grep -e "^<script type=\"text/javascript\">window._sharedData = " | sed -e 's#^.*= \(.*\);</script>$#\1#')
03:32 iross joined
03:32 nshepperd_ joined
03:33 parsnip joined
03:34 tom7942 joined
03:37 cultofmetatron joined
03:39 <tobiasBora> And an haskell script that rely on HTTP conduit, and that do the grep/sed by using basic operation on text: drop, dropEnd (I don't even use regex !)
03:39 <tobiasBora> However, the bash version is always faster. When I used regex (and so I needed to do a string conversion), it was still more visible...
03:39 xcmw joined
03:40 systemfault joined
03:40 exferenceBot joined
03:40 splanch joined
03:41 systemfault joined
03:42 Scip joined
03:44 <tobiasBora> Hum I found a reason: I'm using stack exec, when I directly run the exec it's quicker
03:45 hexagoxel joined
03:47 <tobiasBora> But the regexp part is still longer to run...
03:48 <tobiasBora> (it's not amazing, but it's visible on a few runs...)
03:52 spatial joined
03:53 <tobiasBora> Haskell is 10% slower, even when the haskell is optimised without regexp, and when I use sed in my file...
03:53 <tobiasBora> in my bash script*
03:57 tripped joined
03:57 uglyfigurine joined
03:58 ploop joined
03:59 <spatial> p -> debug $ fmap (p !! ) $ randomRIO(0, length p - 1) I have a short 'debug' function to print. But I get Prelude.!!: index too large
03:59 <lyxia> Well now I know why free doesn't have the natural bijection making FreeT a left adjoint. At some point you need hoist, but free doesn't depend on mmorph... http://lpaste.net/353839
03:59 int-index joined
03:59 <spatial> How to debug this ? 'debug' is x <- value printf "Random move to [%d]\n" x This is where the exception is thrown.
04:00 Swizec joined
04:01 <lyxia> spatial: p may be empty.
04:01 <int-index> Hi. Trying to understand type applications. The user guide says that type variables printed in curly braces are not available for type application.
04:01 <int-index> :t runReader
04:01 <lambdabot> Reader r a -> r -> a
04:02 <int-index> GHCi says runReader :: forall {a} {r}. Reader r a -> r -> a
04:02 bbcue joined
04:02 <int-index> (if I :set -fprint-explicit-foralls)
04:02 <geekosaur> yes, I don't think lambdabot's got print-explicit-foralls support
04:02 <int-index> And yet I'm sure I can use visible type application for runReader.
04:02 <int-index> and it's order of variables is forall r a, not forall a r.
04:03 <int-index> Why does GHCi print incorrect foralls?
04:03 <int-index> its*
04:04 <spatial> lyxia: Right. One more pattern check.
04:04 <MarcelineVQ> I've wondered the same thing about that rule
04:04 <MarcelineVQ> *int-index:
04:05 <geekosaur> https://ghc.haskell.org/trac/ghc/ticket/13401 ?
04:06 <* geekosaur> thought he'd seen something about that go by...
04:06 <int-index> geekosaur, thanks, the explanation in the ticket makes perfect sense. (Now I only need GHC HEAD for :type +v)
04:08 takle joined
04:08 marcopullo joined
04:09 systadmin joined
04:11 <MarcelineVQ> Actually now that I've tried it their example works as they describe, I'm just not sure why it does :>
04:11 <MarcelineVQ> The example being https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#visible-type-application "When printing types with -fprint-explicit-foralls enabled"
04:12 <MarcelineVQ> This came up in #ghc earlier as f :: forall a b . a -> b -> Int if f 'c' :: b -> Int then you can't visibly-type-applicate to it anymore, f 'c' @Char is an error for example. Could anyone explain to me why visible type application is limited in this fashion to the fully polymorphic form?
04:12 fakenerd joined
04:13 sellout- joined
04:13 <jle`> int-index: in my ghc it says r a
04:14 <jle`> *ghci
04:14 <jle`> runReader :: forall {r} {a}. Reader r a -> r -> a
04:14 <MarcelineVQ> to expand: f 'c' becomes f 'c' :: forall {b}. b -> Int why is the forall b hidden now?
04:14 kvda joined
04:14 <int-index> jle`, I'm using GHCi v8.02
04:14 <int-index> 8.0.2
04:15 harfangk joined
04:15 <jle`> ah i see
04:15 <jle`> yes it's now forall {a} {r}. for me too
04:15 <jle`> i wonder if it's a regression, or if 8.0.1 was correct only by coincidence
04:15 connrs joined
04:19 <geekosaur> I vaguely recall a ticket about that as well, but didn't spot it in the list
04:19 lerax joined
04:20 <jle`> print-explicit-foralls is nice though, i might start adding it to my cabal files
04:21 <* geekosaur> notes that he's good at recalling and searching for tickets, not good at type / kind level shenanigans; no clue about what VTA is up to
04:21 <dibblego> is anyone at Boston Haskell this evening?
04:22 badlands joined
04:22 <monochrom> No, but everyone was at Toronto Haskell :)
04:22 <dibblego> if so, can you please ask Ed to check his phone :)
04:22 <monochrom> oops
04:23 _sras_ joined
04:23 <MarcelineVQ> which ed?
04:23 <dibblego> edwardk
04:23 <Welkin> ed, edd, and eddy
04:23 <monochrom> Wait, are people still stuck at Boston Haskell this late?
04:23 <MarcelineVQ> psh easy, edwardk check ur phone
04:24 c137 joined
04:24 <MarcelineVQ> another problem solved
04:24 <monochrom> No, we have to do it the old-fashioned way.
04:24 <MarcelineVQ> torches and fast horses
04:25 <monochrom> Make a banner that says "Ed, you have a phone call". Walk around with it all over the restaurant.
04:25 <_sras_> How can I make Servant log the handlers that were used to Serve a request?
04:26 CABAL_IS_A_HELL left
04:27 Scip joined
04:28 baetheus joined
04:30 jsgrant- left
04:30 etehtsea joined
04:31 robotroll joined
04:31 otto_s joined
04:32 tomboy64 joined
04:33 takle joined
04:35 der_landgraf joined
04:36 Swizec joined
04:38 splanch joined
04:38 cyborg-one joined
04:39 marcopullo joined
04:40 sleffy joined
04:42 WaterPLE joined
04:42 <WaterPLE> __name__
04:43 WaterPLE left
04:44 WaterPLE joined
04:44 spatial joined
04:45 <spatial> randommove :: BoardState -> IO Int Possible to return 0 from this ?
04:46 piyush-kurur joined
04:46 <ChaiTRex> spatial: Sure, randommove _ = return 0
04:46 MarioBranco joined
04:47 FreeBirdLjj joined
04:47 <spatial> How does Int become IO Int ? Thought one can't mix.
04:48 <jle`> return :: Int -> IO Int
04:48 <jle`> the power of functions :)
04:48 <ChaiTRex> spatial: You can check into IO, but you can never leave.
04:48 geppettodivacin joined
04:48 Vaelatern joined
04:48 kdg57 joined
04:49 brynedwards joined
04:49 <spatial> ChaiTRex : Roach motel model :-) Roaches check in, but they don't check out
04:50 <ChaiTRex> If randommove isn't doing any IO-ish stuff, you might consider just making it randomMove :: BoardState -> Int
04:51 <spatial> It is doing. fmap (p !! ) $ randomRIO(0, length p - 1)
04:51 <ChaiTRex> Oh, OK.
04:52 hexagoxel joined
04:52 felixsch_ joined
04:52 splanch joined
04:54 takle joined
04:55 abel-abel joined
04:57 tromp joined
04:58 Xanather joined
04:59 <abel-abel> hello, say I want to define some operators using special characters. I find that I can use something like `>*<` but I can not use `=_=`. GHCi got parse error for `=_=`. Is there some rules for function names which contain only special characters? Thanks in advance!
04:59 <geekosaur> they must all be Unicode symbol class. but _ is considered alphanumeric
04:59 eacameron joined
04:59 conal joined
05:00 <geekosaur> otherwise a name like foo_bar would treat _ as an operator
05:02 <pacak> > let (🐸) = (+) in 1 🐸 2
05:02 <abel-abel> geekosaur, Do you mean this? https://wiki.haskell.org/Unicode-symbols
05:02 <lambdabot> 3
05:02 <geekosaur> no, that's about a specific ghc extension
05:02 <geekosaur> I am talking about the Unicode standard's designations
05:03 <pacak> > let (☭) = (<*>) in Just 4 ☭ Just (+3)
05:03 <lambdabot> error:
05:03 <lambdabot> • Could not deduce (Num a0)
05:03 <lambdabot> from the context: (Num ((a -> a) -> b), Num a)
05:05 <abel-abel> found a similar question on quora. https://www.quora.com/Why-do-Haskell-programmers-like-to-use-unicode-symbols-in-their-code
05:05 <abel-abel> geekosaur, got it. Thank you!
05:05 <abel-abel> pacak, Thanks!
05:05 Benzi-Junior joined
05:06 mmachenry joined
05:06 <pacak> abel-abel: I'd say it's a very bad idea to use unicode - it makes it harder to grep, it tends to look different with different fonts and it might not display for some people properly.
05:07 <abel-abel> pacak, agree with you.
05:07 <* geekosaur> really wishes that, in 2017, that weren't still a consideration
05:07 <kadoban> grep can't handle unicode?
05:07 <abel-abel> pacak, your first statement can not be displayed in Hexchat. while your second does.
05:08 <abel-abel> maybe because of font?
05:08 <geekosaur> it can, but grep :: won't match ∷
05:08 <pacak> kadoban: It totally can. Can you type "你好"?
05:08 <geekosaur> and vice versa
05:08 <kadoban> pacak: Yes, but I take the point.
05:08 <abel-abel> "你好"
05:08 <kadoban> geekosaur: Ah that. Yeah those should probably not be in code IMO
05:08 arawack joined
05:09 <kadoban> IMO it depends on context of the project if a name of 你好 would be appropriate or not.
05:09 <geekosaur> (actually it would match if you came up with the right locale table, but having to come up with custom locale tables to search haskell code is ugh)
05:09 <pacak> kadoban: As a function name? I don't think there are any context where it's appropriate.
05:10 <kadoban> pacak: I don't know what it means, but if the entire team is Japanese (Chinese? whatever), why should they not be able to use names in their own language?
05:10 <pacak> kadoban: That's "hello" in chinese
05:10 {emptyset} joined
05:11 <geekosaur> perfectly cromulent for a hello-world function :p
05:11 Swizec joined
05:12 <ZesenQian[m]> Hello, does ghc core correspond to a single .hs file, or a complete executable?
05:12 <pacak> ZesenQian[m]: What is ghc core?
05:13 <geekosaur> it's an intermediate representation while compiling a .hs file
05:13 splanch joined
05:13 <geekosaur> (it's ghc's version of System F with Haskell-like syntax)
05:13 <pacak> geekosaur: It can also be a core dump produced by ghc. Or whatever ghc-core command displays
05:14 <geekosaur> the latter is the same thing I am talking about
05:20 <kadoban> pacak: Oh.
05:26 X-Scale joined
05:28 castlelore joined
05:28 castlelore joined
05:29 Koterpillar joined
05:31 takle joined
05:33 pikajude joined
05:35 scottj joined
05:35 xtreak joined
05:36 frankie1 joined
05:38 sword865 joined
05:38 geppettodivacin joined
05:39 whaletechno joined
05:39 sgfltx joined
05:40 <Axman6> abel-abel: my prefered way to get unicodeish syntax is to use Fira Code font in my editor - the file doesn't contain any weird symbols, but the font has ligatures for many common operators etc. (like => becoming a double arrow)
05:41 <Axman6> I hate coming across code where someone has use alphas instead of a's for no good reason. it adds nothing but comes with many downsides
05:42 andyhuzhill joined
05:44 dsantiago joined
05:44 armyriad joined
05:46 <MarcelineVQ> I also think ligatures are quite a nice thing to use and keeps code portable between readers
05:46 ahri joined
05:47 raycoll joined
05:47 <MarcelineVQ> if you actually want fancy text at least :>
05:48 uglyfigurine joined
05:48 <geekosaur> and if your editor and/or terminal support ligatures properly
05:48 Rizy joined
05:49 <geekosaur> there's a long list of things that font is known not to work with (or work only with local patching)
05:51 <barrucadu> I used to use ligatures, but found that I ended up with much of my code alignment one character off due to arrows being rendered in a single monospaced cell and suchlike
05:52 xtreak joined
05:53 shafox joined
05:54 diegoksp joined
05:54 ChaiTRex_ joined
05:55 piyush-k` joined
05:55 osa1 joined
05:55 osa1 joined
05:56 MrcRjs joined
05:57 Vorpal joined
05:58 <athan> Is there a way to "cut" inside of a QQ?
05:58 <athan> like [foo| something $(someVarInScope) something |]
05:58 <athan> or is that QQ dependent?
05:58 <athan> (given that `someVarInScope :: String`)
05:58 <pikajude> no that's up to the quasiquoter
06:00 <athan> shoot, thanks pikajude
06:00 <pacak> athan: You can try doing something perverted with CPP....
06:01 <athan> heh
06:01 <pikajude> my frame of reference is hamlet, which takes #{some_expr} in a QQ and uses haskell-src-meta to parse it
06:01 <pikajude> then re-embed it as part of the AST
06:01 juhp joined
06:02 raycoll joined
06:02 juhp joined
06:02 cultofmetatron joined
06:05 bbcue joined
06:05 fizruk joined
06:05 IndigoTiger joined
06:05 diskie joined
06:05 raatiniemi joined
06:06 <jle`> was haunted by half a month by a bug that was the result of my types not being descriptive enough and allowing illegal states
06:06 dec0n joined
06:06 <jle`> as soon as a changed the types the bug was caught
06:06 fxrs joined
06:06 <jle`> haskell success story i guess?
06:06 xmonader joined
06:06 _cyril__ joined
06:06 carbolymer_ joined
06:07 wto_ joined
06:07 chilversc_ joined
06:07 xmonader joined
06:07 Theodule joined
06:07 xmonader joined
06:08 Wizek joined
06:08 cathyjf joined
06:08 dequbed joined
06:08 kshannon_ joined
06:08 <pikajude> that's what we call success
06:08 govg_ joined
06:09 kennyp_ joined
06:09 Marqin_ joined
06:09 xmonader joined
06:09 bravespear|2 joined
06:09 m0rphism1 joined
06:10 __SiCC__ joined
06:10 kolmodin joined
06:11 ChaiTRex joined
06:12 pharaun_ joined
06:12 joehillen_ joined
06:12 niluje joined
06:12 xa0 joined
06:12 rodlogic_ joined
06:12 systemfault joined
06:12 shauryab98 joined
06:12 oherrala1 joined
06:13 indiffernet_ joined
06:13 92AAAQ4C5 joined
06:13 seequ joined
06:13 Rainb joined
06:13 Zialus joined
06:13 andyhuzhill joined
06:13 Unhammer joined
06:14 magthe joined
06:14 shauryab98 joined
06:14 xmonader joined
06:14 Biohazard joined
06:14 <shauryab98> Hi! I've started learning haskell and want to contribute to open source projects. What projects could be great for a beginner?
06:15 xmonader joined
06:15 kwantam joined
06:15 <Axman6> the best projects are ones which you understand the domain of and want tp use
06:15 takle joined
06:16 oelewapperke joined
06:16 systemfault joined
06:16 connrs joined
06:16 jw358 joined
06:18 tomboy64 joined
06:18 xmonader joined
06:18 <shauryab98> Any idea how 'Codeworld' draws graphics? Does it use some other haskell library to do that?
06:20 <Axman6> You doing COMP1100 by any chance?
06:20 <shauryab98> Cis194
06:20 <Axman6> ah, we're using code world in COMP1100 at the ANU
06:21 <Axman6> thought I'd found a student ;)
06:21 <cocreature> shauryab98: find some library that you use or find cool and contribute to that :) almost all projects have some beginner tasks
06:21 _sras_ joined
06:21 <Axman6> Code.world is also available on hackage (and probably github), so you can find out
06:22 <shauryab98> I went through their code but didnt find how the graphics are being generated.
06:23 mrpavo joined
06:26 <geekosaur> "It comes with two backends. When compiled with GHCJS, it uses the JavaScript FFI to run on http://code.world/. When compiled with GHC, it uses the blank-canvas package to provide a webpage consisting of just a panel locally. This way, the same program that runs on the CodeWorld server can also be run locally."
06:28 MoALTz joined
06:28 zariuq joined
06:28 Jackoe joined
06:29 Rainb joined
06:30 shaurya joined
06:30 <jle`> mniip: oh, fwiw, it was your library that helped me track down the bug
06:30 <jle`> i mentioned earlier about arising from using types that weren't discriptive enough
06:30 <jle`> so thanks!
06:30 hexagoxel joined
06:32 takle joined
06:34 danvet_ joined
06:34 meandi_2 joined
06:35 shanemikel joined
06:36 _ashbreeze_ joined
06:38 <piyush-k`> anyone tried ats
06:38 <piyush-k`> ?
06:38 splanch joined
06:39 hvn0413 joined
06:39 <piyush-k`> type theory looks interesting but the error messages are horrible. Cannot make head or tail of the error
06:42 certainty joined
06:43 igniting joined
06:43 FreeBirdLjj joined
06:44 FreeBirdLjj joined
06:48 parmagreen joined
06:48 Jackoe joined
06:49 dmiles joined
06:49 <_sras_> How can I generate psudeo random UUID's in pure code?
06:50 splanch joined
06:50 <pacak> _sras_: You can pass a seed to use
06:51 <pacak> :t random
06:51 <lambdabot> (RandomGen g, Random a) => g -> (a, g)
06:51 <_sras_> pacak: Yes
06:53 mrpavo joined
06:54 jhrcek joined
06:59 xtreak joined
07:00 splanch joined
07:01 bryanlemon joined
07:01 padre_angolano joined
07:01 augur joined
07:02 simony joined
07:02 simony joined
07:02 suls joined
07:02 ogrady joined
07:03 eddsteel joined
07:04 MarioBranco joined
07:04 benzrf joined
07:04 sns joined
07:04 anoe joined
07:04 da-x joined
07:04 RouxTheDay joined
07:04 abh joined
07:04 j_king joined
07:04 Zialus joined
07:05 aidecoe joined
07:05 seequ joined
07:05 mrd joined
07:05 mrd joined
07:05 ChewieBeardy joined
07:06 dunx joined
07:06 Yuras joined
07:06 adraenwan joined
07:06 tomboy64 joined
07:07 niluje joined
07:07 FreeBirdLjj joined
07:07 aeroxam joined
07:08 foobars joined
07:08 c137 joined
07:09 henriksod joined
07:09 rdococ joined
07:09 Reshi joined
07:10 Rainb joined
07:10 raichoo joined
07:10 splanch joined
07:11 tmciver joined
07:11 Rizy joined
07:12 spatial joined
07:13 <spatial> http://lpaste.net/353843 In this section unless (r1 < 0.01) $ do d <- (update d state nv) return () isn't in scope later
07:14 Swizec joined
07:14 <spatial> Looks like (nv,d) <- nextvalue O (randomgreedy r1 rm gm) c newstate is the 'd' in scope.
07:15 <spatial> Is that right ? Will 'd' have the updates done within 'unless' ?
07:15 <kadoban> spatial: The "d" in that inner do block is indeed a new binding, that quickly goes out of scope.
07:15 <geekosaur> suggest you compile that with -Wall
07:16 xcmw joined
07:16 suls joined
07:17 <pacak> spatial: Lines over 100 characters are just ugh.
07:18 spatial_ joined
07:18 <spatial_> Had to leave. Couldn't refactor because unless needs return()
07:18 oish joined
07:19 <spatial_> http://lpaste.net/353843 I mean this.
07:19 <pacak> spatial_: Lines over 100 characters are just ugh.
07:20 <spatial_> pacak: Not a haskell expert.
07:20 <pacak> I suspect they are bad style in any language. Except for maybe Java.
07:20 <spatial_> You mean the characters. I can reduce that.
07:20 takle joined
07:21 shauryab98 joined
07:21 <geekosaur> there's no particular reason you have to use unless there
07:21 <pacak> It looks like whatver on that long line is - can be placed in a separate function.
07:21 <pacak> Add more type signatures
07:21 <pacak> Try to look at formatting in base and other libraries with lots of users
07:22 KarboniteKream joined
07:22 <pacak> If you make your code more readable - it will be easier to develop and debug.
07:22 <geekosaur> d' <- if r1 < 0.01 then return d else update d state nv
07:22 <spatial_> Yes.
07:23 <spatial_> geekosaur: That condition is needed.
07:23 <geekosaur> (except I't write on multiple lines)
07:23 <osa1> I'm trying to add someone as a maintainer in a package. the request seems to be successful but I don't see his hackage name in the "maintainers for <package>" page. is that expected?
07:23 <geekosaur> that condition is also present
07:23 zeroed joined
07:23 zeroed joined
07:24 free_beard joined
07:24 <geekosaur> unless is not magic, it's an if-then-else with `return ()` in the else (which is why the then leg has to also produce m ())
07:24 <spatial_> Any refactoring idea ?
07:24 <spatial_> You mean the function returns at return ()
07:25 <spatial_> I didn't intend that.
07:25 <geekosaur> what?
07:26 <geekosaur> no, I mean then and else types must match
07:26 <spatial_> unless that cond is satisfied continue. Otherwise updata and continue.
07:26 <geekosaur> yes
07:26 <geekosaur> and the if I wrote does the same thing, while letting you get at the value
07:27 takuan joined
07:28 <spatial_> if-then-else (r1 < 0.01) d <- (update d state nv)
07:28 <geekosaur> what?
07:28 yinn joined
07:28 MrWoohoo joined
07:29 <spatial_> Is that what you mean ?
07:29 takle joined
07:29 <geekosaur> [23 07:22:23] <geekosaur> d' <- if r1 < 0.01 then return d else update d state nv
07:30 <spatial_> Ok. I can use that. But code is peppered with such 'returns'. So decided to use when and unless.
07:30 <geekosaur> (I switched the result to d' because shadowing bindings just causes confusion. you've already demonstrated one such, by thinking that it's doing an update like in e.g. python)
07:30 BartAdv joined
07:32 <geekosaur> that might be a symptom of trying to program as if in a procedural language
07:33 <spatial_> Right
07:35 alfredo joined
07:35 quchen joined
07:36 petervaro joined
07:37 bbcue joined
07:38 takle joined
07:39 <joneshf-laptop> Is statically linking a binary really a thing you should do with GHC? I've been trying to figure it out for a bit now, and it doesn't seem like there are any instructions that really work.
07:40 ubsan_ joined
07:41 Jackoe joined
07:41 <geekosaur> joneshf-laptop, the real problem with -static is not with ghc, but with glibc becoming fragile
07:42 <spatial_> game state newstate a = do gameplan a state newstate 'game' returns what 'gameplan' returns. Right ?
07:42 <cocreature> alpine has ghc built against musl which should avoid the glibc problems
07:42 bjz joined
07:45 kritzcreek_ joined
07:45 <joneshf-laptop> geekosaur, I'm sorry, what does that mean?
07:45 tessier joined
07:45 tessier joined
07:46 <geekosaur> glibc dlopen() a bunch of shared objects (nss modules for nameservice lookups, locale modules, ...) at run time. the ABI changes often, such that you can't reliably use one glibc version's shared objects with a different one
07:46 jbiesnecker joined
07:47 <geekosaur> if you like statically and copy the binary elsewhere, you need to copy along the appropriate shared objects and make sure the program uses them instead of the ones on the target system, or you can get core dumps or weirdness
07:47 <geekosaur> (ld will warn you of this if it detects globc being linked statically)
07:47 <geekosaur> *glibc
07:47 <joneshf-laptop> interesting.
07:48 <joneshf-laptop> Do I not understand what static linking means?
07:48 <geekosaur> it means that you use .a files instead of .so files in the link
07:48 <geekosaur> which means the actual library code is linked instead of stubs that load the shared objects at runtime
07:49 louispan joined
07:49 <geekosaur> there is a difference between linking statically and building ghc static libraries; the problem is that you can't easily use ghc static libraries with a ghc built for dynamic libraries, and trying to use -static to overcome this will break glibc as I described
07:50 fiddlerwoaroof joined
07:50 <joneshf-laptop> I think I sort of understand now.
07:50 <joneshf-laptop> Thanks.
07:50 <joneshf-laptop> So, is the solution to use a ghc built for static libs then?
07:50 <joneshf-laptop> Is that even a thing?
07:51 <cocreature> I think the musl ghc in alpine also works
07:51 a3Dman joined
07:52 guiben joined
07:53 X-Scale left
07:53 <joneshf-laptop> cocreature, thanks, I 'll read up on that
07:54 ramzifu joined
07:55 pylbrecht joined
07:55 tobill joined
07:56 unK_ joined
07:57 raichoo joined
07:58 grayjoc joined
08:01 electrostat joined
08:03 Sampuka joined
08:03 cultofmetatron joined
08:04 patbecich joined
08:04 <dmj`> geekosaur: ABI == application binary interface?
08:05 fizruk joined
08:07 nomotif joined
08:08 <dmj`> geekosaur: interesting, just statically linked ghc binaries yesterday and got that exact warning about dlopen()
08:08 certainty joined
08:08 takle joined
08:10 Mortomes|Work joined
08:10 Mortomes|Work joined
08:10 Mortomes|Work joined
08:13 a3Dman joined
08:14 patbecich joined
08:15 takle joined
08:17 <joneshf-laptop> So maybe I should stick with dynamic and figure out the environment instead?
08:17 <joneshf-laptop> Overall goal is figuring out deploy.
08:18 xkb_ joined
08:19 <xkb> hi there. I have a question on Aeson: Is it possible to map the accessor function of a field to a different field name in the JSON?
08:19 razi1 joined
08:19 <xkb> I'm dealing with conflicting names over 2 structures that are in the same module
08:19 <dmj`> joneshf-laptop: here’s the warning I received from static linking, exactly as geekosaur described.
08:19 <dmj`> https://gist.github.com/dmjio/32b226cc892b3bd41112e3624c2e0344
08:20 <dmj`> hsnet_getaddrinfo is just a wrapper around getaddrinfo
08:20 mattyw joined
08:21 <tdammers> xkb: you can write JSON instances by hand instead of deriving them
08:21 <xkb> Hmm I was hoping to avoid that ;)
08:21 splanch joined
08:21 <joneshf-laptop> xkb, yes, there's an option thing you can pass for that.
08:21 <joneshf-laptop> xkb, or do as tdammers suggested
08:22 <tdammers> xkb: then I'd factor the data structures out into separate modules, and import them qualified into the one they're currently in
08:22 <xkb> I'm digging in the docs now to see if I c an find it
08:22 <joneshf-laptop> dmj`, I see. I can't even get to that stage.
08:22 kiltzman joined
08:22 <tdammers> xkb: depending on how exactly you name the fields, you could also pass a custom field name modifier to the deriveJSON options
08:22 Stanley00 joined
08:22 a3Dman joined
08:22 jrslepak joined
08:22 <xkb> @tdammers
08:22 <lambdabot> Unknown command, try @list
08:23 <joneshf-laptop> xkb, or you could use that language extension `DuplicateSomethingSomething`.
08:23 <xkb> @tdammers that sounds like my best bet
08:23 <lambdabot> Unknown command, try @list
08:23 <xkb> tdammers: that sounds like my best bet
08:23 Madars_ joined
08:23 <tdammers> xkb: if it's just removing a prefix, then it's easy
08:23 insitu joined
08:23 <joneshf-laptop> dmj`, this is where i'm stuck: https://gist.github.com/joneshf/044cb9f7c2416e9f12f2233137dc6b3a
08:23 <dmj`> joneshf-laptop: unless you’re doing numeric heavy code, one way to get around some linker issues is to use the integer-simple ghc (avoid linking with -gmp). This also gets around some licensing issues w/ distributing gmp
08:24 ventonegro joined
08:24 <tdammers> xkb: http://hackage.haskell.org/package/json-extra- has an example of how to do this
08:24 <joneshf-laptop> xkb, `DuplicateRecordFields`.
08:25 <xkb> `fieldLabelModifier = drop 1` <= nice
08:25 <dmj`> joneshf-laptop: in your default.nix, besides configureFlags = [ "--ghc-option=-optl=-static" "--ghc-option=-optl=-pthread" ]; and enableSharedExecutables = false; , what else do you have
08:26 prions joined
08:26 Gloomy joined
08:26 yellowj joined
08:26 etehtsea joined
08:26 <joneshf-laptop> dmj`, I know very little about nix so forgive me if I say something silly, but I don't have a `default.nix`. I have a `shell.nix`.
08:26 irivqu joined
08:27 <joneshf-laptop> dmj`, dunno if those can be used equivalently, but I don't have any `configureFlags` in `shell.nix`.
08:27 raichoo joined
08:27 pylbrecht joined
08:27 ragepandemic joined
08:29 <joneshf-laptop> dmj`, is that my problem? That I should be using a `default.nix` in addition to this `shell.nix`?
08:29 zero_byte joined
08:29 thc202 joined
08:29 <dmj`> joneshf-laptop: By default nix doesn’t use cabal-install to build programs, it uses the old school ghc Setup.hs && ./Setup —configure <flags> && ./Setup … etc.
08:30 t0by joined
08:30 t0by joined
08:30 pothepanda joined
08:30 fiddlerwoaroof joined
08:31 <dmj`> Using cabal-install in the nix-shell is basically removing the necessity of cabal resolving dependencies from hackage (calling ghc-pkg list in the nix-shell should show you what is present)
08:32 <dmj`> joneshf-laptop: In your project, I’d call cabal2nix . > default.nix
08:32 <joneshf-laptop> from outside of nix?
08:32 merijn joined
08:33 <dmj`> either or, if you installed cabal2nix with `nix-env -iA cabal2nix -f ‘<nixpkgs>’` that will put a symlink from the store into your profile, making it accessible from anywhere
08:33 <dmj`> unless you are in a shell with —pure, since that should block the PATH
08:34 <joneshf-laptop> I have no idea :(
08:34 <dmj`> just install cabal2nix with nix-env -iA cabal2nix -f ‘<nixpkgs>'
08:34 <dmj`> it’s present at the top level attribute set of nixpkgs
08:34 <joneshf-laptop> L
08:35 <joneshf-laptop> K
08:35 takle joined
08:35 coot joined
08:36 albertid joined
08:36 fotonzade joined
08:36 <hvr> dmj`: does nix contain all versions of a package from hackage?
08:37 connrs joined
08:38 <dmj`> hvr: I don’t believe so, only the most current curated set of packages that are manually synchronized from stackage. It’s always possible to get at old packages by using older hashes of nixpkgs, or calling `fetchFromGitHub`. It does allow you to have multiple versions present though. And package versions will vary amongst ghc’s that you’re using.
08:38 <hvr> dmj`: but this sounds like nix doesn't offer you the full cartesian product of valid solutions
08:39 <hvr> but rather more like a time-indexed family of "planes" within the hackage solution space
08:39 <hvr> which is only a tiny fraction of the solution space
08:39 xcmw joined
08:40 oish joined
08:41 jbiesnecker joined
08:43 <dmj`> hvr: yes, basically the latter. I believe there is a yaml file with a list of packages that is used to generate this file: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/hackage-packages.nix.
08:43 hlundgren joined
08:44 <hvr> dmj`: or put differently, is nix basically just a nix-ified stackage?
08:44 <hvr> (with respect to the supported configurations)
08:45 stianhj joined
08:46 yinn joined
08:46 mfukar joined
08:46 oish joined
08:47 <hvr> looking at the hackage-packages.nix file I notice that most packages only have one single version
08:47 <hvr> while some may have 2 or 3 major versions represented
08:47 mgu joined
08:47 <dmj`> Hydra and nix-serve will only keep so many packages pre-built in the cache before a GC run is called, and these packages live along standard ‘channels’, analgous to LTS snapshots (but inclusive of system deps). Stackage might be considered more stable, no one is going to tell you your packages are broken on nixpkgs. But nixpkgs will look at versions of
08:47 <dmj`> packages on stackage and put them into nixpkgs iirc.
08:48 <joneshf-laptop> dmj`, hmm, got `default.nix` but can't seem to run it. Complains about `mkDerivation`. But, I think i'm kind of getting side tracked here. I'm not commited to using nix to build, since I've heard it's not great on OSX anyway (work computer is OSX). Just using it here since I'm too lazy to install postgres.
08:49 <hvr> dmj`: tbh, this makes nix appear less attractive to me :-/
08:49 <dmj`> hvr: for more popular packages it’s common to see version suffixes appended to the end.
08:50 <hvr> dmj`: i.e. it seems to force me into constrained package sets due to hydra's limitation that it can't build *everything*
08:51 <hvr> i.e. we have a constraint database on hackage so we can let a solver select valid solutions for us
08:51 <joneshf-laptop> That reminds me,I should repond to your issue hvr :)
08:51 <hvr> rather than have to precompute solutions for everyone
08:51 <hvr> +low-dimensional solutions
08:51 <hvr> joneshf-laptop: :-)
08:52 <hvr> joneshf-laptop: if you have questions... feel free to ask!
08:52 <dmj`> hvr: Well, you can override specific packages that you need, or fetch from your fork. But in general most packages on nixpkgs build no problem, tests and haddocks not always. But that can be fixed.
08:53 <joneshf-laptop> hvr, will do. Thanks!
08:53 <hvr> dmj`: what if I want to just leave package resolution up to cabal's solver, and just reuse nix packages in case they happen to be cached?
08:54 <hvr> btw, is overriding specific packages less cumbersome than stack's extra-packages mechanism?
08:54 <dmj`> hvr: In general for most projects I guess I’m not using multiple versions of the same package, if I were it wouldn’t be a problem adding it to a list of overrides and giving it a similar name . You can setup your own personal hydra, that will cache your deps. as long as you’d like, and give everyone on your team access to the cache (behind basic auth
08:54 <dmj`> or something).
08:55 <hvr> (where you have to manually pinpoint versions rather than specifying a version range)
08:56 <hvr> ok, but how does hydra know which install-plans to build?
08:56 <hvr> (or cache)
08:56 Deadhand joined
08:56 <dmj`> hvr: hmm, I don’t think it would be possible to use cabal’s resolver, esp. if you lack a freeze file. Since the hashes could change. In general all dependencies are explicit.
08:57 <hvr> hrm... that's unfortunate... and I guess I'm going to have to reinvent hydra for what I have in mind :-/
08:57 gregman_ joined
08:57 <dmj`> hvr: there is a schedule that is followed based on channels, hydra will follow the channel. Actually, see #2. http://howoldis.herokuapp.com/
08:57 <hvr> that's the thing; I don't need channels
08:58 <hvr> in fact, they're in conflict with what I want
08:58 <hvr> I deliberately want a channel-agnostic hydra
08:59 tromp joined
08:59 dawehner joined
08:59 grayjoc joined
08:59 <dmj`> hvr: hmmm, I see. So with what you have in mind, would you like all of hackage built and cached at any given time.
08:59 <hvr> I'd like a sparse cache of hackage
09:00 <hvr> where stuff gets cached based on demand
09:00 <hvr> I *need* the cabal solver to be in charge
09:01 <hvr> so that I can get the same solutions ppl would get when they run cabal install
09:02 <hvr> schemes like stackage kinda put the cart before the horse in my model
09:03 balor joined
09:03 <joneshf-laptop> hvr, should I pay attention tot he info?: *INFO* Please consider using the experimental `cabal new-build`-powered generator `make_travis_yml_2.hs`
09:04 <joneshf-laptop> Or is it too experimental?
09:04 <hvr> joneshf-laptop: can you link me to the specific comment? :-)
09:04 <joneshf-laptop> I ran step 4 of the instructions here: https://github.com/hvr/multi-ghc-travis#quick-start-instructions and it gave me that into as output.
09:05 <joneshf-laptop> https://gist.github.com/joneshf/c798cec0409d5a6eac48e5454fb5440e
09:05 Jackoe joined
09:05 <hvr> ah right, yeah
09:05 <hvr> if you've got a simple package, the _2.hs script is fairly robust
09:06 <joneshf-laptop> K. I'll give it a shot
09:06 <hvr> joneshf-laptop: lemme know in case it doesn't work as expected
09:06 <hvr> joneshf-laptop: it *is* supposed to work
09:06 Itkovian joined
09:07 <dmj`> hvr: Ah, very interesting, it might just be better to cache every package w/ version on hackage, and then let the cabal resolver hit the cache, and insert the package into your local package db. Assuming packages never change after being uploaded, for reproduceability, and modulo any system deps required.
09:07 <hvr> the only experimental part about it is that it currently uses an unreleased bleeding edge cabal version :)
09:07 a3Dman joined
09:08 <hvr> dmj`: you can't properly cache every package*version; as you'd have to cache the DOF of all sub-install-plans possible for say foo-1.2.3's deps
09:09 <hvr> dmj`: but you can reasonably cache those configurations that actually get "solver coverage"
09:09 <hvr> otherwise would be impossible
09:10 ramzifu joined
09:10 <hvr> it's still got a huge database, but it's quite realistic to cache popular configurations
09:11 <hvr> w/o having to dumb down configurations by resorting to workarounds like stackage
09:11 mojjo joined
09:12 fiddlerwoaroof joined
09:12 bollu joined
09:13 Claudius1aximus joined
09:13 meff` joined
09:13 <bollu> if Sum = A Int | B Bool, and I have sums :: [Sum], can I collect all the "Int"s that are inside "sums" by using lens?
09:14 <hvr> bollu: if you have a prism for Sum, yes
09:14 <bollu> yes, I do
09:14 <bollu> so, like, how do I put it together?
09:14 takle_ joined
09:14 <bollu> I understand I need a Traversal to walk over [], and a Prism to pull out the "Int" from A
09:14 <bollu> but I don't know how to actually write the code for this :)
09:14 <merijn> It's also trivial using a list comprehension
09:15 <bollu> merijn: yeah, but this is a lens exercise :P
09:15 <bollu> merijn: I'm trying to learn how to think lensy
09:15 <bollu> hvr: what would the code using the lens look like?
09:15 <hvr> bollu: jfyi, there's also #haskell-lens where ppl often answer this kind of questions
09:16 <hvr> bollu: I'm just looking up how that traversal oeprator is named (I keep forgetting)
09:16 <bollu> hvr: I asked there as well
09:16 <bollu> but you answered first
09:16 <bollu> :)
09:16 <mojjo> hi! say I have two types: data Point a = Point a a; data Path a = Path [Point a]; I'm trying to write instances of Functor for them now. for Point it was trivial, however I'm stock with the one for Path... (http://lpaste.net/353852)
09:17 <bollu> mojjo: to get to an "a" in Path, you need to go through two layers: one [] layer, and one Point layer
09:17 <bollu> mojjo: so, if you think of "fmap" as being able to puncture a layer
09:17 <bollu> mojjo: what would you need for Path? :)
09:19 <bollu> :t fmap . fmap
09:19 <lambdabot> (Functor f, Functor f1) => (a -> b) -> f1 (f a) -> f1 (f b)
09:19 <bollu> mojjo: ^
09:19 magthe joined
09:20 zeroed joined
09:20 andyhuzhill joined
09:20 <dmj`> hvr: This is cool, definitely think nix could be used to cache common resolver configurations. It’s a very generic framework for building packages. The atomic unit in nix is the derivation, which is just a list of all the sources and inputs a package would need to be reified. It’s like a thunk, a build thunk. Nix takes the key value pairs in a derivation
09:20 <dmj`> and converts them into environment variables, and begins building packages w/ bash. It goes through a series of phases that can be hooked into or overriden.
09:21 locallycompact joined
09:21 skapazzo joined
09:21 <dmj`> hvr: since the derivation is the atomic unit, I don’t think object / archive files can be shared, like new-build will be able to do
09:21 <bollu> hvr: did you find the function?
09:21 <hvr> dmj`: ok, so I could in fact have cabal solver output such a nix derivation
09:21 yearir joined
09:23 takle joined
09:24 <mojjo> bollu: aha, I see. so this works now: instance Functor Path where fmap f (Path pts) = Path (map (fmap f) pts)
09:24 <bollu> mojjo: yep!
09:24 coot joined
09:24 Jacoby6000_ joined
09:24 <bollu> mojjo: I would prefer to write it as Path ((fmap . fmap) f pts), but that's a stylistic choice
09:24 <dmj`> hvr: yes, it seems so, similar to the hackage-packages.nix file, would probably need to generate something similar which has multiple packages versions in it.
09:24 akts joined
09:25 <dmj`> multiple version of the same package*
09:25 uglyfigurine joined
09:25 <akts> greetings everyone
09:26 paolino joined
09:26 <dmj`> hvr: although, this work may be related, https://github.com/haskell/cabal/issues/3651
09:26 bbcue joined
09:26 cpup joined
09:26 <paolino> hi, I have a dumb question, how to write bytes (not Char) to an handle ?
09:27 <paolino> seems to be a hPutBuf but I need a Ptr a
09:27 <merijn> paolino: Use bytestring
09:28 <merijn> Data.ByteString.hPut
09:29 <dmj`> hPutBuf :: Handle -> Ptr a -> Int -> IO () ?
09:29 <joneshf-laptop> hvr, hmm, well the 7.10 and 8.0 builds failed, but I wasn't expecting that: https://travis-ci.org/joneshf/servant-ruby/builds/214166869
09:29 <merijn> hPutBuf is too low level for most people to need
09:30 <paolino> merijn, hPut h (pack [0..10]) ?
09:30 <joneshf-laptop> hvr, do you think that's from the experimental generator?
09:30 <hvr> bollu: sorry, [Right True, Left (), Right False] ^.. traversed._Right
09:30 <merijn> paolino: For example, depending on what you want to output
09:30 <bollu> hvr: oh, (^..) is a many access?
09:30 <akts> Is it possible to get the basics of haskell covered in a fort night ? total newbie here ...
09:31 <paolino> merijn, Word8
09:31 <merijn> akts: Depends on your background, but probably not
09:31 <hvr> joneshf-laptop: looking...
09:32 <hvr> joneshf-laptop: oh... you got doctests...
09:32 <merijn> akts: Unless you have experience with somewhat similar languages (OCaml, Swift, F#, SML) you'll find yourself needing to basically learn from scratch as Haskell is rather different from most mainstream languages
09:33 <akts> I jumped in and joined an online course on haskell... and suddenly got a bit far behind (for reasons of national security :P) ...
09:33 zar joined
09:33 <hvr> bollu: do you know http://www.haskellforall.com/2013/05/program-imperatively-using-haskell.html ? I like to point students to that to get a first taste of lenses
09:33 <akts> oh!! I have a bit of background in c and a lil bit of python
09:34 <hvr> (and it does mention (^..) )
09:34 <bollu> hvr: I read it, yes. I had forgotten about (^..) since I have not used it so far
09:34 <bollu> hvr: so far, I have mostly been using the Prism and the StateT family of lenses
09:34 <bollu> hvr: I'm implementing STG to understand it xD
09:34 Grisha joined
09:35 <akts> one more thing... ahem!! are you guys really strong with math ?
09:35 <hvr> joneshf-laptop: are those doc-tests expected to work?
09:35 <joneshf-laptop> hvr, yep.
09:36 <bollu> hvr: thanks for the help
09:37 <joneshf-laptop> hvr, seems relevant: https://github.com/hvr/multi-ghc-travis/issues/54
09:37 <joneshf-laptop> hvr, Going to try the non-experimental generator
09:37 <akts> my math is a bit under the rain... that is why I asked ... should I be well versed in math to learn haskell ?
09:37 <merijn> akts: Not particularly, and I don't believe it'd help much
09:39 a3Dman joined
09:40 <akts> Thanks merijn, I guess I'll take a crack at my fresh copy of Real World Haskell.
09:41 <merijn> To be honest, Real World Haskell is kinda dated nowadays
09:41 <mojjo> bollu: looks like a good idea to avoid the nesting of fmaps.... The composing you suggest I find bit hard to reason about at the moment.. would you have a hint how to imagine that (fmap . fmap) is getting the type (a -> b) -> [[a]] -> [[b]]
09:42 <tdammers> someone should write a revised edition
09:42 <merijn> There's the CIS something course which I forget which someone will probably jump in and recommend :)
09:42 <merijn> mojjo: Well, let's have a look:
09:42 <merijn> :t fmap
09:42 <lambdabot> Functor f => (a -> b) -> f a -> f b
09:42 biglama joined
09:43 <merijn> So, we have an 'a -> b' and make it 'f a -> f b', but what if fmap a function we already have 'f a -> f b' (let's rename it to 'm x -> m y' for clarity
09:43 splanch joined
09:44 <* sm> inserts standard suggestion of Haskell Tutorial And Cookbook
09:44 <merijn> So, what if we pass 'm x -> m y' to fmap? Well, we get 'a = m x' and b = 'm y', so since fmap does '(a -> b) -> f a -> f b', we get '(m x -> m y) -> f (m x) -> f (m y)'
09:44 <Baklazhan> akts: you might want to be able to derive some formulas (= functions) in a formal way, like the one merijn is doing right now
09:45 tomphp joined
09:45 <merijn> mojjo: Now, since the only restriction is that 'f' and 'm' must be Functor, we can pick [] (a functor) and see the result can be '[[a]] -> [[b]]' (alternative notation: '[] ([] a) -> [] ([] b)' which looks like the 'f (m x) -> f (m y)' we had
09:46 <akts> What you guys are saying is literally greek for me
09:46 <akts> http://www.seas.upenn.edu/~cis194/ <- is this the one ?
09:47 <merijn> Yeah, that one
09:47 howdoi joined
09:49 <akts> Thanks merijn Baklazhan
09:49 <hvr> joneshf-laptop: yeah, I know... doctest are still an open issue for new-build ... as they rely on undefined behaviour which isn't provided by new-build anymore currently
09:50 sagittarian joined
09:50 doomlord joined
09:52 twanvl joined
09:52 <joneshf-laptop> hvr, yikes! undefined behavior?
09:56 <joneshf-laptop> hvr, looks like the old generator still works. Thanks for the help!
09:56 <mojjo> merijn: bollu: yeah, starting to make sense to me now... It helps to remember that the fmap signature includes those parentheses implicitly: (a -> b) -> (f a -> f b) . in other words: just currying, and then it's literally just replacing the symbols after the first arg is passed. nice!
09:57 dsantiago joined
09:57 bollu joined
09:57 <bollu> mojjo: yes
09:57 lukaramu joined
09:58 <joneshf-laptop> hvr, Also, I'm curious. Are you already using/interested in using `servant-ruby` or just noticed it somehow?
09:58 <merijn> mojjo: My usual advice is: do the substitution by hand on paper anytime you get confused until you get comfortable doing them in your head :)
09:58 slomo joined
10:01 mojjo joined
10:02 mohsen_ joined
10:03 marvin2 joined
10:04 ramzifu joined
10:06 splanch joined
10:06 cultofmetatron joined
10:07 bjz_ joined
10:07 ub joined
10:08 <mojjo> bollu: Alright, very good. So one could finally write fmap like: fmap f (Path pts) = Path $ (fmap . fmap) f pts; and use it e.g. like fmap succ $ Path [Point 1 1]; This is sort of the 'deep' solution. Isn't this getting problematic when types are more nested?
10:08 oish joined
10:09 <hvr> joneshf-laptop: I do use servant-ruby, but it got on my radar cause it was flagged on
10:09 cobreadmonster joined
10:09 <hvr> joneshf-laptop: meant, I use servant-* stuff; but not yet -ruby
10:09 <mojjo> I mean, I'd rather have assumed on would intend a usage like: fmap (f :: Point -> Point) $ Path [Point 1 1]
10:09 splanch_ joined
10:10 <hvr> joneshf-laptop: undefined insofar, as the way 'doctest' works relies on being able to see the local package-db; something that was a side-effect of the old system, but doesn't necessarily exist in the same way in the redesigned new-build model
10:11 balor joined
10:12 ertes joined
10:13 <quchen> hvr: Woooo you’re alive! :-D
10:13 <hvr> quchen: yes... I'm slowly resurface from the depth of mainframe programming w/ PL/I & COBOL
10:14 <joneshf-laptop> hvr, that matrix thing is amazing!
10:14 <quchen> hvr: Really? REALLY?
10:14 OnkelTem joined
10:14 jaspervdj joined
10:14 <hvr> quchen: long story... but partly the reason why there GHC 8.0.1 revived the IBM AIX port
10:15 <quchen> Google translate: what does »grundgütiger herrgotimhimmel warum« mean in English
10:15 <quchen> I’d like to use it on IRC
10:16 <hvr> joneshf-laptop: fun-fact: the 3rd-gen matrix builder is powered by servant :-)
10:16 <opqdonut> quchen: with my limited german it sounds a bit like "why god why?"
10:16 <quchen> :-)
10:16 Jacoby6000_ joined
10:17 <mojjo> quchen: sounds like bavarian to me...
10:17 <hvr> quchen: well... turns out there's quite a few legacy-systems vendor-locked into IBM hardware/software that wants to be freeed up a little bit
10:18 qqwy joined
10:18 <qqwy> Good morning! :-)
10:18 <qqwy> Quick question that one of you veterans probably can answer right away: I want to repeat a function on some input until some condition is true for this input, and then count the amount of repetitions.
10:19 <mojjo> "ground-gracious god's heaven.. why?" So, "why god why?" sounds like a good free translation to me..
10:19 <qqwy> In this case, I want to count how often I can run a function on a Set that deletes some of the elements from the set.
10:19 <Ferdirand> by repeat a function, you mean iterate ?
10:19 fizruk joined
10:20 <marvin2> qqwy do you count function recursively calling itself (assuming it is doing that)?
10:21 <Ferdirand> > take 10 (iterate (*2) 1)
10:21 <mojjo> qqwy: what about: length $ takeWhile predicate xs
10:21 <lambdabot> [1,2,4,8,16,32,64,128,256,512]
10:22 <mojjo> > length $ takeWhile (<8) [1,2,4,8,16,32,64,128,256,512]
10:22 <lambdabot> 3
10:23 hexagoxel joined
10:23 Philonous joined
10:23 <qqwy> marvin2, Ferdirand: I am not iterating over a list, but rather have one set, and want to run a function `a -> a` on some `a` until some `a -> Bool` is true, in which case I want to return how many times the `a -> a` function was called to reach that point
10:24 <Ferdirand> well that sounds exactly like iterating over a list
10:24 <Ferdirand> thanks to laziness it won't actually exist as a list in memory
10:24 coot joined
10:25 <Ferdirand> iterate will compute the a's as takeWhile consumes them
10:25 merijn joined
10:25 <Ferdirand> takeWhile itself driven by length, which will discard each element immediately
10:26 <mojjo> qqwy: what do you mean by 'set' exactly, could you give some sample data?
10:26 danza joined
10:27 mda1 joined
10:27 splanch joined
10:27 <qqwy> It does seem like a waste to build a list just to read out its length afterwards. Although because of the lazyness that might not be such a problem, items being consumed while they are being produced and such
10:27 <qqwy> mojjo: Data.IntSet
10:28 <qqwy> A set like `Data.IntSet.fromList [1,2,3]`
10:29 Jacoby6000_ joined
10:30 <Ferdirand> you'd have to inspect the core to be sure, but with optimizations turned on i've heard that fusion might kick in and even eliminate the list allocations completely
10:30 <Ferdirand> perhaps a real expert can confirm
10:31 <qqwy> Thanks!
10:31 bjz joined
10:31 ebzzry joined
10:31 <qqwy> `length $ takeWhile (not . IntSet.null) $ iterate myFun set` works :-)
10:31 <qqwy> First make it correct, then readable, then fast. In that order. So for now, this is more than good enough :-)
10:32 yinn joined
10:33 <cocreature> I would be very surprised if that creates a list
10:39 contiver joined
10:41 <qqwy> This is what I would write when doing it manually:
10:41 <qqwy> https://gist.github.com/Qqwy/419b0db0c1920a7ecfc16c9d3f13812b
10:41 <qqwy> I'll benchmark which approach is faster
10:42 <qqwy> Probably it will still be the list one, because GHC can do ridiculous things with lists ^^'.
10:42 xcmw joined
10:43 <mojjo> qqwy: I'm just wondering if a 'break condition' on iterating over a set makes sense at all. Isn't it the nature of sets that you can't rely on the order - in contrast to lists?
10:44 <mojjo> Then you would have to go over the whole thing anyways, but correct me if I'm wrong here.
10:44 <qqwy> mojjo: In this case I am repeatedly deleting elements (stored elsewhere) from the set. This procedure, doing 'something else' and then deleting an element from the set is what I want to count how many it is repeated until the set is empty
10:44 <qqwy> The set basically stores 'possible starting points' of the procedure.
10:44 splanch joined
10:44 ccapndave joined
10:45 <ccapndave> Morning Haskellers. Is there a special word for 'exiting' a monad? e.g. Maybe a -> a
10:45 <mojjo> qqwy: ok, got you...
10:45 <qqwy> ccapndave: I believe that 'escaping' is usually the term that is use
10:45 <qqwy> used*
10:45 <ccapndave> Awesome, thanks :)
10:45 ventonegro joined
10:46 <qqwy> mojjo: To give some more context, I am solving an exercise for the university
10:46 takle joined
10:47 <qqwy> in which we get an array of `n` numbers as input, where each of the numbers is a distinct number in the range (0..n)
10:47 tomboy64 joined
10:47 <qqwy> This means that array index `i` points to another element in the array
10:48 <qqwy> So it is sort of a 'graph' representation
10:48 <qqwy> and the idea is to find out how many cycles there are in this array
10:48 benl23 joined
10:49 dawehner joined
10:49 <qqwy> For instance, [1,2,3,0] has one cycle, as every element points to the next (with the last one pointing to the first)
10:49 <qqwy> And [0,1,2,3] has four cycles, as every element points to itself
10:50 <qqwy> How I solve it, is by creating an array from this list, so we have O(1) element access, and also creating an IntSet filled with these numbers.
10:51 dawehner_ joined
10:52 <qqwy> Then, I take any number `i` from the IntSet, which is the 'start' of the cycle to consider, and read the `i`-th index' value `v` from the array. The number `i` is then deleted from the IntSet. If that value is equal to the start, the cycle has been completed. If it has not, this procedure is called recursively (so `v` is the new `i`) until it does.
10:53 <qqwy> So this is to find one cycle. After this procedure is completed, the IntSet only contains all numbers that were not part of that cycle.
10:53 <qqwy> So that procedure, runCycle, as a whole, is repeated until the IntSet is empty.
10:54 merijn joined
10:54 <qqwy> :-)
10:54 <qqwy> So what are you working on right now, everyone?
10:54 yqt joined
10:54 <maerwald> proprietary software
10:55 coeus joined
10:55 <brynedwards> Writing a script to load an analytics DB from S3 logs using amazonka-s3
10:56 <qqwy> brynewards: Fancy!
10:56 <qqwy> maerwald: The good or the bad kind of proprietary software? :')
10:56 <brynedwards> :D
10:56 <mfukar> Coincidentally, parsing systemd files to discover dependency cycles (among other things)
10:57 _sras_ joined
10:58 augur joined
11:01 tomphp joined
11:02 Snircle joined
11:11 xanadu_ joined
11:11 Engen joined
11:12 <sbrg> i'm slumming it with clojurescript
11:12 <sbrg> i've found that clojurescript is the frontend solution i like the most so far, even though it's all dynamic.
11:13 <brynedwards> sbrg: What else have you tried?
11:13 seagreen_ joined
11:13 splanch joined
11:13 <sbrg> I've tried Haste, Elm, JS, PureScript, and fiddled a tiny bit with ghcjs
11:15 <sbrg> workflow-wise, there is nothing that even comes close. leinigen + figwheel is just awesome.
11:16 <mojjo> sbrg: interesting, are you using some react wrapper was well? such as reagent?
11:16 <sbrg> exactly, reagent.
11:16 <sbrg> I started with om, but reagent is just so much lighter, and doesn't really seem to sacrifice any features that I need.
11:17 <sbrg> clojurescript is seriously like it's made for react.
11:17 <mojjo> sbrg: yeah, same for me..
11:18 <mojjo> sbrg: defonce is also super nice, do you know if they have sth. like this in elm/purescript?
11:19 <sbrg> I also think it might be rather simple to work with servant's existing JS generation to generate clojurescript functions to consume the APIs.
11:20 ccapndave joined
11:20 <sbrg> mojjo: well, I'm not sure how that would apply to f.x. purescript.
11:20 <Axman6> sbrg: have you seen the hot reloading stuff for pux in purescript?
11:20 <Axman6> https://github.com/alexmingoia/pux-starter-app
11:21 <ccapndave> Axman6: Have you got much experience using Purescript?
11:21 <sbrg> Axman6: I'm not familiar with pux. But one of the reasons I moved from purescript to clojurescript was that I wasted hours trying to get some webpack solution working, and it was very frustrating. even then, the hot reloading wasn't even close to what figwheel is doing. I think one of PS' biggest issues is that they rely so heavily on existing JS tooling, because most of it is, well, utter shit to use IMO.
11:21 <* sbrg> checks link
11:22 tsmish joined
11:22 <Axman6> very little, I did the Yow! LambdaJam workshop last year and did some playing around wiht it, but that;s it. hasn't been relevant to my work
11:22 <ccapndave> Fair enough
11:22 <sbrg> okay, that looks pretty nice
11:22 <ccapndave> I've a got a very large app that I'm building in Elm which is lovely, but I feel like I'm starting to miss some more fancy type system stuff
11:22 <brynedwards> I've been looking at purescript tooling as well and came across this https://github.com/sectore/purescript-webpack-vanilla-hmr
11:23 <brynedwards> Worked OK I think
11:23 <Axman6> ccapndave: yeah IMO you hit the upper limit of Elm extremely quickly
11:23 <ccapndave> Since I was pretty new to FP at the start it was ideal, but now I pretty much understand it I crave more :)
11:23 <ccapndave> You can do everything in Elm still, but it gets a bit wordy
11:24 <Axman6> I feel Elm would be a great teaching tool, but wouldnt want to use it for anything even medium sized because there's very little room for abstraction
11:24 <ccapndave> Agreed
11:24 <ccapndave> On the other hand, its a billion times better than JS
11:24 <sbrg> There's a ton of features that clojurescript offers that I think are incredibly nice to have. For example, there are custom formatters that you can use for the console. You can start a clojurescript repl that is connected to the browser session, and look at and modify the application state directly in the repl and see the change have effect.
11:24 <Axman6> no type classes right?
11:24 tomphp joined
11:24 fakenerd_ joined
11:24 rcat joined
11:24 silver joined
11:24 <ccapndave> No type classes or higher typed kinds or module functors or anything like that
11:25 <ccapndave> No room for any advanced abstraction, basically
11:25 <Axman6> :'(
11:25 <sbrg> Axman6: that is precisely the reason I didn't stick with elm. I was trying to use it to write gimped haskell
11:25 <Axman6> map_list, map_tree, map_maybe, map_either ... no things :(
11:25 <ccapndave> Yeah, you have to approach with a mindset where you don't mind writing boilerplate
11:25 <Axman6> thanks*
11:25 <mojjo> sbrg: what do you mean by custom formatters?
11:25 <Axman6> ccapndave: i mind that a lot
11:26 <ccapndave> Is Purescript a practical alternative though?
11:26 <Axman6> yes
11:26 <ccapndave> Do people use it in production for proper apps?
11:26 <sbrg> mojjo: chrome supports custom formatters, and using them for your clojurescript project is just a matter of preloading some plugin in the leinigen config. then, when you log CLJS objects to the console, they are output in a rich format that you can interact with
11:26 <sbrg> navigate through objects, etc.
11:27 <Axman6> it's not as powerful as Haskell, but it's improving AFAIU
11:27 <ccapndave> I'd happily give it a go but I can't get down the line only to discover that PUX performance (or whatever) isn't good enough for a real app
11:27 coot joined
11:27 <brynedwards> ccapndave: I think this the biggest purescript app out there ATM https://github.com/slamdata/slamdata
11:28 B1ack1isted joined
11:28 <Axman6> "PureScript has been adopted successfully and put into production at several companies now..." - https://survivejs.com/blog/purescript-interview/
11:28 <Axman6> but no details
11:28 <ccapndave> Hmm
11:28 <ccapndave> I might wait a bit and revisit it in a few months
11:28 <Axman6> https://www.reddit.com/r/purescript/comments/5e4alh/ready_for_production_yet/ from a few months ago
11:29 <brynedwards> It is nice but just not that mature ecosystem-wise
11:29 xanadu_ joined
11:29 <sbrg> ccapndave: I was really looking hard for a Haskell-ish frontend language.. but I was surprised to find that while CLJS isn't typed, it kind of feels like it makes up for some of it because of its expressiveness.
11:29 <sbrg> the metaprogramming capabilities just work really well for this kind of stuff
11:29 <Axman6> we're talking about web apps, how mature do you need? JS land does fine with one week from announcement to maturity of new frameworks :P
11:30 <ccapndave> I must say this for Elm - its a great way to teach what monads are
11:30 <ccapndave> Cos it doesn't have them, are you are like "wouldn't it be nice if it had this" only to discover that you have invented a monad
11:30 <mojjo> sbrg: interesting, This might be better than solutions which inject some app state inspector into you webapp on development (forgetting the name of the cljs one now)... Have you checked out boot as replacement for leiningen...? For me this was a good thing to do.. It's tasks are more composable, but I don't know how lein has envolved recently
11:30 <taktoa> best thing about Elm is the popularity of (|>)
11:30 cultofmetatron joined
11:31 <ccapndave> Elixir and F# have it too I think
11:31 <Axman6> ccapndave: I don't think Elm is capable of teaching what monads really are about (it's an abstraction which you can't express in Elm, and therefore can't write code which is generic over any Monad)
11:31 <sbrg> mojjo: nope, I hadn't yet. I've seen people refer to it, but I honestly just started writing cljs two or three days ago.
11:31 <ccapndave> Axman6: Right - so, you find yourself wondering why you can't abstract various things into a common operation
11:32 <ccapndave> Axman6: The fact that you can't express it helps (at least helped me) to understand what it really was
11:32 <ccapndave> After lots of reading tutorials and not quite understanding what it was all about
11:32 <Axman6> yeah, I guess we use a simmilar idea in the Data61 course
11:33 <mojjo> sbrg: cljs lacks types but it has cljojure.spec, which you might want to check out as well.
11:33 <Axman6> we get people to write fmap and ap and sequence over and over again, then show them you only have to write it once
11:33 <ccapndave> Exactly
11:33 FjordPrefect joined
11:33 <qqwy> Yes, Elixir has it as well, but I believe in Elm you pipe the last operand, and in Elixir the first
11:34 <qqwy> (because Elixir does not have built-in partial function application)
11:34 <ccapndave> Yeah, Elm is the last
11:34 <* qqwy> just read back the last 50 lines
11:34 <qqwy> I am also struggling a lot with what kind of front-end tool to use now
11:34 <qqwy> I myself feel that Elm is a wonderful tool for new programmers/programmers from an imperative background to get started with functional programming
11:35 glitch_hat joined
11:35 <ccapndave> qqwy: I think it depends on what your are making
11:35 fakenerd joined
11:35 <ccapndave> Elm is easy and has fairly good tooling
11:35 <mojjo> sbrg: and spec can talk about types and values, which makes it quite expressive.
11:35 <qqwy> but when you're already used to something like e.g. Haskell, Clojure or maybe OCaml (although I don't know OCaml myself at all), it feels like you hit Elm's ceiling really quickly because of the difficulty to abstract things
11:35 <ccapndave> But no fancy abstractions
11:35 <qqwy> not having typeclasses, e.g.
11:36 <qqwy> i.e.*
11:36 <ccapndave> Right
11:36 <qqwy> I love the compiler and its nice error messages though :-)
11:37 <sbrg> mojjo: cheers! I will definitely
11:37 pavonia joined
11:37 <ccapndave> qqwy: Its definitely very possible to make large apps wth Elm; I have one in production now and it works great
11:37 <sbrg> I also read about some haskeller mentioning clojure.match or some such for pattern matching. i need to check that out as well.
11:37 <sbrg> core.match, it seem
11:38 <mojjo> sbrg: yeah, it's like recursive regular expressions operating on trees. amazing
11:38 <mojjo> core.match does not make you happy when coming from haskell ...
11:39 JeanCarloMachado joined
11:39 <qqwy> The thing is: When you know so many different nice tools, you want to work with all their good parts everywhere. (or in other words: You stumble upon a lot of 'language warts' you would not have seen before.)
11:40 <ccapndave> True enough
11:40 <ccapndave> Why doesn't someone make a new language with all the good bits from every language
11:40 <ccapndave> Situation: now there are 16 competing standards
11:40 <qqwy> Which always makes me feel a little bad, too =/ (as I have the utmost respect for the hard choices and years of work that the language creators' have poured in their projects)
11:41 <qqwy> Heh, very Astute x)
11:42 insitu joined
11:42 <qqwy> ccapndave: Very nice! I think I mostly need to bite through the hard skin to get to the juicy stuff inside. It's probably mostly my own prejudices that hold me back to learn more of Elm at this time
11:43 bjz joined
11:43 <ccapndave> You will pick it up in no time at all - its super easy
11:43 Jackoe joined
11:43 <ccapndave> Its basically Haskell + a built in architecture everyone is forced to use + |> - any fancy type stuff
11:44 <qqwy> I tried building a ratonal number library for Elm to learn it, because I did the same to learn Elixir back in the day. But then it turned out that it would be impossible to use these as normal numbers, which made me discard the idea alltogether
11:44 <ccapndave> Wrong kind of app
11:44 <qqwy> Yes, probably :-)
11:44 <ccapndave> You should try and learn it by building some UI stuff
11:44 <ccapndave> That's what its focussed towards
11:45 tobill joined
11:45 <ccapndave> Build a little game out of SVG, or a GUI for some backend
11:45 <qqwy> When I get back to the image gallery I was building as hobby project, I think I'll try to use it there (-:
11:45 <ccapndave> Yeah, perfect
11:45 petermw joined
11:45 <ccapndave> Any kind of generic library is going to be annoying in Elm
11:46 HoierM joined
11:46 _sg joined
11:46 xanadu_ joined
11:46 <qqwy> The thing is, a few days after I stopped working on that, I stumbled across this article: http://reasonablypolymorphic.com/blog/elm-is-wrong
11:46 bollu joined
11:46 <qqwy> Which is probably quite opinionated
11:46 <qqwy> and possibly outdated
11:47 <qqwy> but that made me reconsider elm at that time
11:47 <ccapndave> If you come at it expecting Haskell you will be disappointed
11:48 <qqwy> Yes, that's what happened with me. But then again, I have not yet been able to get PureScript working because it has so much extra settings/boilerplate-ish things going on that I was unable to overcome at the time.
11:50 <qqwy> That, too, might have changed in the meantime. On the other hand: I might be able to teach my coworkers Elm in reasonable time, but by no means a Haskell.
11:52 jluttine joined
11:53 petermw joined
11:54 <mojjo> May I ask a concrete hs question during this front end chat.. :-) ? I'm struggleing to write a Functor instance for a type `data T1 a = T1 (T2 a)` where fmap should map over values of type (T2 a). E.g: `fmap (\(T2 x) -> succ x) (T1 (T2 1))` I just get to run a 'deep' fmap which would be used: `fmap succ (T1 (T 2))`
11:55 asmyers joined
11:55 <opqdonut> mojjo: I'm not sure what your question is, but your first example should be `fmap (\(T2 x) -> succ (T2 x)) (T1 (T2 1))` to type
11:56 <opqdonut> aargh
11:56 byte512 joined
11:56 <opqdonut> `fmap (\(T2 x) -> T2 (succ x) (T1 (T2 1))`
11:56 <opqdonut> and now I messed up the parens
11:56 <opqdonut> `fmap (\(T2 x) -> T2 (succ x)) (T1 (T2 1))` there
11:56 <mojjo> opqdonut: yeah, I forgot this!
11:57 <opqdonut> and even that's only well typed if you define T1 like "data T1 a = T1 a"
11:58 <opqdonut> for "data T1 a = T1 (T2 a)", fmap can't see the T2 because the class is "class Functor f where fmap :: (a -> b) -> f a -> f b"
11:58 xcmw joined
11:59 oisdk joined
12:00 mmn80 joined
12:01 <mojjo> oh, right
12:02 <mojjo> when sticking to my data type it would be: fmap (\(T2 x) -> T2 (succ x)) (T1 1)
12:02 balor joined
12:02 <opqdonut> mojjo: no, it would be: fmap succ (T1 (T2 1))
12:03 <bollu> lens question: I want to filter on a sub-part of a structure, but I want to get the full structure. I'm currently doing: xs ^.. each . filtered (\x -> x ^. subLens > 2). Is there an alternate way?
12:04 Jay-Lenovo joined
12:04 <Jay-Lenovo> wasup
12:04 shesek joined
12:05 KentaKofot joined
12:05 sdothum joined
12:06 <KentaKofot> any fellow autist here?
12:06 MindlessDrone joined
12:06 <mojjo> opqdonut: the T2's are confusing... Real world question: data Point a = Point a a; data Path a = Path [Point a]; Now, I'm trying to do this: fmap f (Path [Point 1 2, Point 3 4]), whereas f is of type Point a -> Point a
12:07 <bollu> can I clean this up? I feel that there is some patern here that I am missing:
12:07 <codedmart> lyxia: Anyway I can bother for another thought/question? This is what I am using at the moment: https://gist.github.com/codedmart/eb5cbe831b0bf4336d43f2ca49039b68#file-fieldnames-hs, but I am wondering if it is possible to have it so when I use gFieldNames with the opts that I don't have to also `@Type` like here
12:07 <codedmart> https://gist.github.com/codedmart/eb5cbe831b0bf4336d43f2ca49039b68#file-artworkcontentplaceholder-hs-L7
12:07 <bollu> `xs ^.. each . filtered (\x -> x ^. subLens > 2)`
12:07 <opqdonut> mojjo: that's not valid
12:07 nomicflux joined
12:07 <codedmart> It feels redundant since I already an in an instance for that type.
12:07 <opqdonut> mojjo: f will have type a -> a
12:07 <codedmart> Not a huge deal just wondering if there is something I am missing.
12:07 <opqdonut> mojjo: you can of course write your own "mapPath :: (Point a -> Point a) -> Path a -> Path a
12:08 <opqdonut> (it would be valid if your type was "data Path a = Path [a]" of course)
12:08 bollu left
12:08 bollu joined
12:09 <mojjo> yeah, f has a -> a, but then the more concrete `Point a -> Point a` should fit as well
12:09 engil1 joined
12:09 <mojjo> but couldn't mapPath be implemented as functor?
12:10 <Logio> it's probably better to ask, whether Path is a functor
12:11 mmhat joined
12:11 <mojjo> Logio: yes, let's assume this is given
12:11 <Logio> can I map a Path a to Path b?
12:11 <Jay-Lenovo> I think alll of us KentaKofot
12:12 <Logio> mojjo, I don't think it is given until the compiler agrees
12:12 systadmin joined
12:13 <mojjo> Logio: I was about to say 'yes!', but maybe I'm wrong. here's the implementation I used: instance Functor Path where fmap f (Path pts) = Path $ f pts
12:13 <cocreature> mojjo: that doesn’t typecheck
12:14 <mojjo> arr, sorry.. wait
12:14 <cocreature> mojjo: f has type (a -> b) but pts has type [Point a]
12:14 <cocreature> so you can’t apply it directly
12:14 <cocreature> mojjo: try writing a Functor instance for Point first (if you haven’t done so already)
12:15 <mojjo> Here's the one for Point: instance Functor Point where fmap f (Point x y) = Point (f x) (f y)
12:15 <cocreature> that looks good!
12:15 <cocreature> so now use that to write the instance for Path
12:15 <opqdonut> mojjo: ah right, so if "f :: Point a -> Point a", then "fmap f :: Path (Point a) -> Path (Point a)"
12:16 msl09 joined
12:16 <opqdonut> mojjo: get it?
12:16 ziocroc joined
12:16 <opqdonut> values of "Path (Point a)" look like "Path [Point (Point 1 2) (Point 3 4)]"
12:17 <msl09> hello I want to start a new project in haskell and I would like to ask a few newbie questions
12:18 <cocreature> msl09: go ahead :)
12:18 <msl09> should I use cabal or stack for package installations?
12:19 <msl09> my haskell-fu is very rusty by the way
12:19 <cocreature> msl09: are you familiar with one of them already?
12:19 <msl09> cabal, but I have found it very painful to use at the time
12:19 <Magnap> Definitely stack
12:20 <cocreature> msl09: in that case give stack a shot. cabal is fine and I use both stack and cabal but I think atm it’s a bit easier to get started with stack
12:20 <msl09> oh nice
12:20 <hvr> unless when you hit problems w/ stack :-)
12:20 <msl09> lol
12:20 marr joined
12:20 <cocreature> there is a reason I use both :)
12:20 henriksod joined
12:20 aib joined
12:21 <hvr> cocreature: speculative computation? you throw both cabal & stack at a problem, and you use whoever succeeds first? ;)
12:21 <cocreature> heh
12:22 <msl09> what would be the difficulty level of making a program that periodically queries a postgres database and reports changes to a table via a REST query
12:22 <msl09> the project I'm trying to make is a very dumb slack bot
12:22 <hvr> msl09: depends on you :)
12:22 dawehner joined
12:22 <Rembane> msl09: pi
12:22 <Rembane> msl09: It's a good project.
12:23 <brynedwards> Does periodically have to be running all the time or is a cron job OK?
12:23 <cocreature> msl09: I don’t know a good measure for difficulty levels but if you know the basics of haskell but none of the postgres libraries & web libraries you can probably do it in an afternoon or so
12:23 <msl09> hmm, it could be implemented in either way brynedwards
12:23 <brynedwards> Well I would use postgresql-simple and http-conduit's simple module for the DB and REST bits
12:24 eacameron joined
12:24 revtintin joined
12:24 <msl09> yeah that's my level of understanding cocreature
12:24 <cocreature> http-conduit for a REST _backend_? that seems like a really weird choice and I’m not sure if that’s even possible
12:24 <* hvr> would have gone for servant
12:25 <cocreature> just use Spock or something like that if you’re new to haskell
12:25 typelevel joined
12:25 <cocreature> or scotty
12:25 <cocreature> I always forget which of those is the new one
12:25 <brynedwards> Sorry I thought he meant sending a request, not a backend
12:25 <liste> ^ scotty is the most noob-friendly
12:25 <typelevel> in :k I see a kind like `(k -> *)` what kind of Type is accepted here? I'm trying to understand the `k` part
12:25 <liste> Spock (like most others) utilize advanced concepts
12:26 <brynedwards> I've done some simple examples of Spock usage here https://github.com/brynedwards/spock-examples/tree/master/examples
12:26 <typelevel> I tried 'True and '[]
12:26 <cocreature> alright, then spocky and postgresql-simple will get you to your goal relatively easily
12:26 <mojjo> cocreature: The only way I get Path being a functor is: `instance Functor Path where fmap f (Path pts) = Path $ fmap (fmap f) pts` But i think this is not the one I'm looking for
12:26 <brynedwards> I can answer questions on basic Spock usage if you have any
12:26 <cocreature> mojjo: I’m pretty sure it is
12:26 riaqn joined
12:26 riaqn joined
12:26 <cocreature> mojjo: there is no other instance that satisfies the Functor laws :)
12:26 <geekosaur> what's accepted will depend on where/how it's used. often you'll find that it's intended to be parameterized by a lifted data constructor for a request type, or similar
12:27 <mojjo> cocreature: ok, this is already quite helpful to know ;-) !
12:27 xanadu_ joined
12:28 <cocreature> mojjo: in fact Functor instances are always unique in Haskell if they exist and you can even ask GHC to find them for you
12:28 <mojjo> my function f could be: f (Point x y) = Point 1 1, with the above I could not just do: fmap f myPath
12:28 cfricke joined
12:29 grayjoc joined
12:29 augur joined
12:29 <cocreature> mojjo: right but that’s because Functor requires that you modify the thing that your type is parametrized over. and your type is not parametrized over Point
12:30 <cocreature> mojjo: in this specific case you could do fmap (\x -> 1) myPath
12:30 <cocreature> but that will fail if you want different values for x and y
12:30 <msl09> brynedwards: oh I just want to make posts and gets from haskell to a remote server, not the other way around
12:30 <Akii> might as well try my luck here. I've a problem which I fail to express in types well enough to be satisfied. Wrote a rather lengthy description here as well as the bad types I used. http://lpaste.net/353855 Anyone got a hint how to eliminate some of the invalid states?
12:30 <cocreature> mojjo: there is nothing wrong in making a "mapPoint :: (Point a -> Point b) -> Path a -> Path b" function. Functor only captures one specific pattern
12:30 <cocreature> if that doesn’t fit then don’t use it :)
12:31 mada joined
12:31 <brynedwards> msl09: So you want a HTTP client? Then I'd look at http-conduit and Network.HTTP.Simple. There's a nice tutorial here https://haskell-lang.org/library/http-client
12:32 <mojjo> cocreature: Alright... ;-) But, could I also define Path parametrized over Point?
12:32 ragepandemic joined
12:32 <cocreature> mojjo: you could define "data Path a = Path [a]"
12:32 <msl09> oh nice
12:32 <msl09> thanks brynedwards
12:32 <cocreature> mojjo: and then if you have a "Path (Point a)" you can map points to something
12:32 <brynedwards> =)
12:33 hlundgren joined
12:33 <mojjo> cocreature: Yes, I see. I think this really solves my problem...
12:35 lep-delete joined
12:40 crumblebumble joined
12:41 takle joined
12:42 silentcontrib joined
12:43 revtintin joined
12:44 aib joined
12:45 yinn joined
12:51 raduom joined
12:51 splanch joined
12:53 xcmw joined
12:53 Unhammer joined
12:53 dotdat joined
12:55 CurryWurst joined
12:57 Fairy joined
12:57 eschnett joined
12:58 aarvar joined
12:59 arpl joined
12:59 guest2 joined
13:00 a3Dman joined
13:00 fakenerd joined
13:01 ziocroc joined
13:02 JuanDaugherty joined
13:03 ramzifu joined
13:04 guest2 left
13:04 JeanCarloMachado joined
13:05 guest2 joined
13:09 ThomasLocke joined
13:09 locallycompact joined
13:09 locallycompact joined
13:10 djellemah joined
13:10 armyriad joined
13:11 freusque joined
13:12 Gloomy joined
13:13 certainty joined
13:14 raduom joined
13:14 Wizek joined
13:18 insitu joined
13:19 phaji joined
13:20 fizruk joined
13:21 nilof joined
13:23 shayan_ joined
13:23 spatial joined
13:23 splanch joined
13:24 <spatial> http://lpaste.net/353843 This code updates and returns an array which is then use in subsequent lines. Any problem with the scope here ?
13:24 ChristopherBurg joined
13:25 spacedog82 joined
13:25 <spatial> Sorry. This code http://lpaste.net/353859
13:25 systadmin joined
13:25 <spatial> Any possibility of an updated array going out of scope ?
13:26 <spatial> And not used by following statements.
13:26 thirteen37 joined
13:26 <spatial> a,b.c.d and d' area arrays
13:26 thirteen37 left
13:28 ziocroc joined
13:28 aib joined
13:28 mrpavo joined
13:30 pi_____ joined
13:31 doodlehaus joined
13:31 dfeuer joined
13:31 mohsen_ joined
13:32 cultofmetatron joined
13:32 mson joined
13:33 <arpl> "If a tree falls in a forest and no one is around to hear it, does it make a sound?" A philosophical question ... and now a spatial observation.
13:34 splanch joined
13:34 laserpants joined
13:35 lukaramu_ joined
13:36 elfeck joined
13:37 cfricke joined
13:38 theelous3 joined
13:38 <elfeck> Hi, can someone tell me how I can apply a function f :: (a -> b) -> c to g :: a -> b -> c so I can write g f
13:38 ystael joined
13:41 MindlessDrone joined
13:41 dan_f joined
13:42 <geekosaur> that doesn't make any sense
13:42 <geekosaur> was the first one intended to be a tuple?
13:42 oish joined
13:43 e14 joined
13:44 <raduom> elfeck: works for me. (f, g, g f) :: ((a1 -> b2) -> c2, a -> b -> c, b1 -> c1)
13:45 <elfeck> raduom: yeah, sorry I confused myself
13:45 <elfeck> raduom: I got it now
13:46 nopf joined
13:47 halogenandtoast joined
13:48 freusque joined
13:48 mizu_no_oto_work joined
13:50 <laserpants> Trying to grok all this F-Algebra stuff; having a type data T = X | Y T T, and expressing this as data e.g. data U a = X | Y a a and then expressing the original type as a fixed point of U. That's the basic idea, or?
13:50 freusque joined
13:50 <mnoonan> laserpants: yup
13:51 <laserpants> So what is the main advantage? From a more operational point-of-view.
13:51 Gloomy joined
13:51 mmachenry joined
13:51 jao joined
13:52 Gloomy joined
13:52 <lyxia> you can compose U with other functors to insert stuff between nodes
13:52 <mnoonan> for me, I like it for making it nice to write various folds over your type
13:52 <byorgey> laserpants: (1) you can write things like folds and unfolds that are generic over any data type expressed as a fixpoint, instead of writing a fold and unfold for each new data types; (2) you can mix in things before taking a fixpoint, like having an annotation at each node
13:52 <mnoonan> e.g. in https://github.com/matt-noonan/FractalStream/blob/master/src/Lang/Expr.hs
13:52 Gloomy joined
13:53 <byorgey> laserpants: some more concrete examples can be found in http://citeseerx.ist.psu.edu/viewdoc/summary?doi=
13:53 xanadu_ joined
13:54 <laserpants> Thanks. I'll have a look at these links. I think I need to read some more code to see how this is used, but some libraries are a bit too advanced when you're just starting to grok these concepts.
13:55 jhrcek joined
13:57 skapazzo joined
13:59 augur joined
14:05 merijn joined
14:06 crobbins joined
14:06 themagician joined
14:07 jomg joined
14:07 dfeuer joined
14:08 orion joined
14:08 orion joined
14:10 alfredo joined
14:11 yellowj joined
14:11 dsh joined
14:11 cpennington joined
14:13 nycs joined
14:15 cultofmetatron joined
14:15 Einwq joined
14:16 tromp joined
14:17 Phlogistique joined
14:17 insitu joined
14:18 netheranthem joined
14:18 balor joined
14:19 <shapr> I think my coworkers think of my Haskell code the same way they think of APL code, 'so concise it's line noise'.
14:19 <c_wraith> Hmm. I usually don't think that about haskell, but definitely still do about APL.
14:20 <c_wraith> Though I've written line-noise Haskell
14:20 <Sornaensis> you can make haskell look as obnoxious as APL
14:20 <c_wraith> Usually by using applicative operators to go pointfree
14:20 <c_wraith> pure is one letter shorter than const!
14:21 sdrodge joined
14:24 asmyers joined
14:24 lep-delete joined
14:26 <shapr> On the other hand, some of them rewrite the compact bits in their own language of choice, it's a fun learning experience.
14:27 KentaKofot left
14:27 <shapr> I still don't understand clojure transducers, can someone explain them to me in terms of Haskell code?
14:27 fizruk joined
14:27 carlomagno1 joined
14:28 <c_wraith> You know, the things that make Haskell seem concise to me aren't even the line noise operators. They're useful library functions like traverse that other languages just don't have.
14:29 whaletechno joined
14:29 <c_wraith> I keep wanting to monkey-patch traverse (or at least traverse_) into Ruby projects I end up on.
14:29 Cheburan joined
14:29 <merijn> shapr: Basically a mix of Tekmo's fold package and pipes/conduit
14:31 Cheburan left
14:31 Cheburan joined
14:32 <shapr> c_wraith: I haven't been able to convince my coworkers that having map and fold available for every datatype is worthwhile.
14:32 Cheburan left
14:33 <shapr> c_wraith: have you written much APL?
14:33 <Sornaensis> c_wraith: yea after I learned haskell I noticed these patterns in other languages I use
14:33 augur joined
14:34 <phz_> hey, I have a stack template file
14:34 <phz_> is there a place I should put it so that I can use it with stack new --template?
14:35 <phz_> put it in*
14:35 <merijn> shapr: So, 3 years ago at a PLDI workshop on array programming someone presented their APL dialect, the compiler for it was written in the language itself. So he decided to show us how elegant APL is by displaying one of the compiler passes
14:35 <brynedwards> phz_: stack templates are taken from https://github.com/commercialhaskell/stack-templates
14:35 <merijn> shapr: It was just an 80 column, ~34 lines dense blob of unicode characters and everyone in the audience was like "wut?"
14:35 conal joined
14:36 <brynedwards> I think they're working on a way for people to include their own templates, but right now it doesn't look like an option
14:36 fendor joined
14:36 <phz_> I’m having a look at that
14:36 burtons joined
14:37 raduom joined
14:39 rekahsoft joined
14:39 spatial joined
14:40 thunderrd joined
14:40 <spatial> http://lpaste.net/353862 I see a non-exhaustive pattern error in choosebestmove. Which is missing ?
14:40 asmyers joined
14:40 <spatial> with EQ or without
14:42 C-16 joined
14:42 <merijn> spatial: What's the error? My guess is that the problem is in choosebestmove, not your case
14:42 e14 joined
14:42 <mnoonan> spatial: isn't it the choosebestmove a [] b c case?
14:42 <merijn> spatial: Since choosebestmove doesn't handle empty list
14:42 freusque joined
14:43 <_sras_> Is there anyway to read a full request body from a request in a Wai middleware but not consume it, so that application that follow can read it?
14:44 <spatial> Non-exhaustive patterns in case
14:44 robkennedy joined
14:45 Jay-Lenovo joined
14:46 Fairy joined
14:46 guampa joined
14:47 freeside joined
14:48 <merijn> spatial: Impossible to say what's missing without full error and line numbers
14:48 qthwyx joined
14:48 <merijn> (Well, not impossible, but I can't be arsed :p)
14:49 xanadu_ joined
14:49 <spatial> LInes correspond to case compare bestvalue1 xvalue of LT -> choosebestmove b xs xvalue x; GT -> return (bestmove1,b)
14:49 <spatial> Non-exhaustive patterns in case is exact exception. At runtime.
14:50 <merijn> spatial: That's not a full error message
14:51 <spatial> *** Exception: file.hs:(220,21)-(222,48): Non-exhaustive patterns in case
14:51 ThomasLocke joined
14:52 halogenandtoast joined
14:53 marsam joined
14:54 Gurkenglas_ joined
14:54 yinn joined
14:55 <c_wraith> shapr: I've written no APL, which would be why it all looks like line noise to me.
14:55 <brynedwards> Maybe put the full exception in lpaste
14:55 bodisiw joined
14:56 statusbot joined
14:56 raycoll joined
14:56 xkapastel joined
14:57 <c_wraith> _sras_: sure, but with the obvious caveat that it means keeping the entire request body in memory, which might be gigabytes
14:58 <_sras_> c_wraith: Yes.
14:58 <merijn> c_wraith: Unless he basically wants "tee" but for conduit? :)
14:59 <c_wraith> merijn: wai doesn't actually use conduit in its interface! :)
14:59 <c_wraith> _sras_: here's a poorly-documented secret: https://hackage.haskell.org/package/wai-
14:59 <c_wraith> _sras_: that's a record accessor
14:59 <c_wraith> _sras_: you can use it to *set* the requestBody on the Request value passed to the next action
15:00 iomonad joined
15:00 al-damiri joined
15:00 Nicop06 joined
15:01 <c_wraith> _sras_: so if you have the full request body sitting around, you can set that to just "return body"
15:01 <c_wraith> _sras_: far more complex options are available - it's just an IO action
15:01 armyriad joined
15:01 <_sras_> c_wraith: Yes.
15:02 linusaurus joined
15:03 cdg joined
15:04 danharaj joined
15:05 uglyfigurine joined
15:05 <c_wraith> err. I guess it has to be slightly more complex than "return body"
15:05 simukis__ joined
15:05 <c_wraith> It has to handle subsequent calls with return empty
15:06 <_sras_> I see....
15:06 epsilonhalbe joined
15:06 <_sras_> Where is it written?
15:06 <spatial> Is there a way to fit [] check in LT -> choosebestmove b xs xvalue x; GT -> return (bestmove1,b) ?
15:06 mhrh3 joined
15:06 <c_wraith> _sras_: where is what written?
15:07 <spatial> LT & []
15:07 <lyxia> spatial: What does that mean? Can you paste a more complete part of your code?
15:07 <_sras_> c_wraith: I mean, is there a spec or somethign that says it should be the behavior...
15:07 <spatial> http://lpaste.net/353862 Non-exhaustive patterns in case
15:07 amargherio joined
15:07 igniting joined
15:08 <c_wraith> _sras_: just in the documentation that I linked to before
15:08 Yuras joined
15:08 takle joined
15:09 funkshun joined
15:09 <lyxia> spatial: it's not clear from that snippet alone what the error could be
15:10 <_sras_> c_wraith: ok. So not doing this. Keeping the entire req body or reading it strictly seems quite dangerous...
15:10 <c_wraith> _sras_: well, in terms of being open to a DoS attack, yes.
15:10 <spatial> http://lpaste.net/353863 Function
15:11 bravespear|2 joined
15:11 Ranhir joined
15:11 <c_wraith> _sras_: but you can certainly implement the logic correctly if you trust all incoming requests (or verify that they're ok in some way before storing everything)
15:11 <lyxia> spatial: your exception message only spans 3 lines, did you make sure to save your code and recompile it?
15:11 <_sras_> c_wraith: Yes..
15:11 <lyxia> spatial: well in that snippet you're clearly missing a case at the end
15:11 <lyxia> spatial: whereas the snippet you first pasted had all three LT/GT/EQ
15:11 oisdk joined
15:12 <spatial> -- EQ -> choosebestmove b xs xvalue x; Didn't see any change
15:13 silentcontrib_ joined
15:13 chenyu joined
15:13 mhrh3 left
15:13 <lyxia> If it's commented out it's not going to be compiled...
15:13 <spatial> Are there runtime exceptions in haskell ?
15:14 <lyxia> you just encountered one
15:14 funkshun joined
15:14 <chenyu> spatial: Yes, I think. From IO operations.
15:15 <c_wraith> Not just IO operations. you can get a runtime exception from anything
15:15 muesli4_ joined
15:15 <c_wraith> It's just that if they don't indicate library user error, they should be counted as bugs.
15:15 <c_wraith> > case Just () of Nothing -> ()
15:15 <lambdabot> *Exception: <interactive>:(3,1)-(4,22): Non-exhaustive patterns in case
15:16 <c_wraith> runtime exception from a pattern match. :)
15:16 silentcontrib joined
15:16 <ventonegro> > head []
15:16 <lambdabot> *Exception: Prelude.head: empty list
15:17 CACAleedhock joined
15:18 roconnor joined
15:19 Jackoe joined
15:21 cinimod joined
15:21 coltfred joined
15:21 timini joined
15:22 <timini> hi im trying to learn me a functionional proramming style
15:22 <timini> im actually using javascript
15:22 lithie joined
15:22 <timini> but my question is more about functional programming than haskel
15:23 <funkshun> timini: alright
15:24 osa1 joined
15:24 osa1 joined
15:24 <spatial> LT -> if (null xs) then return(0,a) else choosebestmove b xs xvalue x; Tried this. No
15:25 <shapr> timini: what's your question?
15:25 cereal_killer_ joined
15:26 sepp2k joined
15:26 <timini> so i have a function which retuns a list - (...args) => [...args] - i want to curry that function so that i can append to the list by calling the curried function multiple times -
15:27 <timini> curry((...args) => [...args])(3)([1,2]) = [1,2,3]
15:27 bweston92 joined
15:27 <c_wraith> that isn't really currying.
15:28 <c_wraith> It's just using a higher-order function that modifies arguments to another function
15:28 <funkshun> timini: you would be better off with a more typical append function
15:28 marfoldi joined
15:28 <funkshun> timini: as c_wraith said
15:28 <timini> cool - this is exactly why i asked you guys :)
15:29 <timini> i dont really know what currying is
15:29 <funkshun> timini: come to haskell, then you can curry all you want :)
15:29 <timini> but i like saying it
15:29 <shapr> timini: it's spicy functions
15:29 <shapr> :t curry
15:29 <lambdabot> ((a, b) -> c) -> a -> b -> c
15:29 <marvin2> currying is taking a function that takes multiple arguments and returning a function that takes one argument and returns a function that takes the rest of the arguments
15:30 <shapr> :t uncurry
15:30 <lambdabot> (a -> b -> c) -> (a, b) -> c
15:30 <c_wraith> timini: your case *is* an example of using ideas from functional programming! Just not currying. :)
15:30 <timini> funkshun, you mean array.append?
15:31 fizruk joined
15:31 <brynedwards> There's an example of currying in JS here http://ramdajs.com/docs/#curry
15:31 <c_wraith> Unfortunately, this is a place where javascript is very non-functional
15:31 <c_wraith> Because you have two options on how to proceed - you either update the array, or create a new one.
15:31 <funkshun> timini: frankly, im not familiar with js, but the built in append method is likely heavily optimized
15:31 <c_wraith> Both are wrong in some cases
15:31 <funkshun> timini: it would be a good choice most likely
15:32 <timini> ok well i guess my question should be - something((...args) => [...args])(3)([1,2]) = [1,2,3] - is there a name for the function something in FP?
15:32 <c_wraith> In some cases, the caller will be shocked if the array they passed in was modified. In other cases, the caller will be shocked if the array they passed in wasn't modified.
15:33 <c_wraith> This is the downside to default mutability. You can't quickly tell if something is depending on it, or depending on the lack of it
15:33 <funkshun> hence, why we're here at #haskell :)
15:34 cdg_ joined
15:36 _sg joined
15:36 <spatial> if (null xs ) then case compare bestvalue1 xvalue of LT -> if (null xs) then return(0,a) else choosebestmove b xs xvalue x; GT -> return (bestmove1,b) else return(0,a)
15:36 <c_wraith> yeah, when the default is immutable and you see something mutable being used, you have a pretty good idea it's going to get mutated. :)
15:36 <spatial> This fixed the runtime exception.
15:37 asmyers joined
15:38 mbuf joined
15:38 dram_phone joined
15:38 jmelesky joined
15:39 sword865 joined
15:39 arpl left
15:39 wraithm joined
15:41 silentcontrib_ joined
15:42 trism joined
15:43 rnaga joined
15:43 magneticduck joined
15:46 <rnaga> Any good online resource where I can find haskell code to read? Want to get a feel for the language
15:46 sleffy joined
15:47 <merijn> rnaga: Without prior knowledge? Or did you already learn the syntax and want to see more "real world" usage?
15:48 Sonolin joined
15:48 <msl09> I'm running into some kind of problem installing postgresql-simple with stack
15:48 <msl09> http://lpaste.net/353864
15:49 <rnaga> I have an idea of the syntax, but I'm still quite new to haskell. Want to go through some "real world" code
15:49 Vibor joined
15:49 <brynedwards> msl09: line 42 "Perhaps you need to add ‘postgresql-simple’ to the build-depends in your .cabal file."
15:50 <merijn> rnaga: Xmonad and pandoc?
15:50 <merijn> rnaga: XMonad is actually shockingly small :)
15:50 <merijn> Like <2.5k LOC iirc
15:50 infandum joined
15:50 ramzifu joined
15:50 <merijn> pandoc is pretty big, but pretty understandable, I think my first haskell contribution was patching the rST parser of pandoc :)
15:51 <shapr> rnaga: My coworkers most commonly use shellcheck, pandoc, and xmonad.
15:51 <merijn> Both should be fairly "basic" haskell, not too many extensions
15:51 <funkshun> rnaga: seconded for xmonad
15:51 <* dram_phone> is wasting one night on ghcjs
15:51 <infandum> What's a quick way to zip over a list of lists? i.e. someZip [1..] [[5,4,6],[1,234]] == [[(1,5), (2,4), (3,6)],[(4,1),(5,234)]]
15:51 <rnaga> Xmonad is awesome! Thanks!
15:51 <merijn> There's also several blogposts explaining xmonad's design :)
15:52 urodna joined
15:52 <rnaga> I'll definitely take a look at pandoc and shellcheck
15:52 <merijn> rnaga: https://xmonad.wordpress.com/2009/09/09/the-design-and-implementation-of-xmonad/
15:52 <shapr> infandum: I don't understand?
15:52 <lpaste_> msl09 pasted “haskellhal.cabal” at http://lpaste.net/4473648252025044992
15:52 <geekosaur> and a few people who mostly grok it as well :p
15:53 <msl09> ohhhh
15:53 <msl09> there is a build-depends for each source directory
15:53 <msl09> http://lpaste.net/4473648252025044992
15:53 <infandum> shapr: So zipping a list with another list, but that second list is a list of lists. I don't want the first level zipped, I want the inner level zipped
15:53 <dschoepe> infandum: Something like map (zip [1..]) [[5, 4, 6], [1, 2, 3]]?
15:53 <infandum> dschoepe: No, because it would start back at 1 for each sublist
15:53 <dschoepe> > map (zip [1..]) [[5, 4, 6], [1, 2, 3]]
15:53 <lambdabot> [[(1,5),(2,4),(3,6)],[(1,1),(2,2),(3,3)]]
15:53 robotroll joined
15:54 <merijn> :t \ls -> [ zip [1..] l | l <- ls ]
15:54 <lambdabot> (Enum a, Num a) => [[b]] -> [[(a, b)]]
15:54 <Vibor> Hi, I was trying to run an example about sql database, tried import Database.Sqlite in ghci, but it was not found. I tried cabal install Database.Sqlite, but no luck, so I'm stuck and how should I proceed ? thanks !
15:54 <merijn> oh, wait I see the problem
15:54 <merijn> Vibor: Which package is that from?
15:54 <geekosaur> cabal-install (nor stack for that matter) wants a package name not a module name
15:54 <merijn> Vibor: Cabal installs packages, not modules
15:54 <geekosaur> (it'd be nice if it dealt with that...)
15:54 <msl09> I have put the dependency to postgresql-simple on the src directory and I tried using it on the app directory
15:54 <Vibor> So what should I do?
15:55 <funkshun> Vibor: find the package name and install with cabal
15:55 <* geekosaur> generally looks up the module on hayoo to get the package
15:55 <infandum> [ zip [1..] [[1,2,3],[4,5]] | l <- [[1,2,3],[4,5]] ]
15:55 <geekosaur> ?where hayoo
15:55 <lambdabot> http://hayoo.fh-wedel.de/ -- See also Hoogle: http://haskell.org/hoogle http://fpcomplete.com/hoogle
15:55 <dram_phone> > [[5,4,6],[1,234]] & unsafePartsOf (each . each) %~ zip [1..]
15:55 <Vibor> The example is located here : https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/Simple%20examples#sqlite-database
15:55 <lambdabot> [[(1,5),(2,4),(3,6)],[(4,1),(5,234)]]
15:55 <dram_phone> I saw partsOf here: https://redd.it/610sa1
15:55 <dram_phone> and it's unsafe because:
15:55 <infandum> yes!
15:55 <infandum> I knew it was probably in lens
15:55 <dram_phone> > > [[5,4,6],[1,234]] & unsafePartsOf (each . each) %~ zip [1..2]
15:55 <lambdabot> <hint>:1:1: error: parse error on input ‘>’
15:56 <dram_phone> > [[5,4,6],[1,234]] & unsafePartsOf (each . each) %~ zip [1..2]
15:56 <lambdabot> [[(1,5),(2,4),*Exception: unsafePartsOf': not enough elements were supplied
15:56 <dram_phone> *Not* the syntax error :(
15:56 rnaga left
15:56 <msl09> ok the build is advancing now sorry brynedwards
15:56 <infandum> It was right the first time...
15:56 <Vibor> Got it thanks ! geekosaur merijn
15:57 <dram_phone> infandum: I changed to [1..2] to illustrate why it's unsafe
15:57 danharaj joined
15:57 <infandum> dram_phone: Ah. Thank you!
15:57 owiecc joined
15:57 <dram_phone> it was because if you don't provide enough values back it's an error
15:58 <dram_phone> but [1..] is infinite so it must be enough :P
15:58 <infandum> dram_phone: Can you remind me of the word names for those functions rather than the symbols?
15:58 umib0zu joined
15:58 <dram_phone> :t (&)
15:58 <lambdabot> a -> (a -> b) -> b
15:58 <geekosaur> the annoying thing about this is that the exported modules of each package should be listed in the index db, so it *should* be able to resolve those itself
15:58 <infandum> :t %~
15:58 <geekosaur> (yes, I know, patches welcomed...)
15:58 <lambdabot> error: parse error on input ‘%~’
15:58 <infandum> :t (%~)
15:58 <lambdabot> ASetter s t a b -> (a -> b) -> s -> t
15:58 <dram_phone> :t over
15:58 <infandum> ah over
15:58 <lambdabot> ASetter s t a b -> (a -> b) -> s -> t
15:58 <infandum> awesome
15:59 <dram_phone> infandum: See, types are more useful here...
15:59 <dram_phone> Not everywhere in lens, though
15:59 uglyfigurine joined
16:00 fendor joined
16:00 mmachenry joined
16:00 <dram_phone> infandum: actually, see this
16:00 <brynedwards> np :)
16:00 <dram_phone> :t unsafePartsOf
16:00 <lambdabot> Functor f => Traversing (->) f s t a b -> LensLike f s t [a] [b]
16:00 <merijn> Anyone here that can tell me what the latex symbol for approximate values is, as in ~20% ?
16:01 <dram_phone> \approx maybe?
16:01 <merijn> dram_phone: That's the wavy =
16:01 uglyfigurine joined
16:02 <dram_phone> oops
16:02 <cocreature> merijn: \tilde?
16:02 <cocreature> hm no I think I’m remembering incorrectly
16:02 <dram_phone> http://detexify.kirelabs.org/classify.html says \sim
16:02 <merijn> ah
16:03 <merijn> \sim looks right
16:03 <infandum> \sim
16:04 <Magnap> Do note that \sim is a relation symbol
16:04 <dram_phone> did they, like, greatly improve the speed of compilation in GHC8?
16:04 <Magnap> So it might not behave the way you want it to
16:05 <merijn> Magnap: I'm using it in text anyway, as in "we get ~20% improvement"
16:05 <Magnap> In text mode you can use \textasciitilde
16:05 <Magnap> ^
16:05 iross joined
16:05 nrmn joined
16:06 <Magnap> See this TeX StackExchange answer: http://tex.stackexchange.com/a/55723/9350
16:08 silentcontrib joined
16:08 Gurkenglas joined
16:09 <nrmn> Is there any way to find the function definition using ghci? I know :i shows where the function is defined
16:09 <glguy> That's the way
16:10 ChaiTRex joined
16:10 tom7942 joined
16:10 <nrmn> <glguy> Is there any way to open the file from within ghci?
16:11 <brynedwards> ghci doesn't really do that sort of thing, it'd be more of an IDE feature
16:11 <glguy> nrmn: No. In general there isn't any source code to edit for installed libraries
16:11 <glguy> You can use :edit to open your $EDITOR in the current module if that module is locally defined
16:12 dpren joined
16:12 <nrmn> Thanks!
16:12 <glguy> nrmn: The easiest way to get to source code is to click the Source links in haddock generated documentation
16:13 raichoo joined
16:14 fendor joined
16:14 harwiltz joined
16:14 eazar001 joined
16:15 mson joined
16:17 <harwiltz> Hello all. I'm trying to implement an identity monad (just a monad that does nothing), and I'm having some trouble using it in do notation (I've already successfully done operations with bind). Basically I have data Identity a = Identity a deriving (Show), and then I have some functions, times2 :: (Num a) => a -> Identity a and addIdentities :: (Num a) => Identity a -> Identity a -> Identity a. When I try
16:17 <harwiltz> let test = do {x <- times2 1; y <- times2 2; addIdentities x y;}, I get compiler errors
16:18 hackebeilchen joined
16:18 <glguy> harwiltz: x and y don't have Identity types
16:18 <harwiltz> First error is "No instance for (Num (Identity b0)) arising from the use of times2
16:18 <merijn> harwiltz: Well, it'd help to put the full error on lpaste :)
16:18 <harwiltz> glguy: they don't?
16:18 <glguy> harwiltz: so you can't apply addIdentities to x or y
16:18 <harwiltz> times2 outputs a Identity a though
16:18 owiecc joined
16:18 <glguy> harwiltz: The point of do-notation is that given "times2 1 :: Identity Int"
16:18 <glguy> then "x :: Int"
16:18 <merijn> harwiltz: Hint: rewrite this code using >>= instead of do notation :)
16:18 deepfire joined
16:18 <harwiltz> glguy: so I should be able to replace that line with return (x+y)?
16:19 <glguy> harwiltz: sure
16:19 genq joined
16:19 <harwiltz> merijn: I was thinking about something like that, but I don't want to use >>= in this implementation
16:19 <harwiltz> glguy: I think that gave me an error as well, Ill try again
16:19 <harwiltz> glguy: Oh, nvm, it compiled
16:19 <harwiltz> Haha
16:19 <merijn> harwiltz: My recommendation for beginners is *always* use >>= until you're comfortable doing that, then start using do notation. This helps understanding what the do notation actually does
16:20 <merijn> harwiltz: See also: https://en.wikibooks.org/wiki/Haskell/do_notation
16:20 <harwiltz> But then what happens, for example, if I was using Maybe instead of Identity, and x <- f returns Nothing? What would x store?
16:20 <harwiltz> merijn: Yeah, I got a little over-zealous ;)
16:20 <harwiltz> merijn: I'm gonna take that advice
16:20 <dram_phone> harwiltz: Write that in terms of >>= first
16:21 <harwiltz> dram_phone: I actually did, I guess I just got confused somewhere
16:21 <merijn> harwiltz: Well, rewrite that one to >>= too and you'll see what happens if it's Nothing :)
16:21 <harwiltz> dram_phone: Oh you mean the maybe one
16:21 <dram_phone> It's f >>= \x -> <the rest of the program>
16:21 <dram_phone> I did this for you
16:21 <dram_phone> And what if f is Nothing?
16:21 Swizec_ joined
16:21 cpennington joined
16:21 <harwiltz> dram_phone: Oh right... its just nothing
16:21 <dram_phone> Nothing >>= f = ...?
16:21 <dram_phone> bingo
16:21 <harwiltz> I see. Thanks
16:22 moongazer joined
16:23 mmachenry joined
16:23 <dram_phone> Because Haskell functions inherently don't 'do' things
16:23 <dram_phone> harwiltz: it really helps to think about Haskell programs in terms of the result they calculate, and not what it 'does'.
16:23 <dram_phone> (That's a pun over there)
16:23 <harwiltz> Hahahaha, will do
16:24 umib0zu joined
16:24 <dram_phone> I know it's hard :P
16:24 <harwiltz> How can I go about making a Monoid instance of Identity? Is that even possible?
16:24 <harwiltz> Since there's no empty element I guess
16:24 SpinTensor joined
16:24 <harwiltz> It must be impossible
16:25 <dram_phone> You said monoid, not monad, right?
16:25 <harwiltz> Yeah, monoid
16:25 <geekosaur> there's a Semigroup for that? :p
16:25 <harwiltz> I already made the monad :)
16:26 <merijn> harwiltz: You can do "instance Monoid a => Monoid (Identity a)"
16:26 <harwiltz> merijn: What does that mean?
16:27 <harwiltz> Ohhhh I see
16:27 <harwiltz> Could I also do "instance Monoid Int => Monoid (Identity Int)"?
16:27 <geekosaur> aside from ghc whining about the lack of type variables
16:27 <harwiltz> Or actually "instance Monoid Num => Monoid (Identity Num)"?
16:27 <geekosaur> no
16:27 <harwiltz> Aw, alright
16:27 <geekosaur> Num is a typeclass, not a type
16:28 <harwiltz> Thats what I was worried about
16:28 <geekosaur> but you can include Monoid and Num in the context for a tyvar
16:28 <geekosaur> (it'd be redundant here since Int is known to have a Monoid instance)
16:28 <harwiltz> But still, can I actually create a Monoid instance of Identity if it doesn't have a generic empty element?
16:28 <dram_phone> nope
16:28 <geekosaur> no.
16:28 <harwiltz> Ok, right]
16:29 <dram_phone> if you could you can just build something out of nothing
16:29 <harwiltz> Right
16:29 <geekosaur> but Semigroup is a monoid without the empty element
16:29 <harwiltz> Do you guys have any ideas of other simple monads I can implement? I'm thinking about making a monad that stores a 'state' of whether its parameter is even or odd
16:30 <harwiltz> like data Parity Int = Odd Int | Even Int
16:30 <harwiltz> Er
16:30 <harwiltz> data Parity = Odd Int | Even Int
16:30 <merijn> harwiltz: Well, simply implementing State and StateT is a good exercise and helps understand monad transformers
16:30 <harwiltz> merijn: Oh, that's true
16:31 <merijn> harwiltz: https://gist.github.com/merijn/098106abd45c940dab09
16:31 <harwiltz> I don't have a clue what a monad transformer is yet though ;)
16:31 <merijn> harwiltz: Honestly, just filling in the blanks here should answer that question :p
16:31 <Sornaensis> transformers, monads in disguise
16:32 silentcontrib_ joined
16:32 B1ack1isted joined
16:32 B1ack1isted joined
16:32 <harwiltz> merijn: Thanks!
16:32 tom7942 joined
16:32 schell joined
16:32 <harwiltz> I didn't know you could define (>>=) or (<*>) as undefined, that's nice
16:32 <merijn> harwiltz: the idea behind monad transformers that you use a transformer to, well, transform an existing monad, adding additional behaviour to >>=
16:32 <harwiltz> Oh wow
16:32 <merijn> harwiltz: You can actually do something much nicer and GHC these days
16:32 danharaj joined
16:32 <dram_phone> > undefined -- That's what undefined do
16:32 <lambdabot> *Exception: Prelude.undefined
16:33 <Sornaensis> :t undefined
16:33 <lambdabot> a
16:33 <harwiltz> Oh, haha
16:33 <merijn> harwiltz: You can use _ or other names starting with _
16:33 <merijn> And GHC will still typecheck your code, but produce an error at the end
16:33 <merijn> So unlike with undefined you can't forget to remove your _
16:33 <merijn> :t map _ [1..10]
16:33 <harwiltz> Oh... alright. So basically whenever I wanna make a monad I actually do have to make the applicative as well
16:33 <lambdabot> error:
16:33 <lambdabot> • Found hole: _ :: Integer -> b
16:33 <lambdabot> Where: ‘b’ is a rigid type variable bound by
16:34 <merijn> harwiltz: Well, in reality not really
16:34 <harwiltz> merijn: How can I avoid it?
16:34 <merijn> harwiltz: You can only write Monad and then do "pure = return; (<*>) = ap"
16:34 <harwiltz> Oh, makes sense actually, that's nice
16:34 <merijn> harwiltz: But it's easier to do all instances by hand in this example for educational purposes
16:35 <merijn> harwiltz: Are you familiar with "default implementations" ala only needing to define either == or /= ?
16:35 <harwiltz> No
16:35 <harwiltz> merijn: I actually just got to class, I gotta leave for now. Thanks for the help!
16:38 nahra joined
16:39 Itkovian joined
16:41 gienah_ joined
16:42 e14 joined
16:42 thunderrd joined
16:44 ragepandemic joined
16:44 araujo joined
16:44 araujo joined
16:44 blrama joined
16:45 Jacoby6000_ joined
16:47 insitu joined
16:47 sleffy joined
16:50 ramana_ joined
16:51 oisdk joined
16:51 eazar001 joined
16:53 locallycompact joined
16:53 MitchellSalad joined
16:53 eazar001 joined
16:53 uglyfigurine joined
16:55 marsam joined
16:58 <heath> what is this iterateFB function? https://hackage.haskell.org/package/base-
16:58 marfoldi joined
16:59 <heath> maybe if i knew what FB stood for, that would help
16:59 <geekosaur> fold/build
16:59 <ChaiTRex> heath: I think it's used behind the scenes for fusion.
16:59 <geekosaur> that, pretty much, yes
17:00 <heath> perfect, thanks you two
17:00 <geekosaur> if you rewrite stuff to fold/build form, it's easier for the compiler to detect opportunities to fuse stuff away
17:00 <ski> `iterateFB c f xs = foldr c undefined (iterate f xs)', i think
17:02 replay joined
17:02 chrissl joined
17:05 t0by joined
17:05 t0by joined
17:07 evil-t0by joined
17:08 MP2E joined
17:08 raichoo joined
17:09 cyborg-one joined
17:11 ramzifu joined
17:12 shafox joined
17:14 shookees joined
17:14 shookees joined
17:15 pera joined
17:15 juhp__ joined
17:20 asmyers joined
17:23 skapazzo joined
17:24 phyrex1an joined
17:25 fakenerd joined
17:25 Bish joined
17:26 Discovery joined
17:26 Swizec joined
17:27 jathan joined
17:28 ikke joined
17:28 zero_byte joined
17:29 cpennington joined
17:29 juhp___ joined
17:30 louispan joined
17:31 fakenerd joined
17:32 {emptyset} joined
17:33 mgu joined
17:36 insitu joined
17:36 marsam joined
17:39 bennofs joined
17:42 ludat joined
17:44 kritzcreek_ joined
17:45 Noldorin joined
17:47 Unhammer joined
17:48 dfeuer joined
17:50 miniBill joined
17:52 robotroll joined
17:55 ragepandemic joined
17:55 gillesmajor joined
17:56 lambdafan joined
17:56 <lpaste_> lambdafan pasted “sum of two squares error” at http://lpaste.net/1472901292622872576
17:58 connrs joined
18:01 cpennington joined
18:02 <ClaudiusMaximus> lambdabot: +/- 1, +/- 3 gives 4 possibilities total
18:03 <ClaudiusMaximus> oops, lambdafan
18:04 `^_^v joined
18:05 <lambdabot> ClaudiusMaximus: no worries mate!
18:05 MP2E joined
18:05 <ClaudiusMaximus> though the wiki page says that different orders should be counted too? so that should give 8 as the answer...
18:07 MarioBranco joined
18:12 ertesx joined
18:13 raycoll joined
18:14 fendor joined
18:14 Wizek joined
18:15 hybrid joined
18:16 limlinlo joined
18:17 mmn80 joined
18:18 tromp joined
18:19 e14 joined
18:19 sellout- joined
18:19 raycoll joined
18:19 <byorgey> lambdafan, ClaudiusMaximus: indeed, it should be 8. The discrepancy is that you are not counting 1 as a divisor of anything. line 24 should be ... divisors' 1 k
18:20 ragepandemic joined
18:23 eugenez joined
18:25 mson joined
18:26 wraithm joined
18:26 Jesin joined
18:26 BlueRavenGT joined
18:28 Iluvala joined
18:28 <Iluvala> hello
18:29 <Iluvala> i've been looking for a question...
18:29 <Iluvala> can anybody help me?
18:29 <eugenez> Hello, friends! Say, how do I check whether Data.Map.lookup return Just x or Nothing and branch based on that? I wanted to use guards like that: func x; | Map.lookup x mymap == (Just _) = some_output, and so on but haskell complains of a new found hole...
18:30 <pavonia> eugenez: Usa a case expression: case lookup x mymap of { Just x -> ...; ... }
18:30 Lord_of_Life joined
18:31 <pavonia> :t maybe
18:31 <lambdabot> b -> (a -> b) -> Maybe a -> b
18:31 tomphp joined
18:31 <pavonia> ^ that's another option
18:31 <geekosaur> if you want to do it with guards, you can use a pattern guard
18:32 Scip joined
18:32 <eugenez> Thank you friends!
18:32 <eugenez> 1 ann n │Loaded GHCi configuration from /tmp/ghci10719/ghci-script
18:32 scriptor joined
18:33 <eugenez> oops sorry :0
18:33 scriptor left
18:33 Yuras joined
18:33 halogenandtoast joined
18:33 <geekosaur> | Just _ <- Map.lookup x mymap
18:34 <geekosaur> myy require PatternGuards extension, I don't recall if that made haskell2010
18:34 <monochrom> Iluvala: what question are you looking for?
18:34 <monochrom> Pattern guards made it into Haskell 2010.
18:35 marsam joined
18:39 dequbed joined
18:40 m1dnight_ joined
18:41 <Iluvala> so, i want to know how is the traduction of Haskell on every platform
18:42 <monochrom> What is traduction?
18:42 <Iluvala> if it's fast or slow
18:43 <Iluvala> in compiling
18:43 alexbiehl_ joined
18:44 raichoo joined
18:44 <davean> is traduction a word from another language?
18:44 lokydor joined
18:44 <davean> I can't even figure out what you might have meant to put there if its english
18:44 <davean> and fast-or-slow begs for a definition
18:44 <Iluvala> mmmm ok
18:44 <davean> and the answer is "it varies"?
18:44 JeanCarloMachado joined
18:44 guest2 joined
18:44 <Iluvala> i can say "translation"
18:45 <davean> your optimization levels, the code complexity (on some sometimes unexpected axis), etc
18:45 <Iluvala> sorry, English it's not my native language ;|
18:46 <davean> In practice the answer is probably "slow" for many people, though you can choose "fast" with certain downsides, but "slow" is relative
18:46 silentcontrib joined
18:46 <Iluvala> yeh
18:47 csaurus joined
18:47 <geekosaur> English cognate "transduce", compare Italian "traducere"
18:47 yinn joined
18:47 <Iluvala> but how do you think is on compiling? speaking of mac, windows or linux
18:47 peterbecich joined
18:48 <davean> Iluvala: the platform is irrelivent?
18:48 <davean> Also, I'm having a REAL hard time guessing your meanings
18:48 <geekosaur> ^
18:48 Gohla1 joined
18:48 <Iluvala> :(
18:48 <Iluvala> sorry
18:49 <davean> Its ok, I'm guess really guessing as to your question when I answer
18:49 <davean> *just really guessing
18:49 <shapr> Iluvala: yeah, how do you think *what* is on compiling? Do you want which platform compiles faster?
18:49 <Iluvala> it's a confused question that i can't do
18:49 mohsen_ joined
18:49 <geekosaur> some people complain that ghc is slow (possibly compared to earlier versions) but to me it's pretty fast unless template haskell is involved
18:49 <geekosaur> ...much like c++ compilers are fast unless you have lots of templates
18:49 fuzzy_id joined
18:50 <geekosaur> (otoh the standard template library is full of ... templates)
18:50 wraithm joined
18:50 <cocreature> geekosaur: who would have thought that the standard template library uses templates :)
18:50 <Iluvala> jaja
18:51 <Iluvala> thanks guys
18:51 <davean> Iluvala: "it probably won't take more then a minute"
18:51 <davean> (But you haven't given nearly enough information for a meaningful answer)
18:52 <davean> "It might take less then a second"
18:52 splanch joined
18:52 <davean> "In practice, Haskell code takes from milliseconds to hours to compile"
18:52 <Iluvala> no, i mean thanks for yours thoughts
18:52 <Iluvala> it's gonna be ok to answer my homework
18:53 <davean> (I'm actually confused as to why you asked about the operating system portion)
18:53 freeside joined
18:53 <davean> the only part that varies by operating system is the linking step and OS calling convention
18:53 m1dnight_ joined
18:53 <davean> which is really quite irrelivent
18:53 <davean> and that doesn't vary by Mac/Linux much
18:53 <davean> though the toolchain you refer to can
18:54 <davean> The compiler you use matters, but most people use GHC
18:54 <Iluvala> yeh
18:54 <davean> other compilers for Haskell have different performance characturistics
18:54 <davean> you'll vary more by CPU type, because then we're using a different backend (in GHC at least)
18:54 <Iluvala> 0:
18:54 <davean> OS isn't a highly correlated value here
18:55 <davean> Frankly, architecture isn't overly predictive either
18:55 tangled_z joined
18:55 <davean> what assembly we us just isn't that much of the compile time
18:55 <davean> the optimizations turned on and the code it's self are what matter most
18:55 <dolio> I suspect a lot of people don't optimize their workflow as much as they could with respect to compile times.
18:56 <dolio> -O0 during most development, and only -O or -O2 when you need to look at performance.
18:56 <davean> dolio: uh, well, frankly a lot of code just doesn't *work* with -O0
18:56 osa1 joined
18:56 osa1 joined
18:56 oleksiyp joined
18:56 <davean> -O0 can lead to flat-out non-functional code in practice
18:57 <davean> so you can't run tests?
18:57 <dolio> Is -O0 going to stop your code from compiling?
18:57 <Iluvala> thanks guy, that will suffice
18:57 <davean> dolio: no, but it'll stop tests from passing
18:57 <dolio> If not, then you can at least use O0 when weeding out type errors.
18:57 <cocreature> dolio: then you can also use -fno-code :)
18:58 <dolio> That exists?
18:58 <davean> yah
18:58 <cocreature> yep
18:58 <dolio> Huh.
18:58 <Iluvala> blessings
18:58 Iluvala left
18:58 <davean> I don't know why you'd do a full compile with -O0
18:58 <davean> It makes sense to just do the front passes and not have optimizations come into it
18:58 <davean> once I *generate actual code* I want -O
18:58 <dolio> Well, I never compile with O0, either. But I don't complain about compile time.
18:59 <davean> otherwise why did I generat eit?
18:59 <cocreature> davean: well I never had my code break with O0 so I often compile with O0 and run it
18:59 <davean> cocreature: ah, I see it all the time
18:59 bollu joined
19:00 <cocreature> davean: you got me interested. do you have a specific example of code that breaks with O0?
19:00 ScarieBlowfish joined
19:00 <davean> cocreature: The general form is it generates extra intermediate data, etc and stack overflows
19:00 <davean> where it operates in O(1) with optimizations
19:00 Cheburan joined
19:01 <davean> Thats the most common case
19:01 <cocreature> ah yeah
19:01 <cocreature> that makes sense
19:01 <davean> and you COULD make it work with -O0
19:01 twanvl joined
19:01 <davean> but then I might as well write C
19:01 <davean> because they'll look the same
19:01 <cocreature> that’s a bit harsh but you have a point :)
19:02 <davean> :)
19:02 <tobiasBora> Hello,
19:02 JeanCarloMachado joined
19:02 _sg joined
19:02 <cocreature> davean: I usually run with -K1K :)
19:02 m1dnight_ joined
19:02 <davean> cocreature: so, Alec actually has a "CMonad" that he pasted C code into and ran it
19:02 connrs joined
19:02 electrostat joined
19:03 <davean> cocreature: Its based on RWS
19:04 <cocreature> RWS is one of those weird things that I’ve learned about pretty early on but I never used in actual code
19:04 <davean> cocreature: He never had untill he wanted to paste git code and have it behave the same in a Haskell program!
19:05 limlinlo joined
19:05 <davean> cocreature: It excited him for weeks
19:05 ystael joined
19:05 Ghi102 joined
19:05 <geekosaur> there's a BASIC monad on hackage somewhere >.>
19:06 Ghi102 joined
19:06 <davean> geekosaur: sadly theres not a C monad because people are bad at releasing things
19:07 handlex joined
19:07 <davean> (its not all of C, but it covers enough to allow a decent copy-pasta migration of some interesting bits)
19:08 shanemikel joined
19:09 ner0x652 joined
19:09 Kreest__ joined
19:10 guest2 joined
19:10 marsam joined
19:11 <benzrf> davean: hmm, what? copy paste?
19:11 <benzrf> was it using template haskell or something?
19:11 <davean> benzrf: no
19:11 <benzrf> so it was just a C interpreter basically?
19:12 bgamari joined
19:12 <davean> No, it was just a monad with similar semantics, and a bunch of functions that allowed most C code to be ~= valid Haskell code
19:12 <dolio> If he's talking about the one Lennart made, it involved a bunch of overloading weird stuff, I think.
19:12 <benzrf> ohhhh
19:12 <benzrf> oh wow, that's pretty fucked up
19:12 <dolio> So that 'a[5]' was an array access.
19:13 <dolio> But also could be assigned to.
19:13 <davean> benzrf: you could paste function bodies from C and get Haskell functions
19:13 <davean> benzrf: it was statement level though
19:13 <benzrf> good god
19:13 <davean> benzrf: yep
19:13 <benzrf> how on earth do you get away with using = for assignment
19:13 <davean> OTOH, "What does that weird bit of C in git do?" becomes "Eh, deal with that later, paste it for now"
19:13 <geekosaur> heh
19:14 <benzrf> or prefix operators
19:14 <geekosaur> some questions may be best not asked. (or, perhaps, not answered especially if it involves looking at the implementation...)
19:14 eschnett joined
19:14 <benzrf> i mean, did it support those things?
19:15 <benzrf> or did u have to tweak it replacing a few small pieces of syntax
19:15 <geekosaur> +1 int, -2 san :p
19:15 <benzrf> eg = to =:
19:15 bollu joined
19:15 drewr joined
19:16 epsilonhalbe joined
19:16 epsilonhalbe left
19:19 featherlessbiped joined
19:21 troydm joined
19:22 bollu joined
19:23 zv joined
19:24 talzs joined
19:25 Cheburan left
19:25 Lord_of_Life joined
19:26 Jesin joined
19:27 arpl joined
19:27 igniting joined
19:28 <talzs> Does anyone know if haskell-mpi is still good? Are there any other distributed memory libraries that I should look at?
19:32 gawen joined
19:33 <dolio> benzrf: They also convinced everyone that 'variable' is about assignment.
19:33 niteria joined
19:34 <Athas> talzs: have you looked at Eden? It's a modification of the GHC RTS that supports distributed memory. It has a lot more buyin than a pure library, of course, but it is very smooth.
19:34 <Athas> You can transparently send closures and even IO actions across the network.
19:35 <talzs> Athas: I haven't yet, but that sounds nice. I'll take a look at it, as I don't really want to deal with mpi haha
19:35 <Athas> I don't think anyone _wants_ to deal with MPI.
19:36 eschnett joined
19:38 nepiktaz joined
19:40 pera joined
19:40 <shapr> Yeah, MPI is frustrating
19:44 adelbertc joined
19:46 t7 joined
19:47 _ashbreeze_ joined
19:48 Itkovian joined
19:50 wraithm joined
19:50 oish joined
19:52 kuribas joined
19:53 scope joined
19:53 limlinlo joined
19:53 m1dnight_ joined
19:56 coot joined
19:57 coot joined
19:58 mmachenry joined
19:59 <scope> Hey guys, is this the correct way to create a module? Do I need a "where"? http://lpaste.net/3039850871400693760
20:01 <mmachenry> scope: Pretty sure you need to have a where at the end of that module line.
20:01 aweijdf joined
20:01 <scope> would that be all I need to add or am I missing something else?
20:01 <mmachenry> That's it.
20:01 <mmachenry> At least that's all I ever do.
20:02 <scope> awesome, thanks
20:02 <mmachenry> I often put the exports on a line each.
20:03 <scope> also, do you have any idea why my ghci takes so long to load?
20:03 <scope> it didn't used to be like this
20:06 marsam joined
20:06 cdg joined
20:07 <alx741> scope: it depends on what are you loading on it (if any?) or just ghci invocation without any paramters (no program to load)
20:10 <scope> literally just the ghci command
20:10 <scope> from CMD
20:10 <scope> takes around a minute to load and get into prelude
20:13 <alx741> when it's done loading take a look at what it spits out "Loaded GHCi configuration ... " and other stuff, that may point you to a potential problem
20:14 coot joined
20:15 <monochrom> benzrf: Before C came around, Algol and Pascal used := just fine.
20:16 <AWizzArd> The new 8.2 Compact regions (non-gc region) – does it also support deletion of objects? Can I remove data from the compact region?
20:16 <geekosaur> "ghci -v" maybe to see what it's loading
20:16 <monochrom> My understanding is that C's rational for = is "saves typing"
20:16 <monochrom> err, rationale!
20:17 <dolio> Clearly bad thinking.
20:17 coot joined
20:17 <dolio> They should have made it longer, so that fewer people would want to use assignment.
20:17 Rodya_ joined
20:17 <geekosaur> better rationale than some things in C, like confusing pointers and arrays :)
20:17 <geekosaur> (and, thereby, programmers)
20:19 hybrid joined
20:19 bjz joined
20:19 takle joined
20:19 <seequ_> It's not like assignment is a bad thing in C. ;)
20:20 <dolio> Yes it is.
20:20 <kuribas> dolio: you would use tail recursion?
20:20 insitu joined
20:20 <kuribas> it blows up the stack quickly
20:22 <kuribas> without TCO assignment is the best option.
20:22 anton___ joined
20:22 <dolio> Being the best doesn't make you good.
20:22 buoto joined
20:22 coot joined
20:23 <mauke> who needs assignment when you have memcpy?
20:23 <dolio> Don't C compilers do good tail calls, to?
20:23 <seequ_> I think modern C has TCO, but the language still is unusable without liberal assignments.
20:24 prkc joined
20:24 <mizu_no_oto_work> Clearly, the right way to do assignment is to have assignment functions like rplaca and rplacd.
20:24 <mnoonan> afaik C doesn't *guarantee* TCO in the language, which is kind of limiting
20:26 <mauke> dolio: I've seen gcc turn 'unsigned fac(unsigned n) { if (n < 2) { return 1; } return n * fac(n - 1); }' into a loop
20:26 silentcontrib_ joined
20:27 <dolio> That's pretty good.
20:28 cyborg-one joined
20:28 locallycompact joined
20:29 <dolio> I'm not sure not having a language guarantee is a real limit.
20:29 <dolio> It could be an excuse.
20:29 b4ff3r joined
20:29 <seequ_> C shouldn't be written with a functional style. That's taking a shotgun, strapping a few rocket boosters to it and using it for a surgery. :P
20:29 <nshepperd> rocket surgery, you say
20:29 <dolio> But people program to specific compiler features all the time.
20:31 <nshepperd> C has almost no language guarantees. in practice people program gcc x86 C
20:31 <seequ_> Programming C to specific features is counter-productive as that reduces portability greatly.
20:31 <nshepperd> (or clang or VC+)
20:32 <Jacoby6000_> seequ_: some problems lend themselves to very concise and understandable recursive solutions (like factorial)... I wouldn't say you should avoid recursion simply because a language isn't functional
20:32 meoblast001 joined
20:32 <dolio> Programming C is often counter-productive, but people still do it.
20:32 <seequ_> C has a lot of guarantees of things that aren't defined. :p
20:33 <nshepperd> but if gcc or clang doesn't guarantee TCO, I wouldn't use recursion
20:33 <seequ_> Jacoby6000_: Well, if on some other pc it blows up the stack, you'll be sad.
20:33 Itkovian joined
20:33 <seequ_> dolio: Necessity usually is very productive.
20:35 snowalpaca joined
20:35 <kuribas> Jacoby6000_: If the recursion depth isn't large it's ok.
20:35 rotcpy joined
20:36 <seequ_> You obviously have to be wary of embedded systems.
20:40 coot joined
20:40 przembot joined
20:41 curious_corn joined
20:42 ludat joined
20:43 <tobiasBora> Is there a symbol equivalent of fmap?
20:43 <tobiasBora> something like >>=
20:43 <monochrom> Yes, <$>
20:43 deepfire joined
20:43 owiecc joined
20:44 <monochrom> In recent GHCs it's also in Prelude so you need not import anything extra. (But older GHCs would have you import Data.Functor or Control.Applicative, your choice.)
20:45 jbiesnecker joined
20:45 <tobiasBora> Hum...
20:45 <tobiasBora> Maybe it's not the good one, I tried :
20:45 <tobiasBora> lines <- (readFile "/tmp/test.txt") <$> unlines
20:45 <tobiasBora> and it does not work.
20:45 <monochrom> The other order!
20:45 minn joined
20:45 <tobiasBora> sure
20:45 <tobiasBora> Thank you!
20:46 <tobiasBora> And in this order there is no symbol that do the job?
20:46 <monochrom> I don't know.
20:47 <tobiasBora> ok thank you
20:48 <dolio> There's <&> in lens.
20:48 ramzifu joined
20:49 <minn> I have 2.2GB of free disk and want to install Haskell using Stack, with room left over. Why would stack setup require all 2.2GB and fail when unpacking the compiler? Does it really require that much space?
20:49 limlinlo joined
20:50 <davean> no, but I'm sure stack installs extra stuff. But 2.2GBs of free space will give you serious issues actually using anything
20:50 <monochrom> GHC is about 1.7GB
20:50 <davean> monochrom: huh?
20:50 <davean> monochrom: not any version I've ever used
20:51 <minn> That's huge! Unfortunately that probably rules out using Haskell for this project. I never realized the compiler and libraries were so large.
20:51 <davean> that being said, even if GHC isn't that large, theres no real reason to fix things if you only have 2.2GBs of space, because irrespective of the size of GHC thats not a useful amount of space
20:51 <dolio> I thought it was more like 0.7GB.
20:51 <davean> dolio: yes
20:51 <davean> minn: well, don't use stack
20:52 _ashbreeze_ joined
20:52 Jackoe joined
20:52 <davean> but still, why are you compiling in a space limited enviroment?
20:55 <minn> I could compile GHC without Stack; but footprint is probably too large. I can request lots more space, but others would need to replicate the setup in a space limited environment (e.g., virtual machines with fixed disk space).
20:55 <davean> "compile GHC"? what are you doing?!
20:56 <davean> why wouldn't you use a compiled GHC?
20:56 <davean> theres so many things wrong about this
20:57 <Adluc> I am happily running stack with everything on beaglebone black, but have to enable swap with at least 2GB, therefore 3GB total with integrated ram
20:58 <Adluc> and mounted home on external flash drive, at least 8GB
20:58 <davean> Adluc: he said disk
20:58 <davean> we're not talking about RAM
20:58 Berra joined
20:58 <dolio> 2.2GB RAM would be pretty dicey, too.
20:58 <davean> 2.2GBs of RAM would be sensible to work on
20:59 <Adluc> I just have a flash drive for compiling, resulting binary runs without it
21:00 <davean> Adluc: right, and worse he said compiling GHC, not compiling WITH ghc
21:01 Itkovian joined
21:02 guest2 joined
21:04 <minn> Okay, well I this problem was caused by me being an idiot. The binary packages seem to work fine.
21:04 <scope> hey guys, what's the fastest way to split a string into a list on whitespace characters?
21:04 <scope> easiest way, rather
21:04 <dolio> words
21:04 <scope> ty
21:05 taksuyu joined
21:05 <monochrom> When you want more generalized splitting, there is Data.List.Split.
21:05 araujo joined
21:06 coot joined
21:07 freeside joined
21:07 <tobiasBora> Hum...
21:07 <tobiasBora> I've a but I can't understand:
21:07 <scope> monochrom, what if I need to split the string into a type such as [(float, float)]?
21:07 <tobiasBora> I've in the top of my file: type WriteMethod = WriteFile Handle
21:07 conal joined
21:07 <tobiasBora> and latter:
21:07 <tobiasBora> writeUser :: WriteMethod -> Person -> IO ()
21:07 <tobiasBora> writeUser (WriteFile handle) person = do
21:08 <monochrom> You will have to split string to strings first, then convert to (float, float) individually.
21:08 <tobiasBora> And I have an error Not in scope: data constructor ‘WriteFile’
21:08 <davean> minn: You'll will 2.2GBs quickly with any notable library stack though
21:08 <scope> using map?
21:08 <davean> minn: I currently have 6.7GBs of installed, compiled, libraries
21:08 <davean> for example
21:08 <monochrom> Yes, map is helpful.
21:09 ramzifu joined
21:09 yellowj joined
21:09 <mauke> tobiasBora: what's WriteFile?
21:09 <davean> minn: You won't be able to function high up the stack with 2.2GBs of space
21:09 <davean> mauke: though you can avoid probiling and such to limit the size a bit
21:09 <davean> minn I mean
21:09 <tobiasBora> mauke: Well a personal Constructor: type WriteMethod = WriteFile Handle
21:09 <mauke> tobiasBora: that doesn't define WriteFile
21:10 marvin2 joined
21:10 <monochrom> tobiasBora: Do you have the definition of WriteFile anywhere? Where did it come from? Show actual code?
21:10 <tobiasBora> mauke: Really?
21:10 <ertes> tobiasBora: 'type' and 'data' are different things
21:10 augur joined
21:10 <tobiasBora> ertes: Ahhhh
21:10 <monochrom> Oh, yeah you need "data".
21:10 <mauke> or newtype
21:11 <tobiasBora> I always exchange these two, what is the exact difference?
21:11 <monochrom> "type" is synonym. Consider it merely macro.
21:11 <ertes> tobiasBora: 'type' defines a type alias, so you're declaring that the type 'WriteMethod' should be the same as the type (!) 'WriteFile Handle', and then naturally it complains that it doesn't know what WriteFile is
21:12 <tobiasBora> hum ok then you !
21:12 <mauke> newtype is like type internally, but to code it looks like data
21:12 <monochrom> If you say "type X = Int" then X and Int are interchangeable, indistinguishable.
21:13 <tobiasBora> Thank you:D
21:13 prophile joined
21:13 <tobiasBora> And is there a shortcut for Person { username = username, age = age} ?
21:14 <tobiasBora> I tried to remove the = username, and it complains
21:14 <minn> davean: That's really useful information - thank you for the help. I'm pretty sure that rules out using Haskell, which is unfortunate.
21:14 <monochrom> There are extensions, RecordPuns and RecordWildcards
21:14 nomotif joined
21:14 <davean> minn: I don't know many things where compiling things using a lot of libraries is small
21:15 <scope> monochrom this is what I'm trying to do if this makes it more clear http://lpaste.net/6413022704261136384
21:15 <davean> minn: look at the size of C libraries+headers for any moderate sized project
21:15 <davean> how big is boost installed?
21:15 <miniBill> So I've got a monad t, and I want to write a function (Monad m) => t (m a) -> m (t a). Is there an intelligent way to write it without reimplementing the wheel?
21:15 <davean> minn: looks like boost can install to 10.9GBs?
21:15 <miniBill> The monad is a simple tree monad
21:16 <monochrom> scope: Yeah, it will go like: map parsePoint (words string). Now you have to implement parsePoint.
21:16 <scope> ah ok wasn't sure if I needed a helper
21:16 ner0x652 joined
21:16 carlosdagos joined
21:16 <davean> minn: it seems really weird to worry about toolchain size and not size of the resultant binary
21:16 <monochrom> Do you also need to worry about parse errors and invalid string inputs?
21:16 <dolio> miniBill: That looks like the type of sequence.
21:17 <ertes> miniBill: if it's an algebraic tree, you can pretty much let GHC write 'sequence' for you
21:17 <monochrom> Oh, helper is optional but separating it out is probably less insane.
21:17 <ertes> miniBill: -XDeriveTraversable
21:17 <scope> so monochrom, parsePoint would end up returning what, a list of (float,float) correct?
21:17 <miniBill> dolio: indeed! thanks!
21:17 <miniBill> ertes: I'll try DeriveTraversable, thanks
21:17 <monochrom> For all I know, if you wrote "map (\s -> ... long code for parsing here ...) (words string)" I would still understand it :)
21:18 <monochrom> No, it's individual, String -> (Float, Float)
21:18 <ertes> miniBill: you can also derive Foldable and Functor, on which Traversable depends
21:18 <scope> ah okay, thank you
21:18 <miniBill> ertes: thank you very much
21:18 _flow_ joined
21:19 Itkovian joined
21:19 <minn> davean: Right, I understand and am appreciating the point.
21:21 prophile joined
21:23 featherlessbiped joined
21:24 augur joined
21:25 coot joined
21:28 <scope> monochrom, the parsePoint function is going to be receiving strings that look like (5,8). I've been googling and unable to find a good way to convert that to a tuple of type (float,float). Do you have a suggestion? I'm very new to haskell
21:28 Koterpillar joined
21:28 <monochrom> If the format is just that, "read" works out of the box. Example:
21:29 <monochrom> > read "(5,8)" :: (Float, Float)
21:29 <lambdabot> (5.0,8.0)
21:29 <scope> oh wow
21:29 <scope> that's a lot simpler than I expected
21:29 <monochrom> Be sure to use types to get the right behaviour. But you already have the necessary type signatures.
21:29 <scope> that worked beautifully
21:30 <monochrom> Other formats will require more coding, yeah, we're lucky.
21:30 <scope> what's an example that would require more coding?
21:30 <scope> I guess, what wouldn't work like that
21:30 djfo joined
21:30 <freeside> "5 8 11 bogus 24.2"
21:30 <monochrom> Say, if they prefer semicolon to comma.
21:31 <scope> ah alright
21:31 <freeside> .oO (you could always pre-treat your input data in perl)
21:32 <scope> another quick question, when I try to load ghci in CMD it takes up to a minute to load
21:32 <scope> it used to be almost instant
21:32 <freeside> in the spirit of perl one-liners, here: fmap ((,) <$> head <*> last) <$> chunksOf 2 $ catMaybes $ (readMaybe :: String -> Maybe Float) <$> words "5 8 11 bogus 24.2"
21:32 <monochrom> If you quit ghci now and run it again, does it take a minute again?
21:32 <scope> yes, every time I try to run ghci
21:34 aib joined
21:35 <scope> basically it sits on "GHCi, version xxxx -------------------" for about a minute before getting into prelude
21:35 napping joined
21:37 lowryder joined
21:38 Itkovian joined
21:39 nyuszika7h joined
21:42 ystael joined
21:42 zero_byte joined
21:44 magneticduck joined
21:44 <lyxia> scope: what's in your .ghci
21:44 <scope> where is that located?
21:45 <lyxia> Maybe in your home folder
21:45 <MarcelineVQ> most often ~/.ghc/ghci.conf
21:46 Itkovian joined
21:46 <scope> I'm on Windows
21:46 <scope> I found a ghci_history file under appdata
21:46 <scope> but there's nothing else
21:47 <lyxia> It might not be the cause anyway. I don't know where else the slowness could be coming from. :/
21:48 <monochrom> Yeah, this is a little bit weird.
21:48 <tobiasBora> monochrom: Ok thank you!
21:48 <scope> it's honestly not that big of a deal it's just an annoyance
21:49 sleffy joined
21:49 <tobiasBora> By the way, I'd like to program a concurrent program, what is the difference between Control.Concurrent.ParallelIO and Control.Parallel.Strategies?
21:49 <freeside> how large is the ghci_history file?
21:49 <scope> 2kb
21:49 <scope> probably not the cause
21:49 <freeside> probably not
21:50 <Phyx-> scope: which version?
21:50 <monochrom> 2kb here too.
21:50 <scope> monochrom, that parsePoint function will load, but it fails on the last element of the list with the error Exception: Prelude.read: no parse
21:50 takuan joined
21:50 <monochrom> What does the string look like?
21:50 <scope> and phyx- it's version 8.0.2
21:51 <scope> "(5,5) (5,5) (5,5) (5,5)"
21:51 djfo left
21:51 <scope> it fails before it prints the last one
21:51 <monochrom> > map read (words "(5,5) (5,5) (5,5) (5,5)") :: [(Float, Float)]
21:51 <lambdabot> [(5.0,5.0),(5.0,5.0),(5.0,5.0),(5.0,5.0)]
21:51 tomphp joined
21:51 <monochrom> should work
21:51 <Phyx-> scope: so is it only startup that is slow or also when you import a new module?
21:51 <scope> just the startup
21:52 <freeside> can you paste the entire ghci start sequence somewhere?
21:52 hiratara joined
21:52 <Phyx-> hmm, then it's something else. I thought the loading of base would be taking a long time, but we relink and load everything when you import a module
21:52 <lyxia> tobiasBora: strategies offer parallelism for pure computations
21:52 <scope> not much to post, it's just the GHCi "versionnum" and the help message
21:53 <scope> then it goes into prelude
21:53 augur joined
21:53 Edith joined
21:53 <scope> monochrom same error
21:53 <scope> I'll paste the code again
21:54 <tobiasBora> lyxia: Ok thank you!
21:54 <Phyx-> unfortunately, the only way to tell for sure what's going on is with a debug build of GHC...
21:54 <scope> monochrom http://lpaste.net/2651339077676171264
21:54 <lyxia> tobiasBora: Concurrence is not parallelism by the way.
21:54 <tobiasBora> There is not problem if the threads write in the same file?
21:54 contiver joined
21:55 uglyfigurine joined
21:55 _ashbreeze_ joined
21:55 <monochrom> scope, I will also need some string that exhibits the error.
21:55 Rodya_ joined
21:55 <scope> "(5,5) (5,5) (5,5)"
21:55 <scope> anything I pass to it with that format monochrom
21:56 <scope> prints everything up to the last element and then fails with no parse
21:56 mizu_no_oto joined
21:56 <lyxia> tobiasBora: you will need to synchronize your threads
21:57 <tobiasBora> lyxia: Hum... How do you do that?
21:57 <tobiasBora> I need to manually use semaphore...
21:57 <freeside> working hypothesis: a state-sponsored actor has hacked into your computer and is messing with your mind via ghci
21:58 ChaiTRex joined
21:58 <lyxia> tobiasBora: concurrent-extra has basic stuff
21:58 <scope> monochrom, interestingly it works with two elements
21:59 <lyxia> tobiasBora: stm has primitives for more custom concurrent abstractions
21:59 <scope> monochrom try different numbers, (5,5) (5,5) (5,5) actually works just fine
21:59 <scope> AHHHH I'm an idiot
22:00 <scope> I had a space in my string monochrom
22:00 <ski> > (`runStateT` "(5,5) (5,5) (5,5)") (replicateM 3 (StateT (reads :: ReadS (Float,Float))))
22:00 <lambdabot> [([(5.0,5.0),(5.0,5.0),(5.0,5.0)],"")]
22:00 adamisntdead joined
22:00 <freeside> when monocrom asks you for an actual string that exhibits the error, you need to give the actual string that exhibits the error.
22:00 <tobiasBora> lyxia: Hum, I'll try to give it a look...
22:00 <scope> freeside fair enough, I just absolutely missed the space
22:00 <scope> figured it was something else
22:00 Rodya__ joined
22:00 Lord_of_Life joined
22:01 ragepandemic joined
22:02 <freeside> maybe you want Data.Text.strip
22:02 <scope> lol it was just user error
22:02 <freeside> :)
22:02 <lyxia> tobiasBora: also look at the Control.Concurrent* modules in base.
22:03 augur joined
22:04 JeanCarloMachado joined
22:05 <monochrom> scope: If you want to be flexible about spacing, my http://www.vex.net/~trebla/haskell/reads.xhtml may give you some ideas. The gist is you now process the whole string, do not split-by-space first.
22:05 Itkovian joined
22:05 <scope> awesome, thanks for the link mono
22:06 napping left
22:07 <ski> scope : note that instead of `reads "..." :: [(X,String)]', one can say `(reads :: ReadS X) "..."'
22:08 <scope> ski awesome, was not aware of that
22:08 mmachenry joined
22:09 <scope> I'm a big fan of this channel, you guys are great. I'm learning haskell slowly but surely.
22:09 Itkovian joined
22:10 mmachenry1 joined
22:11 alphor joined
22:11 <ski> > let s0 = " 12 34 \t " in [(x,y) | (x,s1) <- (reads :: ReadS Integer) s0,(y,s2) <- (reads :: ReadS Double) s1,("","") <- lex s2] -- this use of `lex' ensures there's nothing but white space at the end
22:11 <lambdabot> [(12,34.0)]
22:14 ekr joined
22:15 jbiesnecker joined
22:16 <ski> > let s0 = "(12;34)\n" in [(x,y) | ((x,y),s5) <- (readParen True `flip` s0) $ \s1 -> [((x,y),s4) | (x,s2) <- (reads :: ReadS Integer) s1,(";",s3) <- lex s2,(y,s4) <- (reads :: ReadS Double) s3],("","") <- lex s5] -- `lex' can also be used to scoop up tokens like `;' here. `readParen' can be used to handle the brackets
22:16 <lambdabot> [(12,34.0)]
22:16 <ski> scope ^
22:17 Itkovian joined
22:18 anderson joined
22:18 _ashbreeze_ joined
22:22 tom7942 joined
22:22 takle joined
22:25 eazar001 joined
22:25 marvin2 joined
22:26 rbocquet joined
22:26 Micamo joined
22:27 <Unode> If I wanted to create a client-server, both written in Haskell and didn't want to care too much about the protocol between the two but just that I'm able to deliver full-duplex communication, what haskell libraries should I look into?
22:28 limlinlo joined
22:28 farrioth joined
22:28 bencryption joined
22:29 strykerkkd joined
22:30 <monochrom> The Network module, comes with GHC.
22:31 <geekosaur> actually it doesn't
22:31 hiratara joined
22:31 t0by joined
22:31 t0by joined
22:31 runawayfive joined
22:31 <geekosaur> (and ghc devs get grumpy if you suggest including it, since you'd presumably have some reason for ghc itself to use it... someone actually asked that the other day :)
22:32 <monochrom> Oh, oops, it doesn't come with GHC. The library package name is "network".
22:32 <Unode> monochrom: checking
22:32 <monochrom> Yes I have recently found a new reason for GHC to include it (and http and ssl).
22:32 <ezyang> we are all GRUMPBALLS
22:33 <monochrom> It is to support "ghc -O http://www.vex.net/~trebla/whee.hs"
22:34 deepfire joined
22:34 atomi joined
22:34 <Cale> Nice, and then whee.hs can include some IO-performing Template Haskell :)
22:34 spacedog82 joined
22:34 ph88 joined
22:35 cpup joined
22:35 <Unode> monochrom: uhm I was hoping for something a little bit higher level.
22:35 <monochrom> I think Network is already pretty high level.
22:35 <Unode> monochrom: not according to its description. Unless we are talking about different things.
22:35 Rainb joined
22:36 <Unode> "Low-level networking interface"
22:36 bryanlem_ joined
22:36 doodlehaus joined
22:37 <monochrom> I guess they encourage you to use Network.Socket, which is lower level.
22:37 anuxivm joined
22:37 <Cale> Unode: listenOn / accept / connectTo are a somewhat higher level interface
22:38 <okeuday_bak> programs are more perfect without I/O, a good reason to not include network
22:38 <geekosaur> yes, the higher level interface is a bit warty and needs redesign, so it's not currently recommended
22:38 <monochrom> I don't know a library that is higher level and "this is serious, this is not just for backward compatibility!"
22:38 <Unode> What I had in mind was something that I would initialize (create connection) and then could simply send messages (JSON or some other chunk-like block of info) back and forth.
22:38 <Cale> Well, wait, what's actually wrong with those three?
22:38 <geekosaur> but there's not a lot else unless you want to use conduit or pipes
22:38 <Unode> okeuday_bak: hehe funny remark.
22:39 <Cale> There's the sendTo/recvFrom functions which probably should go away
22:39 <monochrom> I mean, unless you also want to dabble with pipes or conduit.
22:39 <geekosaur> the funniest part os it has those, which are mainly useful with UDP... but Network doesn't support UDP
22:39 <Unode> conduit, checking...
22:39 <okeuday_bak> using sockets as handles works
22:39 <geekosaur> (Network.Socket does, just not the higher level interface)
22:39 <Cale> Unode: conduit isn't a network specific thing, it's a general I/O streaming abstraction
22:40 <okeuday_bak> but using sockets as handles still requires the network dependency to make the handles
22:40 <Unode> Cale: if that is in any way closer to what I just described, that works for me.
22:40 <Cale> I mean, the only thing you're going to need a lot of the time is just the first 4 functions there: withSocketsDo (just a silly Windows portability requirement), listenOn, accept, and sClose
22:41 <Cale> oh, and connectTo, so I guess that's 5
22:41 <geekosaur> it's not even needed on Windows any more, it's a backward compatibility shim for if you need to support older versions of ghc/network for some reason
22:41 <Cale> and then that'll get you a Handle and you can go use the stuff in Data.ByteString or Data.Text.IO or whatever
22:43 <Cale> and of course, you probably want Control.Concurrent, but that's a separate thing
22:43 <scope> ski thanks! I just saw your message. Sorry went to grab food
22:44 <Unode> Cale: trying to check that
22:44 Rodya_ joined
22:45 <Unode> was hoping for a more consensual answer. At this point I just want to sort of get the network part working so I can focus on the other 'more fun' aspects.
22:45 <monochrom> Yikes, I keep mistyping Handle to Handel
22:46 <mauke> Händel!
22:46 <Cale> Unode: I don't know what other capabilities you might need, without a better description of the program you're trying to write, but that'll get you a server or client going pretty easily.
22:47 Voldenet joined
22:47 Voldenet joined
22:49 <Unode> Cale: the closest I can think of is a simple chat-like or bot-like interface with a dual client <-> server component.
22:49 rekahsoft joined
22:50 <Unode> monochrom: You should see how Handel Handles Handles.
22:51 <Cale> Yeah, then those functions from Network should be just fine. You might also want some serialisation library.
22:52 <Cale> Something like Binary
22:52 <Cale> https://hackage.haskell.org/package/binary
22:52 dawehner joined
22:52 <Unode> I was thinking JSON would be more than enough.
22:53 <Cale> Ah, then Aeson
22:53 fosskers joined
22:56 mda1 joined
22:56 <Unode> ok I go away now and play with this. Thanks for all the feedback.
22:57 systadmin joined
22:57 <Cale> We've been using Aeson for serialising and deserialising JSON in both the frontend and backend of our web applications where I work. It's *okay* for that, but there are some gotchas which stem from the fact that it was originally designed for dealing with handcrafted JSON, rather than as a library where any format will do so long as you get back exactly what you put in.
22:58 <Cale> (the latter being representative of how we actually use it -- all our ToJSON and FromJSON instances are written automatically by a bunch of Template Haskell)
22:58 tikhon joined
22:58 Reshi joined
22:59 <tikhon> What are the preferred packages for logging?
22:59 Atlantic777 joined
22:59 jbiesnecker joined
22:59 Atlantic777 joined
23:00 <Cale> I've never actually tried using a package for that, but https://hackage.haskell.org/package/fast-logger came up the other day, and it looks mildly helpful
23:01 <tikhon> That's one of the ones I was wondering about.
23:01 <Cale> In particular, I don't believe very much in the various ones which give you a monad transformer.
23:01 <tikhon> You think it's better to just log from IO?
23:01 <Cale> yeah
23:02 Wizek_ joined
23:02 mysticjohn joined
23:02 <tikhon> I wasn't sure, but I'm happy to lean in that direction. Our codebase still has almost no monad transformers running around :).
23:02 <Cale> Or, well, usually in a larger application, you're going to have some record of configuration you're passing around already -- stick a function in there which gives you an action that writes to the log.
23:04 <tikhon> What do you think of monad transformers in general? I see a lot of people relying on them for organizing larger projects, but I've never felt the need myself.
23:04 bananagram joined
23:04 <tikhon> Working with monad transformers seems a bit awkward in practice.
23:05 <Cale> They're all right if you have a solid vision for what kind of API you want to build. Leaving monad transformers exposed is ugly.
23:05 Itkovian joined
23:05 <Cale> and I don't care much for the MonadReader/MonadState type classes at all -- you always want something more particular than that, which will depend on your application
23:06 <Cale> I mean, you should define a type class in that vein yourself, but with operations more meaningful than 'get' and 'put'
23:06 <tikhon> yeah, that makes sense
23:06 <tikhon> and it helps with the issue of overlapping Reader/States
23:06 <Cale> MonadState over something like [] is rather cool
23:07 <Cale> You can implement a simple parsing library really quickly
23:07 <tikhon> I like the mtl style, but it seems easy to mess up type inference
23:07 <Cale> MonadReader constraints are really bad
23:08 runawayfive joined
23:08 wtetzner joined
23:08 <tikhon> yeah, I could see that
23:08 <tikhon> but Reader in general is another thing I almost never reach for
23:08 <Cale> They ruin your type errors
23:09 MP2E joined
23:09 <tikhon> the project I'm working on now has a custom Random type that's isomorphic to a Reader monad of some sort
23:09 <tikhon> but having a distinct type for it seems much nicer in practice
23:10 <Cale> Yeah, it's just that sometimes the type you're defining will be a newtype of something which works out to a combination of some monad transformers, and it'll save you a bit of trouble writing instances.
23:10 <tikhon> yeah, that's definitely fair
23:11 <Cale> But you generally *should* newtype it
23:11 <Cale> and hide the fact that you're using monad transformers from outside the given module
23:11 Edith joined
23:11 <tikhon> and I guess having mtl-style constraints for it could help make code more polymorphic
23:11 louispan joined
23:12 <Cale> *Sometimes* that polymorphism actually turns out to be useful, and sometimes it just makes your type signatures annoying to write. :)
23:12 <tikhon> yeah
23:12 <tikhon> and, again, it's too easy to mess up type inference
23:12 <Wizek_> @djinn Monad m => [(m Bool, a)] -> m a
23:12 <lambdabot> Error: Undefined type []
23:12 <Cale> Well, MonadReader in particular screws it up, because (->) e is an instance
23:12 <tikhon> right
23:13 <Cale> and GHC deals with it rather poorly for some reason
23:13 <tikhon> Is (->) something of a special case for inference?
23:13 <Cale> An extra or missing argument in a large definition somewhere will turn into an error regarding the entire function definition
23:13 <tikhon> it's definitely a special case for error messages
23:13 <Cale> (it'll point you at the first line of the definition, rather than at the place where the error actually is)
23:14 <Cale> Well, it's not really special
23:14 <Cale> Apart from the fact that function application has special syntax
23:14 muesli4 joined
23:15 dan_f joined
23:16 <Cale> But yeah, I had to go through one of our projects and remove all the MonadReader constraints for the application environment due to that, and I haven't regretted it at all. The constraints are easier to write, the type errors are no longer awful, and there are several methods for directly extracting bits of the configuration..
23:16 nepiktaz joined
23:17 Itkovian joined
23:17 <tikhon> Luckily our codebase has escaped that so far, but some other bits have pretty hairy types.
23:17 <tikhon> Back to logging: has anyone here used hslogger recently? It looks like it was the most common logging library a few years ago, but it was last updated in 2016.
23:18 <Sonolin> to clarify Cale so to solve this, you just cahnged the MonadReader m => constraint to a specific type?
23:18 <Cale> yes, just built my own type class for the operations which ask for various bits of the environment
23:18 marsam joined
23:19 <Sonolin> cool, just wondering since I'm currently in the process of hiding
23:19 <Sonolin> monad transformers in my app, and had begun to convert things to the polymorphic MonadReader constraint
23:19 <Sonolin> but useful error messages seem infinitely more important
23:20 <Cale> Also worth noting that I would basically never use ReaderT over IO on its own
23:21 <Cale> Unless I was in the process of constructing a monad that wasn't going to support all IO, or which at least had some decent *meaning*. It's not worth what you give up if you could just be passing a parameter around instead.
23:22 <Cale> But once you already have some monad which isn't IO, you have less to lose in the way of higher order primitives like forkIO and bracket and catch
23:25 <Cale> (nevermind that it's rarely actually a syntactic convenience relative to parameter passing, once you account for all the uses of liftIO)
23:25 <Sornaensis> :t liftIO
23:25 <lambdabot> MonadIO m => IO a -> m a
23:25 ddere joined
23:25 <Sornaensis> :t forkIO
23:25 <lambdabot> error: Variable not in scope: forkIO
23:25 <Cale> :t Control.Concurrent.forkIO
23:25 <lambdabot> IO () -> IO GHC.Conc.Sync.ThreadId
23:26 <Cale> ^^ things like this which take IO actions as parameters are annoying to use once you pass to working with some transformed monad
23:27 <tikhon> euh, do you end up having to run your whole stack to make it work?
23:28 deepfire joined
23:28 <Cale> Well, you may be able to obtain all the pieces of state and whatnot that are required to re-run the same monad transformers on the action you're passing as an argument. But that might not even make sense.
23:28 lambda-11235 joined
23:29 fDev2179 joined
23:29 ebzzry joined
23:29 <Cale> If it's MonadState for example, with forkIO, all the changes to state which happen on the second thread are going to be lost relative to the original thread. That might not be what you want.
23:29 <tikhon> right
23:29 Itkovian joined
23:29 <Cale> There are similar, but subtler problems with catching exceptions.
23:29 JeanCarloMachado joined
23:30 <tikhon> and, to be fair, that's the sort of thing you *should* consider explicitly—relying on default behavior for things like that leads to bugs pretty quickly
23:31 <Cale> There are some libraries like MonadBaseControl which can help with doing this in a standard way, but they're not magic, and won't help you if the thing you're asking for doesn't quite make sense, even if they force the types to line up.
23:33 Conjecture joined
23:33 <Conjecture> Does Haskell throw errors when you exceed what is representable by a fixed bit integer?
23:34 <Cale> Generally no.
23:34 <Conjecture> Is there a way to make it trigger?
23:34 <Cale> Int will be something of fixed size, but operations are modulo 2^n for some n
23:34 <pikajude> no
23:34 <Cale> Integer is arbitrary precision
23:34 <pikajude> you can't throw an error on overflow
23:34 <Cale> You could make your own type which did
23:34 <pikajude> unless you make a newtype wrapper and implement Num yourself
23:34 <Cale> yeah
23:34 <pikajude> which checks for overflow on every operation
23:34 <Conjecture> Thanks
23:35 <Cale> That may exist somewhere
23:35 <monochrom> I believe that exceeding Integer capacity will only manifest as out-of-memory. :)
23:35 <Cale> Usually it's not so bad just to use Integer if you're at all worried about overflow.
23:36 <Conjecture> Thanks
23:37 <Cale> (Or even if you're not, and you're just not terribly worried about finer performance details, or densely packing the things into unboxed arrays)
23:37 <Conjecture> Maybe I should use Google's coding practice on the subject
23:38 <Conjecture> Use signed when using fixed bit, that way rolls overs come out to very large negative numbers making any error obvious
23:38 tikhon` joined
23:38 <Conjecture> Thanks for the help on the subject
23:40 <dmwit> :t finiteBitSize
23:40 <lambdabot> FiniteBits b => b -> Int
23:40 <Conjecture> Thanks
23:40 <dmwit> ?let ensure p x = x <$ guard (p x)
23:41 <lambdabot> Defined.
23:41 Rotaerk joined
23:41 kefin joined
23:41 <dmwit> :t \op x y -> liftA2 op x y >>= ensure (\v -> v <= bit (finiteBitSize v `div` 2))
23:41 <lambdabot> (FiniteBits b, Ord b, Alternative m, Monad m) => (a -> b1 -> b) -> m a -> m b1 -> m b
23:42 Welkin joined
23:42 <dmwit> ?let checkedOp op x y = liftA2 op x y >>= ensure (\v -> v <= bit (finiteBitSize v `div` 2))
23:42 <lambdabot> Defined.
23:43 yellowj joined
23:43 <nilof> Huh, apparently Haskell was twelve years old when Cobol got user-defined functions
23:43 <dmwit> Oh, I got that backwards, didn't I?
23:43 <dmwit> Ah well. Kind of a stupid hack anyway.
23:43 <dmwit> ?undefine
23:43 <lambdabot> Undefined.
23:45 jbiesnecker joined
23:45 CicelyQuails joined
23:45 eacameron joined
23:47 Rodya_ joined
23:48 soLucien joined
23:48 taktoa joined
23:48 JeanCarloMachado joined
23:49 YongJoon joined
23:50 hybrid joined
23:50 eacameron joined
23:52 arpl left
23:52 Reshi joined
23:52 umib0zu left
23:53 ludat joined
23:54 NenitaMaharg joined
23:56 deepfire joined