<    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 _2_4 25  
26 27 28 29 30 31
00:01 oisdk_ joined
00:01 tmtwd joined
00:01 jshjsh joined
00:01 dni joined
00:01 rcat joined
00:02 coot joined
00:02 <orion> All of this makes sense.
00:03 theDon_ joined
00:03 DarkNoys joined
00:03 skeuomorf joined
00:03 UserJosh joined
00:05 MindlessDrone joined
00:06 <erisco> a practical problem is that when you write something new and you experience an error the first assumption is that it is with what you just wrote
00:06 <erisco> and errors in what you just wrote are the easier to fix
00:06 lordcirth joined
00:06 <erisco> whereas if the error is deep down in some other library it can take a while to even identify that is the case
00:06 <erisco> and further you may have little or no knowledge about the code that is failing
00:08 <erisco> and then depending on the tools, getting a patch out can be a delay
00:08 permagreen joined
00:08 Rainb joined
00:09 <erisco> and on your team's practices
00:09 equant joined
00:10 ocalm joined
00:10 <orion> Right.
00:10 eacameron joined
00:11 tommd joined
00:11 equant left
00:11 xkapastel joined
00:13 Ayey_ joined
00:15 eacameron joined
00:15 eacameron joined
00:15 systemfault joined
00:16 louispan joined
00:16 yamadapc joined
00:17 mr_sm1th joined
00:19 Renesat joined
00:19 JeanCarloMachado joined
00:19 eacamero_ joined
00:20 desku joined
00:21 plutoniix joined
00:21 ericsagnes joined
00:21 plutoniix joined
00:22 rcat joined
00:26 yamadapc joined
00:27 eacameron joined
00:28 vektorweg1 joined
00:29 louispan joined
00:30 s4kashya3 joined
00:30 s4kashya5 joined
00:30 andyhuzhill joined
00:32 boccato joined
00:34 eacameron joined
00:36 yamadapc joined
00:37 xaviergmail_ joined
00:38 Levex joined
00:39 whiteline joined
00:41 robertkennedy joined
00:42 YongJoon joined
00:42 ystael joined
00:42 louispan joined
00:45 wtetzner joined
00:46 tommd joined
00:46 nakal joined
00:49 louispan joined
00:51 markus1209 joined
00:51 markus1219 joined
00:52 cdg joined
00:53 jmcarthur joined
00:54 faberbrain joined
00:55 vektorweg11 joined
00:56 yamadapc joined
00:57 robkennedy joined
00:57 Rodya_ joined
01:01 Levex joined
01:01 zcourts joined
01:01 andyhuzhill joined
01:03 cschneid_ joined
01:04 Ayey_ joined
01:04 dfeuer joined
01:06 Stanley00 joined
01:06 yamadapc joined
01:07 Majiir joined
01:07 Rotaerk joined
01:10 marcopullo joined
01:11 sobaken joined
01:12 Levex joined
01:14 louispan joined
01:14 eschnett joined
01:16 meba joined
01:17 yamadapc joined
01:22 Welkin joined
01:23 eacameron joined
01:24 doomlord joined
01:25 eacameron joined
01:26 louispan joined
01:26 Levex joined
01:27 yamadapc joined
01:28 eacameron joined
01:29 andyhuzhill joined
01:30 FreeBirdLjj joined
01:30 uglyfigurine joined
01:32 serendependy joined
01:32 sobaken joined
01:33 nighty- joined
01:37 djapo joined
01:39 louispan joined
01:39 cyphase joined
01:40 andyhuzhill joined
01:41 Apocalisp joined
01:43 ystael joined
01:45 the|auriscope joined
01:45 yrdz joined
01:46 mda1 joined
01:47 mizu_no_oto joined
01:47 yamadapc joined
01:48 raycoll joined
01:48 wlemuel joined
01:50 NilsHitze joined
01:51 halogenandtoast joined
01:52 juhp joined
01:55 FreeBirdLjj joined
01:55 Ayey_ joined
01:55 faberbrain joined
01:56 minn joined
01:56 louispan joined
02:02 dni joined
02:03 unbalancedparen joined
02:07 JeanCarloMachado joined
02:08 yamadapc joined
02:08 vektorweg1 joined
02:08 a3Dman joined
02:10 niteria joined
02:14 relrod joined
02:14 relrod joined
02:14 eacameron joined
02:15 wei2912 joined
02:16 louispan joined
02:17 andyhuzhill joined
02:18 yamadapc joined
02:18 uglyfigurine joined
02:18 infinity0_ joined
02:21 infinity0 joined
02:21 jsgrant- joined
02:23 subttle joined
02:23 infinity0 joined
02:24 Goplat joined
02:24 benl23 joined
02:25 xaviergmail_ joined
02:25 khouli joined
02:26 infinity0 joined
02:26 chrisdotcode joined
02:27 jw358 joined
02:28 <khouli> hello, can anyone give me pointers on how to implement plugins with recent GHC?
02:28 <khouli> I didn't have any luck with System.Plugins.Load
02:29 infinity0 joined
02:29 <khouli> I did have luck with GHCi.ObjLink
02:30 <khouli> if there's some 'preferred' way to do this, maybe something less GHC specific, I'd like to know about it
02:32 infinity0 joined
02:32 <monochrom> The preferred way doesn't exist yet, but it consists of someone updating System.Plugins to today's GHC API. The library "hint" is pretty close though.
02:34 nomotif joined
02:34 bigos joined
02:34 <monochrom> In fact if you relax from "must load *.o" to "I'm fine with loading *.hs and interpreting", then hint does it.
02:34 <khouli> thanks, I'm checking out hint, sounds interpreter oriented though, is it appropriate for plugins that can be compiled?
02:34 infinity0 joined
02:34 <monochrom> Also mueval, which is what lambdabot uses.
02:35 <monochrom> No unfortunately.
02:37 gugah joined
02:38 <khouli> interpretting isn't a dealbreaker, but let me give some details for what I want to do: there is an early opportunity for compilation and loading, then a long runtime that will use the plugin code
02:38 <khouli> thoughts on the best approach in that case?
02:39 louispan joined
02:40 <monochrom> An up-todate library for that doesn't exist. It will take a lot of work to make it (a lot of learning of the GHC API).
02:41 <khouli> darn, out of curiosity, why is it that System.Plugins is broken?
02:41 xplat joined
02:42 <monochrom> GHC API changed a lot. Also, System.Plugins was a long time ago.
02:42 <monochrom> it works fine if you go back to a GHC version of those days, but will you want to?...
02:43 ystael joined
02:44 Noldorin joined
02:44 <khouli> indeed I don't, so then the GHC API itself is my only option if I want to use recent GHC and get the behavior I described, right?
02:45 <monochrom> Yes.
02:46 minn joined
02:47 Ayey_ joined
02:47 whiteline joined
02:48 <khouli> how difficult do you think it would be for a non-expert like myself to bring System.Plugins up to date?
02:49 tommd joined
02:52 raycoll joined
02:52 Levex joined
02:52 <khouli> I guess what I mean is: would that be something only someone already experienced with the GHC source should approach?
02:52 louispan joined
02:54 <monochrom> No need for GHC source code. Just the GHC API docs. But I think it will still take a while.
02:54 sword865 joined
02:54 hexagoxel joined
02:54 greenbagels joined
02:58 lenstr joined
03:00 hucksy_ joined
03:00 <khouli> suggested GHC API tutorial reading? (google does give me several relevant hits but if there are specific suggestions, I'd like to know)
03:01 Swizec joined
03:02 <khouli> so far what I'm reading is on the API for GHC 7.x, how huge of an API break was GHC 8?
03:04 <monochrom> I don't know of a tutorial.
03:05 dni joined
03:06 xtreak joined
03:06 rekahsoft joined
03:06 subttle joined
03:07 eacameron joined
03:09 <khouli> what about docs in general? for example, the GHCi.ObjLink docs at https://downloads.haskell.org/~ghc/8.0.1/docs/html/libraries/ghci-8.0.1/GHCi-ObjLink.html are very sparse; I just want to check if that's all there is (if that's the case, then ok, I just need to deal with it) or if there's another source for docs I don't know about
03:09 shayan_ joined
03:10 ertes joined
03:10 xplat joined
03:11 <monochrom> No, start with https://downloads.haskell.org/~ghc/8.0.1/docs/html/libraries/ghc-8.0.1/GHC.html
03:13 unbalancedparen joined
03:15 the|auriscope joined
03:16 <khouli> thanks, I hadn't found that page, looks like it'll be a bit of a slog before I grok enough, any other docs/info I should be looking at?
03:17 xplat joined
03:17 <monochrom> Other modules in the same neighbourhood. (Click "Contents" in the top right.)
03:17 <monochrom> But that's a lot of modules and disorienting. Use the "GHC" module as the centre.
03:18 hexagoxel joined
03:18 <khouli> also, what was (or how can I found out) the last GHC version for which System.Plugins worked?
03:19 <monochrom> I forgot.
03:19 <monochrom> Maybe 6.something
03:19 Levex joined
03:20 <khouli> wow, so quite some time ago? alright, so I guess I'd have to walk backwards through the GHC git repo if I want to know?
03:20 yamadapc joined
03:20 andyhuzhill joined
03:21 Jeanne-Kamikaze joined
03:27 LeoVictor joined
03:27 Rodya__ joined
03:29 Rizy joined
03:30 andyhuzhill joined
03:31 brynedwa1ds joined
03:31 yamadapc joined
03:32 the|auriscope joined
03:36 pleax joined
03:41 fabianhu_ joined
03:41 yamadapc joined
03:44 ystael joined
03:47 path[l] joined
03:48 exferenceBot joined
03:49 boek joined
03:51 yamadapc joined
03:51 marsam joined
03:51 raycoll joined
03:52 hexagoxel joined
03:56 subttle joined
03:57 faberbrain joined
03:57 gcross_ joined
03:58 robertkennedy joined
03:58 ramzifu joined
04:00 ystael joined
04:00 Rodya_ joined
04:00 cschneid_ joined
04:01 yamadapc joined
04:03 sidei joined
04:04 mkoenig joined
04:09 halogenandtoast joined
04:10 JoshS joined
04:10 takle joined
04:11 BlaDe^1 joined
04:11 khouli left
04:13 kvda joined
04:17 k0m joined
04:18 safe joined
04:18 mrcrjs_ joined
04:19 aarvar joined
04:19 BlueRavenGT joined
04:19 robkennedy joined
04:20 darjeeling_ joined
04:20 louispan joined
04:23 takle joined
04:25 lambda-11235 joined
04:26 <Zemyla> I found an error on the GHC Trac. https://ghc.haskell.org/trac/ghc/query?status=closed&col=id&col=summary&col=owner&col=type&col=priority&col=milestone&col=component&col=changetime&desc=1&order=changetime
04:27 <jle`> this gets asked every once in a while but i don't think i've ever caught the answer ... does anyone know if there's a way to have ghc only show the first error
04:27 <jle`> i'm doing a big refactor and scrolling back up is pretty annoying v.v
04:28 <Zemyla> I tried sorting by modified, but it seems the last couple of pages have some sort of error that prevents me from doing so.
04:30 takle joined
04:30 <Zemyla> It seems to occur when I have the Modified column open and a ticket without a Modified date is in it.
04:31 hexagoxel joined
04:32 andyhuzhill joined
04:34 Glooomy joined
04:35 Glooomy joined
04:35 takle joined
04:35 Glooomy joined
04:36 Glooomy joined
04:37 pleax joined
04:37 Glooomy joined
04:37 osa1 joined
04:37 osa1 joined
04:38 Glooomy joined
04:39 otto_s_ joined
04:39 desktop joined
04:39 <_deepfire> how do I convert a c2hs-generated function wrapper value into a raw C pointer?
04:40 <_deepfire> ..or, at least, into a FunPtr
04:41 <_deepfire> it /seems/ as if unsafeCoerce gives something else (at least it leads to a segmentation fault..)
04:45 govg joined
04:45 the|auriscope joined
04:45 alexbrown joined
04:46 <alexbrown> clear
04:46 <alexbrown> Hi all.
04:46 yamadapc joined
04:47 wagle joined
04:49 <_deepfire> sadly, so far it appears the easiest way to obtain the function's pointer is to re-declare the c2hs-generated function using a manual "foreign" declaration : -)
04:49 NeverDie joined
04:50 <alexbrown> I have this code https://dpaste.de/nzUw but when i run call `average (inc 3) (inc 5)` got errors `No instance for (Fractional Int) arising from a use of ‘average’`. I am new with Haskell, Please tell me why, and how can i fix it. Many thanks.
04:50 takle joined
04:51 minn joined
04:51 <peddie> alexbrown: doesn't `average` have type `Fractional a => a -> a -> a`?
04:51 systadmin joined
04:52 <Koterpillar> alexbrown: you are using Num, so you promise that 'average' will work on Int, but (/) doesn't
04:52 andyhuzhill joined
04:52 robotroll joined
04:53 <alexbrown> peddie: Koterpillar So, Should I change type signature of `average` from `Num` to `Fractional`?
04:53 raycoll joined
04:54 <Koterpillar> :t (/)
04:54 <lambdabot> Fractional a => a -> a -> a
04:54 <Koterpillar> :t \x y -> (x + y) / 2.0
04:54 <lambdabot> Fractional a => a -> a -> a
04:55 <Koterpillar> alexbrown: see, that's the inferred type
04:56 <peddie> I'm actually a bit puzzled how alexbrown was able to write this type signature using `Num` and the compiler accepted it
04:57 <Koterpillar> :t (\x y -> (x + y) / 2.0) :: (Num a => a -> a -> a)
04:57 <lambdabot> error:
04:57 <lambdabot> • Could not deduce (Fractional a1) arising from a use of ‘/’
04:57 <lambdabot> from the context: Num a
04:57 <Koterpillar> I guess it didn't
04:57 <peddie> my guess too :)
05:00 yamadapc joined
05:00 robertkennedy joined
05:01 haasn joined
05:01 hexagoxel joined
05:01 gornikm_ joined
05:04 lithie joined
05:05 path[l] joined
05:06 takle joined
05:09 isenmann joined
05:10 emmanuel` joined
05:11 yamadapc joined
05:12 ikke joined
05:13 dan_f joined
05:13 bencryption joined
05:14 takle joined
05:15 <halogenandtoast> Howdy all!
05:17 <pacak> o/
05:18 fabianhu joined
05:18 pleax joined
05:19 <centril> is (Any, a) a valid dual of Maybe a ?
05:19 <centril> (is calling it a dual valid?)
05:19 <Koterpillar> :k Any
05:19 <lambdabot> *
05:20 <centril> Koterpillar: Any is Bool with (||) as monoid instance
05:21 takle joined
05:21 yamadapc joined
05:22 mounty joined
05:22 <centril> (Any, a) as a monad always has an a , but also yields if there was a change anywhere
05:23 aarvar joined
05:23 systadmin joined
05:26 <halogenandtoast> As someone who only a a topical understanding of Monads and Monoids (nevermind duals) I find this question interesting, but I'm unable to answer
05:27 <centril> halogenandtoast: you and me both =)
05:28 pavonia joined
05:28 Tene joined
05:28 Tene joined
05:28 ByronJohnson joined
05:28 <Koterpillar> would it need to be a comonad?
05:29 RGamma joined
05:30 <centril> Koterpillar: well, (,) e is a comonad without requiring that e be a Monoid, Any is a monoid tho
05:30 <centril> http://hackage.haskell.org/package/comonad-5/docs/Control-Comonad.html
05:31 <centril> but i dont know if it has to be a comonad to be a dual of Maybe
05:32 <Koterpillar> what is a dual?
05:33 <alexbrown> Many thanks all.
05:33 plutoniix joined
05:33 <centril> Koterpillar: http://math.stackexchange.com/questions/1518509/what-does-dual-mean-exactly-in-mathematics
05:34 andyhuzhill joined
05:35 <centril> I'm thinking that since Maybe has the semantics as All, and since you maybe don't have a result at the end while (Any, a) always has an a , and that All is the dual of Any - then they should be dual, no?
05:36 mstruebing joined
05:36 Rizy joined
05:36 hexagoxel joined
05:36 RGamma joined
05:37 b4ff3r joined
05:37 <Koterpillar> so what's this operator on the type system?
05:38 <centril> Koterpillar: dont understand the question...
05:38 <Koterpillar> your link says there's a negation operator that turns operations into their duals
05:39 Rainb joined
05:39 <Koterpillar> my best guess for what it is for the type system is turning the arrows backwards (Control.Category.Dual?)
05:39 <MarcelineVQ> sometimes
05:40 <centril> right, there isnt a function Maybe a -> (Any, a) since there might be Nothing
05:40 hrk joined
05:40 <centril> is that required?
05:40 <Koterpillar> well, I'm happy to take some type-level transformation
05:41 yamadapc joined
05:41 <Koterpillar> from a to Maybe a it's (a + 1)
05:42 <Koterpillar> from a to (Any, a) it's (a * 2)
05:43 louispan joined
05:44 vlatkoB joined
05:45 <centril> Koterpillar: what does this tell us?
05:45 YongJoon_ joined
05:45 <Koterpillar> I don't know yet. Do you have any other examples of duals?
05:46 JoshS joined
05:46 <centril> Koterpillar: Last is the dual of First
05:46 JoshS joined
05:46 <Koterpillar> shouldn't Any be dual of All then?
05:47 <centril> Koterpillar: it is
05:47 <centril> Koterpillar: because (&&) is the dual of (||)
05:48 <Koterpillar> so, what does the fact that they are dual of each other give you?
05:48 <centril> Koterpillar: nothing - it was just an academic intrest
05:49 <Koterpillar> I'm just trying to figure out what a dual actually is
05:49 <centril> it's a bit unclear to me as well
05:50 Rodya_ joined
05:50 <Koterpillar> and if you can't derive useful properties out of it, is there a point talking about it?
05:50 <MarcelineVQ> it's lots of things https://en.wikipedia.org/wiki/Duality_(mathematics)
05:51 <MarcelineVQ> there's a Dual monoid for example that swaps the order of arguments for mappend, what's interesting about it is that is can only create 'duals' for non-commutative Monoids
05:51 yamadapc joined
05:52 <MarcelineVQ> Last and First for example, yet not Any and All iiuc
05:52 <Koterpillar> here's my lousy definition: A :: (* -> *) is dual to B :: (* -> *) if B (A x) is isomorphic to x
05:52 minn joined
05:52 <centril> MarcelineVQ: how can Any and All not be the dual of each-other ?
05:53 <centril> Koterpillar: can A :: * not be the dual of B :: * ?
05:53 <MarcelineVQ> I've no idea about how to classify that, I was just noting that the Dual monoid wouldn't have an appreciable effect on them because they're commutative
05:54 <Koterpillar> I still don't know what do you get out of any of these definitions
05:54 <centril> MarcelineVQ: iirc A can be the dual of A
05:54 <Koterpillar> i.e. if I prove something for A, can I get something for B?
05:55 <Koterpillar> because if not, then such definition isn't useful
05:56 <centril> Koterpillar: we need to consult a mathematician ;)
05:56 danvet joined
05:56 <centril> they think it is useful
05:56 uglyfigurine joined
05:59 faberbrain joined
06:01 <MarcelineVQ> ah, an ezyang special http://blog.ezyang.com/2012/10/duality-for-haskellers/
06:01 <Koterpillar> close
06:01 <centril> thanks, ill add that to my reading list
06:01 <MarcelineVQ> probably just for one meaning of dual but hopefully relevant
06:02 <Koterpillar> so, we have Just :: a -> Maybe a
06:02 <Koterpillar> and Nothing :: () -> Maybe a
06:03 eacameron joined
06:04 <Koterpillar> then (Bool, a) indeed has duals snd :: (Bool, a) -> a and fst :: (Bool, a) -> ...oops
06:04 <Koterpillar> doesn't look right anymore
06:05 Sh4pe joined
06:06 mkoenig joined
06:08 sanett joined
06:08 dec0n joined
06:09 uglyfigurine joined
06:10 FreeBirdLjj joined
06:11 yamadapc joined
06:13 SpinTensor joined
06:13 tromp joined
06:17 dni joined
06:21 pleax joined
06:22 andyhuzhill joined
06:22 systadmin joined
06:22 ray27 joined
06:24 mettekou joined
06:27 raichoo joined
06:28 sanett joined
06:29 cschneid_ joined
06:35 takle joined
06:35 louispan joined
06:39 Koterpillar joined
06:42 takle joined
06:43 andyhuzhill joined
06:46 ubsan_ joined
06:46 xaviergmail_ joined
06:48 path[l] joined
06:49 hexagoxel joined
06:50 takle joined
06:50 Rodya_ joined
06:51 louispan joined
06:52 Intensity joined
06:53 meandi_2 joined
06:54 Koterpillar joined
06:55 path[l] joined
06:56 pleax joined
06:56 sanett joined
06:58 mda1 joined
06:59 zero_byte joined
07:01 Koterpillar joined
07:02 uncertainty joined
07:03 s4kashya3 joined
07:03 edsko joined
07:06 Starfflame joined
07:07 louispan joined
07:08 vlatkoB_ joined
07:10 takle joined
07:11 quchen joined
07:12 makufiru joined
07:12 yamadapc joined
07:14 obadz joined
07:14 hdeshev joined
07:17 ericsagnes joined
07:18 Ayey_ joined
07:22 systadmin joined
07:22 takuan joined
07:23 yamadapc joined
07:23 hexagoxel joined
07:24 Xanather joined
07:25 hackebeilchen joined
07:27 Kuros` joined
07:28 Deide joined
07:28 eacameron joined
07:31 SurveyBot joined
07:32 <SurveyBot> please fill out this survey
07:32 <SurveyBot> #haskell
07:32 <SurveyBot> https://docs.google.com/forms/d/e/1FAIpQLSeTDkfDkBGHnoY_hfxwCZjJzxntfXZeY4SKqPHlIZT5bz2jQQ/viewform?usp=sf_link#responses
07:33 SurveyBot left
07:33 mutsig joined
07:33 path[l] joined
07:34 <CoconutCrab> f the sandbox didn't have so many holes in it Java applets were arguably better for webapps than the unholy mess we've cobbled together over the last ten years to replace them.
07:34 <CoconutCrab> sorry
07:34 <CoconutCrab> wrong tabs
07:34 raichoo joined
07:37 takle joined
07:37 qqwy joined
07:37 sam_ joined
07:39 Ayey_ joined
07:39 Sampuka joined
07:39 blueonyx joined
07:39 _sg joined
07:39 sobaken joined
07:39 fotonzade joined
07:40 sobaken joined
07:42 curious_corn joined
07:42 thc202 joined
07:43 yamadapc joined
07:43 takle joined
07:45 zeroed joined
07:46 tomphp joined
07:46 tfc joined
07:46 uglyfigurine joined
07:48 edsko joined
07:48 ahri joined
07:49 ramzifu joined
07:50 takle joined
07:51 <halogenandtoast> Anyone have a good suggestion for a weekend Haskell project?
07:51 Mortomes|Work joined
07:52 Ayey_ joined
07:53 alfredo joined
07:53 yamadapc joined
07:53 <blueonyx> halogenandtoast: projecteuler.net
07:54 <ahri> i have a failing hspec test, and a vague understanding of setting breakpoints in ghci. i'd like to take these bits of knowledge and use them in unison. i loaded my src, then the test spec, set my breakpoints, and ran "main", but the unit test fails without hitting my breakpoint. any ideas?
07:54 <halogenandtoast> blueonyx: those are kind of boring, I was looking for something a bit more practical. For example: Write a Sokoban clone, etc.
07:54 <blueonyx> halogenandtoast: make compiling couchdb-conduit great again
07:54 <blueonyx> write a sokoban clone :>
07:54 <halogenandtoast> I did already
07:54 <halogenandtoast> 3 times
07:54 Laing joined
07:55 <blueonyx> i'm working on the ftdi lib to build a weatherstation showing temperatures/date/internet bandwidth usage
07:55 <blueonyx> using an lcd graphics board and a ftdi usb chip
07:56 <blueonyx> there are so many games one could try to implement or solve in haskell
07:56 <blueonyx> or write a bittorrent client
07:56 <blueonyx> or something to do with monero
07:56 faberbrain joined
07:56 <blueonyx> or some rl puzzle
07:56 <halogenandtoast> a bittorrent client could be an interesting project.
07:57 <halogenandtoast> I know very little about it.
07:57 <halogenandtoast> Thanks blueonyx
07:57 pleax joined
07:58 Rodya_ joined
07:59 eacameron joined
07:59 <blueonyx> great way to get into bytestrings and networking or conduit or lenses as well
08:00 <halogenandtoast> All things I want to get better at. And it will be a cool app if it works when I'm done.
08:00 s4kashya3 joined
08:00 <halogenandtoast> Can download some NASA images.
08:00 TheEpsylon joined
08:00 <blueonyx> hehe
08:00 sidei joined
08:01 razi1 joined
08:02 osa1 joined
08:02 osa1 joined
08:04 kritzcreek_ joined
08:04 guiben joined
08:05 sjpet joined
08:07 marcopullo joined
08:07 systadmin joined
08:07 takle joined
08:09 andyo joined
08:10 pfedpy joined
08:10 Iskarlar joined
08:11 quchen joined
08:12 AleXoundOS joined
08:13 mattyw joined
08:13 albertid joined
08:14 tromp joined
08:14 raichoo joined
08:15 zcourts_ joined
08:15 mohsen_ joined
08:16 <sjpet> Good morning. Anyone in here familiar with HSCurses?
08:16 mkoenig joined
08:16 takle joined
08:16 eacameron joined
08:18 ragepandemic joined
08:18 ramzifu joined
08:20 tomphp joined
08:22 petervaro joined
08:22 bluepixe1 joined
08:23 takle joined
08:24 yellowj joined
08:25 t0by joined
08:25 t0by joined
08:27 raichoo joined
08:27 meff` joined
08:30 sausy joined
08:31 laz joined
08:32 uncertainty joined
08:32 xall joined
08:32 xmonader left
08:33 xmonader joined
08:33 bollu joined
08:35 <ahri> argh, after ":l src/MyModule.hs" then ":l test/Spec.hs" how can i set a breakpoint like ":break MyModule 310"? i get this error: module 'MyModule' is from another package; this command requires an interpreted module
08:35 <ahri> (in ghci)
08:35 suls joined
08:36 <sjpet> ahri: does ":l src/MyModule.hs test/Spec.hs" work better?
08:37 sobaken joined
08:38 ania123 joined
08:39 Miroboru joined
08:40 <halogenandtoast> sjpet: I've used the haskell ncurses package...
08:40 <ahri> sjpet: it works! i had no idea i could specify multiple modules with :load ! thank you
08:40 <ania123> I do not understant, why interpreter is machine undependent? a program language code is transformed into machine language is not?
08:40 <halogenandtoast> But not specifically HSCurses methinks.
08:41 <halogenandtoast> ania123: The interperter doesn't directly transform a provided program into the machine language of the system.
08:41 connrs joined
08:41 <halogenandtoast> It only executes already compiled statements.
08:42 <geekosaur> ania123, the interpreter produces bytecode for s imple virtual machine (like the JVM or CLR only much simpler)
08:42 <halogenandtoast> geekosaur: sometimes
08:42 <geekosaur> most of that bytecode references compiled libraries
08:42 <halogenandtoast> geekosaur: sometimes it just directly executes the AST
08:42 ccomb joined
08:42 <ania123> Haskell is interpreter or complier?
08:42 <geekosaur> both
08:42 <pacak> ania123: Can be both
08:42 <halogenandtoast> depends on how you run it
08:42 uncertainty joined
08:42 uglyfigurine joined
08:43 <halogenandtoast> Actually...
08:43 <halogenandtoast> Haskell is neither
08:43 <halogenandtoast> GHC is both an interpreter and compiler
08:43 <pacak> ghc is
08:43 <sjpet> halogenandtoast: I have an issue with the input queue I think. I am handling resizing by capturing sigwinch as in HSCurses.CursesHelper and it works mostly fine, except that if the first key pressed after window resize is a complex one, getch doesn't combine them. e.g. ArrowDown comes as \ESC [ B
08:43 <geekosaur> ghc has multiple backends, most of which compile in various ways (-fasm native backend, -fllvm produces LLVM IR and runs opt and llc on that) but also a bytecode backend used by ghci and to interpret Template Haskell splices
08:43 <osa1> mmm so I updated stack from 1.2 to 1.4 and my snapshots don't work anymore. I'm getting "symbol not found" errors during linking stage.
08:44 <ania123> assume haskell is only interpreter. AfterI install haskell on my pc, any program written in haskel is transformed in another form let assume to byte code. How ,y machine can udnerstand that byte code?
08:44 <geekosaur> hugs is purely an interpreter. jhc is a whole-program compiler/"transpiler" producing ANSI C. uhc is an alternative native-code compiler.
08:45 <ania123> byte code is Platform-independent?
08:45 <halogenandtoast> ania123: it can not
08:45 <geekosaur> (neither hugs nor jhc is under development any more. uhc still sees development but apparently it's mostly Utrecht CS students)
08:45 <sjpet> halogenandtoast: (there is also a non-critical issue that all ungetCh'd KeyResize come in at once along with whatever key is pressed after resize
08:46 <halogenandtoast> ania123: bytecode is interpreted usually by some VM packaged as an interpreter
08:46 <ania123> halogenandtoast: there should be smt which transforms byte codes into machine codes
08:46 <ania123> is not?
08:46 takle joined
08:46 ramzifu joined
08:46 <halogenandtoast> ania123: When I write an interpreter that has a byte code step here is what happens
08:47 <halogenandtoast> lex, tokenize, generate ast, convert to bytecode, interpret bytecode or output bytecode to be interpreted later.
08:47 <ania123> byte code is uniform?
08:47 <geekosaur> there is a bytecode interpreter to go with the bytecode compiler. it's not separate; "runghc" produces bytecode into memory and then runs the interpreter on it, "ghci" uses the bytecode compiler for expressions and then runs the interpreter on it.
08:47 <halogenandtoast> ania123: bytecode is implementation dependendent
08:47 <geekosaur> I',mm not sure the bytecode compile and interpret steps can even be separated in current ghc
08:47 <halogenandtoast> Meaning bytecode for the JVM (Java Virtual Machine) will only run on the JVM
08:47 yamadapc joined
08:48 <halogenandtoast> sjpet: I haven't messed with Sigwinch yet
08:48 <ania123> uh, not quite clear
08:48 <halogenandtoast> Do you have any example code I can try out?
08:48 <geekosaur> ghc's bytecode virtual machine is not a full or standalone implementation like JVM/CLR/beam
08:48 <ania123> JAVA-->byte code -->machine code
08:48 <halogenandtoast> ania123: no
08:48 <ania123> no?
08:48 <ania123> then how is?
08:48 <halogenandtoast> javac compiles your .java file to bytecode
08:48 <halogenandtoast> you run that bytecode with java
08:49 <geekosaur> javac produces byecode. you then run java or jre on that, which is the bytecode virtual machine
08:49 <halogenandtoast> If a system does not have the java runtime installed, then you will not be able to run it
08:49 <geekosaur> you can;t separate those steps with ghc
08:49 <ania123> aha
08:49 <geekosaur> similarly for erlang, you compile to beam bytecode and use beam to run that bytecode
08:49 <halogenandtoast> so as an example I could write a simple stack based language
08:49 zeroed joined
08:49 zeroed joined
08:49 <ania123> so, Java complier generates byte codes for java program?
08:50 <halogenandtoast> 1 means push 2 means pop 3 means add and 4 means print
08:50 <halogenandtoast> push takes an int
08:50 <geekosaur> (and you compile C# or F# or etc. to CLR bytecode which usually has an executable header, after the fashion of self-unzipping exe files on windows)
08:50 <halogenandtoast> so my "machine code" would be
08:50 tomphp joined
08:50 <ania123> so, Java complier generates byte codes for java program?
08:50 <halogenandtoast> 15163422
08:50 <geekosaur> yes, that is what .class files contain
08:50 <halogenandtoast> whuch would print 11
08:50 <halogenandtoast> *which
08:50 uncertainty joined
08:50 <ania123> halogenandtoast: so, Java complier generates byte codes for java program?
08:50 <halogenandtoast> but I have to write an interpreter that can understand that
08:51 takle_ joined
08:51 <geekosaur> there are disassemblers and such for those files that will show you the bytecode as individual "assembly language" instructions, and even assemblers to reconstitute the class file from that format
08:51 <halogenandtoast> ania123: from a perspective yes, java program is a bit ambiguous. In general we just refer to it as the JVM
08:51 <halogenandtoast> or Java Virtual Machine
08:52 <ania123> ok
08:52 <halogenandtoast> and the neat thing about the JVM is that other languages can target this
08:52 <halogenandtoast> they just generate the same bytecode
08:52 <halogenandtoast> for instance Clojure
08:52 <ania123> after byte code is generated JVM interpreter transform it to machine code is not?
08:52 <ania123> byte code --> machine code by JVM
08:52 <halogenandtoast> ania123: not exactly, the JVM itself is compiled for your machine
08:52 <geekosaur> (Android dev environments use that internally since they convert the JVM bytecode to Android bytecode for either the old Dalvik VM or the newer ART VM)
08:53 <halogenandtoast> so it has all these methods that are compiled already
08:53 <ania123> I am inetersted, what transforms byte code into machine code?
08:53 <halogenandtoast> when the runtime executes your program
08:53 <halogenandtoast> it calls these compiled methods
08:53 <ania123> Java program --> byte code by JVM
08:53 <halogenandtoast> it's not converted into machine code...
08:53 <ania123> this is clear
08:54 <ania123> now question, how machine code is udnerstand by my pc
08:54 <Hijiri> the machine code is in the JVM, it chooses which machine code to run based on the bytecode
08:54 <halogenandtoast> the JVM is compiled on your machine. It has a bunch of methods already compiled to machine code
08:54 <Hijiri> but it doesn't transform the bytecode to machine code in a way that is runnable on its own
08:54 <halogenandtoast> the bytecode is then read and just calls these methods
08:54 <halogenandtoast> the bytecode itself is never transformed
08:54 <Hijiri> except I think newer versions of the JVM do some JIT?
08:54 augur joined
08:54 <geekosaur> yes
08:55 <halogenandtoast> Hijiri: shhh that just confuses things.
08:55 <halogenandtoast> Sometimes we lie in order to obtain enlightenment
08:56 the|auriscope joined
08:56 <ania123> Hijiri: there can be infinite deferent machine codes, is not?
08:56 <Hijiri> ania123: I don't know what that means
08:56 louispan joined
08:56 <halogenandtoast> ania123: Do you know what machine code is?
08:57 takle joined
08:57 <ania123> machine code is combination of 0 and 1
08:57 <ania123> no?
08:57 <halogenandtoast> that's binary
08:57 <geekosaur> ania123, a virtual machine of this type is software reading the bytecode and dispatching to different functions
08:57 <halogenandtoast> you need a larger definition to describe machine code.
08:57 <geekosaur> you may be thinking of a different kind of virtual machine, for which the example is LLVM bytecode
08:57 yamadapc joined
08:58 pleax joined
08:58 <geekosaur> (which is never run directly but converted to native code by llc or lld)
08:58 <ania123> machine code for me is some program which machine can read
08:58 <geekosaur> well, slight lie there, llc reads textual LLVM IR
08:58 tomphp joined
08:58 <geekosaur> yes, why should that program not be a big loop that inteprets bytecode?
08:59 Rodenbach joined
08:59 systadmin joined
08:59 <ania123> complier transforms a guven program into machine code, that is clear
08:59 <geekosaur> sometimes
08:59 <halogenandtoast> ania123: machine is too generic.
08:59 Rodya_ joined
08:59 <halogenandtoast> what part of your machine?
08:59 <halogenandtoast> What part of your machine interprets the machine code
08:59 freusque joined
09:00 <ania123> now, what is not clear for me is, what interpreter dies? why it is platform undependent
09:00 piyush-kurur joined
09:00 <halogenandtoast> ania123: write one and find out
09:00 <halogenandtoast> ania123: https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours
09:01 marfoldi joined
09:01 <piyush-kurur> what is the status of backpack in GHC ? Is it implemented in 8.*
09:01 <geekosaur> piyush-kurur, coming in 8.2.1
09:02 <geekosaur> https://github.com/ezyang/thesis/releases
09:02 <piyush-kurur> geekosaur: thanks
09:03 <geekosaur> ania123, you can write a program that can read source code and evaluate it directly (many simple LISP and Scheme implementations)
09:03 <geekosaur> you can write a program that interprets an AST produced either by the same program or by something else
09:04 <geekosaur> you can write a program that reads and interprets bytecode in a big read/case loop
09:04 biglama joined
09:04 <geekosaur> all three of these can be portable because they read the same thing no matter what platform they are on
09:04 <ania123> geekosaur: compiler takes a humen readable code and transforms it to machine code
09:05 <halogenandtoast> ania123: sometimes
09:05 <geekosaur> you;ve said that multiple times
09:05 <ania123> I call machine code a code which can be read by machine
09:05 <geekosaur> you;ve been wrong the same number of times
09:05 <ania123> :)
09:05 <ania123> assume it does always like this
09:05 <halogenandtoast> ania123: machine code are CPU depdendent instructions which depend entirely on its architecture.
09:06 <geekosaur> or perhaps you need to go reeducate the folks who came up with java, erlang, python (can save and interpret bytecode), C#, F#, LLVM, ...
09:06 <ania123> ok
09:06 quchen_ joined
09:06 <ania123> it is mroe or less clear for me
09:06 <ania123> I fail to understand the deference
09:06 <ania123> between compiler and interpreter
09:07 <halogenandtoast> A compiler changes your program from one form to another.
09:07 <ania123> yes, I got it
09:07 <halogenandtoast> A interpreter take your program in a format usually written by a human and executes it.
09:07 <ania123> and it is clear for me
09:07 <geekosaur> ania123, these days the difference is small enough not to matter that much, to be honest. in 1970 it mattered
09:07 <halogenandtoast> compiler takes a file and produces a file
09:07 <ania123> what execution means?
09:07 <geekosaur> there are "hardware" implemntations of the JVM and BEAM, at least
09:07 <halogenandtoast> an interpreter takes a file and does what it says.
09:08 <ania123> aha
09:08 yamadapc joined
09:08 <bollu> geekosaur: any hardware implementations of STG?
09:08 <ania123> halogenandtoast: now my question is
09:08 <ania123> how it does?
09:08 <ania123> I mean, when compler does smt it should be udnerstandable by machine
09:09 <halogenandtoast> example: a file program.code has "print 'hello'" a compiler takes program.code and output program.exe an interpreter take program.code and prints 'Hello' to the screen.
09:09 <ania123> so, transitively ot should be converted to machine code
09:09 <ania123> is not?
09:09 <geekosaur> but no hardware that understands .pyo or llvm bytecode or etc. (yet? although the point of LLVM was to generate native code on the fly from bytecode quickly, so you could send your compiled program to any machine in a heterogeneous cluster and have it run)
09:09 dni joined
09:09 <geekosaur> ania123, what is so hard about the idea of a program that reads and does tings based on bytecode?
09:10 <ania123> interpreter take program.code and prints 'Hello' to the screen.
09:10 <geekosaur> there are programs that read your input and runs commands based on it (e.g. unix shells)
09:10 <halogenandtoast> geekosaur: it's easy to understand when you understand it, it's hard when you don't
09:10 <geekosaur> why can't they do the same with bytecode?
09:10 <ania123> to print Hello, it should be udnestand by machine in some form, is not?
09:10 <halogenandtoast> the interpreter, which has been compiled, has a method for printing text
09:10 <halogenandtoast> your bytecode or program when inspected, will call that method
09:11 <halogenandtoast> s/inspected/interpreted/
09:11 <halogenandtoast> the interpreter has been compiled to run specifically on your system
09:12 <ania123> i think , I see now
09:12 <halogenandtoast> As an example one clever way this has been done is to use a virtual machine
09:12 <halogenandtoast> which is basically a computer emulator
09:12 <halogenandtoast> so you basically write a system which acts like a computer
09:12 uncertainty joined
09:12 <halogenandtoast> so you can easily target it regardless of what platform it runs on.
09:13 <ania123> I see
09:13 <ania123> so
09:13 <halogenandtoast> In a way, bytecode can just be machine language for an emulated computer.
09:13 <halogenandtoast> and much like a CPU takes an instruction and does something with it
09:13 <halogenandtoast> so does the emulated computer
09:13 <geekosaur> bollu, I have a vague recollection of someone doing an FPGA implementation
09:14 grayjoc joined
09:14 <geekosaur> bollu, also see HaLVM
09:14 <ania123> halogenandtoast: when we write haskell program test.hs
09:14 <halogenandtoast> but instead of having hardware to perform the instruction, the emulated computer has precompiled instruction that target your current architecture.
09:14 <ania123> it is complaied to machine code?
09:14 <halogenandtoast> depends on what I do with it.
09:14 Rizy joined
09:15 <halogenandtoast> if I use runhaskell it is not
09:15 <halogenandtoast> if I load it into ghci it is not
09:15 <ania123> if u use runhaskell what will happen
09:15 <ania123> or if u load it with ghci
09:15 <halogenandtoast> sorry I don't have time to answer as I have a Japanese lesson.
09:15 takle joined
09:16 <ania123> ok. thank you!
09:16 <geekosaur> it generates and then runs bytecode
09:17 <geekosaur> let's try a simpler example since haskell compilers aren't very simple.
09:17 <geekosaur> I have a one-line program: PRINT "Hello"
09:17 mattyw joined
09:17 mda1 joined
09:17 <geekosaur> my compiler reads this and writes out bytecode: 01 05 48 65 6c 6c 6f 00
09:18 <geekosaur> I now run the interpreter on this bytecode.
09:18 yamadapc joined
09:18 <geekosaur> It reads 01 and knows that it is supposed to print a string, which is the next thing in the bytecode.
09:18 <geekosaur> Next it reads 05 which is the length of the string to read back
09:18 <geekosaur> Next it reads 48 65 6c 6c 6f. Now it has the string, and it calls its internal print routine on that string.
09:19 <geekosaur> And finally it reads 00, which tells it to exit.
09:19 <geekosaur> That is how a bytecode interpreter works
09:19 <ania123> very clear explanation
09:19 <ania123> thank you
09:20 <ania123> the interpreter comes
09:20 <geekosaur> The interpreter must be compiled (to machine code or whatever) on any machine you want to use it on. The *bytecode* it understands is the sam everywhere
09:20 <ania123> with haskell system
09:20 <geekosaur> *same
09:20 <ania123> is not?
09:20 <geekosaur> ghci comes with ghc, yes
09:20 <geekosaur> (in fact "ghci" is just a wrapper that runs "ghc --interactive")
09:20 Glooomy joined
09:21 <ania123> then it is not fully machine independent
09:21 <ania123> because
09:21 <ania123> every haskell system should depend to machine
09:21 <ania123> the one whiche cen be installed on mac can nto be installed on PC
09:21 <ania123> no?
09:22 <geekosaur> the programs that come with ghc are all native machine code, yes.
09:23 takle joined
09:23 <geekosaur> that does not mean they are incapable of interpreting
09:23 <geekosaur> you are confusing levels
09:23 <ania123> seems so :)
09:23 <geekosaur> you do not have to use a program that is itself interpreted, to interpret other code
09:24 <geekosaur> inf act you usually want the intepreter program to be native code
09:24 <geekosaur> but what it interprets does not have to be, and in fact usually is not, native code
09:24 eacameron joined
09:24 <geekosaur> it can be typed commands, or it can be bytecode like I described earlier
09:24 <ania123> ok, thanks
09:25 LeoVictor joined
09:27 xaviergmail_ joined
09:27 xall joined
09:27 <geekosaur> (there are interpreters that interpret native machine code though. valgrind is the best known one)
09:28 yamadapc joined
09:30 takle joined
09:30 piyush-kurur left
09:31 Grisha joined
09:31 Grisha left
09:32 <ania123> geekosaur, in the case when a compiler compails a program directly to machine code.
09:33 <ania123> what kind of code is generated ?
09:34 <geekosaur> that's actually soemwhat complex. most compilers go through various stages, only producing native code at the end
09:34 <geekosaur> with gcc you get gcc's internal representation (s-expressions, sort of), then that is converted to assembly language, then it runs "as" to produce machine code
09:35 hsk3 joined
09:35 <hsk3> Cale, hey
09:35 <geekosaur> with clang it produces LLVM IR, then runs llc to produce LLVM bytecode, then optionally runs lld to produce native machine code (this can be deferred to the end, either for cluster use or for LTO)
09:36 <geekosaur> ghc produces ghc core, then STG, then cmm, then either LLVM IR or native machine code or ghc's bytecode
09:36 bollu joined
09:37 <hsk3> I understand it's good practice, for if-then-else, to put then-else at a deeper column than if.
09:37 <hsk3> Is it similarly good practice, for let-in, to put in at a deeper column than let?
09:37 gregman_ joined
09:37 <geekosaur> (cmm is essentially a simplified dialect of C intended as a compiler intermediate language. STG is a representation of an evaluation graph; see Simon Peyton Jones' STG paper for details)
09:38 <geekosaur> hsk3, it is
09:38 mkoenig joined
09:38 tomphp joined
09:38 yamadapc joined
09:38 balor joined
09:39 <geekosaur> in particular, layout can become confused if you indent to the same level (the DoAndIfThenElse extension relaxes this specifically for if/then/else in "do", but that does not help if you use them in "let" or "case" or other layout-inducing elements)
09:39 plutoniix joined
09:39 Iskarlar joined
09:39 <hsk3> geekosaur I understand that "let", "do", "of", and "where" are layout keywords. Is "in" also a layout keyword?
09:40 <geekosaur> no
09:41 <geekosaur> the bindings in let ... in induce layout, so you can bind more than one name either by using explicit braces and semicolons or by indentation. the "in" has following it a single expression, so it doesn't need layout.
09:41 sobaken joined
09:42 <hsk3> so, dude change your nickname :S
09:42 <geekosaur> ?
09:42 <hsk3> "so" is highlighting in my irc client because of this dude with this nickname lol
09:42 <hsk3> no big deal
09:43 whiteline joined
09:44 brynedwards joined
09:46 <hsk3> geekosaur, so is this https://paste.ee/p/Su7Lj better than this https://paste.ee/p/YE0LU ?
09:47 <zaquest> are IO ops on Handle thread safe with line/block buffering on?
09:47 <zaquest> in a sense that they won't split lines
09:47 takle joined
09:48 <ahri> i'm considering the architecture of a game i'm writing, and i need a way to randomly generate stuff. however i also like the clean world of pure functions, especially for testing - i.e. it can't be random in tests otherwise i can't easily make assertions. i don't really know how i can achieve this. how are these problems solved in haskell?
09:48 yamadapc joined
09:48 <ahri> so far all of my code is completely devoid of any IO
09:48 <suppi> ahri: you make a random seed in IO
09:49 <hsk3> ahri pseudo-random
09:49 <geekosaur> zaquest, buffering is process level, because Handles are process level
09:49 <suppi> and pass it to the pure function to use and create the world
09:49 <geekosaur> so threads operating on the same Handle will interleave
09:49 <ahri> suppi: so my tests would use the same seed every time
09:50 mmn80 joined
09:50 cschneid_ joined
09:50 <suppi> ahri yes
09:50 <geekosaur> hsk3, what you wrote will work either way. if you were to use that inside the bindings of another let, or in a do, the second one would throw an error
09:51 <hsk3> geekosaur okay, but even if both work here, the former is still better practice?
09:51 <geekosaur> because the "in" would be interpreted as separate from your "let" and processed as part of the outer layout
09:51 halogenandtoast joined
09:51 <geekosaur> it is because it works consistently
09:51 <geekosaur> the second one will fail under some circumstances, as I described
09:51 <suppi> you don't even need the seed to be random :) then you always get them same generated world
09:52 the|auriscope joined
09:52 <geekosaur> basically it's easier to stick to something that always works instead of needing to adjust the indentation depending on where you're writing it
09:52 <ahri> suppi: the only random thing is whether a powerup is dropped. it would be nice if in the test i can make it clear that a powerup of type X _will_ drop, rather than experimenting and then seeding with 1234 because it happens to get the behaviour i want; do you think there's a simple way to achieve this?
09:52 <geekosaur> nobody likes needing to remember special cases
09:53 <suppi> ahri pass true or false?
09:53 <hsk3> geekosaur cool. yet one question: isn't it pity that I have to break my "tab" = 4 spaces convention? Suddenly, I'm using only 2 spaces here. I have to pick 1, 2, or 3.
09:53 <hsk3> Unless I do https://paste.ee/p/Ftx8K or https://paste.ee/p/3j3YP which both look bad.
09:54 takle joined
09:54 <suppi> pick a number, if it's even pass true if not false, etc.
09:55 jhrcek joined
09:55 <geekosaur> hsk3, could just indent by 1 space there. (that's my usual convention for let/in, because the *end* of "let" and of "in" then line up)
09:55 CurryWurst joined
09:55 FullyFunctional joined
09:57 <hsk3> geekosaur ok i'll do that. still pity. i was hoping to consistently stick to 4 spaces or zero spaces.
09:57 <hsk3> oh well
09:57 <ahri> suppi: hm, ok, i'll have a play with actually generating random numbers and bear this in mind. thanks!
09:57 <geekosaur> (equivalently, the bindings line up with the expression that uses them)
09:58 faberbrain joined
09:58 balor joined
09:58 <geekosaur> I actually vary a bit from something that strict; not just this case, but also I tend to indent "where" 2 spaces so the bindings attached to it are indented 4 spaces
09:58 <geekosaur> foo\n where\n bar = ...
09:58 <suppi> ahri good luck :)
10:00 Rodya_ joined
10:00 takle joined
10:00 pleax joined
10:00 cur8or joined
10:01 <hsk3> geekosaur looks good actually
10:01 <hsk3> Thank you
10:02 xtreak joined
10:02 harfangk joined
10:03 <halogenandtoast> back, did we solve the compiler/interpreter thing?
10:03 zar joined
10:04 <halogenandtoast> geekosaur: I indent the same.
10:04 <halogenandtoast> I haven't found any specific guidelines for indentation though.
10:04 <halogenandtoast> Or even newlines. I know some people have two newlines between function definitions.
10:04 Rizy_ joined
10:04 Levex joined
10:04 <zaquest> geekosaur, sorry i don't understand what does it mean that Handles are process level?
10:05 <geekosaur> zaquest, it mans they do not belong to threads, they belong to the entire process
10:05 takle joined
10:06 <geekosaur> this is necessary because on all operating systems ghc runs on and compiles for, the underlying OS construct is process level not thread level
10:06 <geekosaur> you cannot give a thread its own standard input, for example
10:07 tomboy64 joined
10:07 <geekosaur> (standard input being defined as OS file descriptor 0 on both POSIX and Windows)
10:07 Michu joined
10:08 phaji joined
10:08 oish joined
10:08 yamadapc joined
10:09 ub joined
10:12 takle joined
10:12 eugenez joined
10:14 CurryWurst_ joined
10:14 <Maxdamantus> Well, you could get into a different situation in Linux if you pass the right integer to SYS_clone
10:15 fendor joined
10:16 <eugenez> Hello, friends! Let's say I want to programm function that returns 2*x+1. I don't want to make it func x = 2*x +1, want it to be fancy func = ... I tried multiple variants, but the only one that worked ended up being func = (+) 1 . (*) 2, whick is less than readable and is very far from original math function. Can I get something like func = 2*<*> + 1 working?
10:17 jaspervdj joined
10:17 sanett joined
10:18 uncertainty joined
10:18 <halogenandtoast> eugenez: ... maybe f = (1 +) . (2 *)
10:19 <halogenandtoast> is a little easier to read
10:19 <halogenandtoast> and (1 +) is just succ
10:20 <eugenez> halogenandtoast: Thank you!
10:20 <halogenandtoast> np.
10:20 pleax joined
10:20 takle joined
10:20 <geekosaur> Maxdamantus, yes, I was leaving clone out of it because I'd kinda prefer to forget LinuxThreads ever existed. As would almost everyone else that had to suffer through them. :)
10:23 esad joined
10:24 <zaquest> geekosaur, ah, that, i see, thanks.
10:25 dron2065 joined
10:26 takle joined
10:27 dron2065 left
10:28 dron2065 joined
10:28 mkoenig joined
10:28 fotonzade joined
10:29 locallycompact joined
10:32 dron2065 left
10:34 Koterpillar joined
10:36 zero_byte joined
10:36 uncertainty joined
10:37 dron2065 joined
10:39 Cnnnll joined
10:39 nilof joined
10:39 oisdk joined
10:41 sidei joined
10:41 marr joined
10:42 benl23 joined
10:44 sphinxo joined
10:47 geekosaur joined
10:48 rcat joined
10:48 ericsagnes joined
10:49 dhil joined
10:51 tabaqui1 joined
10:52 merijn joined
10:52 the|auriscope joined
10:53 takuan joined
10:55 augur joined
10:58 sdothum joined
11:00 Rodya_ joined
11:00 JagaJaga joined
11:01 desktop joined
11:02 Snircle joined
11:03 kuribas joined
11:04 merijn joined
11:04 netheranthem joined
11:06 Sampuka joined
11:06 ajhager joined
11:11 hexagoxel joined
11:11 coot joined
11:13 Iskarlar joined
11:16 sanett joined
11:17 systadmin joined
11:21 jgertm- joined
11:23 christiandiloren joined
11:23 tommd joined
11:24 oleks_ joined
11:24 <christiandiloren> I'm getting this error and I am not quite sure what is wrong: Pattern syntax in expression context:
11:24 <christiandiloren> m -> manUsername m == u && manPassword m == p
11:25 <christiandiloren> It seems to be saying that I have some pattern matching syntax in here but I don't see it.
11:25 <christiandiloren> Any ideas?
11:25 pleax joined
11:26 yamadapc joined
11:27 <zaquest> ok, sorry, but i have to ask again :) if i have several threads that do hPutStrLn on a handle will the lines from different threads split each other? is it the same for bytestring's IO operations? does the length of the strings matter? what about hPutStr with manual newlines at the end (it appears to me that putStrLn acquires handle's mvar at least twice from looking at code in base)? i really dont want that manual synchronization if i can avoid it :)
11:27 <brynedwards> The 'm -> ...' is syntax used for pattern matching after a case statement
11:27 <brynedwards> Did you mean to do a lambda? add a \ before the m so it's \m -> manUsername m ...
11:27 lkb joined
11:28 lkb joined
11:28 lukaramu joined
11:28 <christiandiloren> Oh, doh! You would think I would have seen that! Thanks brynedwards.
11:28 <brynedwards> =)
11:29 oleks joined
11:29 lkb joined
11:30 luknerw joined
11:32 luknerw joined
11:33 lkb joined
11:33 geekosaur joined
11:35 <zaquest> TMR issue 19 has an article about mighttpd that says it's safe and lines won't be split. my tests show that lines are not split but that might be just luck...
11:36 <pacak> zaquest: With hPutStrLn you'll get a mix of those.
11:36 <pacak> Mixed letters.
11:36 <pacak> You can make them in sync by putting your handle into MVar
11:36 geekosaur joined
11:36 <Athas> zaquest: it is probably just luck. IIRC, Michael Snoyman wrote a blog post recently about this issue (and why it should be changed to be line-based atomicity). I'll see if I can get it up.
11:36 <pacak> ByteString or Text will give better results
11:36 <kuribas> zaquest: https://www.reddit.com/r/haskell/comments/5db3lj/haskells_missing_concurrency_basics/
11:36 malt3 joined
11:37 <Athas> Yes, that one.
11:37 <kuribas> The opinions seem to vary on that one.
11:38 luknerw joined
11:38 <Athas> Right, I also disagree myself.
11:38 <Athas> Synchronisation ought to be explicit.
11:38 plugin joined
11:39 czeq joined
11:40 <geekosaur> zaquest, it locks the Handle only long enough to manipulate the buffer. the problem there is that putStr/hPutStr becomes a series of putChar/hPutChar each of which locks the Handle for one character
11:40 coot joined
11:41 <Athas> es
11:41 sidei joined
11:41 <geekosaur> zaquest, the usual way to handle this is to have a dedicated thread to write output to a Handle, and feed it chunks of the appropriate size (here, presumably lines) over a Chan (or maybe a bounded Chan, which you can find on Hackage)
11:41 bjz joined
11:42 JeanCarloMachado joined
11:43 stoopkid joined
11:44 djapo_ joined
11:44 <zaquest> geekosaur, i thought so from looking at the code, but i since it showed no signs of breaking lines i thought i missed something. also i might be wrong, but it seems that bytestring's hPut* functions are implemented differently and should be thread safe for at least lines <1024, do you know anything about it?
11:44 <geekosaur> not offahnd, I was speaking of System.IO
11:45 <geekosaur> I still would not want to trust it, although you seem to really want to trust it
11:45 <Athas> zaquest: I am quite sure that is an implementation detail.
11:45 <geekosaur> either you want to trust it that badly and therefore should just trust it and find out yourself, or you require correctness more than you require trust and you implement it safely to begin with
11:46 portu joined
11:48 AntiSpamMeta1 joined
11:48 Einwq joined
11:48 <systadmin> helo
11:51 systadmin joined
11:52 djellemah joined
11:53 <zaquest> Ok, thank you guys. Seems like that post mentions all I wanted to know. It just the knowledge that there's already an MVar in there that doesn't provide any usable thread safety it bugs me :)
11:53 <systadmin> How does the derive function work?
11:54 the|auriscope joined
11:54 louispan joined
11:54 <liste> systadmin: what derive function?
11:54 <systadmin> liste: `derive (Ord)` something like that
11:55 <liste> systadmin: oh, the deriving mechanism
11:55 <systadmin> yep
11:55 <liste> http://stackoverflow.com/q/3864647
11:55 <systadmin> thank
11:56 <liste> also
11:56 <liste> https://www.haskell.org/onlinereport/derived.html#derived-appendix
11:56 coot joined
11:57 <geekosaur> zaquest, it does provide thread safety, insofar as two threads cannot modify the buffer associated with the Handle at the same time (this is necessary or flushing the buffer could write garbage or even dump core). It has nothing to do with output synchronization, nor does it have anything to do with synchronization of independent write operations
11:58 Iskarlar joined
11:58 <systadmin> my head is melting on comprehending how deriving works
11:58 <geekosaur> C does this also but is also more prone to treat a single write-string operation as a single buffer manipulation (provided there is room in the buffer); System.IO doesn't have that optimization
11:58 <geekosaur> (perhaps it should...)
11:59 <liste> systadmin: it's implemented by the compiler
11:59 <liste> systadmin: so basically if you do data Foo = .. deriving (Eq) the compiler generates an Eq instance
11:59 <geekosaur> systadmin, currently it's wired into the compiler. the Report typeclasses have formulaic deriving expansions that ghc mostly follows as specified.
12:00 faberbrain joined
12:00 <systadmin> But what if I'm deriving more than one typeclass?
12:00 <geekosaur> 8.2.1 will have at least part of deriving strategies, which are intended to enable user-defined derivings
12:00 <liste> systadmin: then the compiler generates an instance of each you derive
12:00 mattyw joined
12:00 ajhager joined
12:01 Rodya_ joined
12:01 halogenandtoast joined
12:01 moongazer joined
12:02 mattyw joined
12:03 sdothum joined
12:03 [scrooge] joined
12:03 <zaquest> geekosaur, yes, i understand that it's for buffer access synchronization, however since you still get garbage-ish output unless you use more synchronization it doesn't seem useful. i don't know anything about dump core case though.
12:04 uncertainty joined
12:04 <geekosaur> then that's your problem :)
12:05 <geekosaur> the usual I/O buffer implementation has pointers into what may be either a fixed or ring buffer. while the buffer is being updated, one or more of the pointers may not be valid as seen by other threads
12:06 <geekosaur> so the MVar ensures that any other threads see a consistent buffer state
12:07 <geekosaur> that is *all* it does. I don't know offhand if this can actually cause a core dump in ghc, although various things I have traced through seem to think the consequences of not having that mutex are fairly severe
12:08 <geekosaur> in at least some glibc versions, the corresponding stdio+iostreams buffers *can* cause core dumps without a mutex protecting other threads from seeing an inconsistent buffer state
12:09 <zaquest> geekosaur, if i understand things correctly it is enough to know the start of the buffer and it's length to not violate memory access, and both are constant after the buffer's allocation. so the only reason for that lock that i can see is too make the garbage less trashy :)
12:10 silentcontrib joined
12:10 Einwq joined
12:11 _sg joined
12:13 danza joined
12:13 <geekosaur> zaquest, you do not understand things correctly unless you go through GHC.Handle source and probably parts of the RTS. or every relevant comment therein was outright lying.
12:13 <geekosaur> " various things I have traced through seem to think the consequences of not having that mutex are fairly severe" does not mean "oh, it can interleave output"
12:13 mutsig joined
12:13 <geekosaur> the implication is crashes or deadlocks
12:14 aib joined
12:14 fendor joined
12:15 HoierM joined
12:15 sanett joined
12:16 Apocalisp joined
12:17 xaviergmail_ joined
12:18 cfricke joined
12:19 sanett joined
12:25 <* geekosaur> wonders if his connection has stabilized yet :/
12:25 pleax joined
12:30 balor joined
12:33 benoliver999 joined
12:33 <zaquest> geekosaur, well, yes, one always can introduce crashes and deadlocks. but is it in general true that no correct (meaning garbage output is correct :)) implementation is possible w/o that lock? or is it just how ghc's runtime is implemented? am i missing something again?
12:33 <geekosaur> sorry, I guess I have to go read the whole implementation then?
12:33 <geekosaur> so I can answer yoi?
12:34 <geekosaur> but it is clear that you really really badly want to believe that the only possible issue is your output is not interleaved and ghc has a mandate to insure this for you
12:34 lep-delete joined
12:34 <geekosaur> and that there is no possible reason that not-crashing-or-deadlocking is the reason it would use an MVar
12:35 daniel-s joined
12:35 <geekosaur> so I can only say: go ahead and do what you want, since you know that what you want it to do is the only behavior it can possibly have
12:36 Ferdirand joined
12:36 sidei joined
12:36 pleax joined
12:37 esad joined
12:37 <zaquest> no, sorry, i didnt mean that. i just wonder if you know of any theoretical limitation that would prevent an implementation w/o the lock. sorry for bothering you.
12:38 <geekosaur> well, as you have determined that the reason I gave cannot possibly exist...
12:38 <geekosaur> again: since you know better, please go ahead and do whatever
12:38 silver joined
12:39 <geekosaur> I will try to forget the comments that say that it is for correctness of buffer management, or try to reinterpret those comments as you have informed me that they must mean something else.
12:39 <zaquest> my english isn't good but i don't think i said something similar...
12:40 mkoenig joined
12:40 mada joined
12:40 <geekosaur> what you said is you believe the only possible reason for MVar locking is to ensure that sequencing by lines occuirs
12:40 <geekosaur> because that si what uyou want
12:41 ajhager joined
12:41 <geekosaur> which also invalidates anyone that is working with, say, a binary packet protocol, but I guess they don't matter either?
12:41 <geekosaur> in any case you are telling me you are convinced that the locking must support your specific use case
12:42 <geekosaur> and no other makes any sense at all
12:50 mizu_no_oto_work joined
12:50 codesoup joined
12:52 hits1911 joined
12:53 <halogenandtoast> Does anyone know if intero mode (or haskell mode) has a way to unindent after I double return?
12:53 the|auriscope joined
12:56 hits1911 left
12:56 Iskarlar joined
12:56 unK_ joined
12:56 <zaquest> geekosaur, no. why? what makes you think so? i wouldn't ask advice if i thought i know better. and i don't mean lines only (it's just my current case, which i figured and thanked you all for help), i mean atomicity of writing functions in general (hPut* in case of haskell). and since the point when i figured my case i was just wondering if it's possible to do it w/o the lock in general case (not only in ghc, or even haskell, which i tried to indicate
12:56 <zaquest> by repeatedly saying "in general")
12:56 eschnett joined
12:57 <geekosaur> zaquest, every time I tried to explain what the locks you were doing, you either declared it not relevant or apparently "wrong" because only your desired behavior is correct
12:57 <geekosaur> I'm done. Do whatever.
12:57 <geekosaur> If it breaksd, since you know what it Should Do(tm), report a bug against base.
12:58 dcoutts joined
12:58 dcoutts joined
12:58 <geekosaur> Stop bugging me because you don't seem to think anything I say is relevant unless it agrees with what you want.
13:00 Yuras joined
13:00 eacameron joined
13:00 merijn joined
13:01 systadmin joined
13:01 faberbrain joined
13:01 <Cale> Sorry, what was the issue here?
13:02 Rodya_ joined
13:03 Philonous joined
13:05 ccomb joined
13:05 asmyers joined
13:07 mmhat joined
13:07 zero_byte joined
13:08 MarioBranco joined
13:08 grayjoc joined
13:08 Ferdirand joined
13:09 <halogenandtoast> Cale: probably easiest just to read the log and search for zaquest
13:09 <halogenandtoast> The initial question was "are IO ops on Handle thread safe with line/block buffering on?"
13:10 <Cale> ah, yes they are, though you might not like the result.
13:10 <halogenandtoast> the follow up was a bit more complex
13:10 <halogenandtoast> "ok, sorry, but i have to ask again :) if i have several threads that do hPutStrLn on a handle will the lines from different threads split each other? is it the same for bytestring's IO operations? does the length of the strings matter? what about hPutStr with manual newlines at the end (it appears to me that putStrLn acquires handle's mvar at least twice from looking at code in base)? i really
13:10 <halogenandtoast> dont want that manual synchronization if i can avoid it :)"
13:10 <zaquest> Cale, mine? my original question was about thread safety of operations on Handle (in particular about when they break lines) and whether I need explicit synchronization, but this is long solved. After that I was just wondered if it's (theoretically) possible to implement non-crashing non-deadlocking write ops w/o the buffer lock.
13:10 <Cale> You shouldn't really write to the same Handle from different threads, because while nothing will actually go wrong, you'll just make yourself a mess of the output.
13:10 <halogenandtoast> not my question
13:12 <Cale> Well, unless you do extra synchronisation -- but the easiest thing to do is just to make a simple thread whose sole job is to write things to the Handle, and then have other threads send it chunks of data to write.
13:12 <halogenandtoast> zaquest: I don't know of any language that allows you to write to the same handle in such a way that output might not overlap without some locking mechanism
13:12 <halogenandtoast> or maybe mailboxes in Erlang...
13:12 <halogenandtoast> What Cale is describing sounds like mailboxes in erlang :p
13:12 <halogenandtoast> to me at least
13:13 pleax joined
13:13 freusque joined
13:13 uncertainty joined
13:14 <halogenandtoast> This seems very reminiscent of the dining philosophers.
13:14 <merijn> Although doing manual locking in Haskell for this would be pretty easy too
13:14 <halogenandtoast> nvm, don't know why I said that.
13:14 <merijn> But the single thread per handle is easiest
13:14 <Cale> Well, kinda. It's simpler than that. You just have a Chan for a single type of message -- perhaps Text or ByteString or whatever it is that you want to write
13:15 <merijn> Cale: But then you have no way to close said channel to indicate being done, unless you use TChan
13:15 <merijn> Although I actually have a working closable channel with some other nice properties, but I'm still working on benchmarking it, as criterion isn't particularly good at these kinda benchmarks
13:16 <Cale> There are some other options there if you need that.
13:16 <merijn> So I'd have to fix criterion first >.<
13:16 <merijn> Thirty yaks later...
13:16 <Cale> Yeah, there's a package with a bunch of different variations on channels
13:16 <Cale> including closeable ones
13:16 <merijn> Cale: Most of the ones I've found are not as good as they could be
13:16 esad joined
13:16 <Cale> https://hackage.haskell.org/package/stm-chans
13:17 <robertkennedy> If lambdabot interpreted its own output, can you think of a command to get it to loop?
13:17 <merijn> The STM ones are ok, but often want non-STM channels :)
13:17 PSoBI joined
13:19 <halogenandtoast> > (putStr . ap (++) show) "> (putStr . ap (++) show) "
13:19 <zaquest> yes, thank you guys. i actually used all these approaches, including stm-chans before. it's just i read in TMR issue 19 that Handle's buffer is MVar protected and that they don't use explicit synchronization in mighttpd for logging. So I decided to ask how reliable this is. Turned out it's more an implementation detail of bytestring package than a guarantee. After that I just wondered about the destination of Handle's buffer MVar and whether it is
13:19 <zaquest> absolutely necessary to have a non-crashing buffering in general case or it's just GHC's implementation that needs it.
13:19 <lambdabot> <IO ()>
13:19 esad joined
13:20 <zaquest> necessary to have it for *
13:21 sanett joined
13:21 ajhager joined
13:21 <robertkennedy> > ap (++) show "> ap (++) show"
13:21 <lambdabot> "> ap (++) show\"> ap (++) show\""
13:21 <robertkennedy> Nice
13:23 doodlehaus joined
13:24 tommd joined
13:25 balor joined
13:25 <halogenandtoast> lamdbabot is just too smart
13:25 sidei joined
13:25 cpennington joined
13:25 <merijn> halogenandtoast: Mostly lambdabot has been tried and tested by hundreds of people over years, trying to find ways to break it ;)
13:26 contiver joined
13:26 zero_byte joined
13:26 zar joined
13:26 animated joined
13:28 zariuq joined
13:28 <halogenandtoast> > ap main getLine
13:28 <lambdabot> error:
13:28 <lambdabot> • Variable not in scope: main :: IO (String -> b)
13:28 <lambdabot> • Perhaps you meant ‘min’ (imported from Data.Ord)
13:28 <halogenandtoast> I'm not very creative
13:29 <halogenandtoast> I am surprised that there is no main though
13:30 <liste> lambdabot can't do IO
13:30 <halogenandtoast> That definitely solves a lot of problems
13:31 <Cale> > getLine
13:31 <lambdabot> <IO [Char]>
13:31 dsh joined
13:33 esad joined
13:34 <ski> @help run
13:34 <lambdabot> run <expr>. You have Haskell, 3 seconds and no IO. Go nuts!
13:34 sanett joined
13:34 lukaramu_ joined
13:35 PC-PC joined
13:35 DataComputist joined
13:35 Kreest__ joined
13:35 PennyNeko joined
13:35 DataComputist joined
13:36 DataComputist joined
13:37 bennofs joined
13:38 dcoutts joined
13:38 dcoutts joined
13:38 <Cale> > text$ap(++)show"> text$ap(++)show"
13:38 <lambdabot> > text$ap(++)show"> text$ap(++)show"
13:38 <Cale> A little closer ;)
13:38 ystael joined
13:40 ChristopherBurg joined
13:40 dcoutts joined
13:40 dcoutts joined
13:41 <halogenandtoast> text$ap(++)show "> text$ap(++)show "
13:42 <halogenandtoast> > text$ap(++)show "> text$ap(++)show "
13:42 <lambdabot> > text$ap(++)show "> text$ap(++)show "
13:42 <halogenandtoast> I assume you'd want the spaces
13:42 rekahsoft joined
13:42 <halogenandtoast> > text$ap(++)show "\b> text$ap(++)show "
13:42 DaGabKing joined
13:42 ogrady joined
13:42 <lambdabot> > text$ap(++)show "\b> text$ap(++)show "
13:45 <ogrady> http://lpaste.net/353594 I feel like this should be a one-liner. But I can't seem to figure out the right way to bind the result of `somethingMonadic` while returning.
13:45 xall joined
13:46 fendor joined
13:46 <halogenandtoast> maybe f (foo t) = somethingMonadic t >>= (MyMonad.return . Bar)
13:47 meba joined
13:47 <lyxia> Why is it MyMonad.return rather than return
13:47 <lyxia> Do you also have MyMonad.fmap? fmap Bar (somethingMonadic t) ?
13:47 cyborg-one joined
13:47 mkoenig joined
13:47 <halogenandtoast> yeah I agree it should just be return...
13:48 <ogrady> lyxia: it could just be return as well, I guess.
13:48 crobbins joined
13:48 <halogenandtoast> so: f (Foo t) = somethingMonadic t >>= (return . Bar)
13:49 <ogrady> Ah, that workd, great. Thank you. :)
13:49 MarioBranco joined
13:49 <halogenandtoast> No problem
13:50 <lyxia> m >>= return . f should be equivalent to fmap f m
13:50 <ogrady> I am fairly new to haskell and I was under the impression that qualifying functions is good style. Therefore the MyMonad.return. Is that not the case?
13:50 <halogenandtoast> so f (Foo t) = Bar <$> somethingMonadic t
13:50 BartAdv joined
13:51 <halogenandtoast> ogrady: I would not qualify in that case
13:51 <Rotaerk> even if you do qualify it, wouldn't the qualification be Control.Monad.return
13:51 <halogenandtoast> Rotaerk: not if he did import qualified Control.Monad as MyMonad
13:51 <c_wraith> ogrady: anyway, qualification doesn't work like that. You qualify things with the module they are defined in, and return is defined as part of the Monad class, not your instance
13:51 tommd joined
13:52 <Rotaerk> oh, I figured MyMonad was a particular monad instance
13:52 <ogrady> Ah, I see. I was already confused how a "thing" I have specified instances of different monads for knows "whos" return to call.
13:52 Gurkenglas_ joined
13:53 Fallenwood joined
13:53 the|auriscope joined
13:53 <halogenandtoast> ogrady: welcome to type classes
13:53 <ogrady> Coming from OOP, in case it wasn't obvious. :)
13:53 <halogenandtoast> ogrady: Ah this is a good test, I'm writing a talk called Haskell for Rubyists
13:54 <halogenandtoast> and step 1) is to explain a little math rules and step 2) is to explain type classes
13:54 <halogenandtoast> then build up Functor, Applicative, and Monad
13:55 mkoenig joined
13:55 <halogenandtoast> So I guess the question is... do you understand type classes?
13:55 <ogrady> I guess not.
13:56 eacameron joined
13:56 <halogenandtoast> So I guess an easy, yet great example is (==) since it's pretty easy to understand
13:56 <halogenandtoast> You could do 1 == 2 or "foo" == "bar" and it works
13:57 <halogenandtoast> but mathematically speaking, we can't have some function foo that takes inputs from different domains.
13:57 Glooomy joined
13:57 <halogenandtoast> so how does (==) even work?
13:58 balor joined
13:58 <ogrady> (I'm still with you, in case you're waiting for a response :) )
13:58 <halogenandtoast> Well in the OOP world, we could maybe do something with interfaces
13:58 <halogenandtoast> But in the functional world we essentially create a type class which allows us to defined a sort of interface
13:58 <halogenandtoast> for example
13:58 <halogenandtoast> class Eq a where
13:59 <halogenandtoast> (==) :: a -> a -> Bool
13:59 <eschnett> one could define
13:59 <halogenandtoast> So Eq is a type class that requires you to defined (==) for your instance of that type class
13:59 <halogenandtoast> to make an instance for YourClass
14:00 <clamchowder> can I ask an sml question here
14:00 esad joined
14:00 <halogenandtoast> instance Eq YourClass where
14:00 <clamchowder> Standard ML
14:00 <halogenandtoast> (YourClass anInt) == (YourClass anotherInt) = anInt == anotherInt
14:01 <halogenandtoast> so with that instance defined I can now use (==) with something of type YourClass
14:01 <halogenandtoast> If you do :i Eq in ghci you can see a bunch of things have an instance defined already
14:01 <ogrady> Yes, that needed some getting used to syntactically for me. In OOP you define the datatype with all its operations. In Haskell you seem to define collections of operations and then bind them to whatever data you have.
14:02 mizu_no_oto_work joined
14:02 dbmikus joined
14:03 <halogenandtoast> ogrady: Sure it is a different syntax, but I think it makes sense over time.
14:03 Rodya_ joined
14:03 <halogenandtoast> It makes it easy to make existing classes adhere to your type classes
14:03 <nitrix> I'd word it as you define data types and regroup types with similar capabilities under a common type class that provides you with an interface for performing the supported operations on such types.
14:03 <ogrady> It does now more or less. But for me, coming from OOP, that made a big difference.
14:04 <halogenandtoast> ogrady: so the point here is that Monad is "just" a type class
14:04 <nitrix> Without type classes, you'd be writing a different function for each type and lose ad-hoc polymorphism.
14:04 psychicist__ joined
14:04 `^_^v joined
14:04 <halogenandtoast> and `return` is part of that interface
14:04 <nitrix> eqInt, eqBool, eqString ...
14:04 <halogenandtoast> so if you have something that is an instance of Monad, it will have defined its own return
14:04 <halogenandtoast> and the correct one will be used
14:05 blueonyx joined
14:05 <halogenandtoast> check out :i Monad in ghci for some useful insight
14:05 <centril> I thought transformM (Control.Lens.Plated) was not supposed to cross type boundaries, but it seems to do that... I thought you were supposed to use transformOn biplate for that...
14:05 <centril> how do I get it to not cross type boundaries?
14:05 sword865 joined
14:06 ramzifu joined
14:06 <halogenandtoast> ogrady: I'm a Ruby programmer mostly so I've been down this road as well.
14:06 merijn joined
14:06 <centril> an example tree: data E = V String | I Int | E :+: E | E :*: E | EB B ; data B = B E (and derive .., Typeable, Data) + instance for Plated
14:06 `Guest00000 joined
14:07 <ogrady> halogenandtoast: I guess that makes somewhat sense. I was under the impression that I could define instances for my data for multiple monads, like IO, Control... then the return would be ambiguous.
14:07 <centril> tried with: (EB $ B $ V "x" :+: V "x") :*: I 3 and it crosses type boundaries
14:08 <halogenandtoast> ogrady: IO is not a type class so you cannot define an instance for it
14:08 <clamchowder> Is there an SML REPL that has autocompletion from input history?
14:08 <ogrady> halogenandtoast: I see that now :)
14:09 <centril> ogrady: haskell picks the (>>=) and return/pure implementation based on unifying the constraints you have put via the type signature of your function, or it picks the most general one it can find based on other functions used
14:09 esad joined
14:09 <`Guest00000> can i have a type synonym for a variable? e.g. have "f :: Syn -> Syn" and in other place "type Syn = a". the point is controlling mono-/polymorphicity from a single line, the type synonym definition
14:09 <ogrady> So thanks again. Everytime I come here I learn a new bit. I'm always amazed at how helpful the haskell community is in contrast to other PL communities. :D
14:09 <centril> `Guest00000: type Syn = a <-- free variable a, should be bound by Syn, so type Syn a = a
14:10 <halogenandtoast> ogrady: Yeah I like it here usually, and I've found myself disenchanted with outers as well.
14:10 <halogenandtoast> *other channels
14:10 <centril> `Guest00000: unless a is a specific a, in which case you can do that
14:10 ccomb joined
14:10 carlomagno joined
14:10 <`Guest00000> centril: aha, thanks. so if i want to have it, i need to insert ugly points everywhere?
14:11 <centril> `Guest00000: is a in type Syn = a a general type variable or a specific data type?
14:11 theelous3 joined
14:11 <`Guest00000> centril: variable
14:11 <`Guest00000> i want to e able to quickly change whether Syn is variable or a specific type
14:12 <`Guest00000> from one line
14:12 <`Guest00000> s/from/in
14:12 <centril> `Guest00000: no, unless you use existentials like type Syn = forall a. <apply a to something>
14:12 chrisdotcode joined
14:12 <`Guest00000> thanks
14:12 <`Guest00000> hmmm
14:13 Jesin joined
14:13 pleax joined
14:14 <ocharles> Does anyone know how to extend hvr's travis script to override a package from Git source?
14:14 <ocharles> I currently depend on something that hasn't been released
14:14 Ayey_ joined
14:14 Fallenwood joined
14:15 <centril> ocharles: you need to drop cabal and go over to stack
14:15 <centril> ocharles: this might interest you: https://github.com/DATX02-17-26/DATX02-17-26/blob/dev/.travis.yml
14:15 <ocharles> ok, are there any examples you know of that I can steal a travis.yml from?
14:15 <ocharles> thanks!
14:16 mrijkeboer joined
14:16 <ocharles> Now to finally use stack for the first time :}
14:16 <centril> it doesn't use the fancy multi resolver stuff for having both GHC 7.10.3 + 8.0.2 + HEAD, but you can combine it with the hvr stuff to get that i guss
14:17 <ocharles> I'm fine with just building on 8.0.2 for now
14:17 <centril> then my link should do =)
14:17 <ocharles> yep, it looks good :) just need to write a stack.yml
14:18 <centril> and please don't use our slack hash :P (i dont know if it would work if you did...)
14:18 mrijkeboer joined
14:18 <centril> there's a stack.yml in the same repo you can steal
14:18 adraenwan joined
14:20 <ocharles> haha, I saw that key. it was tempting
14:20 <ocharles> but only if you guys fix the build for me
14:23 hits1911 joined
14:23 sanett joined
14:24 coltfred joined
14:25 cdg joined
14:26 esad joined
14:29 sidei joined
14:29 augur joined
14:30 guampa joined
14:30 al-damiri joined
14:30 <Reisen> best way to format an `x :: Text` of a number with commas? I.E, "-192312313.23" -> "-192,312,313.23"?
14:30 marsam joined
14:32 Ayey_ joined
14:33 <merijn> hmmm, I can't seem to find any locale aware function for numbers
14:33 mizu_no_oto_work joined
14:33 <Reisen> Yeah, it seems like a bit of a void from googling
14:33 <Reisen> Might be time to write a package
14:35 mkoenig joined
14:36 contiver_ joined
14:36 wraithm joined
14:38 <halogenandtoast> Any easy way to look up where certain operators come from trying to find <> and hoogle only has bad answers
14:38 <halogenandtoast> Ah found it in Data.Monoid
14:38 <halogenandtoast> Still want to know if there are any suggestions though
14:39 hrk joined
14:39 xaviergmail_ joined
14:39 augur joined
14:40 pleax joined
14:40 <merijn> There's also Hayoo
14:40 <Reisen> Try hayoo instead http://hayoo.fh-wedel.de/
14:40 <merijn> halogenandtoast: oh, <> from Monoid being skipped is kinda bad...
14:42 <halogenandtoast> Hayoo seems better
14:42 <halogenandtoast> as in it solves this problem
14:42 <riaqn> Hi, how do I define instance for (Show MVar)?
14:42 <c_wraith> riaqn: usually you don't
14:42 <riaqn> yeah, but how?
14:42 <merijn> riaqn: Why do you want it?
14:42 <riaqn> The problem is that one of my adt contains mvar
14:42 <c_wraith> riaqn: there's usually a reason if a type in base doesn't have a Show instance
14:42 <ocharles> you *could* have Show a => Show (MVar a) with unsafePerformIO, but I wouldn't recommend it
14:43 <merijn> riaqn: And what would you expect it to do?
14:43 <riaqn> and I'm defining Show for this ADT
14:43 thunderrd joined
14:43 <halogenandtoast> instance Show (MVar a) where show _ = "hello"
14:43 <ocharles> riaqn: you will probably have to write a custom Show instance
14:43 <merijn> riaqn: Well, why not print "<Mvar>" instead of trying to show the MVar?
14:43 <zaquest> halogenandtoast, there's command line hoogle utility, it shows Data.Monoid (<>) for me.
14:43 Iskarlar joined
14:43 Ferdirand joined
14:43 <riaqn> good suggestions guys, I can imagine that Show of MVar is impure.
14:44 tommd joined
14:44 <merijn> riaqn: Well, it depends on whether you're trying to show the MVar or it's contents
14:44 <halogenandtoast> zaquest: Good point! I'd much rather do this in the command line
14:45 <riaqn> merijn: yeah, I was trying to show the content.
14:45 <merijn> halogenandtoast: You can actually configure commandline hoogle to index whatever you want
14:45 <riaqn> but now I understand it's safer to just show "MVar"
14:45 <halogenandtoast> merijn: My made up programming language Dagon?
14:45 <halogenandtoast> The answer might be yes, but the result might not be what i want.
14:45 <riaqn> hmm, but how about showing the memory address? that way at least I know if two MVar is at least the same thing.
14:45 <merijn> halogenandtoast: I meant which packages you want :)
14:46 <halogenandtoast> riaqn: You can look at the Eq instance
14:46 <merijn> halogenandtoast: Standard Hoogle indexes only PART of all hackage packages
14:46 <halogenandtoast> riaqn: instance Eq (MVar a) where (MVar mvar1#) == (MVar mvar2#) = isTrue# (sameMVar# mvar1# mvar2#)
14:46 <merijn> halogenandtoast: The local install you can configure to index all packages you want, including ones not covered in regular Hoogle
14:46 <halogenandtoast> there be same dank code
14:46 <riaqn> halogenandtoast: the problem is that I'm not interested in the equality of two specific MVars.
14:47 <riaqn> but instead, in general, I hope to spot the equlity if there is one.
14:47 <riaqn> when I'm showing the ADT.
14:47 <halogenandtoast> given `data MVar a = MVar (MVar# RealWorld a)` I don't know that you can...
14:47 <halogenandtoast> but I'm bad at this
14:48 wraithm joined
14:48 <merijn> *can* you do it, yes, but it will involve very brittle, dangerous and ugly code :)
14:48 <riaqn> merijn: yeah I understand. any hint?
14:48 <merijn> I mean, there's not a lot you *can't* do with GHC haskell, including lots of horrifically dangerous things
14:49 <halogenandtoast> merijn: you have my attention.
14:49 <merijn> Presumably you can get an Addr# from MVar# which you can (potentially via Ptr) turn into integer and print
14:49 <riaqn> to be honest I don't understand why MVar just doesn't include the Show instance which prints the address.
14:49 <riaqn> should make perfect sense.
14:49 <merijn> riaqn: Because generally Show is expected to output syntactically valid Haskell
14:49 <riaqn> ahh I see.
14:50 mkoenig joined
14:50 <riaqn> merijn: so any working code? I know nothing about low-level details of GHC
14:50 <merijn> halogenandtoast: Well, first, disclaimer: Lots of stuff in here is horrifically dangerous and can instantly remove all the safety Haskell gives you, so...Here there be dragons
14:50 <merijn> halogenandtoast: But, have a look at GHC.Prim: https://hackage.haskell.org/package/ghc-prim-0.4.0.0/candidate/docs/GHC-Prim.html
14:50 <merijn> halogenandtoast: If you like low level C/ASM stuff, there's lots of cool stuff there :)
14:51 <halogenandtoast> merijn: Oh nice, I always wondered where this stuff lived, but never took the time to find it.
14:51 <halogenandtoast> I like compilers/interpreters
14:51 <halogenandtoast> so this aspect of haskell was interesting to me (but not enough to look it up apparently)
14:51 CoconutCrab left
14:51 sagittarian joined
14:51 <merijn> halogenandtoast: Oh, in that case there's also an excellent intro paper to how you can compile Haskell
14:52 <halogenandtoast> is that GHC-Prim page huge, because Chrome chokes on it
14:53 <merijn> halogenandtoast: The STG paper provides a (by now somewhat outdated) explanation of how one can compile a lazy functional language to a normal machine: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.53.3729&rep=rep1&type=pdf
14:53 biglama joined
14:53 <halogenandtoast> sorry I meant the source
14:53 <merijn> halogenandtoast: The source is huge yes, but it does open fine in Chrome for me
14:53 <merijn> halogenandtoast: That paper requires only minimal Haskell knowledge and a little bit of familiarity with C/asm, callstacks, etc. won't hurt
14:54 bjz joined
14:54 <merijn> It's a bit dated compared to actual GHC, but it's good starting point
14:54 MarioBranco_2 joined
14:54 <halogenandtoast> merijn: Thanks I'll give it a read
14:55 sidei joined
14:59 plugin joined
14:59 uglyfigurine joined
15:00 gcross_ joined
15:00 plugin joined
15:00 marsam joined
15:00 doodlehaus joined
15:01 raycoll joined
15:01 ptek joined
15:02 wlemuel joined
15:03 faberbrain joined
15:03 Rodya_ joined
15:04 fosskers joined
15:04 Fairy joined
15:04 the|auriscope joined
15:04 cschneid_ joined
15:05 robkennedy joined
15:05 Yuras joined
15:05 pera joined
15:06 Boomerang joined
15:06 `^_^v joined
15:06 jchia_ joined
15:07 Levex joined
15:09 hits1911 left
15:09 sanett joined
15:09 sellout- joined
15:09 robertkennedy joined
15:10 cdg joined
15:10 gawen joined
15:13 pleax joined
15:13 doodleha_ joined
15:16 skeet70 joined
15:16 simukis__ joined
15:17 FullyFunctional left
15:18 wraithm joined
15:20 systemfault joined
15:20 deepfire` joined
15:22 conal joined
15:24 ragepandemic joined
15:25 <_deepfire> given a cabal file that defines both a library, and an executable that depends on it -- what makes cabal recompile the library-exposed modules the second time for the executable?
15:25 <ogrady> Alright, now I have a similar problem to before, but I need to bind a whole list of monadic values. I imagined something like http://lpaste.net/353599 would do the trick, but apparently not.
15:25 jsgrant- joined
15:26 sidei joined
15:27 <merijn> _deepfire: You probably have the library and executable source in the same directory?
15:27 esad joined
15:27 <merijn> _deepfire: GHC doesn't realise it's supposed to use the exports from the library when a file is doing "import Foo" in a directory that contains Foo
15:28 magneticduck joined
15:28 <merijn> _deepfire: The solution is to move the library and/or executable to a different sub directory and specifying a hs-source-dir (or whatever the right field name was)
15:28 Guest18067 joined
15:29 <_deepfire> merijn: you are right, indeed
15:31 freusque joined
15:31 Faucelme joined
15:33 takle joined
15:34 <_deepfire> merijn: it worked like a charm!
15:34 <_deepfire> merijn: thank you!
15:34 <merijn> _deepfire: np :)
15:35 Goplat joined
15:38 Levex joined
15:38 mimi_vx joined
15:39 <_deepfire> now if only ghc-plugin-natnormalise didn't cause spurious recompiles due to https://ghc.haskell.org/trac/ghc/ticket/12567 ...
15:39 <halogenandtoast> ogrady: what is the data constructor for Bar there?
15:40 <merijn> ogrady: Needs more types
15:40 <merijn> ogrady: I have no idea what the type of everything there is
15:41 <merijn> What's 'x', 'xs', 'Bar' and 'somethingMonadic'?
15:41 wraithm joined
15:41 <ogrady> Well, maybe it would help more if I'd post something that actually works: http://lpaste.net/353600
15:41 <ogrady> Works and all. But I think that again this could be a one-liner.
15:41 <halogenandtoast> O_o
15:41 <halogenandtoast> why do you hate me
15:42 <ogrady> I don't tho! D:
15:42 <halogenandtoast> says he doesn't hate me, uses ττ
15:42 <merijn> ogrady: Isn't it just "Q.TyFun <$> mapM ττ ts <*> ττ t"?
15:42 jmelesky joined
15:42 <ogrady> That's actually two τs. :D
15:43 <halogenandtoast> merijn: it is
15:43 auto_complete_ joined
15:43 freusque joined
15:44 <halogenandtoast> ogrady: I have no idea what a τ is so I'm already convinced you don't like me.
15:44 {emptyset} joined
15:44 <halogenandtoast> If I can't type it with my keyboard currently, I don't want it.
15:45 chrisdotcode joined
15:45 <ogrady> Ah, yes, works great. Thanks! I have to read up more on those weirdly named functions. halogenandtoast welcome to my world where I have to figure out why on earth things are named "<*>". D:
15:45 ajhager joined
15:46 <halogenandtoast> That just the infix version of apply
15:46 <monochrom> Inspired by Star War spaceships.
15:46 <merijn> ogrady: Not really any specific reason for that name, honestly. It's an operator mostly since that reads nicely
15:46 skeuomorf joined
15:47 <halogenandtoast> merijn: that and it works well with <* and *>
15:47 <ogrady> halogenandtoast: It's a tau and actually makes sense in my context. My boss is kinda in love with unicode and the such. Didn't bother to rename it in the paste as I didn't think it would be a problem.
15:47 <halogenandtoast> well in distinguishing them...
15:47 <halogenandtoast> ogrady: I looked it up, it's overloaded
15:47 <halogenandtoast> 7 definitions for mathematics, and 9 in Physics
15:48 <halogenandtoast> because f both of those fields :p
15:48 <ogrady> merijn: that I get. And it probably really reads nicer than a fully fledged word. But it really gives me a hard time when I have that backwards lookup of "now which operator did that thing again..."
15:48 <merijn> ogrady: That's why we have Hoogle :)
15:48 <halogenandtoast> ogrady: You will use <$> and <*> so often that will quickly go away
15:48 <merijn> @hoogle f (a -> b) -> f a -> f b
15:48 <lambdabot> Control.Monad.Compat (>>=) :: m a -> (a -> m b) -> m b
15:48 <lambdabot> Data.GI.Base.ShortPrelude (>>=) :: m a -> (a -> m b) -> m b
15:48 <lambdabot> Monad (>>=) :: m a -> (a -> m b) -> m b
15:48 <merijn> But yeah, Applicative is so common you will know it off the top of your head
15:49 <merijn> That's...unhelpful, lambdabot
15:49 <halogenandtoast> lol
15:49 <ogrady> Huh, right. I could have entered the signature there. Didn't even occur to me.
15:49 <halogenandtoast> perfect example!
15:49 <ogrady> ...well.
15:49 MrcRjs joined
15:50 <halogenandtoast> honestly step 1, write those two type signatures on a piece of paper next to you
15:50 <halogenandtoast> step 2, look at paper
15:50 <halogenandtoast> Sounds dumb, works very well when you are learning
15:51 <halogenandtoast> Also... wait until you get to lenses
15:51 <ogrady> now, where do I fit "fear-vomit uncontrollably and procrastinate for half an hour" in there?
15:51 OnkelTem joined
15:51 <halogenandtoast> ogrady: when you don't have one of those two type signatures
15:52 Ayey_ joined
15:52 raichoo joined
15:52 <shapr> halogenandtoast: I have a bunch of those dumb but helpful tricks.
15:53 <halogenandtoast> Okay I should really both walk my dog and then go to sleep
15:54 <halogenandtoast> it's almost 1 am here.
15:54 <shapr> I should do real work, it's almost noon here
15:54 <halogenandtoast> shapr: Nah, real work is for 1am
15:54 <shapr> psh, I wish
15:54 <orion> shapr: What do you do?
15:55 <shapr> orion: I write Python for pindrop.com
15:55 oisdk joined
15:55 <halogenandtoast> shapr: my sympathies, unless you like python, in which case... "cool"
15:56 <shapr> I'd rather be writing Haskell
15:56 <merijn> shapr: Story of my life
15:56 <merijn> shapr: I thought I'd safe time by using python libraries
15:56 <shapr> But that's why I stay up late, to write Haskell code :-)
15:56 <merijn> shapr: Long story short as of next week I'm rewriting all this python into Haskell :p
15:56 <shapr> merijn: sounds great!
15:56 <halogenandtoast> shapr: I have the same problem, except I write ruby instead of python
15:57 <shapr> Hopefully I can jump to a Haskell job soon.
15:58 urodna joined
15:59 <halogenandtoast> I tried starting my own company initially in rails, rewrote it in haskell, got stuck, rewrote it in elixir, and then finally gave up again and rewrote it in rails
15:59 <shapr> halogenandtoast: what got stuck?
15:59 <shapr> I'd be interested in what could improve Haskell
15:59 <halogenandtoast> shapr: I believed haskell to be the correct technical choice, but it was hard to do things like nested forms with associated data.
16:00 <halogenandtoast> Mainly because Yesod wanted them to be type safe
16:00 <shapr> I haven't done any recent webdev with Haskell, I should fix that.
16:00 Ayey_ joined
16:00 <halogenandtoast> shapr: if you want to see a simple app example in Yesod, I always enjoy touting https://github.com/halogenandtoast/nhk-reader-haskell
16:01 <orion> merijn / shapr: What percentage of people in this channel do you think do Haskell professionally?
16:01 <merijn> halogenandtoast: How comfortable with Haskell? (i.e. I have a fun pointer, but it won't make sense if you're still like complete beginner)
16:01 <Cale> shapr: Be sure to have a look at Reflex-DOM :)
16:01 MarioBranco joined
16:01 fizbin joined
16:01 <shapr> halogenandtoast: ah, I've seen that before. But I still can't read any of it :-(
16:01 <merijn> orion: Honestly, no real clue
16:01 <Cale> https://www.youtube.com/watch?v=dOy7zIk3IUI
16:01 <shapr> orion: I'd guess at least 25%, there are quite a few Haskell jobs
16:02 <halogenandtoast> merijn: I'm probably in the middle. I can solve a lot of problem until they get into libraries I haven't used...
16:02 <merijn> shapr: True, OTOH a lot of people with Haskell jobs aren't here :)
16:02 {emptyset} joined
16:02 Mario_Branco2 joined
16:02 <merijn> halogenandtoast: If you like type safety and web development (and also a lack of documentation :p) you should have a look at Ur/Web
16:02 <shapr> merijn: yes, also that
16:02 <merijn> halogenandtoast: http://www.impredicative.com/ur/
16:02 <halogenandtoast> merijn: I looked at it, I needed better/more examples
16:03 <orion> shapr: I just applied to a Haskell job and got rejected. :(
16:03 <shapr> orion: have you written a bunch of Haskell?
16:03 <orion> shapr: Yes.
16:03 <shapr> My most recent Haskell inerview asked me what libraries I've created and/or maintained.
16:03 <halogenandtoast> merijn: I looked at http://www.impredicative.com/ur/todomvc/ for example
16:03 <shapr> orion: Is your Haskell source up on github?
16:03 systemfault joined
16:03 <orion> shapr: https://github.com/centromere
16:04 tig_ joined
16:04 CurryWurst joined
16:04 oish joined
16:04 <shapr> orion: In that case, apply for more Haskell jobs?
16:04 revtintin joined
16:04 <orion> I will.
16:04 <merijn> Where did you interview?
16:04 <orion> merijn: Takt.
16:05 <orion> The company was going to be using Haskell to work with artificial intelligence. I was very sad to have missed that opportunity.
16:05 wraithm joined
16:05 <shapr> orion: there are more opportunities!
16:06 <ystael> this seems like a good time to mention my company (in Boston) is looking for one more back end developer, we have a mix of Python and Haskell
16:06 MarioBranco_2 joined
16:07 <halogenandtoast> ystael: I used to live in Boston
16:07 oish_ joined
16:07 <orion> ystael: On site?
16:07 <halogenandtoast> as in I lived in Boston last year.
16:07 <ystael> orion: Yes, local only for the dev team for now, sorry
16:07 <ertes> what's the clean way to get GHC 8 on debian 8?
16:07 <ertes> the not-compiling-yourself way
16:08 <halogenandtoast> ertes: step 1) install a better OS
16:08 <halogenandtoast> I kid
16:08 <orion> ystael: May I PM you?
16:08 <halogenandtoast> ystael: Is your company one I would have heard of?
16:08 <ystael> sure
16:08 rotcpy joined
16:08 <MarcelineVQ> ertes: iirc, there's an unstable package manager option for newer things, e.g. the list here https://packages.debian.org/search?keywords=ghc
16:08 <ertes> halogenandtoast: i'm one nuisance away from installing nix and bypassing apt entirely
16:09 <ystael> halogenandtoast: Maybe not, it's a relatively young startup: http://www.tvisioninsights.com/
16:09 <MarcelineVQ> er, or, is the name the debian flavor?
16:09 conal joined
16:09 <halogenandtoast> ystael: ... you have a japanese website?
16:10 auto_com1lete_ joined
16:10 <halogenandtoast> I ask because I live in Tokyo
16:10 <ystael> We have a Japanese partner company, yes, but the tech team is all in Boston
16:11 mson joined
16:11 yellowj joined
16:11 <halogenandtoast> I see
16:11 auto_com1lete_ left
16:11 <bennofs> ertes: I have idea but http://downloads.haskell.org/debian/ sounds promising?
16:11 sphinxo joined
16:11 <bennofs> s/idea/no idea
16:12 Luke_ joined
16:12 <ertes> well, every clean way seems to imply adding sources for another debian version
16:12 faberbrain joined
16:13 <halogenandtoast> Oh well, I'm not moving back to the US any time soon.
16:13 <bennofs> ertes: that page says "Debian 8"
16:13 <halogenandtoast> You guys can't seem to keep your president in line. I'm fine here with my prime minister and emperor
16:13 <ertes> oh, wait
16:13 <merijn> orion: Also, are you willing to relocate?
16:13 <ertes> that's a haskell-only source
16:13 <ertes> bennofs: thanks!
16:14 erisco joined
16:14 <orion> merijn: I live in New Hampshire. I am unwilling to relocate at this time.
16:14 <fizbin> Is there any way to express the constraint "This type constructor F needs to have an Ord instance for (F b) whenever b has an Ord instance"?
16:15 <merijn> orion: Ah, because Standard Chartered is basically always hiring people in Singapore, I think. But that doesn't help if moving is not an option :)
16:15 <erisco> F :: Ord b => b -> F b perhaps?
16:15 <halogenandtoast> orion: NH, that's a tough sell, I can't imagine a lot of Hakell going on there.
16:15 <bennofs> fizbin: sounds like something that'd only be possible with the `constraints` package and working with constraints explictly
16:16 <orion> halogenandtoast: That's why working remotely is key. I save thousands of dollars by not needing to drive in to work every day.
16:16 <bennofs> fizbin: hmm or wait. How about f :: (forall b. Ord b => Ord (F b))
16:16 <bennofs> fizbin: that should work
16:16 <orion> And living in a huge city like Boston is stressful and sucks the joy out of life.
16:16 <halogenandtoast> orion: I ride a train, or work from home with my job, it's just not haskell... yet
16:16 <halogenandtoast> orion: everyone likes different things
16:16 <halogenandtoast> Tokyo is my dream city
16:16 <fizbin> bennofs: Huh. Maybe.
16:16 Rryy joined
16:16 <erisco> I don't know what that syntax means oO
16:17 <bennofs> erisco: It means: given an Ord instance for b, I can give you an Ord instance for F b
16:17 <lyxia> it's not Haskell though
16:18 <erisco> bennofs, but you have put Ord (F b) in a position where a type is expected
16:18 <halogenandtoast> erisco: don't worry, I think you need the ExistentialQuantification language extension
16:18 <fizbin> bennofs: Yeah, I don't understand how to make that syntax work.
16:18 <halogenandtoast> so you might not have seen/used it before
16:18 <erisco> what you can do is f :: Ord b => (Ord (F b) => r) -> r
16:18 <bennofs> hmm not sure, I swear I've seen something like that
16:18 <bennofs> erisco: ah right
16:19 <halogenandtoast> fizbin: you need to use the ExistentialQuantification language extension.
16:19 <fizbin> erisco: Except how do I put that as a constraint on a function's input types?
16:19 <bennofs> halogenandtoast: don't think it'll work even with that ext
16:19 <halogenandtoast> probably not
16:19 <erisco> fizbin, f is a function, so I am not sure what you're asking
16:19 mrijkeboer joined
16:20 <bennofs> fizbin: you could do: (forall b. Ord b => Dict (F b))
16:20 <lyxia> fizbin: constraints has a type (:-), such that a value of type (Ord b :- Ord (F b)) represents the constraint you want. You have to pattern match on it explicitly when you want to use it though.
16:20 <bennofs> fizbin: where Dict is from the `constraints` package
16:20 <fizbin> What I want is something like: myFunction :: forall b, gr, f. (MyDynGraph gr, Ord b, (forall q. Ord q => Ord (f q)), Functor f) => ...
16:21 <ertes> f :: (forall a. Ord a => Dict (F a)) -> …
16:21 <ertes> something like that?
16:21 <ertes> whoops
16:21 <ertes> f :: (forall a. Ord a => Dict (Ord (F a))) -> …
16:21 <bennofs> fizbin: yes, you'd need to write that as: (...) => (forall a. Ord a => Dict (Ord a)) -> ...
16:21 <bennofs> fizbin: and call it like: myFunction Dict
16:21 serendependy joined
16:21 sanett_ joined
16:22 osa1 joined
16:22 osa1 joined
16:22 BusFactor1 joined
16:22 <ertes> or better:
16:22 <ertes> f :: (forall a. Ord a => proxy a -> Dict (Ord (F a))) -> …
16:22 <bennofs> ertes: why's that better?
16:23 <fizbin> bennofs: That doesn't make sense to me; I don't understand what "Ord a" means as a type.
16:23 <ertes> bennofs: makes using that function nicer =)
16:23 <fizbin> I know what "Ord a" means as a type constraint.
16:23 <bennofs> fizbin: it's the ConstraintKinds extension, which allows using constraints in types
16:23 <ertes> f liftOrd = case liftOrd (Proxy :: Proxy a) of Dict -> …
16:24 <erisco> I assume Dict does not take a type, it takes a constraint
16:24 <ertes> or even: f liftOrd x = case liftOrd (pure x) of Dict -> …
16:24 <bennofs> fizbin: you can do stuff like: data Foo c where Foo :: c => Foo c
16:24 <bennofs> fizbin: where c has kind Constraint
16:24 coot joined
16:24 mettekou joined
16:24 sanett joined
16:25 Rryy left
16:25 Glooomy joined
16:25 <ertes> fizbin: Dict can only be constructed when the required constraint is satisfied (i.e. the instance is in scope, or a type equality actually holds)
16:25 <ertes> fizbin: whenever you pattern-match on that Dict, you get that constraint to the RHS of "->" by virtue of type refinement
16:25 oisdk joined
16:26 <erisco> virtuous type refinement
16:26 <ertes> case myDict of Dict -> {- the constraint is satisfied here -}
16:28 psychicist__ joined
16:29 <ertes> fizbin: note that the forall variant is basically equivalent to requiring: instance (Ord a) => Ord (F a)
16:29 <fizbin> Which is what I actually wanted to require.
16:30 <ertes> do you abstract over F?
16:30 robotroll joined
16:31 <fizbin> I do. What I actually need is Ord (f (SomeAnnoyinglyComplicatedTypeIdRatherNotBurdenCallersWith))
16:31 <tabaqui1> what's is a current status of cabal/stack test modules?
16:31 <merijn> God, I wish Python has 1) Monoids and 2) monoid instance for functions...
16:31 <tabaqui1> I want to write test-suite, but detailed-0.9 looks a little bit old for me
16:31 <erisco> it sounds like you want Python to have type classes
16:32 <ertes> it sounds like you want to write haskell instead =)
16:32 <tabaqui1> and documentation for both types (+ exitcode-stdio) is confusing
16:32 <merijn> ertes: I do :(
16:32 <erisco> can't you dynamically extend types with magic getters? maybe that is another language
16:33 decaf joined
16:33 SpinTensor joined
16:33 marsam left
16:33 <fizbin> One can do "this object now behaves sort of like a function" magic with python __call__ methods.
16:33 <erisco> you can define <> to lookup a predefined attribute on the operands
16:33 <erisco> where this attribute is the implementation
16:33 <merijn> ertes: I guess I'll handcode a hacky monoid :\
16:33 <erisco> or you can keep a global table of type to implementation
16:34 pleax joined
16:34 mrrec joined
16:34 <fizbin> merijn: You can even override __add__ and use "+" for your monoid's operation.
16:34 <erisco> gross
16:35 <erisco> every time a programmer overloads + with a function that is not associative and commutative a kitten dies
16:35 <fizbin> erisco: So, every time + gets used for string concatenation?
16:35 <ertes> merijn: i can't imagine how that would be remotely as convenient as in haskell
16:36 <* erisco> throws up a little
16:36 <ertes> even if i ignore the fact that you don't get infix operators
16:36 Swizec_ joined
16:36 Ayey_ joined
16:36 Engine joined
16:36 <fizbin> I mean, + as string concatenation is really, really common.
16:36 <merijn> ertes: It's not, but I don't have time to rewrite everything in Haskell before the paper deadline, sadly :)
16:36 thunderrd_ joined
16:36 oisdk joined
16:37 <ertes> well, i suppose you could use instance arguments or even the global table erisco mentioned
16:37 <ertes> at least python does support functions
16:38 <erisco> mempty is an issue because you don't get any inferred type information
16:38 <erisco> but you can have it take a type as an argument, or however Python does that
16:38 FullyFunctional joined
16:40 oisdk_ joined
16:41 <fizbin> But I'll point out that an advantage of making + your monoid operation (with __add__) is that then "sum" is mconcat.
16:41 conal joined
16:41 grayjoc joined
16:42 Sonolin joined
16:42 wraithm joined
16:44 dfeuer joined
16:45 <erisco> sounds like duck type programming
16:45 <erisco> I guess you're being Pythonic
16:46 TheEpsylon joined
16:47 faberbrain joined
16:47 fendor joined
16:47 sphinxo joined
16:48 marsam joined
16:48 <erisco> fizbin, do you know the rules, by the way?
16:48 Fairy joined
16:48 noteshui joined
16:48 faberbrain joined
16:49 <fizbin> "the" rules? That's awfully broad.
16:49 tromp joined
16:50 <ski> @quote the.rules
16:50 <lambdabot> sarah says: "But I don't _want_ functional programming!" -- Sarah Peyton Jones, age 11, upon hearing the rules of Go
16:50 cur8or joined
16:50 Levex joined
16:51 <erisco> fizbin, I thought Kirk maybe told you
16:51 kantokomi joined
16:51 xall joined
16:51 medicijnman joined
16:52 <fizbin> erisco: That's with two "z"s. Common mistake.
16:53 <erisco> I object, because he didn't write it out, he just spoke the word
16:54 oisdk joined
16:55 spacedog82 joined
16:55 <* ski> . o O ( "... of misfortune" )
16:55 <centril> stack build is giving me: .stack-work\dist\ca59d0ab\build\JAA\JAA-tmp\Normalizations.o:fake:(.data+0x98): undefined reference to `DATX021726zm0zi1zi0zi0zm2MQgTHUfheZZ7igIDVIIrIF_NormziNormM_unique_closure'
16:55 mmachenry joined
16:55 kody joined
16:56 <centril> `gcc.exe' failed in phase `Linker'. (Exit code: 1)
16:56 hits1911 joined
16:56 mmachenry1 joined
16:56 Ayey_ joined
16:57 <lpaste_> Centril pasted “stack undefined reference” at http://lpaste.net/353603
16:57 <MarcelineVQ> centril: did you forget to add a module to exposed-modules or other-modules?
16:57 <centril> MarcelineVQ: probably
16:58 <centril> That error message needs to be improved tho =)
16:58 moonlightSonata joined
16:58 marsam joined
16:59 <centril> MarcelineVQ: thanks, that worked
17:00 trism joined
17:00 <hits1911> I have main = interact $ (show . f . read). The function "f" does the processing of input and returns a data. Is there a simpler way to do this like without show and read etc. For instance, main = X f ?
17:01 Luke joined
17:01 wildlander joined
17:02 <Cale> hits1911: Well, if you lose the show and read, then f will be expected to take and produce a String
17:02 AndreasK joined
17:03 MindlessDrone joined
17:03 gcross_ joined
17:05 mizu_no_oto_work joined
17:05 sidei joined
17:05 Rodya_ joined
17:05 mmachenry1 joined
17:06 rps_ joined
17:07 <hits1911> Couldn't be a function as foo :: (a -> b) -> IO (). Reading the input and feeding it to the function it takes as argument, converting the result to String and so on.
17:08 wraithm joined
17:08 <Cale> hits1911: You could of course define one
17:08 uglyfigurine joined
17:08 <Cale> foo :: (Read a, Show b) => (a -> b) -> IO ()
17:09 <Cale> foo f = interact $ show . f . read
17:09 wraithm_ joined
17:10 Deide joined
17:10 <hits1911> Cale: looks simple enough. thank you.
17:12 ystael joined
17:12 phyrex1an joined
17:13 mettekou joined
17:14 simendsjo joined
17:14 Levex joined
17:14 Ayey_ joined
17:16 ptvttg joined
17:18 tag joined
17:19 <erisco> that looks scary
17:20 ikke joined
17:20 Swizec joined
17:20 JoshS joined
17:20 asmyers joined
17:21 MissingNoIOI joined
17:22 subttle joined
17:23 MindlessDrone joined
17:23 JoshS joined
17:24 <rps_> I've been learning Haskell for about 3 months now. It's a lot of fun learn the language and I really enjoy reading the papers about the theory behind the language.
17:24 uncertainty joined
17:25 <rps_> But I get discouraged about its practicality for me. After 3 months, I still have problems thinking about how to program something that's useful.
17:25 <rps_> What was the "hump" that you got over where you felt like you can program things that are useful?
17:27 throwaway432 joined
17:28 <cocreature> rps_: for me it was quite simple: reduce the amount of time reading and just write some code :)
17:28 <lep-delete> you don't learn programming by reading only
17:28 weurdo joined
17:28 <koala_man> rps_: for me it was writing things that are useful, even if they didn't leverage Haskell much. I kept seeing ways things could be improved, and I still do.
17:29 <cocreature> it’s easy to fall into the trap of reading and reading and never writing code because Haskell is sufficiently different from other languages that doing a bit of up-front reading is usually a good idea
17:29 JoshS joined
17:32 <rps_> Yeah, I feel like I'm in that reading trap, ha
17:32 plugin joined
17:32 <cocreature> I’ve fallen into that trap myself :)
17:32 elliotanderson12 joined
17:33 <rps_> I'll usually write something, get a compile error, and then read about why the compiler wouldn't allow that for a half hour
17:34 ramzifu joined
17:34 <ezyang> I wonder if CS did it all again, what we call "Set" should really be "PowerSet"
17:34 <rps_> Even if it's reading through documentation for a library, I find myself hitting a wall of understanding
17:35 plugin_ joined
17:36 <rps_> I'll just try writing more code. If I have any specific questions, I'll come back here and ask them.
17:36 sidei joined
17:36 <rps_> Thanks for the suggestion
17:36 zeroed joined
17:36 zeroed joined
17:36 hits1911 left
17:37 <ski> ezyang : as in `Data.Set.Set' ?
17:37 <ezyang> yeah
17:37 castlelore joined
17:37 castlelore joined
17:38 <ezyang> or maybe it's OK to name types after "individual examples" of the construction in question
17:38 decaf joined
17:38 <ski> "an `Integer'"
17:39 <ski> (as opposed to the set of `integers'. iirc they used that convention in Pascal ?)
17:39 <ezyang> touche
17:39 <ski> it could still be `Subset Integer', though
17:40 <ezyang> Well, {1,2,3} is certainly "a set of integers"
17:40 <ski> a subset, i'd say :)
17:40 <ski> (material vs. structural sets)
17:41 SolitaryCypher joined
17:42 Apocalis_ joined
17:42 lithie joined
17:44 <Apocalis_> I've a monad stack like StateT k (StateT p (LoggingT (ExceptT e IO))), and I'd like to convert the concrete stack to an mtl constrained monad. How can I represent the two state monads?
17:44 bennofs joined
17:44 <ezyang> "Poorly"
17:45 sphinxo joined
17:45 manuel_ joined
17:45 <ezyang> you might consider the technique in http://blog.sigfpe.com/2010/02/tagging-monad-transformer-layers.html
17:45 <Apocalis_> my thought was to combine them into MonadState (k,p) and just Lens into the part I'm interested in
17:45 <ezyang> another possibility is to combine the two state transformers together to StateT (k, p)
17:46 Ayey_ joined
17:47 asmyers joined
17:48 ubsan_ joined
17:48 uncertainty joined
17:50 tromp joined
17:50 t0by joined
17:51 ner0x652 joined
17:51 <dolio> The answer is, in a sense, always that you used named references of some sort.
17:51 <dolio> With multiple StateTs, you're using a sort of de Bruijn notation.
17:51 <monochrom> Yes, you may actually be better off with (MonadState (k,p) m, MonadLogging m, MonadError e m, MonadIO m)
17:52 <dolio> With a compound state your references are the projection functions, or lenses, or something like that.
17:52 xall joined
17:52 robotroll joined
17:53 Ayey_ joined
17:53 <dolio> In something like ST you can allocate new references dynamically.
17:53 beanbagu1 joined
17:55 <dolio> Some extensible effects stuff might allow you to use the type of the state as the reference 'name' (one cell per type), but I don't think that's actually a very good idea.
17:56 <kadoban> Is there a function for "choose exactly k values from a list" (or a range) in all ways, similar to how permutations works, except ... not permutations.
17:56 <mohsen_> What does /= operator do?
17:56 <kadoban> mohsen_: It's "not equal", the opposite of ==
17:57 <shapr> kadoban: how would your thing be differnt from permutations?
17:57 <shapr> > 1 /= 1
17:57 <lambdabot> False
17:57 <ski> @src (/=)
17:57 <lambdabot> x /= y = not (x == y)
17:57 <shapr> > 1 == 1
17:57 <lambdabot> True
17:57 Einwq joined
17:57 <shapr> hej Einwq, god morgon
17:57 connrs joined
17:57 <kadoban> shapr: Because the elements of the output list are exactly k elements long, not the same length as the original list. I can of course write that in terms of permutations, but it's pretty awfully inefficient
17:58 mofasa joined
17:58 mofasa_ joined
17:58 <kadoban> I can write it directly too I guess, but if I don't have to ...
17:58 <dolio> I don't know of any predefined function that does it.
17:58 <mohsen_> Thanks guys
17:58 <kadoban> Alrighty, thanks.
17:58 <* ski> would try using `StateT [a] []'
17:58 <mofasa_> IS there any way to figure out what pattern(s) is missing in a non-exhaustive pattern match?
17:59 <ezyang> mofasa_: Usually it's obvious by inspection
17:59 <kadoban> ski: Hmm, I'll give that a try.
17:59 <glguy> mofasa_: Often the answer is in the next line of the error message
17:59 <shapr> mofasa_: you could add an underscore pattern at the end, and have that call error with the output
17:59 <mofasa_> ezyang: usually ..
17:59 <ezyang> paste it? :)
17:59 <glguy> (if warnings are turned on)
18:00 <shapr> mofasa_: foo a@_ = error $ "did not expect " <> show a
18:00 <glguy> Don't even need the @_
18:00 <shapr> oh right
18:00 meoblast001 joined
18:00 <ertes> mofasa_: if you use -W or -Wall, GHC will tell you which patterns are missing
18:01 <ski> kadoban : nondeterministically decide whether to use or discard the next element. if you know the input length beforehand, you can also prune when there's not enough remaining elements
18:01 tomphp joined
18:01 <kadoban> Yeah, seems like it makes sense
18:02 MindlessDrone joined
18:02 pera joined
18:03 replay joined
18:03 Fairy joined
18:03 <mofasa_> How to compile a non-stack project with Stack and use compiler args? `stack ghc MyFile.hs` works but `stack ghc -- MyFile.hs -Wall` gives no output at all
18:04 augur joined
18:04 burdges joined
18:04 Luke joined
18:04 <kadoban> stack ghc -- --make -Wall MyFiles.hs should work, though 'stack ghc' is rarely needed. Is this a cabal-install project? You should usually do 'stack init' and then 'stack build'
18:04 wraithm joined
18:04 Ayey_ joined
18:05 <shapr> burdges: jeff?
18:05 <mofasa_> It's just a couple of lonely hs files (school homework) without external dependencies
18:05 <shapr> In that case, kadoban's --make suggestion is best
18:05 Apocalisp joined
18:05 <ertes> mofasa_: also you could just use GHC
18:05 Rodya_ joined
18:06 <ertes> ghc -Wall blah.hs
18:06 <shapr> Apocalisp: your clone was here earlier asking about monad transformers :-P
18:06 <shapr> some guy named Apocalis_
18:06 <mohsen_> How am I supposed to report a typo in lyah?
18:06 <Apocalisp> don't indulge him
18:06 nadirs joined
18:06 <mofasa_> kadoban: That gives no output either. The files are probably created but there's no terminal output (errors or warnings) even with Wall
18:06 <glguy> mohsen_: I don't think you are
18:07 <shapr> Apocalisp: :-)
18:07 JeanCarloMachado joined
18:07 <ezyang> mofasa_: Add -fforce-recomp?
18:07 <mohsen_> glguy: There is no way to contact the writer
18:07 <mohsen_> ?
18:07 <okeuday_bak> anyone have any information building with cabal using local files (no remote use)?
18:07 <mofasa_> ezyang: Thanks, that did it!
18:07 <kadoban> mohsen_: LYAH is pretty old, and AFAIK hasn't been updated in a *long* time. Though I could be wrong.
18:07 <glguy> okeuday_bak: Yeah, someone has that information
18:08 <ezyang> mofasa_: A long standing annoyance with warnings is they only get emitted if you actually need to build the file in question
18:08 plugin joined
18:08 <okeuday_bak> glguy: is there a good place to look? it seems like the ghc compilation may be doing this, but it doesn't really attempt to show the path
18:08 <Apocalisp> shapr: one of me tells only lies, the other asks only insincere questions
18:09 <shapr> Apocalisp: and I have to guess which? This sounds like a logic puzzle I could solve with Haskell.
18:09 <shapr> mohsen_: BONUS500 was active here on #haskell when writing LYAH, but hasn't been seen since then.
18:09 ajaXHorseman joined
18:09 <mohsen_> I see
18:10 <mohsen_> Do you guys know which version of Haskell was this guy describing when writing the book?
18:10 <mohsen_> I think I could have used a more up to date book:p, but unfortunately I'm on chapter 8 :P
18:11 Noldorin joined
18:11 <Einwq> Godmorgon shapr :)
18:11 ertesx joined
18:11 <centril> Einwq: godmorgon Einwq
18:11 <Einwq> godmorgon centril
18:12 xinming_ joined
18:12 <centril> main :: IO () ; main = putStrLn "godmorgon!"
18:12 sssilver joined
18:13 <centril> > putStrLn "godmorgon!"
18:13 <lambdabot> <IO ()>
18:13 <centril> lambdabot: stupid...
18:13 <Apocalisp> god eftermiddag
18:13 Amadiro joined
18:13 <centril> Apocalisp: lambdabot vägrar...
18:13 <kadoban> > "centril: smrt..."
18:14 <lambdabot> "centril: smrt..."
18:14 grayjoc joined
18:14 schell joined
18:14 <cocreature> mohsen_: I wouldn’t worry too much about it. iirc the last time I looked almost everything still applies to today’s haskell
18:14 <schell> what’s the difference between uniqueness types and linear types?
18:15 <centril> schell: "In computing, a unique type guarantees that an object is used in a single-threaded way, with at most a single reference to it. If a value has a unique type, a function applied to it can be optimized to update the value in-place in the object code. Such in-place updates improve the efficiency of functional languages while maintaining referential transparency. Unique types can also be used to
18:15 <johnw> maybe ... http://lambda-the-ultimate.org/node/1548
18:15 <centril> integrate functional and imperative programming."
18:16 <centril> "The term is often used interchangeably with linear type, although often what is being discussed is technically uniqueness typing, as actual linear typing allows a non-linear value to be "cast" to a linear form, while still retaining multiple references to it. Uniqueness guarantees that a value has no other references to it, while linearity guarantees that no more references can be made to a value.[2]"
18:16 <Apocalisp> centril: lambdabot gav dig whnf av programmet :)
18:16 <mohsen_> cocreature: Hmmm
18:16 <Apocalisp> eller var det nf
18:16 Noldorin joined
18:17 <schell> centril, johnw: ah! thank you guys
18:17 Netwolf joined
18:17 <Netwolf> jfn
18:17 <centril> schell: https://en.wikipedia.org/wiki/Uniqueness_type#Relationship_to_linear_typing
18:18 takle joined
18:18 xall joined
18:18 ajaXHorseman_ joined
18:18 Netwolf left
18:19 <shapr> mohsen_: I like haskellbook.com, it's very up to date, but it's also $60
18:19 <schell> my interest is due to http://blog.tweag.io/posts/2017-03-13-linear-types.html, and the fact that idris has uniqueness types
18:20 <schell> i’m wondering how different they are in practice
18:20 <schell> (i’ll have to use both to find out)
18:21 oisdk joined
18:21 danharaj joined
18:23 MindlessDrone joined
18:24 merijn joined
18:24 FrankZappa_ joined
18:25 locallycompact joined
18:26 Dembel joined
18:26 takle joined
18:27 <monochrom> kadoban: http://hackage.haskell.org/package/permutation-0.5.0.5/docs/Data-Choose.html may help you.
18:27 <monochrom> The library name is "permutation" but half of it is combination (n choose k).
18:29 <kadoban> Nice, ya that looks like exactly what I was looking for
18:30 Rodya_ joined
18:30 dni joined
18:31 kody joined
18:31 <ertes> schell: i'd be happy, if we had at least one of them
18:32 kody1 joined
18:32 <ertes> reading anything about uniqueness types or linear types only makes me feel depressed
18:32 jophish joined
18:32 <schell> ertes: were uniqueness types removed from idris? or do they not work well?
18:33 <schell> http://docs.idris-lang.org/en/latest/reference/uniqueness-types.html
18:33 {emptyset} joined
18:33 <ertes> schell: i'm talking about haskell
18:33 pie__ joined
18:33 <schell> oh! either as in unique or linear :)
18:33 <ertes> haven't used idris beyond hello world
18:33 <schell> i see
18:35 <schell> well the article i linked above makes it seem like linear types are “close”
18:35 <schell> though i hope they don’t intend to use that unicode “lolly” symbol
18:35 <dolio> schell: The difference is how the property is checked.
18:35 <dolio> A value with a unique type has not been shared, and if it gets shared, it will no longer have a unique type.
18:36 <dolio> A value with a linear type may not be further shared.
18:36 dfeuer joined
18:36 <dolio> But it may already be shared.
18:36 <schell> interesting, so the two systems overlap but they’re not the same
18:37 <dolio> Also linear doesn't allow you discard the value, either, whereas uniqueness typing doesn't typically care about that part.
18:37 <c_wraith> do languages with linear types often have a sink function?
18:37 <schell> hrm, that makes me think linear typing is better for resource management then
18:37 plugin joined
18:39 <dolio> Depending on what you want to do, you may be able to accomplish your goal with either scheme.
18:41 <dolio> For instance, Clean uses uniqueness types to tighten up the world-passing 'model' of I/O.
18:41 wraithm joined
18:42 BlueRavenGT joined
18:42 <nshepperd_> Affine types let you discard values, right?
18:42 <c_wraith> yes, affine is 0 or 1 use
18:43 Dembel joined
18:43 Ayey_ joined
18:43 <AWizzArd> Let’s say I have an instance of data Foo = { key1 :: T1, key2 :: T2, …, keyn :: Tn } – Can I use pattern matching to directly access key2, but at the same time have a name for the whole Foo instance?
18:44 <mohsen_> shapr: Isn't it a bit expensive? it is, at least in my country's currency.
18:45 <ski> AWizzArd : use `@'-patterns
18:46 <AWizzArd> ski: aah good, that works.
18:46 <mohsen_> "span is kind of like takeWhile, only it returns a pair of lists." Is this pair of lists in the form of a tuple?
18:46 <dolio> schell: Which you might think woudl be a better use case for linear types.
18:47 <dolio> But, if the only way to continue with your program is always to produce another unique value to pass on, it's kind of the same as having things linear.
18:48 <* schell> is digesting this
18:49 xall joined
18:50 sepp2k joined
18:50 zar joined
18:50 <mauke> :t span
18:50 <lambdabot> (a -> Bool) -> [a] -> ([a], [a])
18:51 <dolio> It's kind of like how existential things can be replaced by universals and vice versa.
18:51 <dolio> Because the difference depends on whether you are producing or consuming them.
18:52 sssilver joined
18:55 bcfdigtco joined
18:56 oisdk joined
18:57 wraithm joined
18:58 PennyNeko joined
18:58 albertus1 joined
18:59 viuo joined
19:00 osa1 joined
19:00 oisdk joined
19:01 madsj joined
19:01 <shapr> mohsen_: yeah, but if you want to learn Haskell with a recent book, it's worth the money.
19:02 takle joined
19:02 meoblast001 joined
19:03 <monochrom> It is not the only recent book. (And "best book" depends on you, too, not just the books.) But all recent books cost you money.
19:04 <monochrom> (As for worth, that mainly depends on you. The demand-price law implies that value means how desperate you are.)
19:05 fotonzade joined
19:06 guampa joined
19:06 ragepandemic joined
19:07 takle joined
19:07 connrs joined
19:08 sepp2k1 joined
19:08 zar joined
19:09 Rodya_ joined
19:10 cyborg-one joined
19:10 Levex joined
19:11 Natch joined
19:11 <mohsen_> shapr: In my currency its almost 1/3 of the salary of a primary school teacher
19:12 <ertes> i would really like to review that book at some point
19:12 <mohsen_> monthly salary*
19:12 <ertes> but i wouldn't pay $59 to do it
19:12 umib0zu joined
19:13 Jesin joined
19:13 <ertes> mohsen_: these lecture notes are free and highly practical with lots of exercises: https://www.seas.upenn.edu/~cis194/spring13/lectures.html
19:13 <jle`> AWizzArd: by the way, 'instance' means something else in Haskell than you are thinking of
19:14 <ertes> and i like its "explain, but don't hold their hand" approach
19:14 eschnett joined
19:15 osa1 joined
19:15 <mohsen_> ertes: Thanks
19:15 descender joined
19:15 Ayey_ joined
19:16 <jle`> the author has been understanding of financial situations of haskell learners in the past mohsen_
19:16 <jle`> if you contact them directly you might be able to get a discounted price
19:17 marsam joined
19:17 <bcfdigtco> I just finished those exercises this week. Can confirm—they're very useful. They don't go very far though.
19:17 fizbin joined
19:17 <bcfdigtco> I personally would like to get more experience with building a monad stack for my application.
19:17 <jle`> i know that they both care more abut teaching haskell than about making money, and the price is mostly to support themselves during the writing process
19:18 <jle`> so they would probably be happy to help :)
19:18 <ertes> this is subjective, but i believe monad transformers are by far the most abused abstraction in haskell
19:19 <bcfdigtco> @ertes Oh? Can you elaborate?
19:19 <lambdabot> Unknown command, try @list
19:19 <ertes> there is hardly ever a reason to have an "application monad", for example
19:19 <bcfdigtco> ertes: Oh? Can you elaborate?
19:19 <ertes> and transformers are far more satisfying and useful, if you use them in a short-lived manner
19:20 <bcfdigtco> Yeah, when I see application-level monad stacks, they feel like global state, but clunkier.
19:20 <ertes> it's not a philosophical point though, but quite a practical one: transformers suffer a lot from the expression problem
19:22 JagaJaga joined
19:22 <mohsen_> jle`: No its probably not expensive for someone that lives in europ or america, it becomes expensive when it's shipped to third world countries, which I'm from one of them, but my brother lives in america, I can ask him to buy me this book.
19:23 haskellnewb joined
19:23 <mohsen_> He comes home every now and often:)
19:23 <haskellnewb> hello guys, i am need of some help with generators and filters
19:24 Luke joined
19:24 Ayey_ joined
19:24 wraithm joined
19:25 <Akii> haskellnewb: just go ahead and ask
19:26 <Akii> mohsen_: just contact bytemyapp, he's lurking on IRC in #haskell-beginners or on twitter
19:26 nakal_ joined
19:26 mda1 joined
19:28 <kaol> How come ghc wants to deduce (Bounded a0) and not use Bounded a in this? http://lpaste.net/353609
19:28 <haskellnewb> Ok, following: i had to write a filter which will select the element of a list which has a distance to its following element of <= some small value.. now i want to use this filter with pairs of numbers (Double, Double). The selector code is here: http://pastebin.com/jUFj0p2K
19:29 oisdk joined
19:29 <ertes> reading the sample… something bothers me immediately: its disrespect for haskell.org, and its aggressive promotion of stack and stackage
19:30 Wamanuz joined
19:30 <monochrom> ertes: sample of haskellbook.com?
19:30 <ertes> yes
19:30 <michalrus> I find myself defining a lot of `newtype A = A { toText :: Text } deriving (Show, Eq)`… Can this somehow be made less verbose?
19:30 <monochrom> Ah, I think I agree with you.
19:31 oisdk joined
19:32 connrs joined
19:32 <monochrom> haskellnewb: Line 2's "a" is unrelated to line 1's "a".
19:34 <haskellnewb> monochrom: i think you meant kaol?
19:34 <monochrom> It will be hard to do what you want. You will need to jump into a small rabbit hole.
19:34 <monochrom> Oh! Sorry, yes.
19:34 <haskellnewb> i have no a in lne 2 ^^
19:34 <haskellnewb> No problem
19:34 <monochrom> kaol: Line 2's "a" is unrelated to line 1's "a". It will be hard to do what you want. You will need to jump into a small rabbit hole.
19:35 <monochrom> Look for both "ScopedTypeVariables" and "proxy".
19:36 <kaol> Ok, I'll look into those. My full code is quite a bit longer but I think it's the same issue I got with this two liner. Thanks.
19:37 <monochrom> I think the salient feature is "(a lot of constraints on type variable t) => (but t doesn't appear here)".
19:38 Ayey_ joined
19:38 <monochrom> That is disallowed. So you have to work around with the "proxy" idea: "(constraints on type var t) => p t -> (t doesn't have to appear here)".
19:39 <monochrom> And then you need line 1's "t" sync with the function body's "t", which is what ScopedTypeVariables does.
19:39 <jle`> mohsen_: in your specific situation it could be considered prohibitively expensive, so there's no harm asking :)
19:42 merijn joined
19:43 cur8or joined
19:45 marsam joined
19:49 tomphp joined
19:51 tromp joined
19:54 data_hope joined
19:54 cdg joined
19:55 twanvl joined
19:55 MP2E joined
19:56 Ayey_ joined
19:56 mstruebing joined
19:56 OnkelTem joined
19:59 centrinia joined
19:59 Gurkenglas joined
20:00 ompaul joined
20:00 darjeeling_ joined
20:02 geppettodivacin joined
20:03 Apocalisp joined
20:03 Vaelatern joined
20:03 Ayey_ joined
20:03 OnkelTem joined
20:05 ccomb joined
20:06 armyriad joined
20:06 napping joined
20:07 the|auriscope joined
20:09 {emptyset} joined
20:11 anuxivm joined
20:11 forgottenone joined
20:12 plugin joined
20:12 Ayey_ joined
20:14 geppettodivacin joined
20:14 meoblast001 joined
20:14 Vaelatern joined
20:15 subttle joined
20:17 zero_byte joined
20:18 Guest_ joined
20:19 anuxivm joined
20:19 oisdk joined
20:21 AleXoundOS joined
20:22 Ayey_ joined
20:24 halogenandtoast joined
20:26 moth joined
20:27 sellout- joined
20:29 eiriksfa joined
20:31 epsilonhalbe joined
20:31 Ayey_ joined
20:32 wraithm joined
20:33 uglyfigurine joined
20:34 <eiriksfa> anyone here got some time to help out a newbie?
20:35 <Cale> Probably
20:35 <monochrom> No guarantee.
20:35 <eiriksfa> ^.^
20:35 <Cale> Best just to ask about what you need help with
20:35 <Lazersmoke> ^
20:35 bjz joined
20:36 freechips joined
20:36 <eiriksfa> well, I'm trying to learn haskell, and thought it would be a decent idea to use codeingame as a learning tool
20:37 <eiriksfa> and while looking over one of the challanges I believe I would have been able to solve it pretty quick, if I had the input in the form of an [Int], but using an input stream is sort of difficult when you know nothing about Monads
20:37 conal joined
20:37 epsilonhalbe left
20:38 <eiriksfa> and I would sort of like to wait a bit before learning about it as well honestly
20:38 <monochrom> No Monad necessary for using [Int].
20:38 <Lazersmoke> what was the input format if it wasn't [Int]?
20:39 <eiriksfa> [IO Int]
20:39 pleax joined
20:39 uglyfigurine joined
20:39 <monochrom> OK, read my http://www.vex.net/~trebla/haskell/IO.xhtml
20:39 beanbagula joined
20:40 <eiriksfa> okay, thanks, will read that one first, might come back with more questions after testing
20:40 <napping> how did you get a [IO Int]?
20:40 <eiriksfa> replicateM 5 $ do / input_line <- getLine / let ei = read input_line :: Int / return (ei)
20:40 <eiriksfa> where '/' is a linebreak
20:40 <Lazersmoke> hmm that's a bit of an odd type. you can use `sequence` to help you out if you just need a quick fix
20:40 <Lazersmoke> http://hackage.haskell.org/package/base-4.9.1.0/docs/Data-Traversable.html#v:sequence
20:42 <napping> Isn't that IO [Int]?
20:43 umib0zu left
20:43 dan_f joined
20:43 dni joined
20:43 <Lazersmoke> yeah it should be: `replicateM :: Applicative m => Int -> m a -> m [a]`
20:43 fotonzade joined
20:43 <Lazersmoke> so the list should be on the inside
20:44 peterbecich joined
20:44 <eiriksfa> oh, yea, sorry, it's an IO [Int]
20:45 <Lazersmoke> btw, whenever you have something like `do {x <- whatever; let fx = f x; return fx}`, it's the same as `fmap f whatever` or `f <$> whatever`
20:48 Ayey_ joined
20:48 <napping> Does ghc try to optimize the implementation of match expressions much? compiler/deSugar/Match.hs doesn't seem to be using column heuristics or anything
20:50 oisdk joined
20:53 md201 joined
20:56 dsh joined
20:59 alx741 joined
21:01 schell joined
21:01 Ayey_ joined
21:03 Luke joined
21:05 doomlord joined
21:07 tromp joined
21:08 Ferdirand joined
21:08 Rainb joined
21:10 Ayey_ joined
21:12 <lep-delete> i think you have to be careful with re-ordering colums wrt. lazyness
21:12 <lep-delete> afair
21:13 Fairy joined
21:14 Ch3ck_ joined
21:15 mohsen_1 joined
21:15 wraithm joined
21:16 Ayey_ joined
21:16 uglyfigurine joined
21:17 vydd joined
21:17 vydd joined
21:18 skeuomorf joined
21:18 Luke joined
21:19 uglyfigurine joined
21:20 dmwit_ joined
21:21 <ogkloo> Hi #haskell, I'm trying to install Eta from source, but every time I run stack setup (installed from this: https://docs.haskellstack.org/en/stable/install_and_upgrade/, version 1.4.0), I get "stack will use a locally installed ghc..." and then quits. Is this normal? Sorry, I'm kinda new to stack.
21:22 caumeslasal joined
21:23 initiumdoeslinux joined
21:23 wraithm joined
21:23 <Lazersmoke> ogkloo that is normal; stack setup is not how you build from source, though
21:24 <Lazersmoke> you probably want to cd to the directory and do "stack build"
21:24 <Lazersmoke> or "stack install" if you want it copied to an executable directory
21:25 mizu_no_oto_work joined
21:25 _ashbreeze_ joined
21:25 <ogkloo> Lazersmoke: thank you, I ran their install script but it spits out a lot of errors, but I think that's on the eta part of it.
21:26 Detrumi joined
21:27 oisdk joined
21:28 <Lazersmoke> yeah its almost certainly on eta's end
21:28 <Lazersmoke> they have a huge custom build script: https://github.com/typelead/eta/blob/master/shake/Build.hs
21:29 Ayey_ joined
21:29 <ogkloo> yeah iirc their documentary is due for another update soon so I probably just got into it at an unlucky time. Now I'm getting file permission errors, so I'm just gonna chown a lot of things and hope.
21:30 ziocroc joined
21:31 <mpickering> napping: Exactly what kind of case expressions do you mean?
21:31 <mpickering> It does do some optimisations
21:32 <napping> I was specifically looking a5t maranget's papers
21:33 zariuq joined
21:33 <napping> Maybe some things like this: http://pauillac.inria.fr/~maranget/papers/opat/
21:33 <napping> maybe it does some things like this, though I didn't notice anything that looks like keeping a summary of the information known when backtracking
21:34 Ayey_ joined
21:34 plugin joined
21:35 <napping> or the column ordering heuristics like in “Compiling Pattern Matching to Good Decision Trees”
21:35 sepp2k joined
21:35 <napping> http://moscova.inria.fr/~maranget/papers/ml05e-maranget.pdf
21:35 ramzifu joined
21:36 conal joined
21:36 <dolio> napping: Some of the things that latter paper does are incorrect in Haskell.
21:37 <napping> I'm not surprised if some of the details would have to change, but I doubt laziness generally removes all choice
21:39 <napping> Isn't it just that you would always be forced match on a column whose first row has a constructor pattern ?
21:39 zargoertzel joined
21:39 wtetzner joined
21:39 <dolio> No, some of the matrix splitting is subtly incorrect, as I recall.
21:41 <napping> How is that? I can see a problem if you force something before it's actually required
21:41 <dolio> There was a talk about rewriting the match compiler in GHC a bit ago that had an example, I'll see if I can find it.
21:43 zar joined
21:44 doodlehaus joined
21:45 conal joined
21:48 pera joined
21:48 mmachenry joined
21:49 <dolio> napping: So, I think the example is...
21:49 <dolio> `f _ False = 1 ; f True False = 2 ; f _ _ = 3`
21:49 zariuq joined
21:50 conal joined
21:50 bjz joined
21:50 <dolio> And the compiler in that paper will erroneously never evaluate the first argument.
21:51 <dolio> In the case of the second argument being True.
21:51 Lord_of_Life joined
21:51 <dolio> But that is incompatible with the Haskell report's specification of how pattern matching works.
21:51 <dolio> Which says each case gets tried in order.
21:52 <dolio> So `f undefined True` should blow up.
21:52 augur joined
21:52 hiratara joined
21:52 <napping> does it really specify the order?
21:52 xaviergmail_ joined
21:53 <napping> that just seems to require forcing some more things at the end of the match
21:53 <monochrom> Haskell Report specifies strictness. It specifies that "f xxx True" is strict in xxx.
21:53 <dolio> The answer must be as if you tried them in order.
21:53 <dolio> It doesn't matter how you actually do it as long as you get the same answer.
21:54 <monochrom> Yeah, you need to bottom out, despite optimizations and shuffling.
21:54 <dolio> But if you are careless, you will forget that you have to be strict in the first argument if the second argument is True.
21:54 <napping> ok, but that doesn't seem like a deep problem
21:55 <monochrom> OTOH you could propose to the Haskell Prime committee to relax this.
21:55 <monochrom> But then ETA is approx 10 years. :)
21:55 <napping> the definitions of necessity and exhaustiveness from the paper would have to be adjusted for a non-strict language anyway
21:55 kadoban joined
21:56 <dolio> https://people.cs.kuleuven.be/~george.karachalias/papers/p424-karachalias.pdf
21:56 <dolio> That is the paper that describes how the pattern match compiler is currently implemented.
21:56 <dolio> I think.
21:57 <napping> ah, that seems likely
21:57 <dolio> Anyhow, I wrote a pattern match compiler based on the paper you linked, modified in the way I thought was required for laziness (the choice of what to split on). And the result is wrong. :)
21:58 <dolio> Because it thinks that second case is redundant, and I didn't realize it isn't when modifying for laziness.
21:58 <napping> I'm looking into implementing one for a non-strict rewriting case
21:59 oisdk joined
21:59 <napping> I was just looking at compilers and wondering how much GHC would optimize things
22:00 <dolio> You also have to decide what you think "optimized" is.
22:00 <dolio> That splitting trees paper optimizes for fewest necessary cases, but at the cost of duplicating code.
22:01 <napping> in my case it will be performance of a program totally dominated by matching
22:01 <dolio> As I recall.
22:01 <napping> I hoped to find more papers talking about some combinations of decision trees and backtracking, but I haven't found any
22:01 <dolio> But it's possible for optimizing for smallest code size to be better, I think.
22:02 <napping> Well, yes, minimum expected depth isn't necessarily the same as speed
22:02 Koterpillar joined
22:03 <napping> But I doubt the absolute smallest code will be optimal
22:03 <monochrom> Clearly, the smallest code is a self-extracting exe... :)
22:04 <monochrom> self-decompressing, even
22:04 <napping> Think i-cache here
22:05 vydd joined
22:05 vydd joined
22:05 <erisco> there's no free lunch, and stuff
22:05 Hi joined
22:05 <dolio> Or maybe there's some order that would be better for branch prediction for your particular problem, and that blows away doing redundant work or something.
22:06 <dolio> Which probably wouldn't be worked out by the 'optimal' splitting tree.
22:06 <napping> Why not?
22:06 <napping> well, for some notion of 'optimal' that doesn't take into account the actual distribution, sure
22:06 <dolio> Right.
22:06 <napping> but that's certainly something I can profile
22:07 <erisco> but then your machine may be different than another
22:07 <napping> There's no reason to suspect that never duplicating code will get the best performance here
22:07 <dolio> Branch prediction is probably a more realistic example than code size.
22:08 <napping> I do suspect that leaving some rows with wildcards to be handled by backtracking might be better than turning everything into a pure decision tree
22:08 Ayey_ joined
22:09 <napping> although that does remind me of BDDs, where the optimization problem gets a lot trickier if you allow repeated tests
22:09 <napping> Like with code size, I expect it would mostly be a question of not exceeding branch predictor size
22:10 <Tuplanolla> Saner processor architectures will save us.
22:10 prophile joined
22:10 <napping> if there are few enough branches and enough time to warm up, having separate jump instructions for matching a position in different contexts are probably more predicatable
22:10 prophile joined
22:11 <napping> I'm also not terribly concerned about compilation time, at least for a fully-optimized "release" build
22:12 <erisco> if they make these techniques transparent then they'll just come up with another set of opaque ones
22:12 <erisco> how else do they compete
22:12 takle joined
22:13 <napping> Tuplanolla: save us from what?
22:14 <Tuplanolla> Save us from unpredictable optimizations.
22:14 kaeluka joined
22:15 <ezyang> linear types for guaranteed otpimization is really cool :)
22:15 <napping> I'm not too worried about anything unpredictable
22:16 mounty joined
22:18 doomlord joined
22:19 _deepfire joined
22:21 vaibhavsagar joined
22:23 takle joined
22:24 schell joined
22:25 wraithm joined
22:25 gugah joined
22:26 doodlehaus joined
22:26 k0ral joined
22:27 <hpc> ezyang: i was actually thinking using linear types to make a FFI that understands rust
22:27 <hpc> far better than the current FFI understands C
22:28 FullyFunctional left
22:31 hiratara joined
22:35 Ayey_ joined
22:35 <jle`> weird that adding a layer of indirection (in the form of a strict-field data wrapper) made my program a little faster
22:35 <jle`> i wonder if it's just noise
22:35 <jle`> better run my benchmarks a few more times
22:38 systadmin joined
22:38 ccomb joined
22:42 pera joined
22:42 systemfault joined
22:42 subttle joined
22:43 AustinTasseltine joined
22:45 <centril> Is there a IOT (IO Transformer) monad ?
22:46 <johnw> centril: what would it's base transformer ever be?
22:46 Voldenet joined
22:46 Voldenet joined
22:46 <johnw> err, base moned
22:47 <Cale> Well, anything, presumably
22:47 <centril> johnw: that's a good question
22:47 <centril> I guess newtype IOT m a = m (IO a) wouldn't make much sense...
22:47 <Cale> In principle, such a thing could exist, but it would require a different approach to implementing IO
22:47 <Cale> If IO were implemented, for instance, as a free monad
22:48 <johnw> you'd need to be able to write this function m (IO (m (IO a))), which I don't think you can
22:48 <Cale> Then IOT would make sense as a corresponding FreeT
22:48 <johnw> -> m (IO a)
22:48 <Cale> Yeah, that wouldn't be a valid approach
22:48 <napping> you need a distribution function like m (IO a) -> IO (m a)
22:48 <centril> how about IOT m a = IO (m a) ?
22:48 <Cale> no, that still doesn't help
22:49 <johnw> napping: which I guess does work for some m, like (,) b
22:49 <Cale> You need to actually know something about IO
22:49 <Cale> in order to be able to do this
22:49 <Cale> it can't work opaquely
22:49 <napping> I suppose that might sometimes be weaker than MonadIO
22:49 <Cale> and since IO in Haskell is an opaque type, you're out of luck
22:49 <Cale> If you only need *certain* IO actions, then check out FreeT
22:50 <centril> johnw: why exactly is :: m (IO (m (IO a))) -> m (IO a) needed?
22:50 <Cale> :t join
22:50 <lambdabot> Monad m => m (m a) -> m a
22:50 <centril> oh shit
22:50 <centril> didn't see that it was join
22:50 doodlehaus joined
22:51 <centril> Cale: yeah - if you cant write join then no dice
22:51 <napping> Cale: why do you say "need to know something about IO"?
22:51 <Cale> napping: I mean, it's not true that for all monads, M and N, that the composite of M and N is a monad.
22:51 <napping> sure
22:51 <Cale> There's no generic way to do it
22:52 doodlehaus joined
22:52 <Cale> So, if you don't assume something special about IO, that is, it's effectively an arbitrary monad, you're not going to have any luck.
22:52 <napping> ah, it can't be a MonadTrans instance, no
22:52 kvda joined
22:52 <johnw> the most generic condition under which it applies is if you can say: forall a, n (m (n a)) -> m (n a), for some Monad m and some Applicative n
22:52 <Cale> There could be a reasonable IOT in principle though
22:53 <centril> Cale: would it be a helpful addition ?
22:53 <napping> But you can require something more than Monad m for your instance Monad (IOT m)
22:53 <centril> is it motivated?
22:53 <Cale> (effectively something like a free monad transformer, for a functor which explains what all the IO primitives are)
22:53 sphinxo joined
22:54 <napping> centril: I suspect MonadIO covers most of what you might want
22:54 <Cale> centril: I wouldn't expect it to be especially useful either
22:55 <centril> napping: =) in my case tho, Im using IO as base, so it was just an academic question
22:55 <centril> (or Identity as base)
22:56 ziocroc joined
22:56 <johnw> I wouldn't mind seeing FixT f m
22:56 lavalike_ joined
22:56 <Cale> However, there would certainly be an advantage to having IO not be opaque
22:57 <centril> Cale: how could IO not be opaque ?
22:57 <Cale> It would actually be really cool to be able to take arbitrary IO actions and inspect what they were going to do before running them
22:57 <centril> given that RealWorld is opaque... ?
22:57 <Cale> You wouldn't use RealWorld
22:58 <Cale> The RealWorld thing is just a hack to get GHC's dependency analysis to keep the order of evaluation of a bunch of impure functions straight.
22:58 <centril> Cale: then how can you model arbitrary IO without an interface that constrains performance considerably for IO ?
22:58 <napping> allow hurting performance?
22:58 <Cale> Well, you'd make good performance an open question
22:58 <Cale> Maybe not impossible
22:59 <napping> Cale: you probably couldn't inspect too far
22:59 <napping> before hitting a lambda
22:59 <Cale> Right, but you could always inspect the next thing to do
22:59 <napping> you could make a free monad with syscalls as actions or something
22:59 <Cale> and transform the action so that you get to inspect the thing after
22:59 <centril> wouldn't you need a to have a constructor for every primitive IO operation? which would require a biiiig list ?
22:59 <napping> maybe a bit too OS-specific
22:59 <Cale> centril: Probably not that big.
22:59 <centril> (maybe not so big)
22:59 <Cale> You could have a few really generic ones
23:00 lavalike joined
23:00 <centril> Cale: the more you have the better the performance I guess
23:00 <Cale> I think Idris does it, iirc.
23:00 <Cale> Could be wrong, but you might want to look
23:00 <centril> the more specific you can be when it comes to operating system operations, the better
23:01 <centril> and operating systems still have a lot & different set of operations
23:01 <centril> differing*
23:01 <napping> usually no more than 256 syscalls, right?
23:01 <centril> Cale: interesting, I've been meaning to take a closer look at Idris
23:02 <centril> napping: have you seen the syscalls in windows? so many headers...
23:02 <centril> how do you efficiently model arbitrary FFI ?
23:02 mizu_no_oto joined
23:03 <napping> you might have a more opaque type there, like a "ForeignSymbol args result" and an action to call a foreign function
23:03 <centril> napping: right, still less opaque I guess
23:04 <napping> and there it's more a question of making it extensible
23:04 <centril> than letting entire IO be opaque
23:04 <centril> napping: exactly
23:04 pera joined
23:04 doomlord joined
23:04 <napping> and maybe making it harder to create new ill-typed values
23:04 <centril> much problems, tricky tricky
23:04 <centril> also probable :P
23:04 <napping> there could still be functions for getting the symbol name or address or whatever
23:05 stelleg_web joined
23:05 HoierM_ joined
23:06 isenmann joined
23:07 <centril> right
23:08 systadmin joined
23:08 PennyNeko joined
23:08 Thra11 joined
23:08 tromp joined
23:11 gridaphobe joined
23:12 plugin joined
23:14 lavalike joined
23:15 vydd joined
23:15 systemfault joined
23:16 vydd joined
23:21 halogenandtoast joined
23:26 Ayey_ joined
23:26 eSVG joined
23:27 tromp joined
23:31 louispan joined
23:35 mexisme joined
23:40 <jle`> hi all
23:40 <jle`> why isn't there a MonadIO instance for Proxy
23:40 <jle`> it follows all of the laws
23:40 <jle`> that is all i wanted to say
23:41 khlrbi joined
23:42 Swizec joined
23:43 Natch joined
23:43 scope joined
23:43 oisdk joined
23:43 khlrbi left
23:43 <scope> hey all, I have a quick question as a haskell noobie if anyone could help me out.
23:44 <jle`> scope: ask your question, you don't need permission :)
23:44 cschneid_ joined
23:44 <centril> scope: shoot!
23:45 <scope> So, I have a function "distance" that takes in arguments: (x1,y1) (x2,y2), and I'm trying to access the arguments within the definition.
23:45 sillyotter joined
23:45 <scope> I keep getting type mismatch errors, and I'm guessing it has something to do with the parameters being in tuples?
23:45 <jle`> hard to say without seeing the error
23:45 <ezyang> paste some code
23:45 <MarcelineVQ> @lpaste
23:45 <lambdabot> Haskell pastebin: http://lpaste.net/
23:45 <centril> scope: if you can, paste your code @ http://lpaste.net/
23:45 <jle`> by 'hard' i mean 'more or less impossible' :)
23:45 <centril> MarcelineVQ: hah :D
23:45 <scope> sure one sec
23:46 conal joined
23:46 <scope> http://lpaste.net/6107602198248554496
23:46 <Koterpillar> aaaand the error?
23:46 <scope> when I try to set it equal to just "x1" or any of the other arguments I get errors. I just need to know how to access those arguments.
23:46 <scope> one sec
23:47 <glguy> don't forget to wrap the error in <spoiler> tags
23:47 <jle`> the error is probably that you don't have anything on the right side of the equals sign
23:47 <Koterpillar> you're promising to give back any b that's a Floating; x1 is not b, it's a
23:47 <geekosaur> scope, the reason you cant just returb one of the parameters is ... that
23:47 <geekosaur> type conversion is NOT automatic in haskell
23:47 <jle`> distnace (x1, y1) (x2, y2) = (you need something on this side)
23:47 <scope> well when I try to input the actual equation for euclidean distance it does the same
23:47 <geekosaur> (except for literals, but that's soemthing of a compiler hack)
23:48 <jle`> i doubt it gives the same error
23:48 <geekosaur> yes, you need to coerce your a-s to b-s at some point
23:48 <geekosaur> or decide what you actually meant with the type
23:48 <scope> for instance if I do = sqrt (x1 - y1)^2 + (x2 - y2)^2 I get the same error
23:48 <glguy> :t sqrt
23:48 <lambdabot> Floating a => a -> a
23:48 <jle`> scope: the result is the same type as the items in the inputs
23:48 <jle`> so you don't want Point a -> Point a -> b
23:48 <jle`> you want Point a -> Point a -> a
23:49 <glguy> scope: Separate problem is that you probably meant to write: sqrt ((x1 - y1)^2 + (x2 - y2)^2)
23:49 <geekosaur> is there some reason you have that Real constraint?
23:49 <scope> As I said I'm extremely new to Haskell. I've tried it that way as well glguy
23:49 Swizec joined
23:49 <scope> that's just how the function stub was given to me
23:50 <glguy> scope: Like I said, it's a separate problem from your type problem. You need parentheses for sqrt to span the whole sum
23:50 <scope> here I'll paste my code again in a second
23:50 <jle`> scope: you take in an (a, a) and you return something that's the same type as the things inside the tuple
23:50 <scope> so how do I go about fixing that?
23:50 <jle`> scope: so the type of the thing you return is 'a'
23:50 <jle`> not 'b'
23:51 <jle`> `Point a -> Point a -> a` should work
23:51 <jle`> `Point a -> Point a -> b` means that the result isn't the same type as the tuple's contents
23:51 <jle`> or well, not necessarily the same type
23:51 <jle`> but in your case, the thing in the tuples is the same type as the thing you're returning
23:51 YongJoon joined
23:52 <scope> I'm being told it's because sqrt takes in a float but I'm giving it a real
23:52 <jle`> Real isn't a type, so that's not quite an accurate explanation
23:52 <geekosaur> yes
23:52 <geekosaur> or, well, sort of.
23:52 <geekosaur> it takes a type with a Floating instance, you give it one which is only knwon to have a Real instance
23:52 <jle`> but if you fix it to be Floating a => Point a -> Point a -> a, it should work
23:52 dopey_ joined
23:52 cdidd joined
23:53 <scope> so a friend is saying realToFrac should fix it?
23:53 Welkin joined
23:53 <jle`> we're not quite sure what you want to fix yet exactly because you haven't shown us the code, so it's hard to say
23:53 <lpaste_> glguy annotated “No title” with “No title (annotation)” at http://lpaste.net/6107602198248554496#a353616
23:53 <geekosaur> that gives you a type with a Fractional instance. not all such types are known to have Floating instances. (Rational, for example)
23:54 <jle`> but from inferring from what you are saying, it should work as Floating a => Point a -> Point a -> a
23:54 <jle`> but, it's difficult to say exactly because we aren't sure what the code is
23:55 <jle`> h:268
23:55 <Welkin> h265
23:55 <scope> jle one sec
23:55 <glguy> If it's the case that you're required to maintain the original type, then you can insert a realToFrac between sqrt and its argument
23:56 <scope> this doesn't quite work either http://lpaste.net/5629341131524276224
23:56 <scope> glguy tried what you said
23:56 eacameron joined
23:56 <scope> "could not deduce (Floating (a -> b)) arising from a use of 'sqrt'
23:57 <glguy> scope: You still have to use Haskell function application syntax, not literally control-v the word realToFrac into the line
23:57 <glguy> sqrt (realToFrac ( ...
23:58 <scope> is that not what I did though...?
23:58 <glguy> scope: Then you have the problem that you're not computing distances
23:58 <glguy> you've got your xs and ys crossed
23:58 <glguy> no, you forgot the parentheses
23:58 <glguy> so you're using realToFrac as the argument to sqrt
23:58 <scope> wait the whole thing is encapsulated in parentheses though
23:59 <scope> sqrt realToFrac((x1 - y1)^2 + (x2 - y2)^2)
23:59 <scope> OH
23:59 <scope> shit
23:59 mson joined
23:59 <scope> wow
23:59 <scope> I see what you mean sorry
23:59 <jle`> yeah, that means that you're applying the function sqrt to realToFrac
23:59 <jle`> and square rooting a function usually isn't what you want :o