<    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 justicefries joined
00:03 <jle`> 1;0c/b 10
00:04 <jle`> i wonder why my terminal emulator or ssh client throws these random characters onto the screen
00:06 andrei_chiffa__ joined
00:07 ivana_ joined
00:08 markus1189 joined
00:08 markus1199 joined
00:08 Swizec joined
00:08 mdarse joined
00:08 baasvik joined
00:09 ivana_ left
00:11 <baasvik> is there a way to just fetch dependencies with cabal and *not* build them?
00:11 <ezyang> it's either cabal get or cabal fetch
00:11 <baasvik> cabal install (from inside a directory with a sandbox in it) and (cabal install --dry-run) seem to have different behavior
00:12 <baasvik> okay let me put a shell script in the pastebin and hopefully get some guidance on what I'm doing wrong
00:15 maerwald_mob joined
00:15 WizJin joined
00:16 rekahsoft joined
00:16 Swizec joined
00:18 manek joined
00:18 mbw joined
00:19 <manek> hello guys! :) Is it possible to tell stack to copy-bins of dependencies? I've got a package that needs graphmod which is shipped as executable only. I want to add it to stack config and copy its executable to bin folder. Unfortunetally `-copy-bins` copies only my lockal package bin
00:22 <mbw> Hello everyone. Can you interface with a C routine that expects a pointer to over-aligned memory? Say it is something computationally expensive that uses vector instructions. I don't have a concrete example in mind, I'm just curious. My google-fu didn't come up with anything, either.
00:23 <mbw> I presume I could just interface to aligned_alloc or something, and then call the C function?
00:24 <ezyang> mbw: Well, if you're passing Ptrs around, you can make them however you want
00:25 cyphase joined
00:25 theDon_ joined
00:26 Shatnerz0 joined
00:26 <geekosaur> mbw, hsc2hs allows you to specify alignment in various ways. for a Ptr, iirc it's part of the Storable instance for the target type
00:26 hamishmack joined
00:27 lambda-11235 joined
00:28 dramforever joined
00:29 zcourts_ joined
00:29 contiver_ joined
00:31 dreco joined
00:35 Rizy joined
00:36 gugah joined
00:37 pera joined
00:39 gugah joined
00:41 nakal joined
00:42 ramzifu joined
00:43 ljc joined
00:43 bjz joined
00:45 <mbw> Ok, so how I understand it, the #alignment keyword is used for computing the alignment of a given C struct, taking padding into account. However according to the documentation, the #type keyword is restricted to C's POD types. On the other hand, in the FFI example for interfacing with Gsl on the HaskellWiki, they define their own Storable class, which mandates specifying an alignment. So I guess there are
00:45 <mbw> these three ways: 1. Allocate normaly, assuming natural alignment. Then send an offset pointer to C. 2. Call a C allocation function. 3. <Insert something intelligent about Storable here>. The hsc2hs documentation isn't really conclusive for me.
00:46 <mbw> 1. is not entirely correct, since I would need to figure out the actuall address (which is probably possible).
00:47 louispan joined
00:47 <mbw> Since I don't have _that_ much with Haskell's FFI (and hsc2hs, inline-c and ...) yet, I guess I better post-pone this and just assume it's possible.
00:47 lambda-11235 joined
00:47 dreco joined
00:47 <mbw> Anyway, thanks ezyang and geekosaur.
00:48 <mbw> *that much experience
00:48 <baasvik> Here's what I'm trying to do http://lpaste.net/7137326431440207872
00:48 <baasvik> I'm trying to fetch Haskell stack sources
00:48 <baasvik> and the sources for dependencies inside a cabal sandbox without building anything
00:49 <geekosaur> short version is you use hsc2hs when building direct FFI bindings to functions, and Storable when the FFI interface exclusively uses pointers to arrays
00:50 <geekosaur> you *can* do arrays via hsc2hs, but you are limited to what Foreign.Marshal.Array can do... Storable is a later and more complete interface, and gives you access to things like Storable Vectors
00:51 lambda-11235 joined
00:51 <geekosaur> so unless you're doing something very simple, you may want to focus on Storable and ignore Foreign.Marshal.Array. note that Storable also replaces hsc2hs's struct support in this case
00:52 <mbw> So with storable, the focus is on *exclusively*, and a function like void do_stuff(double *a, size_t n); does *not* apply?
00:52 _ashbreeze_ joined
00:53 <dmwit> ongy: You have a question about new-exec/new-run?
00:53 Textmode joined
00:53 <dmwit> ongy: Oh, just about the existence? https://github.com/dmwit/cabal/tree/feature/new-run
00:54 <dmwit> ongy: And yeah, new-exec can run things you've built, but will not build them if you haven't already. new-run does
00:57 <dmwit> (new-exec never builds, but will happily execute any command; new-run always builds and only works for executables in your dependency tree)
00:57 <monochrom> So there is a new-* series of commands, new-build, new-run, etc?
00:57 <dmwit> yep
00:57 <monochrom> <joke> Is there also a new-fangle? </joke> <duck>
00:58 <dmwit> =D
00:58 <monochrom> Actually is there a reason they are all called new-*?
00:59 <dmwit> Yes. They're a big breaking change to the way you use cabal.
00:59 <dmwit> And they're not finished/well-tested yet, so it's premature to just drop them on people for sure.
00:59 Coldseeker joined
01:00 doodlehaus joined
01:00 pita left
01:00 <dmwit> (Disclaimer: This is my outsider understanding of the current state. IANACD)
01:02 sellout- joined
01:02 <dramforever> I hope this isn't off-topic, but: {Where can I find|Are there any} implementations of 'Okasakian' persistent data structures in 'mainstream' languages?
01:03 lambda-11235 joined
01:03 JeanCarloMachado joined
01:03 <dramforever> mainstream, like for example C
01:03 EuAndreh[m] left
01:04 <geekosaur> mbw, the question is about how you use it from Haskell, not from C. the Haksell side interface for hsc2hs is Foreign.Marshal. the Haskell side interface for Storable is the type's Storable instance
01:06 <geekosaur> and, if you use Storable you can take advantage of anything that supports a Storable instance. with Foreign.Marshal you basically get whatever you write in the hsc file, and would have to reinvent much of Storable if you wanted to use it
01:06 Fairy joined
01:06 baasvik joined
01:08 ajhager joined
01:09 ner0x652 joined
01:09 alexknvl joined
01:10 mbw joined
01:14 FreeBirdLjj joined
01:16 <EvanR> dramforever: they are rewritten from scratch each time
01:16 <EvanR> in C
01:16 doomlord joined
01:16 hexagoxel joined
01:18 mjs2600 joined
01:18 buglebudabey joined
01:18 <mbw> Realistically speaking, I think the use case is probably not realistic, anyway. To have a function set up in a way that certain alignment conditions stricter than natural alignment are fulfilled, makes sense if the function is called a lot of times and doesn't do much work. Otherwise, the usual autovectorized code that jumps around between vectorized/unvectorized parts is fine. The former case is probably
01:18 <mbw> not realistic, since I wouldn't want to call into C from Haskell a large number of times and I *presume* their is no portable way to inline a foreign function.
01:18 <dramforever> EvanR: Okay, I don't think I'll be using one, but I would be happy to see one
01:21 nemorichard joined
01:24 crobbins joined
01:24 wlemuel joined
01:26 pasukon joined
01:26 crobbins_ joined
01:26 wraithm joined
01:26 mac10688 joined
01:27 <mbw> Anyway, thanks for your help.
01:27 crobbins_ joined
01:28 lambda-11235 joined
01:29 shaal joined
01:29 crobbins_ joined
01:30 _sras_ joined
01:30 wedens joined
01:31 buglebudabey joined
01:31 <_sras_> How can I use postgresql's hstore type with Opaleye. What are the respective Opaleye types?
01:33 mkoenig joined
01:34 NextHendrix joined
01:35 <NextHendrix> hi, the docs for lambdabot are severely lacking, are there any better ones hiding away
01:35 <NextHendrix> ie not the wiki or on github
01:37 TxmszLou joined
01:37 conal joined
01:38 andrei_chiffa_ joined
01:42 tommd joined
01:43 ingex joined
01:44 sanitypassing joined
01:47 doodlehaus joined
01:48 contiver_ joined
01:49 suls joined
01:50 fosskers joined
01:51 Rizy joined
01:54 contiver_ joined
01:54 mjs2600 joined
01:54 <posco> it seems the `-i` option is ignored with `ghc --make` mode. Is there something I am doing wrong?
01:54 <posco> ghc -fforce-recomp --make -iout-hi -v -c Bar.hs -odir out-obar -hidir out-hi-bar
01:55 <ezyang> -i controls source include path, not his
01:55 <posco> this link suggests otherwise: https://downloads.haskell.org/~ghc/5.00/docs/set/separate-compilation.html#RECOMP
01:55 <posco> in finding interface files it says use `-i`
01:55 <ezyang> you do realize those docs are for GHC 5?
01:56 <posco> yeah. :) but I hoped/assumed the options would be the same...
01:56 <posco> let me find the latest
01:56 <ezyang> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/separate_compilation.html#search-path
01:57 mhagemeister joined
01:58 <posco> I'm not immediately finding an option to include a directory in the interface search
02:00 <posco> it seems like `-i` might be right, it is just that make mode expects the full source to be there
02:00 <posco> without `--make` it seems to work
02:01 <ezyang> I think it's -hidir
02:01 <posco> I thought that was for output
02:02 pleax joined
02:02 pasukon joined
02:03 mekeor joined
02:03 <posco> just to be clear what I'm really trying to do: write bazel rules for haskell.
02:05 <posco> if I don't use `--make` I need to pass the files in the correct dependency order.
02:05 <MarcelineVQ> posco: there is a difference with --make https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/separate_compilation.html#search-path
02:05 <posco> if I use `--make` I can't see the interface files from a different compilation.
02:06 <MarcelineVQ> I've never used the option so I've nothing more useful to add :X
02:06 <posco> so, it looks like --make just can't be used in this way.
02:06 vadimich joined
02:07 <posco> MarcelineVQ: thanks for pointing that out, though
02:07 doodlehaus joined
02:09 dbmikus joined
02:10 FreeBirdLjj joined
02:10 michael1 joined
02:11 pacak joined
02:12 kadoban joined
02:14 Welkin joined
02:14 GlobalAtom left
02:15 sobaken joined
02:15 mkoenig_ joined
02:16 parsnip0 joined
02:17 parsnip joined
02:17 parsnip joined
02:17 drostie joined
02:20 infinity0 joined
02:20 deepfire joined
02:20 Rizy joined
02:21 marfoldi joined
02:22 cschneid_ joined
02:23 doyougnu joined
02:23 infinity0 joined
02:26 infinity0 joined
02:28 infinity0 joined
02:30 echo-area joined
02:30 raycoll joined
02:31 infinity0 joined
02:31 govg joined
02:33 halogenandtoast joined
02:34 infinity0 joined
02:36 danharaj joined
02:38 ptvirgo joined
02:39 clinton joined
02:39 tsmish joined
02:41 mwilly joined
02:46 Rizy joined
02:47 anuxivm left
02:51 doyougnu joined
02:52 Shatnerz0 joined
02:53 ajhager joined
02:54 cyanobacteria joined
02:57 cdg joined
02:58 conal joined
03:00 <clinton> Is there a way to partially apply type families that aren't constraints?
03:00 hucksy joined
03:01 Foras joined
03:01 markasoftware joined
03:01 hexagoxel joined
03:02 pleax joined
03:04 afarmer joined
03:08 systadmin joined
03:09 ronnik joined
03:09 raycoll joined
03:10 pickle_ joined
03:11 echo-area joined
03:11 fuccboi joined
03:12 fuccboi joined
03:12 thecrooked joined
03:13 <geekosaur> clinton, I don't think you can do partial application at all at the type level
03:13 <geekosaur> you can defer checking, but there are no type lambdas and few and limited hacks to simulate them
03:13 manlet joined
03:14 mjs2600 joined
03:15 steeze joined
03:17 echo-area joined
03:20 systemfault joined
03:24 sobaken joined
03:25 danthemyth joined
03:26 Guest77462 joined
03:26 eklavya joined
03:27 argent0 joined
03:28 raichoo joined
03:28 argent0 left
03:30 xall joined
03:30 cmr joined
03:30 cmr joined
03:32 vadimich joined
03:32 fabianhu joined
03:34 tommd joined
03:36 raycoll joined
03:39 connrs joined
03:40 <clinton> geekosaur: I've written it up on stackoverflow now http://stackoverflow.com/questions/42591536/partially-applied-type-families
03:40 <clinton> geekosaur: Basically I want to do with ordinary type families what I can do with constrained ones
03:40 halogenandtoast joined
03:41 jmcarthur joined
03:44 Rizy joined
03:46 aarvar joined
03:50 ljc joined
03:51 roconnor joined
03:53 ertes joined
03:55 uglyfigurine joined
03:55 <Xnuk> @hoogle (Monad m1, Monad m2) => m1 (m2 x) -> (x -> m1 (m2 y)) -> m1 (m2 y)
03:55 <lambdabot> Data.Functor.Syntax (<.*$>) :: Functor f0 => (c -> d) -> f0 (a -> b -> c) -> f0 (a -> b -> d)
03:55 <lambdabot> Data.Functor.Syntax (<*.$>) :: Functor f0 => (a -> c -> d) -> f0 (b -> c) -> f0 (a -> b -> d)
03:55 <lambdabot> Data.Functor.Syntax (<~~~$>) :: Functor f0 => (a -> b -> c -> d -> e) -> f0 d -> f0 (a -> b -> c -> e)
03:57 mhagemeister joined
03:58 alx741 joined
04:00 Jeanne-Kamikaze joined
04:01 Wizek joined
04:01 Wizek_ joined
04:02 exferenceBot joined
04:04 <arkasis> I have a question; I don't understand the error messages -> http://lpaste.net/353201
04:04 pleax joined
04:05 brynser joined
04:05 lspitzner joined
04:05 pasukon joined
04:06 <dmj`> arkasis: usage of map here is suspect
04:06 <dmj`> map a (\c i ->
04:06 <dmj`> on line 20
04:06 hexagoxel joined
04:07 <arkasis> the problem is the syntax? (or semantics?
04:08 netheranthem joined
04:09 <dmj`> :t map
04:09 <lambdabot> (a -> b) -> [a] -> [b]
04:09 shadowbug joined
04:09 <dmj`> the type of addition you have is :: [Bit] -> [Bit] -> [Bit]
04:10 <dmj`> which means the type of the a parameter is also [Bit], which is being passed to the first argument of map
04:10 <dmj`> map is expecting (a -> b) and you’re providing [Bit]
04:11 <dmj`> which is the first error
04:11 <doyougnu> roughly speaking, map expects a function and a list. The way you've written it "a" is the function you pass to map, so you get a type error when you try to pass the lambda function "(\c i -> ...)"
04:11 pera joined
04:11 <arkasis> hm... I'm going to try again
04:11 <arkasis> thanks
04:11 <doyougnu> because that is not a list
04:12 <dmj`> arkasis is your assumption that a should be a list and the lambda the index and value?
04:13 <arkasis> yes, because I come from javascript
04:13 <dmj`> and once addition does type check, that map function will never be evaluated since it always returns [True]
04:13 mhagemeister joined
04:14 <arkasis> ok, I'm have to check the type of map
04:14 unmanbearpig joined
04:14 bjz joined
04:14 <dmj`> arkasis: ok, well that’s fine. Haskell does have some functions that allow one to traverse over a structure with both value and index
04:15 <dmj`> I’ll let you experiment though
04:16 <doyougnu> ^^ best way to learn
04:16 <arkasis> I prefer to know the name of that function (?
04:16 eacameron joined
04:18 fizruk joined
04:18 <arkasis> nvm, I think I can make that function and learn haskell on the way
04:19 mjs2600 joined
04:20 dsantiago joined
04:20 <dmj`> arkasis: since haskell is lazy, it’s often times nice to generate a parallel list that corresponds to the indexes, and then zip them together
04:21 <dmj`> :t \f xs -> map f $ zip xs [0..]
04:21 <lambdabot> (Num b1, Enum b1) => ((a, b1) -> b) -> [a] -> [b]
04:21 connrs joined
04:21 otto_s joined
04:22 <arkasis> seems a bit complicated for me at the moment
04:24 <dmj`> arkasis: then we can uncurry f to get the function you were looking for
04:24 <dmj`> :t \f xs -> map (uncurry f) $ zip xs [0..]
04:24 <lambdabot> (Num b1, Enum b1) => (a -> b1 -> b) -> [a] -> [b]
04:25 <arkasis> @____@
04:25 <lambdabot> Unknown command, try @list
04:25 <dmj`> where b1 is the type of your index, ‘a’ is the value, and ‘b’ is the type of what you’re returning
04:25 hamishmack joined
04:25 pickle_ joined
04:25 <Sornaensis> @list
04:25 <lambdabot> What module? Try @listmodules for some ideas.
04:26 <Welkin> !list
04:26 <Welkin> show me your fserves!
04:29 systemfault joined
04:29 graygoose124_ joined
04:29 <Wizek> hi, Anyone knows of a function `:: (Char -> IO String) -> Handle -> IO Handle` that would allow to map over a readable stream?
04:29 mhagemeister joined
04:29 eacameron joined
04:30 safe joined
04:30 yrdz joined
04:30 tripped joined
04:32 newbie23 joined
04:33 <drostie> Wizek: you want to run a program on every character read from a handle?
04:33 <Wizek> I'm launching a child-process, and I'd like to redirect its stdout to the main process'es stdout in a way that distinguishes both streams, e.g. indent the children's output. I imagine maybe using it something like this: `f (\case '\n' -> return " \n"; a -> return a) childHandle >>= dupTo stdout`
04:33 justanotheruser joined
04:33 <drostie> Wizek: and then ignore the strings that those programs produce?
04:34 systadmin joined
04:35 <pikajude> wouldn't it be "\n "
04:35 <Wizek> pikajude, yes, good catch
04:35 <pikajude> i tried
04:37 <Wizek> drostie, I don't think I'd want to run a program on every character, no. In fact, in my particular usecase `(Char -> String) -> Handle -> IO Handle` may be sufficient too.
04:38 <Wizek> the reason I thought to have the function parameter monadic is to allow handling stateful decisions too, e.g. change all 'a' to 'b' only if it was preceeded by 'c'
04:39 <Wizek> But that's a more general usecase I don't directly care about right now.
04:39 connrs joined
04:41 afarmer joined
04:42 <Wizek> Also, I thought to write this function myself, the thing that's keeping me is it doesn't seem to be easy to create a mock Handle to simulate for tests. But maybe I'll more along those lines
04:42 mtncoder joined
04:43 ramzifu joined
04:47 bigos joined
04:48 pickle_ joined
04:52 newbie32 joined
04:54 louispan joined
04:57 abcu2 joined
04:58 <drostie> Wizek: I can completely understand how to make some pipes and spawn a new thread which reads from the one pipe and writes some transformed text to the other pipe. Looking over the normal IO libs I am not sure I see anything better built-in to Haskell unfortunately...
04:59 Goplat joined
05:00 isidore joined
05:02 conal joined
05:02 path[l] joined
05:05 thunderrd_ joined
05:05 pleax joined
05:06 tel joined
05:07 revtintin joined
05:14 unmanbearpig joined
05:15 Swizec joined
05:15 cdg joined
05:19 jmorris joined
05:26 wedens joined
05:27 <Wizek> drostie, How do you do that in Haskell?
05:27 freechips joined
05:28 hexagoxel joined
05:28 cyphase_ joined
05:30 FreeBirdLjj joined
05:33 dan_f joined
05:34 mizu_no_oto joined
05:38 drostie_ joined
05:38 ludat joined
05:39 wtetzner joined
05:39 systadmin joined
05:39 systemfault joined
05:40 deepfire joined
05:43 jmorris joined
05:44 jsoo joined
05:45 osa1 joined
05:45 osa1 joined
05:46 michbad joined
05:48 mwsb joined
05:49 humboldt joined
05:50 Steini- joined
05:51 newbie32 joined
05:53 BartAdv joined
05:55 wedens joined
05:58 Nerterologist joined
06:02 hexagoxel joined
06:02 Rizy joined
06:03 <ongy> dmwit: ah thanks. So new-run is a thing sometime soon(?) and nice work :)
06:03 <ongy> the current state of crypo-libraries in haskell confuses me
06:04 bjz_ joined
06:04 mwsb joined
06:07 systadmin joined
06:16 unmanbearpig joined
06:19 janos joined
06:20 jedws joined
06:21 quark[0] joined
06:22 eklavya joined
06:25 bigos joined
06:27 <drostie_> Wizek: import the System.Posix.IO.ByteString module that you're looking at, and also Control.Concurrent, start off with `do { (in_R, in_W) <- createPipe; (out_R, out_W) <- createPipe; thread <- forkIO (runConnector in_R out_W); return (thread, (out_R, in_W)) }`, fill in `runConnector` with something that does a `threadWaitRead` on the in_R and a `threadWaitWrite` on the out_W combined with some read, some transform, and some write, and recursing back on
06:27 <drostie_> the function to loop over it again.
06:27 <Squarism> Theres no alternative to Data.Time? It feels very clumsy / unintuitive.
06:27 vtomole joined
06:28 geekosaur joined
06:30 mhagemeister joined
06:32 <dmj`> Squarism: this is a good article on time, https://two-wrongs.com/haskell-time-library-tutorial
06:33 diamat joined
06:33 <Squarism> ive read that
06:36 <Squarism> but if i compare it to java's joda time it feels a bit primitive. I would like to express things like (minusMonths 3 $ plusHours 2 d1) `isWithin` $ periodFrom d2 $ weeks 2
06:36 tommd joined
06:36 <Squarism> instead they do alot of millis/picoseconds
06:40 <Squarism> dmj`, thank you anyhow! =D
06:41 <dmj`> Squarism: np
06:41 <Wizek> Squarism, such an API may be nice, but I don't believe I've seen it implemented in any package
06:41 <Wizek> yet
06:41 hexagoxel joined
06:42 <Wizek> Squarism, you may comb through all 28 packages tagged with Time on hackage to get a somewhat definitive answer to you question: http://hackage.haskell.org/packages/#cat:Time
06:43 drostie-m joined
06:44 <Squarism> Wizek, ok - ill look into that
06:45 eacameron joined
06:46 Kreest__ joined
06:48 edvorg joined
06:49 <cheater> hi
06:50 <Wizek> drostie-m, Thanks, I might give that a try! (for now I've side-stepped the problem)
06:50 <drostie-m> Wizek: I am back for a sec after the last thing I said before...
06:50 Edith joined
06:50 <drostie-m> Cool.
06:50 systadmi1 joined
06:51 <drostie-m> Also the Pipes library looked like it might make this stuff easier.
06:52 <Wizek> drostie-m, Also this one: https://hackage.haskell.org/package/io-streams
06:52 <Wizek> that I've found along my searches
06:54 wedens joined
06:55 connrs joined
06:56 osa1 joined
06:58 cschneid_ joined
07:02 meta-coder joined
07:04 benl23 joined
07:06 zero_byte joined
07:08 deepfire joined
07:09 Maxou joined
07:10 Rizy joined
07:17 unmanbearpig joined
07:19 takuan joined
07:19 uglyfigurine joined
07:22 pleax joined
07:22 dan_f joined
07:23 jutaro joined
07:26 mzf joined
07:27 stczhc joined
07:27 pickle_ left
07:27 danthemyth joined
07:28 eklavya joined
07:30 watabou joined
07:31 eacameron joined
07:31 pantsman_ joined
07:32 nomotif joined
07:34 begriffs joined
07:35 wedens joined
07:35 mannen joined
07:38 louispan joined
07:40 fizruk joined
07:43 connrs joined
07:44 boombanana joined
07:44 insitu joined
07:46 mohsen_ joined
07:46 LeCamarade joined
07:47 pleax joined
07:48 calincru joined
07:51 vin joined
07:53 mhagemeister joined
07:55 nilg joined
07:57 eklavya joined
08:01 mbeidler joined
08:06 caumeslasal joined
08:10 bahtiyar joined
08:11 danvet joined
08:17 raichoo joined
08:17 unmanbearpig joined
08:20 FreeBirdLjj joined
08:21 sigmundv joined
08:24 beanbagu1 joined
08:24 sternmull joined
08:24 hexagoxel joined
08:25 lordcirth joined
08:25 mbeidler joined
08:27 hackebeilchen joined
08:28 danthemyth joined
08:29 caumeslasal joined
08:30 xall joined
08:30 spatial joined
08:33 Destol joined
08:34 <spatial> http://pastebin.com/LxzCpQgE Thought a global array in a State Monad is like this. Seems to be wrong.
08:34 fizruk joined
08:35 <spatial> Some type problems
08:35 robotroll joined
08:36 bollu joined
08:36 louispan joined
08:37 tommd joined
08:37 simukis__ joined
08:37 Rizy joined
08:38 abcu2 joined
08:40 hrehf joined
08:41 H9|wka joined
08:41 SpinTensor joined
08:42 fractalsea joined
08:43 revtintin joined
08:44 dreco joined
08:45 <mniip> spatial, you can't have global variables without unsafe hacks
08:45 <mniip> and State is something else,
08:45 <mniip> it's for having variables without IO
08:45 bjz joined
08:46 ner0x652 joined
08:46 begriffs joined
08:47 <spatial> The same patter works for fun :: Map.Map String Int fun = Map.empty
08:47 <begriffs> Is there a Haskell library to read audio data from the microphone input of the soundcard?
08:47 hexagoxel joined
08:49 bollu joined
08:49 rgc joined
08:51 zero_byte joined
08:56 beanbagula joined
08:56 raycoll joined
08:59 mirpa joined
08:59 simukis__ joined
08:59 owiecc joined
09:02 ragepandemic joined
09:02 jutaro joined
09:05 nurupo joined
09:05 FreeBirdLjj joined
09:06 nshepperd joined
09:09 cyphase joined
09:10 cyphase joined
09:10 mmn80 joined
09:10 <Squarism> begriffs, https://wiki.haskell.org/Applications_and_libraries/Music_and_sound
09:11 contiver_ joined
09:11 bollu joined
09:14 <begriffs> Squarism: hm, none of those seems right.
09:14 <begriffs> So far this looks closest https://hackage.haskell.org/package/conduit-audio
09:15 <begriffs> But not sure how you connect it to the soundcard
09:15 <Squarism> http://hackage.haskell.org/packages/#cat:Sound
09:15 hexagoxel joined
09:16 ltielen joined
09:16 <Squarism> Not an expert on this, but doesnt the OS have a notion of "default line in/microphone in"
09:18 <Rembane> You can set it with ALSA
09:18 unmanbearpig joined
09:18 revtintin joined
09:20 <begriffs> I'll look into that, thanks.
09:21 chaosmasttter joined
09:23 unmanbearpig joined
09:25 certainty joined
09:26 halogenandtoast joined
09:27 louispan joined
09:29 xall joined
09:31 pleax joined
09:33 binaryplease joined
09:36 zcourts joined
09:37 unmanbearpig joined
09:37 phyrex1an joined
09:38 <halogenandtoast> If I have a haskell program I've written, but it's dependent on some OS specific binary, is there any way to "bundle" them together?
09:39 <halogenandtoast> I do have the source code to the other binary, so I supposed I could convert it into Haskell, but I don't really want to
09:42 TorkMattar joined
09:43 marr joined
09:44 <zomg> halogenandtoast: at least with libraries you can link them statically
09:44 eklavya joined
09:44 <zomg> but not sure if that'll make it work on OS's the library wasn't designed to work on, same issue most likely with any binaries
09:45 eklavya joined
09:47 Herihor joined
09:48 kritzcreek_ joined
09:49 yumh joined
09:49 bjz joined
09:49 t7 joined
09:53 Herihor joined
09:54 janos joined
09:54 Raikko joined
09:54 louispan joined
09:55 systadmin joined
09:55 biglama joined
09:56 <bollu> is there a way to "get" a value inside a state monad lensily?I was to "get" SomeField out of ComplexObject. (^. SomeField) <$> get seems too verbose
09:56 Cassiopaya joined
09:58 fractalsea joined
10:00 Gurkenglas joined
10:01 benl23 joined
10:02 FreeBirdLjj joined
10:04 fractalsea joined
10:04 hexagoxel joined
10:06 mda1 joined
10:09 Herihor joined
10:09 systadmin joined
10:09 zipper joined
10:16 eklavya joined
10:17 FullyFunctional joined
10:20 certainty joined
10:25 chaosmasttter joined
10:26 orbifx joined
10:26 pleax joined
10:27 nilof_ joined
10:28 chenyu` joined
10:28 janos joined
10:28 DisruptiveNL joined
10:28 arkasis joined
10:29 janos joined
10:29 fnurglewitz joined
10:29 caumeslasal joined
10:32 wlemuel joined
10:35 davezd joined
10:36 cyphase joined
10:37 janos joined
10:38 JeanCarloMachado joined
10:39 eklavya_ joined
10:42 Mortenl joined
10:42 pita joined
10:42 insitu joined
10:43 thc202 joined
10:43 eklavya joined
10:45 halogenandtoast joined
10:45 <halogenandtoast> zomg: sorry I had disconnected.
10:46 <halogenandtoast> Maybe I can make it a library somehow, it's just an Objective-C program
10:46 <halogenandtoast> I don't care if it app works on different OSs
10:47 kuribas joined
10:50 FreeBirdLjj joined
10:53 augur joined
10:54 silver joined
10:56 geekosaur joined
10:57 FullyFunctional left
10:59 cschneid_ joined
11:02 BartAdv joined
11:04 janos joined
11:05 Berra joined
11:07 systadmin joined
11:09 mstruebing joined
11:09 boombanana joined
11:10 louispan joined
11:12 oisdk joined
11:14 mszczygiel joined
11:15 ph88 joined
11:19 Jackneill_ joined
11:20 mhagemeister joined
11:20 <ph88> hi all
11:21 janos joined
11:23 raynold joined
11:23 sgflt joined
11:23 <Squarism> i have an MVar where i store : Map String (TChan SomeType) - i feel i got a need to change its type to myMVar :: (SomeClass a) => Map String (TChan a) ... but i cannot se how i could store differnt instances of SomeClass on it?
11:24 <Squarism> Or could that be possible?
11:26 <Squarism> gah, im in desperate need of some typeclass expert. Cause im clearly out on deep water here
11:27 albertus1 joined
11:27 eklavya joined
11:28 echo-are` joined
11:30 janos joined
11:32 <ph88> helps already when you show some code that works and changes you want to make to it that dont work .. like a small test case
11:33 <Squarism> ph88, i guess. Its just that im hesitant of spending lots of time on an idea that doesnt fly
11:35 calincru joined
11:35 rufs joined
11:36 magneticduck joined
11:36 eatsfoobars joined
11:36 <Squarism> i think my only question is - how can i store values of different type in the same MVar wo using Union types. I would need a down/up cast mechanism for that and i understand there is no such thing in haskell
11:37 halogenandtoast joined
11:37 systadmin joined
11:40 <ph88> Squarism, well i'm too nooby to know what you're talking about, so i guess sit around till someone else understands it
11:41 JeanCarloMachado joined
11:41 eatsfoobars joined
11:42 psychicist__ joined
11:43 <ph88> ocharles, are you around ?
11:43 louispan_ joined
11:43 zcourts_ joined
11:46 simukis__ joined
11:47 <hexagoxel> Squarism: Dynamic/existential type/unsafeCoerce are your options
11:48 ziocroc joined
11:49 <Squarism> hexagoxel, Ok thank you. Im not sure if you describe 1/2/4 concepts?
11:49 <hexagoxel> Squarism: Dynamic/(existential type)/unsafeCoerce
11:50 <hexagoxel> what is SomeClass?
11:50 <hexagoxel> if the existential makes sense depends on that.
11:50 _ashbreeze_ joined
11:50 eklavya_ joined
11:50 aib joined
11:51 <hexagoxel> (you'd have data SomeInstance = forall a . SomeClass a => SomeInstance a and TChan SomeInstance)
11:53 dbohdan joined
11:54 <Squarism> hexagoxel, SomeClass would be just be a collection of "traits" for a certain type of message
11:54 <Squarism> Really it should be a type parameter
11:55 <Squarism> (rambling)
11:55 zxiiro_ joined
11:56 <Squarism> Really it should be a Java style type parameter. But i dont know how to express such
11:56 <hexagoxel> i am not convinced that what you have in mind would not be a (inefficient/bad) emulation of a union type.
11:57 Chobbes joined
11:57 chirpsalot joined
11:57 skeuomorf joined
11:58 <hexagoxel> i think example code would help.
11:59 eklavya joined
12:02 Snircle joined
12:02 allegorical left
12:03 <Squarism> hexagoxel, http://lpaste.net/353204
12:03 <Squarism> thats my sketch so far.
12:04 free_beard joined
12:04 Unhammer joined
12:04 <Squarism> its basicall about launching games (that have their own messageing model) depending on a "GameType" parameter found in the database - for a gameid parameter given by a connecting client. I have htis all working for one game.
12:05 <Squarism> but i want to make it generic so i can have the same gameloop/messaging code for all games
12:06 MarcelineVQ joined
12:06 dramforever joined
12:06 <Squarism> launch game would creat a gameAdapter and just invoke gameLoop. The hard part constructing these typed channels and storing them in one MVar
12:09 srbaker_ joined
12:09 jomg joined
12:09 haennar joined
12:13 <hexagoxel> Squarism: i think you can use an existential without any constraint/any additional type class. Something in the direction of GameServerInstance = forall m1 m2 . GameServerInstance (GameAdapter m1 m2) (TChan m1) (TChan m2)
12:14 <hexagoxel> that way you can have a monomorphic list of instances, yet when matching on a specific, you know that the types match up.
12:15 thatguy joined
12:15 sgflt joined
12:15 thatguy joined
12:16 FjordPrefect joined
12:17 connrs joined
12:17 <Squarism> hexagoxel, so you mean my MVar should be typed with GameServerInstance?
12:17 zero_byte joined
12:18 Kreest_ joined
12:18 OnkelTem joined
12:19 obadz joined
12:19 <Squarism> (ive never used existential types in haskell)
12:19 obadz joined
12:21 fall_ joined
12:21 <hexagoxel> Squarism: yes, probably. the code does not show yet how you use the MVar.
12:22 <hexagoxel> Squarism: maybe consider the two examples at 3.2 on https://wiki.haskell.org/Existential_type
12:22 <hexagoxel> (hmm are there no better explained examples of existential without constraints around?)
12:22 sdothum joined
12:23 <Squarism> ill take a deep look into the hint you've given me
12:23 <Squarism> hexagoxel, thanks alot
12:24 eklavya joined
12:24 eklavya joined
12:24 <Squarism> ...ill prolly need to read up on how they are used to persue this
12:27 lep-delete joined
12:28 danthemyth joined
12:29 nmattia joined
12:29 janos__ joined
12:30 srbaker_ joined
12:31 jgertm joined
12:31 iulian joined
12:32 <Mortenl> Is there any work going on to bring scoped threads back into the standard library? They're pretty nice
12:32 Mortenl left
12:32 jophish_ joined
12:32 <nmattia> hi guys, I'm looking for some advice. I have a cabal project that builds an executable. the test-suite contains integrations tests that use the produced executable. with stack everything is fine, since it'll build the executable first and then put it on the path. however I'm struggling with nix, because I can't really pass the result of the derivat
12:32 <nmattia> ion as a build input to the derivation itself
12:33 balor joined
12:33 raichoo joined
12:33 stef204 joined
12:33 <nmattia> one solution would be to skip the checkPhase, though it's a bit hacky
12:35 <hexagoxel> Squarism: https://hackage.haskell.org/package/foldl-1.2.3/docs/Control-Foldl.html#t:Fold seems like a nice real-life example of a non-typeclass existential.
12:35 <hexagoxel> note that there is an implicit "forall x ."
12:36 eklavya_ joined
12:36 <hexagoxel> and with some creative imagination, a game is just a Fold over some game state :)
12:36 cdg joined
12:37 deepfire joined
12:38 k0001 joined
12:38 tommd joined
12:39 connrs joined
12:40 FjordPrefect joined
12:40 mjs2600 joined
12:41 tsmish joined
12:41 eklavya joined
12:43 sepp2k joined
12:44 sarkin joined
12:44 moongazer joined
12:44 mhagemeister joined
12:46 lukaramu joined
12:48 owiecc joined
12:48 Michael-jx joined
12:48 <Michael-jx> Hello , this is your videogame for pc windows ? https://sourceforge.net/projects/black-fps/?source=directory
12:48 fizruk joined
12:50 pavonia joined
12:50 connrs joined
12:52 osa1 joined
12:52 osa1 joined
12:54 moongazer joined
12:56 eklavya_ joined
12:57 eklavya__ joined
12:57 govg joined
12:58 eatsfoobars joined
12:59 srbaker_ joined
13:00 calincru joined
13:00 insitu joined
13:01 eklavya joined
13:06 Foras joined
13:10 sepp2k1 joined
13:12 vwxyz1234 joined
13:12 vwxyz1234 left
13:13 epsilonhalbe joined
13:13 shayan_ joined
13:14 louispan joined
13:16 keri joined
13:17 soLucien joined
13:18 Wuzzy joined
13:20 jomg joined
13:21 connrs joined
13:22 Deide joined
13:22 srbaker_ joined
13:26 marvin2 joined
13:27 DonComo joined
13:28 srbaker_ joined
13:30 zcourts joined
13:33 eklavya_ joined
13:33 lukaramu_ joined
13:34 vadimich joined
13:35 eklavya__ joined
13:35 vadimich joined
13:39 danthemyth joined
13:40 janos joined
13:41 netheranthem joined
13:41 zero_byte joined
13:42 oisdk joined
13:43 andrei_chiffa__ joined
13:45 fractalsea joined
13:46 nadirs joined
13:48 eklavya joined
13:48 <ph88> anyone here familiar with GHC.Generics? it seems to me that product (fields) are encoded like this data (:*:) a b p = a p :*: b p and sum (data constructors) are encoded like this data (:+:) a b p = L1 (a p) | R1 (b p) Is there any other way to do deal with the data constructors ?
13:49 oisdk joined
13:50 <ph88> if i have a type like data Foo = Foo1 | Bar | Foo2 and i want to find the last data constructor that starts with "Foo" i can't really do it right now, because i need lookahead. With product it's not a problem
13:51 Shatnerz0 joined
13:51 edvorg joined
13:55 <ph88> if it was encoded as a list consisting out of tuples of 2 elements like (elem1, (elem2, () )) then i could pattern match to get the head and the tail like (head, tail) where tail would be (elem2, ()) .. but since the head is L1 and tail is L2 i can not inspect both at the same time ..
13:56 oisdk_ joined
13:57 insitu joined
13:57 pera joined
13:57 osa1 joined
13:58 sternmull joined
13:59 andrei_chiffa_ joined
13:59 <jchia_> I'm trying to use Data.Vector.Sized with MonoTraversable, using "instance MonoFoldable (VS.Vector n a)" and thus getting a warning about orphan instances. If I use a newtype to wrap the VS.Vector, I can't easily use the functions that take a VS.Vector. Is there a better way to avoid the orphaned instance?
14:02 zero_byte joined
14:03 <lyxia> ph88: use overlapping instances.
14:04 <ph88> lyxia, what does that give me ?
14:05 <lyxia> ph88: actually, what exactly are you trying to do?
14:06 <ph88> i'm trying to traverse the structure and find the last occurance of a type
14:06 <ph88> structure like Foo (Wrap T) (Bar (Wrap T)) (Wrap (Qux T)) find the last T
14:06 <ph88> but actually looking at this .. i only have 1 data constructor ..
14:07 <ph88> so looks like i'm trying to solve a problem that i don't have o_O
14:07 <lyxia> By overlapping instances I mean that instance C (a :+: (b :+: c)) would be the instance for the non-last part of sum, and instance C (a :+: b) can then assume that b is not a sum, and thus is the last constructor.
14:07 mkoenig joined
14:07 <lyxia> you can actually avoid overlapping instances there because you know that b is actually a C1.
14:07 <ph88> aah very smart !
14:08 <lyxia> now you know!
14:08 <ph88> so instead of b i put C1 ?
14:08 mekeor joined
14:09 eklavya_ joined
14:10 <ph88> lyxia, actually i think i will use those overlapping instances to throw an error if my type contains multiple data constructors .. then you are not suppose to call that function on it .. do you think that is a good idea ?
14:10 <Athas> What is the meaning of semicolons at the top-level in Happy?
14:11 <lyxia> ph88: sure
14:11 yaxu joined
14:11 jgertm joined
14:13 iulian joined
14:14 stoopkid joined
14:15 <ph88> lyxia, eh actually that last thing i said is not even true .. what i need to do is inspect the value to see which data constructor was chosen i guess .. i mean ultimately i am trying to change a value to i don't need to do anything on data constructors which were not chosen. Do you know how i can find out which data constructor the value has?
14:18 coot joined
14:18 wildlander joined
14:19 srbaker_ joined
14:20 halogenandtoast joined
14:21 acfoltzer joined
14:21 pikajude joined
14:21 <ph88> i think it will do that automatically, no? because when you convert a value to a generic representation then the data constructors which are not in the value will not be in the representation, or am i wrong ?
14:21 <lyxia> it's in the parameter of C1: C1 ('MetaCons something something)
14:22 <ph88> the name ?
14:22 <lyxia> Uh, I didn't understand your last question
14:22 mokus joined
14:22 janos joined
14:22 <lyxia> yeah what I wrote is how you find the name of the constructor.
14:23 SegFaultAX joined
14:23 rixile joined
14:24 <ph88> i mean when i have a structure like data Foo = Foo1 | Bar | Foo2 but a value like value = Foo2 and i write a generics function for it, do i need to worry about covering other non-chosen data constructors? I think the others (Foo1, Bar) are not even in the representation ?
14:24 janos__ joined
14:24 <ph88> in my case i don't even think that i need the name of the constructor since the operation will be the same on all the constructors ^^
14:25 srbaker_ joined
14:25 <ph88> if i have like data = Foo1 (Wrap T) (Bar (Wrap T)) (Wrap (Qux T)) | Foo2 (Wrap T) (Bar (Wrap T)) no matter if it's Foo1 or Foo2 i need to change the value of the last T (they both have a last T)
14:25 eklavya joined
14:26 raichoo joined
14:28 janos joined
14:29 <lyxia> you don't write a generic function for a particular value
14:29 <lyxia> The generic representation of Foo, Rep Foo is a sum
14:30 insitu joined
14:30 <lyxia> and from value will just map your constructor to one of the variants in that sum
14:31 <lyxia> but if you're writing a generic function Rep a -> X, it will need to handle all variants in one way or another
14:31 thatguyfrombefor joined
14:31 janos joined
14:31 raichoo joined
14:32 Rizy joined
14:32 gawen joined
14:33 uberman joined
14:33 <ph88> how does that work "from value will just map your constructor to one of the variants in that sum" ?? this automatic mapping
14:33 thatguy joined
14:34 Klumben joined
14:35 Noldorin joined
14:35 <lyxia> from Foo1 = M1 (L1 (L1 (M1 U1))) :: (D1 _ (((C1 _ U1) :+: _) :+: _)) p
14:35 <lyxia> something like that is generated by GHC when you derive Generic.
14:36 <lyxia> (from has two other cases for Bar and Foo2 of course)
14:36 <lyxia> ph88: from is basically one direction of the isomorphism between Foo and (Either (Either () ()) ())
14:37 insitu joined
14:38 <ph88> aah i see .. so it only takes a part of the full representation (the other caes) ?
14:38 <lyxia> what part
14:39 makkron_ joined
14:40 tommd joined
14:40 <lyxia> Do you mean that Foo1 is mapped to the "branch" A in (A :+: B :+: C) and doesn't really care what's in the other two B and C? That sounds about right.
14:42 caumeslasal joined
14:43 <ph88> ya
14:44 tsmish joined
14:46 steeze joined
14:47 insitu joined
14:48 drostie-m joined
14:48 SuprDewd joined
14:49 vctrh joined
14:49 <vctrh> hey
14:50 fnurglewitz joined
14:50 marting joined
14:51 mkoenig joined
14:51 gugah joined
14:54 <martinga> I've written a library for accessing patent data from the EPO, and a client using it to download PDFs. I think it is worth putting out there on Hackage for others, but it is my first significant bit of code. What's the best way to ask the community for a quick review / sanity check? Library is at https://github.com/fros1y/patent-api and the tool is at https://github.com/fros1y/epo-download
14:56 <lyxia> You could try the Haskell-café ML, or reddit.
14:58 <hpc> ML? in #haskell?
14:58 jmcarthur joined
14:59 <hodapp> it's a big conspiracy, don't worry about it
15:00 <lyxia> Machine Learning is the future.
15:01 <martinga> It's Sneaky ML. You know, SML.
15:02 Bigbootyjudy joined
15:03 Xanather joined
15:04 alem0lars joined
15:06 <vctrh> there are a few of us are doing machine learning in haskell
15:08 mhagemeister joined
15:08 haennar joined
15:08 nmattia joined
15:08 caumeslasal joined
15:09 moongazer joined
15:10 rekahsoft joined
15:12 <hodapp> there's DataHaskell on Gitter
15:12 <hodapp> ML libraries in Haskell seem to be rough though
15:13 tom7942 joined
15:13 <hodapp> I haven't attempted to use HLearn yet but looked through some examples, and there are a couple convnet things too that I'd like to look at
15:14 <hodapp> but every time I use R, I think about how this could be made SO MUCH CLEANER by using actual types instead of a lot of monkey-patching and duct-tape
15:15 FullyFunctional joined
15:15 <hodapp> I suppose HaskellR is still a thing.
15:17 <vctrh> hodapp yeah it could be so much better than R
15:17 <vctrh> hlearn is not very active
15:17 <hodapp> it just seems to be the most active :|
15:18 doodlehaus joined
15:18 <vctrh> https://github.com/mikeizbicki/HLearn/graphs/contributors
15:18 <vctrh> kind of stalled for the last year+
15:18 FullyFunctional left
15:18 <vctrh> i think datahaskell kind of has to build things up anew
15:19 <hodapp> yeah. I'd like to help with some of that but just haven't had time as of late
15:19 <hodapp> someone had a dataframe-like API (not Frames) that looked promising
15:19 <vctrh> as a lot of the one-man attempts at this stuff have mostly fizzled
15:20 <vctrh> was this from the other day? i haven't seen anything too promising in that arena yet
15:20 <hodapp> it was from some months ago
15:20 <hodapp> http://hackage.haskell.org/package/analyze
15:20 epsilonhalbe joined
15:20 epsilonhalbe left
15:20 <hodapp> if we had something that could handle most of the data-juggling stuff from the Hadleyverse that would go amazingly far
15:21 <hodapp> e.g. reshape2, dplyr and friends
15:21 <vctrh> trying to find a tutorial or example of this...
15:21 <vctrh> actually i had an idea in the dataframe space i'm experimenting with
15:21 <hodapp> yeah?
15:22 <vctrh> may share soon but have to convince myself its not a dead end first
15:23 <hodapp> are you in the dataHaskell gitter? may get the most interest there
15:23 <hodapp> dataframes are a thing I'd have a hard time living without in some fashion
15:23 <vctrh> yeah i'm over there
15:24 <vctrh> well even though i'm working on this data frame experiment
15:24 <vctrh> i'm not convinced it's the way to go
15:24 <jchia_> jophish: I'm trying to increment an element in a Data.Vector.Sized.Vector 20 Int. What's the simplest way to do it? With regular vector, I just use Data.Vector.modify with Data.Vector.Mutable.modify. The context is I'm using Data.Vector.Size.Vector as a histogram and I need to increment a bucket for each sample I encounter.
15:24 <vctrh> maybe haskell needs its own abstraction
15:24 <hodapp> it's not a rigidly-defined abstraction either. R does it one way, Python another with Pandas, and Scala another still in Spark
15:24 <vctrh> rather than transplanting R/Pandas verbatim. i keep thinking there's maybe a lens-y substitute for dataframe
15:25 <hodapp> doesn't Frames do something along these lines?
15:25 <vctrh> i'm not sure what that would look like but maybe someone does
15:25 <vctrh> I don't think Frames is it :/
15:25 <vctrh> it was a good try but the ergonomics of working with it are too problematic
15:25 <hodapp> I haven't worked much with it yet
15:26 <vctrh> doesn't scale to unwieldy CSVs (which are eveyrwhere in data science)
15:26 <vctrh> or rather, doesn't handle unwieldy data gracefully
15:26 <hodapp> but whatever it is, I'd love if certain things that are sort of a royal pain in R - like doing transformations that turn a row into multiple rows but maybe variable numbers of them - were much more direct
15:26 <vctrh> for example if you have a few hundred columns or more, compile times get not so good
15:27 <hodapp> hmmm
15:27 <vctrh> also try loading in 2 or 3 CSVs and you'll inevitably have a namespace clash
15:27 <vctrh> with the accessors being derived by column names
15:27 <vctrh> it was a good try, but i think the template haskell route is *too* static an approach
15:28 <Rembane> What about going the Data.Map approach? It's not as Haskelly, but it could work.
15:28 <Rembane> You might need some prefixes for the keys though.
15:28 <vctrh> Rembane it kind of works. I've rolled my own data analyses around map and vector
15:28 <vctrh> the problem is you can write your own joins and stuff
15:28 <vctrh> but it gets to be slow
15:28 <hodapp> whatever it was, if it's going to be usable the way dataframes are in many languages, would have to be something where it's trivial to add new columns based on existing columns to do quick computations and such
15:29 <hodapp> and where things like melt/cast aren't monstrosities
15:29 <Rembane> vctrh: It is indeed. Hm...
15:29 <vctrh> medium size-ish data sets that you'd left_join and filter like nothing in R
15:29 <vctrh> start to become substantial obstacles with Map representations
15:29 aidecoe joined
15:29 coot joined
15:30 theelous3 joined
15:30 AndroUser2 joined
15:31 aidecoe_ joined
15:31 <vctrh> Rembane i'm experimenting with a pretty different approach to the problem now
15:32 <Rembane> vctrh: What's your current approach?
15:32 <Rembane> vctrh: Or rather, the different approach?
15:32 watabou joined
15:33 alx741 joined
15:34 <vctrh> well might be premature to say because it could also be a dead end ... but the experiment i'm trying is to wrap a dplyr-like DSL around an in-memory sqlite database
15:34 bollu joined
15:34 <bollu> I'm reading lens over tea, I don't understand this sentence: "Now let's consider 2 cases – the first is when we use it to turn s into a, the second is when we use the iso to turn b into t. The definition we already have works well enough for the former case, but in the latter case sdoesn't even exist" Link: https://artyom.me/lens-over-tea-4. Could someone please tell me what it is trying to say?
15:34 wlemuel joined
15:35 <vctrh> give relational operations to the relational gods. then couple that with some bridges to standard haskell data structures like Map and IO operations (like CSVs)
15:35 moongazer joined
15:36 <vctrh> kind of flips the dplyr sql database backend model on its head
15:36 <Rembane> That does indeed sound interesting, I'm afraid I don't have any intuition on if it is a sound design.
15:37 calincru joined
15:37 <bollu> OMG lens is ungoogleable
15:38 <vctrh> neither do i. i think a question is how cleanly one can write an interpreter to sqlite. i would've tried building it on opaleye but i'm not sure if it's actively maintained
15:38 <rdococ> asdf
15:38 <bollu> how do you keep a message for someone? I forgot
15:38 <bollu> using lambdabot
15:39 JeanCarloMachado joined
15:39 <vctrh> so i'm trying to do it from scratch. no obvious reason why it wouldn't work but it's still an experiment at this stage.
15:39 roconnor joined
15:40 <vctrh> alternatively, one could always use the many sql DSLs but i think they tend to be just slightly too low level for data analysis/data munging stuff.
15:40 <bollu> @msg ekmett "thanks for 'use' :) how would I have discovered it if it wasn't for your help?"
15:40 <lambdabot> Not enough privileges
15:40 <bollu> hm
15:40 <Rembane> vctrh: You could build your EDSL on top of a SQL EDSL.
15:40 <bollu> I had the same problem sometime back
15:40 <bollu> @tell ekmett "thanks for 'use' :) how would I have discovered it if it wasn't for your help?"
15:40 <lambdabot> Consider it noted.
15:41 FreeBirdLjj joined
15:41 <vctrh> Rembane like i said I'd use opaleye if I was confident their sqlite dsl wasn't trending towards abandonment
15:41 e_svedang joined
15:41 <vctrh> for now i'm building it on sqlite-simple
15:41 <Rembane> vctrh: Ah, good point.
15:41 danthemyth joined
15:42 f-a joined
15:43 tremon joined
15:47 ilja_kuklic joined
15:48 zeroed joined
15:48 zeroed joined
15:48 carlomagno joined
15:51 connrs joined
15:51 doodlehaus joined
15:51 <bollu> I fail to understand how the Iso instance of lens is encoded using PRofunctots
15:51 <bollu> Profunctors
15:51 <bollu> I'm reading lens over tea, but I'm confused as to how the method makes sense
15:52 <bollu> could someone walk me through this?
15:52 lithie joined
15:52 <johnw> hi bollu
15:52 <johnw> consider this function: iso :: (s -> a) -> (b -> t) -> Iso s t a b
15:54 <bollu> johnw: yes
15:54 <bollu> johnw: what repr. of Iso are you using? :)
15:54 <johnw> type Iso s t a b = forall p f. (Profunctor p, Functor f) => p a (f b) -> p s (f t)
15:54 berkobra joined
15:55 <bollu> johnw: I want to know where that came from
15:55 <bollu> johnw: but do go on
15:55 <johnw> Control.Lens.Iso
15:55 <johnw> note that if we use (->) as our profunctor, it becomes the type of Lens
15:56 <bollu> johnw: yep
15:56 <johnw> by another choice, we get the type of Prism
15:56 loanatic joined
15:56 <bollu> John[Lisbeth]: I meant, like, "how did we arrive at that representation, and how does it represent isomorphisms" ?
15:57 <bollu> johnw: what is the other choice?
15:57 <bollu> johnw: ^
15:57 Dagnabit joined
15:57 <bollu> John[Lisbeth]: sorry for the ping!
15:57 gugah joined
15:57 <johnw> this: Iso s t a b ~ (s -> a, b -> t)
15:57 <johnw> as you saw in the over tea article
15:58 <bollu> johnw: yes, that's the part I'm iffy about. I don't understand the "enum "example
15:58 <bollu> johnw: I am able to create a function called "enum_rev" like so: https://github.com/neongreen/artyom.me/issues/18
15:58 <bollu> but according to the article, I should not be able to do so?
15:59 <bollu> johnw: https://artyom.me/lens-over-tea-4
15:59 <berkobra> hello everyone
15:59 <bollu> berkobra: hey
15:59 <berkobra> i am a newbie trying to tackle project euler problems
16:00 <berkobra> but I got a parse error in my code
16:00 <berkobra> http://lpaste.net/353208
16:00 <berkobra> can you have alook :)
16:00 <bollu> johnw: could you please take a look? :)
16:00 <johnw> bollu: actually, this article really lays it out quite well, so maybe #haskell-lens is a better place to ask for the deeper theory. I don't know how they came up with the exact definition we have for Iso.
16:00 ub joined
16:01 pera joined
16:02 <bollu> johnw: did you read my issue?
16:02 <bollu> johnw: it's like, I'm stuck on a par
16:02 <bollu> johnw: I did ask on #haskell-lens, but it seems dead :(
16:02 <johnw> I did, but I'm afraid I don't have the time to dig into this deeply right now
16:02 jomg joined
16:02 <bollu> johnw: I see. thanks anyway :)
16:02 <bollu> johnw: much appreciated
16:02 owiecc joined
16:03 <johnw> in your enum_rev example, btw
16:03 <johnw> what happens if I .~ an integer that toEnum fails to convert?
16:03 oisdk joined
16:04 <johnw> myEnum & id .~ 99999
16:04 <bollu> hm
16:04 <bollu> it errors out
16:05 <bollu> I think
16:05 <johnw> that's not a lawful lens, then
16:05 <johnw> it should at the very least be a prism
16:05 <lpaste_> bollu pasted “euler-#4-fixed-syntax” at http://lpaste.net/353209
16:05 <bollu> berkobra: that is the fixed syntax, but you still have _semantic_ type errors :)
16:05 kritzcreek_ joined
16:05 <bollu> berkobra: particularly, what is the type of isPalindrome?
16:06 <bollu> I see
16:06 <bollu> hm
16:06 <bollu> johnw: thanks
16:08 dreco joined
16:10 mda1 joined
16:10 mada joined
16:11 <berkobra> oh, do I need explicit type declaration for problem_4 ?
16:11 tsahyt joined
16:13 mtncoder joined
16:13 deepfire joined
16:14 tom7942 joined
16:15 alx741 joined
16:16 BlueRavenGT joined
16:17 mmn80 joined
16:17 <bollu> it will warn you about conflicting choices of "which number type"
16:19 Rizy joined
16:19 <berkobra> bollu what do you mean by fixed syntax
16:19 raichoo joined
16:20 fall_ joined
16:20 <Squarism> im trying to compile this but get 2 compile errors http://lpaste.net/353212
16:20 <bollu> berkobra: you don't need the "-"
16:20 <Squarism> ...on line 96
16:20 <bollu> "="*
16:20 <bollu> berkobra: and you also need to push the "|" pattern guards a little ahead
16:21 <berkobra> do I have to double indent after 'where'?
16:21 <berkobra> or is it about the guards
16:21 prohobo joined
16:21 <berkobra> I can't really wrap my head around the indentation rules of Haskell
16:21 pera joined
16:22 <sbrg> berkobra: for the most part, things just need to be at the same indentation level to be a part of the same 'block'
16:22 <sbrg> I prefer to have 'where' on a line of its own, indented two spaces. definitions in the 'where' clause are indented 4 spaces
16:23 <berkobra> thanks sbrg
16:23 <berkobra> and bollu too
16:23 <berkobra> Now I can move on to the actual logic errors of the code :)
16:24 certainty joined
16:26 <bollu> every lens is Iso?
16:26 deank joined
16:26 <bollu> sbrg: no worries :)
16:26 mda1 joined
16:26 <bollu> johnw: every Lens is an Iso right?
16:26 <bollu> oh no
16:26 <bollu> every Iso is a Lens
16:26 <bollu> hmm
16:27 gcross joined
16:27 <Squarism> better paste with error : http://lpaste.net/353213
16:28 loanatic joined
16:33 Nikola joined
16:35 safe joined
16:36 urodna joined
16:37 mszczygiel joined
16:37 certainty joined
16:38 <lyxia> Squarism: createGameServerInstance must be polymorphic
16:38 coltfred joined
16:38 <lyxia> but gameLauncher1 uses a monomorphic value
16:38 <lyxia> Squarism: did you mean to use an existential type?
16:39 <Squarism> lyxia, yep.. i want to use existential type
16:39 <Squarism> (never tried in haskell before)
16:39 <lyxia> Squarism: data GameLauncher = forall m1 m2 . GameLauncher { ... }
16:39 <Squarism> ah
16:40 <Squarism> that did the trick
16:40 <Squarism> thanks lyxia
16:40 <lyxia> yw
16:40 tommd joined
16:40 <Nikola> ... so I want to write an application in haskell - the target platform is ghc on linux : After writing some data to disk, I would would sometimes like to call sync(2). How can I do that?
16:40 trism joined
16:41 fizruk joined
16:41 FjordPrefect joined
16:42 <cocreature> Nikola: it looks like the unix package provides fsync https://hackage.haskell.org/package/unix- but not sync. so your only option is probably the C ffi
16:44 <tsahyt> what's the fastest pure haskell FFT implementation?
16:44 <tsahyt> probably equivalent to the fastest that does not bind to fftw
16:44 <Nikola> Aahhh ... thanks cocreature: How come a function like that is not in the standard library? Any OS would provide some way to synchronize buffers to disk, wouldn't if ?
16:45 <cocreature> Nikola: I think it’s just rarely used. personally I never needed that function
16:45 zero_byte joined
16:46 tommd joined
16:47 fractalsea joined
16:49 <Nikola> cocreature: So you always use a database or other service to store data ?
16:49 <cocreature> Nikola: I would suspect that a PR to the unix package adding this would be accepted
16:49 <cocreature> Nikola: no I just don’t care enough about when files are written to call "sync(2)"
16:50 <Nikola> cocreature: And how _do_ you store the data ? :-)
16:50 <cocreature> Nikola: I just write to a file and let the os decide when it syncs :)
16:52 ragepandemic joined
16:53 janos joined
16:54 freechips joined
16:55 insitu joined
16:55 <geekosaur> Nikola, I would question using sync(), it is a very blunt hammer that impacts the entire system
16:56 oPn7 joined
16:56 oisdk joined
16:56 JagaJaga joined
16:56 certainty joined
16:56 <geekosaur> unless the entire system is guaranteed to be dedicated to your application, rethink that
16:56 <oPn7> hello guys, where am i doing wrong here about indentations ? https://paste.kde.org/psn0eczll can anybody help ?
16:56 <geekosaur> because it WILL trash performance systemwide
16:57 <Nikola> Sure - fsync is fine - thanks - But I mean more high-level: "How do you store data" ... say you have a web application receiving lots of messages ... I am looking into append-only event store solutions, like e.g. "java-dirty" (dead-simple object serialization
16:58 <geekosaur> oPn7, first thing I see is "-h"::String is both redundant and illegal without ScopedTypeVariables
16:58 <geekosaur> (also, you should include full error messages with this kind of paste)
16:59 <monochrom> Yeah, I don't think I see indentation errors either.
16:59 <Nikola> but that in haskell ... and I guess I'd somehow like to make sure the store is consistent and persisted to disk at some point
16:59 <geekosaur> I think it also needs parentheses, and when they are missing could well confuse the parser in ways that makes it suggest bad indentation just as a "I have no clue, maybe this?"
16:59 <Nikola> https://github.com/mrwilson/java-dirty/blob/master/java-dirty/src/main/java/uk/co/probablyfine/dirty/Store.java
16:59 <oPn7> i added those String things because it shows that they are not String
17:00 <geekosaur> Nikola, that is what fsync is for
17:00 Boreeas joined
17:00 <geekosaur> you want to sync that store, not every single dirty buffer on the system
17:00 mohsen_ joined
17:00 <Nikola> geekosaur: yep, but fsync is not in the standard library either (neither is sync())
17:00 eklavya joined
17:00 <geekosaur> depending on other activity, your data may actually end up being delayed
17:00 <oPn7> geekosaur: excat error message is "parse error (possibly incorrect indentation or mismatched brackets)"
17:01 <geekosaur> cocreature pointed you to https://hackage.haskell.org/package/unix-
17:01 <oPn7> line 11,9
17:01 <geekosaur> that is fsync
17:01 <monochrom> Oh interesting, there is a parse error.
17:01 <geekosaur> oPn7, yes, that's the "I'm completely lost" error
17:02 <oPn7> :D
17:02 jsgrant- joined
17:02 <oPn7> what that means ?
17:02 <geekosaur> what I said and you apparently only saw the last part of
17:02 <Nikola> oh ok - so unix- is there in any standard installation ?
17:02 <cocreature> Nikola: yep
17:03 <kmelva_> is there something "beyond" algebraic data types as in Haskell? analoguus to what dependent types are to Haskell?
17:03 <geekosaur> Nikola, on a unixlike system, yes
17:03 <geekosaur> should be obvious it wont be on windows
17:03 <Nikola> how do I know what is standard and what not ?
17:03 <monochrom> OK, it is parentheses. (h::String)
17:04 <geekosaur> Nikola, https://downloads.haskell.org/~ghc/8.0.1/docs/html/libraries/frames.html
17:04 <geekosaur> libraries that come with ghc
17:04 <cocreature> Nikola: in general I would say that the what is part of the standard library and the packages bundled with ghc is not particularly important. every project is going to depend on a bunch of external libraries
17:04 <geekosaur> (I should point to 8.0.2 buut someone forgot to upload it yet again :/ )
17:05 <geekosaur> also you should understand that ghc ships with *as little as possible* because ghc's haskell code has some nasty dependency gotchas in the name of performance
17:05 <geekosaur> so pretty much everything requires external libraries and trying to avoid them is a fool's errand
17:05 <geekosaur> (anything that ships with ghc is not uphgradeable, basically, except by replacing ghc)
17:06 <MarcelineVQ> geekosaur: 8.0.2 is there it just didn't replace /latest/
17:06 thatguy joined
17:06 <geekosaur> I swapped 8.0.2 for 8.0.1 and got a 404
17:07 <geekosaur> oh, they dropped the frames interface :(
17:07 <geekosaur> or renamed it maybe
17:07 <* geekosaur> considers a usability bug report
17:10 tommd joined
17:11 rixile joined
17:13 nyuszika7h joined
17:14 boombanana joined
17:14 nyuszika7h joined
17:15 <thatguy> If I am writing a game in haskell and I want to save the positions of all of my agents and they change all the time, is it really a good idea to have immutable data structures then?
17:15 <oPn7> geekosaur: can you look at this ? https://paste.kde.org/pwyj0nze5
17:15 <Theophane> thatguy: you could use the State monad
17:16 connrs joined
17:16 <geekosaur> oPn7, for starters, once you lose the unnecessary type annotations, you don;t need the parentheses either
17:17 insitu joined
17:17 <geekosaur> second: getArgs is IO [[Char]], but you are using its result as if it were IO [Char]
17:19 <geekosaur> it is getArgs not getArg. it returns a *list* of arguments, not a single argument or a string containing multiple arguments
17:20 ij left
17:22 zero_byte joined
17:23 <geekosaur> oPn7, for your use case, the patterns you want are probably ("-h":[]), ("-d":[]), and _
17:23 <geekosaur> although you could also write the first two as ["-h"] and ["-b"]
17:24 <geekosaur> er -b not -d in that first one, sorry
17:25 <oPn7> okey
17:25 alunduil joined
17:26 <oPn7> there, that says, i expect [Char] but you gave me Char ? Couldn't match type ‘Char’ with ‘[Char]’
17:26 owiecc joined
17:27 FreeBirdLjj joined
17:27 gugah joined
17:27 moongazer joined
17:28 <geekosaur> please pastebin current code and full error again
17:28 <* geekosaur> ... is still fuzzy, sigh
17:30 <oPn7> http://pastebin.com/Mh21YuQ0
17:31 <oPn7> sorry :D pastebin is blocked here
17:31 <oPn7> used proxy for that
17:31 Lord_of_Life joined
17:31 janos joined
17:33 zeroed joined
17:33 <geekosaur> "pastebin" does not mean exactly pastebin.com and in fact many of us prefer you not use that. did paste.kde.org die?
17:33 coot joined
17:34 janos joined
17:34 <geekosaur> never mind, I will try to remember to precisely identify the nopaste host from now on
17:35 <oPn7> okey :D
17:36 <geekosaur> so you said that gave you a mismatch on Char vs [Char] but the error talks about IO () and SP.CreateProcess...
17:36 raycoll joined
17:36 <geekosaur> the problem here is that "shell" does not do what you think
17:36 <oPn7> yeah after your suggestions [] that part is okey
17:37 <oPn7> yeah i realized that. i used createProcess $ ...
17:37 <oPn7> but another error
17:37 <geekosaur> it specifies whether to use a shell or direct exec in a process creation specifier
17:37 <geekosaur> you probably want to use system
17:37 <geekosaur> @index system
17:37 <lambdabot> System.Process, System.Cmd
17:37 xplat joined
17:38 <geekosaur> unless you are actually intending to capture output or something
17:38 moongazer joined
17:38 certainty joined
17:38 <oPn7> i should use System.Cmd
17:39 pyx joined
17:39 <geekosaur> you already have System.Process imported...
17:40 raichoo joined
17:40 <oPn7> geekosaur: https://paste.kde.org/pzmpxe3bm
17:40 noegip joined
17:41 janos joined
17:41 <geekosaur> oPn7, yes, this is why I suggested system instead of CreateProcess
17:41 <geekosaur> you have to handle the result of CreateProcess
17:42 noegip left
17:42 <geekosaur> it is giving you a tuple of possible filehandles and a result status, but you are using it in a place that expects "nothing" ( (), the degenerate tuple aka "unit")
17:42 andrei_chiffa__ joined
17:45 <lpaste_> geekosaur pasted “No title” at http://lpaste.net/353214
17:46 _sg joined
17:47 doomlord joined
17:47 zclod joined
17:48 <oPn7> geekosaur: yeah i did that and • Couldn't match type ‘SX.ExitCode’ with ‘()’
17:48 <geekosaur> :t system
17:48 <lambdabot> error: Variable not in scope: system
17:48 <geekosaur> :t System.Process.system
17:48 <lambdabot> String -> IO GHC.IO.Exception.ExitCode
17:48 <geekosaur> mrr. right, same problem with a simpler type
17:49 <geekosaur> so add ">> return ()" to the end of that if you don't care whether it succeeds or not, otherwise handle the ExitCode
17:50 <geekosaur> if you're not doing anything else after that, I would actually suggest: SP.system "..." >>= exitWith
17:50 <geekosaur> so the Haskell program relays the result of the build to whatever invoked it
17:50 Myrl-saki joined
17:51 <geekosaur> er, probaby need to qualify that
17:51 zcourts joined
17:51 <geekosaur> SP.system ... >>= SX.exitWith
17:52 <oPn7> the "..." part the thing i need to know actually :D if it works will message "Built is successfull etc.."
17:54 fractalsea joined
17:54 ertesx joined
17:54 ragepandemic joined
17:55 contiver joined
17:56 twomix joined
17:56 raichoo1 joined
17:56 iomonad joined
17:58 <MarcelineVQ> but little did the townsfolk know that the superhero known only as ertesx was actually ertes all along
17:59 <geekosaur> oPn7, the ... part is the nix-whatever you had there
17:59 <geekosaur> do I also have to copy-paste what you have already written as well?
17:59 <ertes> great… thanks a lot for blowing my cover…
18:00 <geekosaur> I feel like we are not speaking the same language somehow, you are oddly precise in the palces you should not be and imprecise where you need to be
18:00 <oPn7> yeah yeah gotcha
18:01 <oPn7> it cant know whether nix-build .. is done its job or not. i am idiot sorry :D
18:03 <oPn7> geekosaur: what this means ">>=" or ">>" ?
18:03 <geekosaur> the short version is that's what "do" notation turns into
18:04 <Myrl-saki> Is there a Parsec where failing is local?
18:04 <geekosaur> when you have something like IO ExitCode, you can;t use it directly because it is something that must be executed by the runtime to at some point produce an ExitCode
18:04 rly joined
18:04 <Myrl-saki> Something like attoparsec, except not on Bytestrings and Text.
18:04 <geekosaur> >>= is how you add something to be done whenever the ExitCode becomes available
18:05 caumeslasal joined
18:05 <geekosaur> >> is the version that ignores the result, and is used when the result is IO () because there;s nothing useful to do with a received ()
18:05 <geekosaur> but you can use it to "ignore" any IO result
18:05 <Myrl-saki> By that, I mean I don't have to use `try`.
18:06 <Myrl-saki> (That, or convince me why `try`.)
18:06 ublubu joined
18:06 <oPn7> geekosaur: okey thank you, i got it
18:06 <tommd> In liquid Haskell I've reflected a function {-@ reflect func @-} which is a case/pattern match on a user data type. Now liquid is complaining about Unbound Symbols `is_{constructor}`.
18:07 <tommd> Any liquid guru's here who have seen this?
18:09 <geekosaur> Myrl-saki, the point of try is not fail. the point of try is that backtracking is *expensive*
18:09 <geekosaur> so it does not backtrack, if a parser parses something and then fails the part it parsed is still consumed. you use try to tell it explicitly when to backtrack
18:10 <geekosaur> and where to backtrack to
18:10 <geekosaur> to limit the cost of backtracking
18:11 Miroboru joined
18:11 <thatguy> if I am writing some kind of simulation which mostly is: iterate stepSimulation initialstate, should I then just chunk together the whole "world" state into one data structure which stepSimulation then works on?
18:11 <Myrl-saki> geekosaur: Right.
18:11 <tsahyt> Myrl-saki: attoparsec just has implicit try
18:12 <Myrl-saki> tsahyt: I know, and I like that.
18:12 <Myrl-saki> But I don't want to work with only ByteStrings and Lists.
18:12 <tsahyt> it can and will backtrack arbitrarily, and if you're not careful this can lead to some major performance problems
18:12 <Myrl-saki> Err
18:12 <Myrl-saki> Text*
18:12 <Myrl-saki> geekosaur: Isn't there a better way such as identifying common token prefixes?
18:13 anton__ joined
18:13 <geekosaur> how should it do that without pre-parsing your Haskell code?
18:13 <Myrl-saki> geekosaur: Right.
18:13 ragepandemic joined
18:13 <Myrl-saki> geekosaur: That's the programmer's job.
18:13 <geekosaur> perhaps you want to use happy instead of parser combinators
18:13 <rly> thatguy: how high performance does this simulation have to be?
18:14 <geekosaur> but yes, in parser combinators that is the programmer's job, but few want to do that much work
18:14 JeanCarl1Machado joined
18:14 Micamo joined
18:14 <geekosaur> but you can;t write simple combinator code and expect runtime to have inspected all possible code paths and built prefix tables
18:14 jeddak joined
18:14 <Myrl-saki> geekosaur: I guess it's a difference in perspective. I find identifying which part to add `try` more tiring and ugly.
18:15 <tsahyt> Just having try added implicitly everywhere is hardly more satisfying imo
18:15 <Myrl-saki> tsahyt: It's less ugly though. :P
18:15 mstruebing joined
18:15 <geekosaur> I don;t find adding try where needed a problem; it's usually fairly obvious where it si needed
18:15 <thatguy> rly: its just a hobby project so it doesn't have to compare with C code but I'd like to learn how to do it right in the long run
18:15 <tsahyt> a <||> b = try a <|> b
18:15 <tsahyt> now you don't have try littered everywhere
18:15 <tsahyt> at least not obviously
18:15 <Myrl-saki> tsahyt: True. xD
18:16 <Myrl-saki> geekosaur: I guess I have to rephrase my question to something the docs don't show.
18:16 <Myrl-saki> geekosaur: Where (in real code) does not adding try benefit the programmer?
18:16 <geekosaur> ...although I admit I figured out parsers (including writing my own parser generators) some time back so I don;t have to think much about it :)
18:17 <geekosaur> performance, reduced memory requirements
18:17 <thatguy> rly: so I don't need to get the last bit of optimization out of the code but I'd like to think about performance nevertheless
18:17 <Myrl-saki> WHoops, I still horribly phrased that.
18:17 <geekosaur> granted not too much of either unless your parser is really lopsided, but.
18:17 <Myrl-saki> geekosaur: Where is backtracking not required?
18:17 k0001 joined
18:18 <rly> thatguy: GHC will never get you *very* good performance, regardless of what microbenchmarks show.
18:18 <Myrl-saki> I find myself requiring backtracking for almost anything.
18:18 <geekosaur> anywhere there's only one valid parse, anywhere you are parsing only a single token as pass/fail
18:18 <monochrom> When you have an unambiguous grammar. Or an ambiguous grammar but you have a secret tie-breaker.
18:18 <Myrl-saki> geekosaur: Ohhh
18:18 <geekosaur> (although you must bve careful witht he latter because usually the token type is Char)
18:19 <thatguy> rly: is that because it is functional or because of the langauge design?
18:19 <Myrl-saki> geekosaur: I forgot the performance implications of `try` on a single token. Thanks.
18:19 <geekosaur> you can simplify this with a 2-level parser, one level is Char tokens an produces lexemes, the second level handles lexeme parsing and can avoid backtracking
18:19 <rly> thatguy: for real programs, you need to understand the specific run-time system and how it interacts with your program.
18:19 noctux joined
18:20 <thatguy> rly: yes I was thinking about if some multi-paradigm language like Ocaml may be better suited for me
18:20 <rly> thatguy: the language itself induces some slowness.
18:20 <Myrl-saki> geekosaur: Right. Not really a fan of that though.
18:20 <geekosaur> (the lexeme generator can often avoid try because it has simpler pass/fail conditions, the actual parser can avoid it because it is more often handling single lexeme tokens)
18:20 <rly> thatguy: the value of Haskell is that the semantics are quite clear for concurrency/parallelism primitives.
18:21 <rly> thatguy: but in GHC there are also some exceptions to this, which exist because of "performance".
18:21 chaosmasttter joined
18:22 <rly> thatguy: Haskell is supposed to be a Sufficiently Smart Compiler language.
18:22 <rly> thatguy: OCaml's design is to have a really stupid compiler.
18:22 <thatguy> rly: so if I want a general purpose language and am mostly interested in numerical simulations where I do think about performance, would you say that some multi-paradigm language like ocaml may be better suited?
18:22 <rly> thatguy: I think you can use Haskell, but you should just use it as a compiler then.
18:23 <thatguy> rly: do you recommend any other functional language which maybe is not sooo strict about state and is a bit clearer about what which code does?
18:23 <hpc> you could do something silly like use haskell to generate fortran ;)
18:23 <rly> thatguy: this is a bit what the domain specific language hype was about a few years ago.
18:23 <rly> hpc: why would that be silly?
18:23 tom7942 joined
18:23 buttons840 joined
18:24 <rly> thatguy: I think you want to have a slow implementation in Haskell, and then another backend which compiles for example to Fortran (or C++, or..).
18:24 xanadu_ joined
18:24 <rly> thatguy: FFTW works like this.
18:24 <monochrom> Ironically, generating Fortran is less silly than generating C.
18:24 <Sornaensis> that's how scipy works
18:25 <rly> thatguy: it exploits OCaml to do various smart things, but it never actually uses the OCaml run-time system.
18:25 <monochrom> Did you know that mature Fortran compilers are more optimizing than mature C compilers?
18:25 <Sornaensis> you write python and it emits C++
18:25 ptek joined
18:25 <monochrom> Age of Fortran notwithstanding, there is also C's own issue of too many semantic gotchas forcing optimizers to be really paranoid.
18:25 <thatguy> Sornaensis: I was using numpy/scipy for my stuff before learning haskell indeed
18:25 <rly> thatguy: having said that, Haskell is fine for the first version of your simulation, or whatever.
18:26 octarin joined
18:26 <rly> thatguy: if at some point it turns out that you want to do *huge* things and you are running a few hundred node cluster, then you might want to look in these things.
18:27 jmct joined
18:27 NemesisD joined
18:27 Shatnerz joined
18:27 Shatnerz0 joined
18:27 <Sornaensis> what's wrong with cloud haskell
18:27 connrs joined
18:28 <rly> Sornaensis: nobody uses it?
18:28 <rly> Sornaensis: by "nobody", I mean "almost nobody".
18:28 <rly> Sornaensis: it was just written as a "look, we can do Erlang too".
18:28 <Sornaensis> that didn't really answer my question
18:29 <geekosaur> your question isn;t really answerable
18:29 lspitzner joined
18:29 <thatguy> rly: ok thanks for the insight
18:29 <rly> Sornaensis: the latest "news" was over a year ago.
18:30 <thatguy> that helped a lot but now I am thinking if haskell is the right language to dig further into
18:30 <rly> Sornaensis: this might mean it's already God's personal best code and nothing can be improved, or nobody cares about it.
18:30 <geekosaur> that said, cloud haskell depends on a feature of ghc that is still evolving (stable names)
18:30 <rly> That was quick.
18:30 <geekosaur> so a pause in development can mean they're waiting on changes upstream
18:31 <rly> A business wouldn't like to be dependent on a single implementation of a language.
18:31 <monochrom> I think both can happen. Usually, nobody cares about God's personal best code.
18:31 osa1 joined
18:31 <thatguy> yeah well I did the whole tutorial cis 194 and loved it but as soon as I want to apply it to my problems (mostly numerical stuff) I get the feeling that I would like to have some state at least
18:31 <geekosaur> rly, where's the second impl of perl5? python? (ok, there's a few but they're all worse) php?
18:32 <rly> thatguy: there are IORefs in Haskell.
18:32 <rly> thatguy: all the features are there, but imperative algorithms often look more ugly in Haskell.
18:32 <rly> (which is to be expected)
18:32 <thatguy> but am I just to new to haskell or is numerical (mathematics) mostly very imperative?
18:33 JeanCarloMachado joined
18:33 <thatguy> its nearly always that you have some state which changes or some solution which you imperatively make better etc
18:33 <rly> thatguy: for the part where it matters (FPU behaviour), Haskell is also not pure.
18:34 caumeslasal joined
18:34 <rly> I wonder whether anyone ever has demonstrated superior Haskell performance for a real numerical simulation (i.e., something used in climate models, for example).
18:35 <rly> I'd expect to have heard about it, if that had happened.
18:35 <monochrom> To a large extent, the "multitude" of Python implementations is no better than Haskell's situation of "we do have jhc, ajhc, nhc, and hugs".
18:35 <rly> monochrom: I disagree on that point.
18:35 <rly> monochrom: Python2.X has viable implementations.
18:36 <rly> monochrom: in Haskell, there is Haskell 98 in what can best be described as toy implementations.
18:36 orbifx joined
18:36 <thatguy> monochrom: I don't understand what you mean by that
18:36 loanatic joined
18:36 <thatguy> rly: do you use haskell for climate numerics?
18:37 <rly> thatguy: there are some full program optimization compilers for Haskell.
18:37 <rly> thatguy: they are even more niche (of course) than using Haskell in the first place.
18:37 <rly> thatguy: no
18:37 <rly> thatguy: I have used Haskell for non-trivial things, which completely destroyed GHC.
18:38 <rly> thatguy: not the same domain as yours.
18:38 <thatguy> so you are not actively using haskell anymore?
18:38 conal joined
18:38 <rly> thatguy: no, I sometimes write some scripts in it, but no "real work".
18:38 <thatguy> so what do you use now if I may ask?
18:39 <rly> thatguy: I don't want to endorse other things I also don't like :)
18:39 <rly> thatguy: IMHO, the world is a complete mess.
18:39 <rly> thatguy: we don't even have production file systems which have been verified to be free of bugs.
18:39 <thatguy> :D
18:40 <cocreature> well, formal verification is a _lot_ of work
18:40 <rly> We do have academic file systems with that property, though, but that happened in the past 5 years or so.
18:40 <rly> cocreature: I think it's less work than having a "bug tracking system" and "debugging random clients".
18:40 <thatguy> ok I think I'll just try to implement my simulation in haskell for now
18:40 <rly> cocreature: take for example "ZFS".
18:41 <rly> cocreature: it was designed a *long* time ago, and it still doesn't work.
18:41 <cocreature> rly: as someone working on formal verification, I disagree :)
18:41 <thatguy> but did I get it right that if you want to be performant on such bigger projects you cannot stick to functional languages but will have to return to C/C++ or something else lowlevel imperative?
18:41 <rly> cocreature: what do you do? Coq/Agda?
18:41 <cocreature> even if you formally verify your file system, you are probably making incorrect assumptions in your formal model and your file system is still buggy
18:42 <rly> cocreature: wrong assumptions can be fixed.
18:42 <ertes> Myrl-saki: http://blog.ezyang.com/2014/05/parsec-try-a-or-b-considered-harmful/
18:42 <rly> cocreature: at least it would get better over time.
18:42 <rly> cocreature: with our current development method, there is no way to know whether progress is being made.
18:42 <cocreature> well good luck writing your formally verified file system
18:43 TxmszLou joined
18:43 <rly> cocreature: you don't want to say specifically what tooling you use?
18:43 <rly> cocreature: do you work on it commercially? Intel?
18:43 janos joined
18:43 <cocreature> rly: we prove the equivalence of C code using smt solvers
18:43 <cocreature> not commercially, academia
18:43 <ertes> Myrl-saki: auto-backtracking is needlessly expensive and in parsers for human languages makes error reporting almost useless
18:43 <rly> cocreature: right, and that approach was already dead when I was in university.
18:44 <cocreature> lol
18:44 <cocreature> sry I have no interest in continuing that conversation
18:44 <rly> cocreature: unfortunate.
18:44 sim642 left
18:45 <monochrom> The wrong-specification problem is solved by not assigning blames unilaterally. You only assert "implementation mismatches specification". You don't assert the assymetric "implementation is wrong". The value of verification is that you now get two perspectives (the implementation and the specification) not just one (the implementation), this is supposed to be more informative.
18:45 <ertes> also changing assumptions can be quite expensive
18:46 <ertes> up to completely having to redo all proofs
18:46 daddychevere joined
18:46 <rly> ertes: if you write a program without a proof, you still need to do that work, except you don't write it out and you hope for the best.
18:46 mhagemeister joined
18:47 <ertes> rly: you don't need to, and generally it's not done
18:47 <rly> ertes: sure, and that's why all bug trackers are filled.
18:47 zeroed joined
18:47 zeroed joined
18:48 <cocreature> so let’s just stop using computers because writing correct software is impossible
18:48 <ertes> try to look for formal proofs in the linux kernel… not machine-checked proofs, just formal ones that would actually count as real proofs, i.e. instances of "you still need to do that work"
18:48 <johnw> cocreature: it's not impossible, just hard
18:48 <ertes> rly: it's easy to say: "it needs to be done"
18:48 <ertes> actually doing it is a different story
18:48 <cocreature> johnw: I was being sarcastic :)
18:48 <monochrom> I do stop exercising because it is hard. :)
18:49 <monochrom> Also, I stopped demanding proofs of correctness because getting people to write proofs is hard.
18:50 <monochrom> Writing proofs is not hard for me. But getting other people to do it is hard.
18:50 <ertes> one factor is that our tools aren't adequate for formalising a whole system
18:50 <rly> I think the problem is that there are only a few people on the planet who can write proofs and not all of those teach.
18:50 <ertes> and i believe before they get adequate, AI will take over writing them
18:50 <rly> I.e., write proofs of "production quality".
18:51 <ertes> rly: that's *a* problem… a more relevant problem is that it's *hard*, even for people who can do it
18:51 <MarcelineVQ> monochrom: where do you learn to write proofs?
18:51 <rly> ertes: part of the reason is that proving theorems is in EXP.
18:51 <rly> ertes: so, of course it is hard.
18:51 <MarcelineVQ> monochrom: would sicp teach me?
18:51 Whitesquall joined
18:52 <monochrom> And it doesn't have to be proofs. You need to wipe-clean your keyboard? Guess what, doing it yourself is so much easier than convincing someone else to do it.
18:52 <rly> monochrom: haha
18:52 <cocreature> MarcelineVQ: software foundations is pretty good if you are interested in formalizing and proving things about software
18:52 <ertes> rly: now combine that with the problem of practical/commercial feasibility… sure, software is never *finished*, but at some point you want to produce something people can actually use =)
18:52 raichoo joined
18:53 <rly> ertes: lots of software I have written happily hums away in data centers/clouds.
18:53 <cocreature> in a lot of cases the cost of bugs is simply cheaper than the cost of verifying that there are no bugs
18:53 <ertes> rly: and those are formally verified?
18:53 <rly> ertes: I wrote them, so they are perfect ;)
18:53 <ertes> so no
18:54 <rly> ertes: the only reason I am interested in formal tools, is because I don't like the quality of the software the rest of the planet is producing.
18:54 lspitzner joined
18:54 <rly> ertes: the current software development process doesn't scale for > SMALL_CONSTANT number of people.
18:55 <rly> The Linux kernel solved it by using trust.
18:55 <MarcelineVQ> I'm quite interetsed in learning about this stuff. even the idea of a proof is a little bit of black magic to me, if something works for x+1 and x+2 how can you then know it works for x+n
18:55 <cocreature> MarcelineVQ: https://www.cis.upenn.edu/~bcpierce/sf/current/index.html that’s the book I was mentioning
18:55 <ertes> MarcelineVQ: induction
18:55 <monochrom> MarcelineVQ: Bird's textbooks are one kind of books that teach proofs.
18:55 <monochrom> I haven't read SICP.
18:55 <ertes> MarcelineVQ: you prove that 1. it works for 0, 2. if it works for x, it also works for x + 1, for all x
18:55 <cocreature> I’ve read the first half or so of sicp. I don’t think it helps with teaching proofs
18:56 <ertes> MarcelineVQ: then in a certain sense magically it works for all natural numbers =)
18:56 <cocreature> induction on natural numbers made a lot more sense to me once I saw general structural induction and understood that natural numbers are just a special case of that
18:56 <ertes> (induction is not universally accepted as a valid principle, but i think most mathematicians accept it)
18:57 <monochrom> Induction is explained poorly because most explainers do not make explicit the "forall" quantifiers.
18:57 <rly> Induction is something you learn in high school.
18:57 <monochrom> You rightfully observe that "(forall x. works for x) => (forall x. works for x+1)" is circular logic. But induction does not say that.
18:58 <monochrom> Induction says "(forall x. (works for x => works for x+1))". Very different.
18:59 <monochrom> Once upon a time, there was a kid who saw a wounded bird. The kid was kind-hearted and able, he saved the bird and healed it.
18:59 <monochrom> The bird turns out to be a fairy. The fairy says, "I will grant you two wishes".
18:59 <ertes> MarcelineVQ: exercise: prove that the sum of two even natural numbers is an even natural number… you may use the usual arithmetic properties (associativity, distributivity, etc.) of addition and multiplication
18:59 <Fairy> I said no such thing!
19:00 <monochrom> (Why two, why no three? Because I'm teaching induction!)
19:00 <monochrom> Haha OK sorry Fairy. Different fairy.
19:00 <Fairy> <_<
19:00 mthek joined
19:00 systemfault joined
19:00 <monochrom> The kid was a math geek. (I guess the fairy was, too.) So he said: first wish, today I receive one gold coin.
19:01 <monochrom> Second wish: For each day, if I received a gold coin on that day, then I will also receive a gold coin on the next day.
19:02 bollu joined
19:02 <monochrom> If you now see that the kid will receive everyday a gold coin thereafter, you have understood induction.
19:02 bollu left
19:02 oisdk joined
19:03 <ertes> then the fairy says: "sorry, i'm propositional, but i'm happy to serve your first wish"
19:04 doyougnu joined
19:05 <buttons840> while were on this topic -- i was wondering if dependant types can be used to prove anything which is true? i know there are certain types of logic that cannot be expressed with dependant types, but are there alternative proofs for the same things?
19:05 <MarcelineVQ> ertes: I don't know what it means to prove something ^^; uhm, 2 + 2 = 4 this is true regardless of which two is in which spot, why is this true, well, uhm, 1 + 1 is 2, 2 + 1 + 1 is 4 1 + 1 + 2 = 4 and even 1 + 1 + 1 + 1 = 4
19:06 <ertes> MarcelineVQ: first define what it means for a natural number to be even
19:06 <ertes> MarcelineVQ: use the phrase "there exists" in your definition
19:07 <buttons840> MarcelineVQ: i am reading a book called "How To Prove It", which is focused on mathematical proofs and not on any computer program, but it might be a good resource for you to learn about proofs
19:08 <doyougnu> You may want to checkout Proofs in Idris then. 2 + 2 = 4 in Idris looks like this:
19:08 <doyougnu> two_plus_two : n = 2 -> m = 2 -> m + n = 4
19:08 <doyougnu> two_plus_two p q = rewrite p in rewrite q in Refl
19:10 anuxivm joined
19:11 <MarcelineVQ> there exists a set of natural numbers which consists only of multiples of 2, they are called even numbers
19:11 mathk joined
19:11 MrcRjs joined
19:11 dustmote joined
19:11 <ertes> MarcelineVQ: definition: for all natural numbers n the statement "n is even" is equivalent to the statement: there exists …
19:11 <ertes> finish the sentence
19:12 t7 joined
19:13 <osa1> what's wrong with this pattern synonym: `pattern Some x <- Left x where Some x = Left x` ?
19:14 xkapastel joined
19:14 <ertes> MarcelineVQ: if you can't figure it out: why is 10 even? what makes it even?
19:15 <cocreature> osa1: compiles for me, what makes you think it is incorrect?
19:15 ptvirgo joined
19:15 <osa1> cocreature: I get an error
19:15 <osa1> ghc 8.0.1
19:15 Boomerang joined
19:16 <cocreature> osa1: hm works with 8.0.2 and 8.0.1 for me
19:16 <osa1> huh, 8.0.2 doesn't give an error
19:16 <MarcelineVQ> there exists a factor of 2?
19:16 <ertes> MarcelineVQ: yeah… 10 is even, because it's a multiple of 2
19:16 <ertes> and "multiple of 2" means: "there exists a natural number k such that 10 = 2*k"
19:17 cyborg-one joined
19:17 oleksiyp joined
19:17 <ertes> MarcelineVQ: now generalise this: definition: for all naturals n, "n is even" is the same statement as: there exists …
19:17 <osa1> cocreature: http://lpaste.net/353216
19:18 <geekosaur> osa1, iirc 8.0.1 does have some bugs in patsyns
19:18 m0rphism joined
19:18 <geekosaur> you may want to stick to 8.0.2
19:18 <cocreature> osa1: that’s different to the one you pasted here. it uses Right and not Left in the constructor
19:19 xubunto joined
19:19 <xubunto> jw what does lift do?
19:19 <xubunto> (i assume haskell has this function)
19:19 <osa1> cocreature: ahh! so can't I use Right in the pattern part and Left in the expression part?
19:20 <cocreature> osa1: it definitely feels wrong but I’m still thinking about why that’s not allowed :)
19:20 <ertes> xubunto: it's most likely 'lift' from MonadTrans… do you have a working understanding of monads?
19:20 <osa1> yeah it's weird but it should be possible
19:20 <xubunto> ertes: yes
19:20 triceph joined
19:21 <ertes> xubunto: let T be a monad transformer, then 'lift' embeds an action of the target monad m in (T m)
19:21 <ertes> lift :: m a -> T m a
19:21 <MarcelineVQ> it feels a bit like parroting, but: there exists a natural number k such that n = 2*k
19:22 <ertes> MarcelineVQ: that's correct, and it may feel like it, but having a precise definition in terms of logical primitives (in this case: explicit quantification) is important
19:22 <xubunto> MarcelineVQ: is that lifting too?
19:22 <cocreature> osa1: ah! it works with an explicit type signature. so it’s just ghc’s inference that is not smart enough to figure out that the left and right side have to have the same type
19:22 <ertes> MarcelineVQ: now try to prove that the sum of two even naturals is always an even natural… first formulate an actual logical statement, a precise version of this statement
19:23 <xubunto> oh
19:23 mannen joined
19:23 <ertes> MarcelineVQ: you will need the phrase "for all"
19:23 <osa1> cocreature: how do you add a type sig to a pat syn?
19:23 soLucien joined
19:23 <ertes> MarcelineVQ: (you may reuse your definition of "even" now, because now it's exact)
19:23 <ertes> ((taking the definition of naturals for granted))
19:23 <cocreature> osa1: http://lpaste.net/353217
19:23 <xubunto> ertes: so say i lift just 5
19:24 <tsahyt> Is there such a thing as an applicative transformer?
19:24 <ertes> xubunto: lift (Just 5)
19:24 JeanCarloMachado joined
19:24 <xubunto> what would that do
19:24 <ertes> tsahyt: sure, every monad transformer is an applicative transformer
19:24 athan joined
19:24 <tsahyt> ertes: but what about transformers for things that are applicatives but not monads?
19:24 newbie73 joined
19:24 <osa1> cocreature: awesome! thanks
19:24 <ertes> tsahyt: but there are easier methods to combine applicative functors
19:24 newbie64 joined
19:24 <ertes> xubunto: lift :: Maybe a -> T (Maybe a)
19:25 <ertes> xubunto: choose T, then it may be clearer what it means
19:25 raynold joined
19:25 <ertes> whoops
19:25 <ertes> xubunto: lift :: Maybe a -> T Maybe a
19:25 govg joined
19:25 <xubunto> ertes: either *2 or String
19:26 <ertes> xubunto: do you know what MaybeT is?
19:26 <newbie64> hi, what is the difference between polytypic programming and generic programming?
19:26 <tsahyt> ertes: what I'm dealing with here is that I have values that are calculated recursively with an ArrowLoop interface (which does make more sense here than for FRP) and a 1 sample delay on each recursive step. But this of course can lead to infinite recursion quite quickly. So I was thinking about providing a type that provides limited recursion somehow, since that's how you generally handle these things in
19:26 <tsahyt> DSP
19:26 <xubunto> ertes: no
19:27 <ertes> xubunto: newtype MaybeT m a = MaybeT { runMaybeT :: m (Maybe a) }
19:27 <ertes> for all monads m, (MaybeT m) is a monad
19:27 <ertes> in other words: instance (Monad m) => Monad (MaybeT m)
19:27 <ertes> xubunto: you may want to take it as an exercise to implement Functor, Applicative and Monad instances for this by yourself
19:27 zcourts_ joined
19:28 <kuribas> Strange how adding code makes it faster... I added an iteration limit, and my code is 25% faster!
19:28 <ertes> xubunto: once you've done that, implement the following instance: instance MonadTrans MaybeT
19:28 <xubunto> i went through the stuff for functors
19:28 <ertes> this will require you to implement 'lift' for MaybeT
19:28 <kuribas> Probably has something to do with cache prediction...
19:29 bahtiyar_ joined
19:29 <glguy> lolisa: Assuming polytypic means definitions using polymorphic types, the definitions are implemented with no knowledge of the type variables, and specific knowledge of the non-type variables. so 'map :: (a -> b) -> [a] -> [b]' is going to work uniformly in choices of 'a' and 'b', using only the knowledge of lists and functions
19:30 alexbiehl joined
19:30 <glguy> lolisa: Typically "generic" programming is where the structure of the function definition gets access to the structure of the types its operating on without being tied to a specific type
19:30 <glguy> This happens using Template Haskell, GHC.Generics, or SYB/Data.Data
19:31 <glguy> where the structure of types is made available either in a common type representation or a common value representation
19:31 <lolisa> Sorry... I should provide some context
19:32 <lolisa> http://www.cs.ox.ac.uk/ralf.hinze/talks/Nijmegen.pdf
19:32 <glguy> Did you have a more complete question then?
19:33 reuben364 joined
19:33 <lolisa> Yes. Polytypic programming also 'look into constructor' so it seems very similar to generic programming. I dont know if they are the same thing, or have some subtle difference.
19:34 yaxu joined
19:34 <glguy> Into a specific constructor
19:34 <glguy> Like for map, only the constructors (:) and [] are available, not those of types 'a' or 'b'
19:35 skeuomorf joined
19:35 louispan joined
19:36 <MarcelineVQ> ertes: for all even natural numbers n and for all even natural numbers k, n+k is even
19:36 zeroed joined
19:37 <lolisa> I think polytypic is not the same thing as polymorphic...
19:37 <xubunto> ertes: ill look into applicative functors
19:38 Jeanne-Kamikaze joined
19:38 reuben364 joined
19:38 eazar001 joined
19:38 <glguy> lolisa: Yeah, this talk appears to use polytypic to mean what I described as generic
19:38 <ertes> MarcelineVQ: yeah… can you prove it? show why it must be true
19:38 <glguy> paper->slides
19:39 <lolisa> thx anyway :)
19:39 lspitzner joined
19:39 <lolisa> ertes, yes. induction on the definition of eveness.
19:39 sigmundv joined
19:40 pera joined
19:40 <glguy> lolisa: This looks like the precursor to GHC.Generics
19:40 <lolisa> Yes it sure does. Very interested into such thing.
19:40 <lolisa> to be more formal, induction on the proof that n is a even number.
19:40 Deide joined
19:41 <lolisa> base case: n = 0 is a even number, n + k = 0 + k = k, use the other hypothesis
19:41 <ertes> lolisa: please don't spoil it… it's an exercise!
19:41 wildlander joined
19:41 <jle`> i have my types defined in a seperate 'types' file, but in order to write instances for it, i would be using some utility functions that aren't defined in the types file
19:41 <lolisa> Oh, very sorry, does not see context
19:41 doodlehaus joined
19:42 <jle`> if i move them all to the types file then the file becomes a bit bloaded and it sort of defeats the purpose
19:42 <glguy> Related to GHC.Generics, I did an implementation of a unified lens/traversal generator supporting type-changes this week http://lpaste.net/353157
19:42 <jle`> is there any common strategy to handle this nicely?
19:42 <ertes> (also you don't need induction here… i explicitly allowed MarcelineVQ to use arithmetic properties of addition and multiplication)
19:42 loanatic joined
19:42 <cocreature> jle`: I sometimes have a Types.Util module
19:43 <glguy> Don't merge all the types into a Types file?
19:43 <xubunto> ertes: can you give me a direction on applicative functors? (i have a sense on normal functors)
19:43 <jle`> glguy: but if i don't do that then i end up with cyclic imports eventually usually
19:43 <jle`> cocreature: does types.util have the typeclass instances too?
19:44 <cocreature> jle`: depends, I don’t have strict rules here
19:44 <glguy> jle`: That's OK, you can make hs-boot files so that you can maintain the complicated types in separate modules and still have them import each other where needed
19:45 <ertes> xubunto: where functors allow you to map over the (let's call it) point type of a single value, applicative functors let you combine two values into a single one while mapping over their point types
19:45 <jle`> gotta look into hs-boot files then
19:45 <ertes> fmap :: (a -> b) -> f a -> f b
19:45 <ertes> (<*>) :: f (a -> b) -> f a -> f b
19:46 <ertes> xubunto: ^
19:46 <xubunto> yea that f is confusing
19:46 <ertes> xubunto: look at a particular instance: Maybe
19:48 <ertes> xubunto: look also at [] and IO
19:48 sdothum joined
19:48 <ertes> there is not only a list of values, but also a list of mapping functions
19:48 <ertes> [] does something along the lines of cartesian product
19:48 carlomagno joined
19:49 <ertes> IO: there is not only a program for the value, but also a program for the mapping function for the value
19:49 triceph left
19:50 <xubunto> ertes: i found lyah article on it so reading through it
19:52 troydm joined
19:52 robotroll joined
19:54 janos joined
19:55 connrs joined
19:55 chaosmasttter joined
19:57 zcourts joined
19:58 biglama joined
19:58 Maxdaman1us joined
19:58 <dbohdan> Hey, everyone!
19:58 <dbohdan> I've run into an issue with a socket Handle that only manifests on Windows.
19:58 mmn80 joined
19:59 <dbohdan> When I do hReady on a socket Handle my program terminates with the message:
19:59 <dbohdan> >fdReady: fd is too big
19:59 <dbohdan> >This application has requested the Runtime to terminate it in an unusual way.
19:59 <dbohdan> >Please contact the application's support team for more information.
19:59 alx741_ joined
20:01 <dbohdan> The code to reproduce the issue + log: http://lpaste.net/917655724551569408
20:01 sigmundv_ joined
20:01 <dbohdan> Does anyone here know what this is?
20:02 <dbohdan> The example (and the larger socket program from which it derives) works normally on Linux and FreeBSD.
20:02 <geekosaur> dbohdan, that means the ghc runtime is using select() with a (virtual, for Windows) file descriptor number that exceeds FD_SETSIZE
20:03 <dbohdan> I would the underlying C code that prints the message, but I'm not sure what it means.
20:03 <geekosaur> (well, slightly more complex than that)
20:03 <dbohdan> *found
20:03 oisdk joined
20:03 <dbohdan> Should I be using hReady differently?
20:04 <dbohdan> (on Windows)
20:04 <geekosaur> I don't think so. but I also didn't think the ghc runtime used select(), precisely because of issues like this... but winsock is seriously weird and select() might be the only API available
20:04 rixile joined
20:04 loanatic joined
20:04 insitu joined
20:04 <geekosaur> and in that case you may need to rethink things, because the error translates to "winsock can;t cope with the number of sockets you have open"
20:05 jgertm joined
20:05 <geekosaur> oh, hm. you probably don;t want hReady there anyway
20:05 <geekosaur> it doesn't do what you think
20:05 <geekosaur> why did you use it?
20:06 martinga left
20:06 <geekosaur> (and given how winsock works, I would not want to bet on things actually being set up fully enough for it to work there)
20:07 <dbohdan> Originally I was writing a function that pipes data from one handle to another.
20:07 <dbohdan> I'll paste it.
20:07 sz0 joined
20:08 tremon joined
20:08 <dbohdan> It's for a little program that I like to write in every new language I learn.
20:08 <dbohdan> http://lpaste.net/2334901538167717888
20:10 <geekosaur> mm. at this point you probably need to talk to someone who knows what the network library is doing on Windows
20:10 conal joined
20:11 <dbohdan> I use `forkIO $ relay a b` and `forkIO $ relay b a`. The hReady check is to handle the other green thread closing the socket underneath you.
20:11 <geekosaur> last time I looked at the details, it still required you to wrap stuff in withSocketsDo (this is unneessary in current versions)
20:12 <geekosaur> yes, the problem is that something may be deferring actually creating the full socket <-> fd hack that winsock uses (socketToHandle doesn't do that part, Handle-s for sockets on Windows are not fd based)
20:12 Shatnerz joined
20:14 <dbohdan> Could I force the socket creation?
20:15 <geekosaur> ... that's kinda the wrong question. the socket exists
20:15 <geekosaur> Windows sockets *are not file descriptors*
20:16 <geekosaur> what doesn;t necessarily exist yet is an evil hack somewhere in the depths of winsock that creates a fake fd so you can use normal I/O functions and Windows CRT will detect it and use the appropriate winsock functions instead
20:16 <geekosaur> and I don;t know the guts of the network library on Windows well enough to know what controls that part
20:16 path[l] joined
20:16 dmwit_ joined
20:17 ner0x652 joined
20:17 <dbohdan> I guess it's time to learn Winsock properly.
20:17 <geekosaur> it's weird and ghc's runtime for some reason tries to avoid conflating sockets and their fake file descriptors as much as possible even though most socket APIs require you to use the fd interface :/
20:17 <* dbohdan> shudders
20:18 <geekosaur> (so, some of this may be on ghc's runtime. Handle is moderately evil when it comes to winsock)
20:19 <dbohdan> Is there a list of known Windows gotchas? The docs for Network.Socket have some notes on Windows but not about this.
20:19 <geekosaur> not that I know of
20:20 <geekosaur> ghc generally treats windows as a second class citizen :( (despite having been funded by microsoft research!)
20:21 dmwit joined
20:21 <Tuplanolla> If the funds aren't working, you aren't using enough.
20:22 <thoughtpolice> Well, this particular problem is tricky because the way Windows async I/O works is really, fundamentally different from Linux/BSD (honestly, I like Windows' approach more, tbh). There have been attempts to fix the feature parity problems, and it fixed certain issues like asynchronous interrupts and FD limits. Making it all scalable is still even more
20:22 <thoughtpolice> difficult.
20:22 <geekosaur> also I'm not 100% on that explanation of what's going wrong here. I can see it happening that way but I cn also see other things (that would imply ghc's runtime is just broken for some reason. what ghc version?)
20:22 <geekosaur> yes, windows async I/O is much saner
20:22 connrs joined
20:22 <geekosaur> but this particular problem *is* an fd limit
20:22 <thoughtpolice> (IIRC, it probably requires scheduler integration to actually be fast, otherwise you die from the context switching).
20:23 <thoughtpolice> Right, I'm just saying the reason it uses select() (and thus why the limit exists at all) is partially a design thing, to be figured out
20:23 tom7942 joined
20:23 <thoughtpolice> Well, mostly the performance part. I think Joey's port of the I/O manager to Windows actually did fix a lot of the egregious feature-parity problems, but it wasn't very fast. That's probably OK.
20:24 JeanCarloMachado joined
20:24 <thoughtpolice> e.g. things like socket functions not being interruptible on Windows via async exceptions
20:24 <thoughtpolice> Which means things like 'timeout' on a forkIO'd thread waiting on a foreign call can work, etc.
20:25 TabAtkins joined
20:25 lukexi joined
20:25 <thoughtpolice> The scheduler thing is kind of shitty if you want to get the performance back, though. It's conceptually nice having the I/O manager almost entirely separated from the runtime, and written in Haskell, I think. It's a challenge for sure.
20:25 S11001001 joined
20:25 <geekosaur> btw if anyone knows a Windows programmer with a fair amount of internals knowlege who is willing to learn hacking on a haskell compiler, ghc needs them badly
20:25 michbad joined
20:25 rcat joined
20:26 <geekosaur> there's *one* person who actually groks windows
20:27 <geekosaur> (that person would not be me. I know a little but get lost quickly when it starts getting into details)
20:27 <dbohdan> geekosaur: Maybe not making Haskell's Windows support better is part of Microsoft's F# strategy? (j/k, F# fans tell me MS doesn't have one.) Still, it seems like Haskell on Windows works way better than it used to even 5-7 years ago, if you go by the blog posts.
20:28 <dbohdan> stack is very consistent across different platforms.
20:28 doomlord joined
20:28 badlands joined
20:29 <thoughtpolice> GHC-on-Windows improvement in the past few years, IMO, is largely attributable to Tamar more than anyone.
20:29 <thoughtpolice> It's not just obvious things like async I/O parity... hundreds of bugs, toolchain issues, minor wrinkles. Many of those are collectively, together, far more than the sum of their parts, so to speak.
20:29 vektorweg11 joined
20:30 JoshS joined
20:30 <geekosaur> dbohdan, they were funding it for OS hardening / security research. they've moved that project on to other things at this point though
20:30 <geekosaur> and yes, Tamar's done a lot of good work to fix up what used to be a much more terrible Windows story
20:31 <dbohdan> Would you say that Haskell is or isn't production ready on Windows?
20:31 freusque joined
20:31 <dbohdan> (For network-y applications.)
20:31 <dbohdan> Command line tools seem to works great.
20:31 <geekosaur> there are people who use it. most of them have figured out the pain points, but I don;t know of any writeups
20:32 bjz joined
20:32 <thoughtpolice> Depends. Are you writing a server that gets called twice a day to do reporting? That's easy. Do you want 500,000 concurrent connections? That's... not going to be easy I'm afraid.
20:32 <geekosaur> but, I'm mostly a unix person, so.
20:32 <dbohdan> geekosaur: Me too...
20:33 <dbohdan> thoughtpolice: Closer to the former than the latter, I guess.
20:33 janos joined
20:34 Kuros joined
20:35 coltfred joined
20:36 <xubunto> ertes: fun thing those applicative functors
20:36 janos__ joined
20:36 Wizek joined
20:36 Wizek_ joined
20:37 <dbohdan> All right, you've given me some tips (thanks!) and I'll try to investigate the problem some more, maybe with a debugger. I'll get back to you if I find anything interesting.
20:37 jsgrant- joined
20:37 augur joined
20:38 <Tuplanolla> Threads seem to install their own exception handlers that print out the exceptions when they arrive and exit. Is there a way to completely replace this mechanism?
20:38 okeuday_bak joined
20:39 <Zemyla> Bit janitoring is just as annoying with Haskell as it is with any other language, it seems.
20:39 <xubunto> so what is the symbol <* for?
20:40 <Tuplanolla> It's `<*>`, but ignores the result on the right, xubunto.
20:40 <Rembane> xubunto: It's like >> but in the other direction and or applicative functors.
20:40 <Rembane> +f
20:40 <Zemyla> xubunto: a <* b = const <$> a <*> b.
20:40 <Zemyla> Except potentially more optimized.
20:41 connrs joined
20:41 <Tuplanolla> It comes up often with parsers etc.
20:41 <Theophane> hi folks!
20:41 <geekosaur> Tuplanolla, fafik it's just a catch (\(e :: SomeException) -> ...) wrapped around the whole thing. what are you trying to do?
20:42 <Tuplanolla> Just exploring, geekosaur.
20:42 <Theophane> I'm trying to create a shell application (a REPL, basically), and I would need to hold the network socket as a global state, and I have a few questions about it:
20:43 <Theophane> Is it the good way to do it?
20:43 prohobo joined
20:43 <Theophane> and should I investigate about the State monad?
20:43 <geekosaur> hm, actually that cant be right. I think they actually don;t trap excedptions at all, and they propagate up to top level and abort the program
20:43 <Zemyla> Theophane: You can probably get away with the ReaderT monad.
20:44 <Theophane> okay cool, thanks Zemyla :)
20:44 <geekosaur> and you will need to understand how exceptions work if you want to change this, although the wrapper I suggested is a good start
20:44 <Zemyla> If you need to change the socket, use the ReaderT monad holding an MVar with the socket in it, so you always have the most updated state of the socket.
20:44 <geekosaur> *** but remember that Haskell is lazy ***
20:45 coltfred joined
20:45 <geekosaur> threads can and will produce unevaluated thunks that get evaluated sometime afterward and throw then, and no exception handler in the thread will help you
20:45 <Theophane> Zemyla: okay cool :) thanks for the tip!
20:46 prohobo left
20:46 chenshen joined
20:47 <Tuplanolla> Hmm, indeed.
20:49 <Zemyla> I'm having to save 2 or 3 21-bit Unicode Chars to a single Word64.
20:51 gawen joined
20:51 doodlehaus joined
20:52 jsgrant- joined
20:53 oisdk joined
20:53 doodlehaus joined
20:54 octarin joined
20:54 octarin joined
20:56 janos joined
20:56 alx741 joined
20:57 janos__ joined
20:57 <mekeor> what do symbols in lispy languages do? – explained for haskellers? what do correlate to in haskell?
20:57 <Rembane> I want to count the number of constructors in a data type programmatically, how do I do that?
20:57 coltfred joined
20:58 <lyxia> Rembane: generics or template haskell
20:58 <mekeor> lyxia: you cound use the Bound type class i think?
20:58 <glguy> :t length . dataTypeConstrs . dataTypeOf
20:58 <lambdabot> Data a => a -> Int
20:58 <mekeor> @src Bound
20:58 <lambdabot> Source not found. Wrong! You cheating scum!
20:59 <Rembane> lyxia, mekeor, glguy: Thank you!
21:00 <mekeor> @src Bounded -- that's what it's called
21:00 <lambdabot> Source not found. Are you typing with your feet?
21:00 eschnett joined
21:00 deepfire joined
21:00 <xubunto> i like this lambda bot
21:01 <mekeor> yes, but i'm too stupid to use it
21:01 <xubunto> it is a sassy bot
21:01 <xubunto> :D
21:02 octarin joined
21:02 <lyxia> mekeor: doesn't bounded only allow you to count values?
21:02 ronnik joined
21:02 shayan_ joined
21:02 sepp2k joined
21:03 chenyu` joined
21:03 taksuyu joined
21:03 graygoose124_ joined
21:03 janos joined
21:04 staafl_ joined
21:04 cdg_ joined
21:04 cpape` joined
21:04 takle_ joined
21:04 jud^ joined
21:05 orion___ joined
21:05 pavonia_ joined
21:05 Kuros` joined
21:05 <Cale> mekeor: They're roughly like nullary data constructors
21:05 emmanuel` joined
21:06 sgript- joined
21:06 Celtore joined
21:06 Deaddy_ joined
21:06 metalbot joined
21:06 Hafydd_ joined
21:06 Hafydd_ joined
21:06 <Cale> mekeor: They're just values which can cheaply be compared for equality (though not necessarily ordering)
21:07 raatiniemi_ joined
21:07 aminb joined
21:08 Tourist joined
21:08 oelewapperke joined
21:08 Tourist joined
21:08 Vivek___ joined
21:08 oleks_ joined
21:11 Welkin joined
21:11 malt3_ joined
21:11 dan_f joined
21:12 Ak2i joined
21:13 pdgwien joined
21:13 segfaulthunter joined
21:13 jackneill__ joined
21:13 jeddak joined
21:15 quark[0] joined
21:16 DrCode joined
21:16 Celtore left
21:16 <okeuday_bak> After base-4.3, using fail "string" :: Either String a causes an error exception, is there an alternative that doesn't create an exception?
21:17 indiffernet joined
21:17 justanotheruser joined
21:17 Younder joined
21:17 Bashmetim joined
21:17 bitonic_ joined
21:17 naudiz joined
21:17 aarvar joined
21:17 cdg joined
21:18 <byorgey> okeuday_bak: Left "string" ?
21:18 bigs_ joined
21:18 Maerten joined
21:18 bluepixel joined
21:18 deni joined
21:18 chenshen joined
21:18 nomotif joined
21:18 Vq joined
21:18 andrei_chiffa_ joined
21:18 pera joined
21:18 athan joined
21:18 fnurglewitz joined
21:18 sternmull joined
21:18 cyphase joined
21:18 cmr joined
21:18 kaeluka joined
21:18 dcoutts__ joined
21:18 caasih joined
21:18 cpup joined
21:18 nille joined
21:18 bus000_ joined
21:18 Jonno_FTW joined
21:18 Tene joined
21:18 brennie joined
21:18 Xnuk joined
21:18 lexi-lambda joined
21:18 liyang joined
21:18 samgd joined
21:18 jchia joined
21:18 jorj joined
21:18 __main__ joined
21:18 nikolah joined
21:18 surtn joined
21:18 zomg joined
21:18 Reisen joined
21:18 crosleyt joined
21:18 deni joined
21:18 <okeuday_bak> byorgey: yeah, problem #4 at http://blog.ezyang.com/2011/08/8-ways-to-report-errors-in-haskell-revisited/
21:19 raycoll joined
21:19 zipper joined
21:20 so joined
21:20 SCHAAP137 joined
21:21 alx741_ joined
21:21 <byorgey> okeuday_bak: that blog post is from 5 1/2 years ago. I don't think anyone at all advocates the use of 'fail' these days.
21:21 <okeuday_bak> byorgey: k, good to know
21:21 oleks joined
21:22 oisdk joined
21:22 deni joined
21:22 <okeuday_bak> byorgey: it seems best to avoid, is there something better than "Either CustomEnumerableType" for code that wants to avoid IO/exceptions, or is that best?
21:23 Bane^ joined
21:24 paolino joined
21:26 tadni- joined
21:26 Levex joined
21:27 deepfire joined
21:27 pasukon joined
21:30 <Zemyla> byorgey: Lots of people use it implicitly in list comprehensions.
21:31 <byorgey> Zemyla: that's true
21:32 deech joined
21:34 heurist joined
21:35 mikeplus32 joined
21:35 <deech> Hi all, this is a dumb question but how do I write a newline character to a file? I'm trying to write "hello\nworld" but having no success with 'writeFile blah "hello\\nworld", "hello\\\nworld" or "hello\\\\nworld".
21:36 <geekosaur> you wanted the one you didn't try. \n
21:36 jgertm joined
21:36 <AWizzArd> In main (i.e. inside an IO do block) I would like to call a pure function, which returns a Bool. What I did was x <- return (myFn data) and in the next line I had to putStrLn x, so that it would actually get evaluated.
21:36 <deech> That saves it as "hello <actual-newline> world"
21:36 cierdan joined
21:36 <deech> I want "hello\nworld".
21:37 <geekosaur> \\n
21:37 <AWizzArd> Can I call myFn in a way that it *does* get evaluated, but the result will be thrown away?
21:37 <deech> That gets me "hello\ <actual-newline> world".
21:37 <geekosaur> that sounds very wrong
21:37 patbecich joined
21:37 <AWizzArd> (I just want to time it via getCPUTime)
21:37 <mekeor> ddeech: try "
21:37 <mekeor> "
21:37 <geekosaur> > "hello\\nworld"
21:37 <lambdabot> "hello\\nworld"
21:38 <geekosaur> > text "hello\\nworld"
21:38 <lambdabot> hello\nworld
21:38 zygentoma joined
21:38 <mekeor> > show "hello\\nworld"
21:38 <lambdabot> "\"hello\\\\nworld\""
21:38 <geekosaur> AWizzArd, what you wrote was the same as "let x = myFn data" and neither one forces evaluation
21:38 <geekosaur> "let !x = myFn data" will force at least partial evaluation
21:39 <AWizzArd> geekosaur: okay, I will give this a try, thx
21:39 fre2 joined
21:39 <geekosaur> you may need an extension (BangPatterns)
21:39 oisdk joined
21:40 augur joined
21:42 <geekosaur> AWizzArd, also, timing stuff in Haskell is really hairy because of laziness.You want to look at the criterion package.
21:42 <geekosaur> it deals with most of the hairy edge cases
21:42 <AWizzArd> geekosaur: yes of course, true benchmarking is what is really the right way to go here. But in this case my goal is to simply play around with basic newbie Haskell stuff
21:43 <geekosaur> right, but the edge cases caused by laziness are bad enough that criterion is really needed even for basic/quick timings
21:43 <geekosaur> that was originally why it was written
21:43 <geekosaur> not benchmarking, just handling all the edge cases
21:44 mizu_no_oto_work joined
21:44 ali_bush joined
21:44 <AWizzArd> Makes sense. In my case here it’s okay though, because I am not really very interested in the timings and don’t need accuracy.
21:44 <AWizzArd> Just trying to get ideas to compile.
21:45 nshepper1 joined
21:46 Rainb joined
21:46 <geekosaur> (it was like 2 weeks of discussion and tinkering on -cafe to get a "quick timing" to work, followed by someone collecting the result and making a package out of it. laziness is not the friend of timing)
21:47 <AWizzArd> (-:
21:47 <AWizzArd> https://tech.channable.com/posts/2017-02-24-how-we-secretly-introduced-haskell-and-got-away-with-it.html
21:47 orbifx joined
21:49 wildlander joined
21:50 loanatic joined
21:50 tadni- joined
21:51 contiver joined
21:51 danthemyth joined
21:52 bluepixel joined
21:52 Goplat joined
21:53 hiratara joined
21:55 cierdan left
21:55 Nerterologist joined
21:57 <contiver> I´ve seen unsafePerformIO mentioned many times, but never had to deal with it till now.
21:57 <contiver> In the compress function here (at the bottom) https://github.com/ananthakumaran/hopfli/blob/master/src/Codec/Compression/Hopfli/Raw.hsc , would it be better to return IO Bytestring?
21:57 roconnor joined
21:58 fractalsea joined
21:58 <contiver> I didn't write the code, but since I'm maintaining it, I thought I'd ask.
21:58 Celtore joined
21:58 <okeuday_bak> is there a helper function in haskell somewhere that takes a single argument and doesn't do anything with it?
21:59 vektorweg1 joined
21:59 <exio4> okeuday_bak: const ()
21:59 <exio4> okeuday_bak: id?
22:00 <exio4> okeuday_bak: tell us the type signature you want :)
22:00 jgertm joined
22:00 <okeuday_bak> exio4: yeah, good point, thanks
22:01 contiver_ joined
22:01 epsilonhalbe joined
22:02 <hpc> contiver_: it's common for things that operate close to foreign imports to use unsafePerformIO
22:02 <hpc> contiver_: think of it as building a pure interface around impure code
22:02 Ulrar joined
22:02 coot joined
22:02 Sose_ joined
22:02 mannen joined
22:02 m0rphism joined
22:02 raichoo joined
22:02 ertes joined
22:02 pacak joined
22:02 austinkeeley joined
22:02 tinkyholloway joined
22:02 s4kashya1 joined
22:02 jchia_ joined
22:02 trevb joined
22:02 rps1 joined
22:02 cchalmers joined
22:02 xocolatl joined
22:02 ziman joined
22:02 eikke joined
22:02 earldouglas joined
22:02 micro_ joined
22:02 biocage joined
22:02 ReinH joined
22:02 bydo joined
22:02 s4kashya_ joined
22:02 rlr joined
22:02 pfoetchen joined
22:02 kml joined
22:02 nikivi- joined
22:02 rejuvyesh joined
22:02 robertc joined
22:02 mounty joined
22:02 juri_ joined
22:02 <Cale> contiver: It's debateable. You'd sort of expect that compress is a pure function, so probably unsafePerformIO is okay there.
22:02 <hpc> there's a high bar to meet as far as ensuring that it is actually pure
22:02 <okeuday_bak> exio4: let f = (\x -> x) would be all I would want, just wondering if there is some standard definition somewhere, that should accept any type, right?
22:02 <hpc> but it might be worth the effort for something like this
22:03 <jle`> okeuday_bak: f is 'id'
22:03 <jle`> @src id
22:03 <lambdabot> id x = x
22:03 <hpc> people like being able to compress data at will ;)
22:03 <okeuday_bak> jle`: k, thanks
22:03 <Cale> Yeah, it's hard to know that the external libraries you're relying on really do produce a deterministic result.
22:03 bitonic_ joined
22:03 bigs_ joined
22:03 <Cale> But if you can ensure that, it's nice to be able to let this be a function ByteString -> ByteString
22:04 louispan joined
22:04 <geekosaur> pedantry alert, you likely want unsafeLocalState (which skips some unnecessary cross-thread locking relative to unsafePerformIO)
22:05 <contiver> Cale, hpc: thanks for the answers, I think I'll leave it like that then.
22:05 <contiver> geekosaur, hadn't heard of that function, I'll keep it in mind :)
22:05 <geekosaur> the FFI spec defines it
22:06 <hpc> "It is expected that this operation will be replaced in a future revision of Haskell"
22:06 sjl_ joined
22:06 <hpc> unsafeLocalState = unsafeDupablePerformIO
22:06 <hpc> (in ghc)
22:07 <contiver> hpc: yeah, just read that. I guess it's deprecated (or will be)?
22:08 insitu joined
22:08 <hpc> deprecation warnings are red
22:08 <hpc> this seems more like a volatile api or something
22:09 <Cale> I'm not sure I'd use unsafeDupablePerformIO for that
22:09 insitu joined
22:09 <Cale> While it's probably safe if the IO gets duplicated, you're duplicating a potentially rather expensive operation.
22:10 <ertes> monochrom: BTW, i didn't have a satisfying experience with any of the proof systems i tried so far =/
22:10 <ertes> i saw one project to implement such a system in haskell, but it seemed abandoned
22:10 <contiver> If I may ask, what's the difference between the two? (unsafePerformIO and unsafeDupablePerformIO)
22:11 <geekosaur> unsafePerformIO adds locking to ensure two threads don;t run it at the same time
22:11 <geekosaur> which is necessary if you are working with the I/O manager, but not for most FFI calls
22:11 <Cale> With unsafeDupablePerformIO, there's a few cycles during which if more than one thread starts evaluating the same thunk, both may perform the entire evaluation.
22:11 buglebudabey joined
22:12 <Cale> I would recommend just sticking with unsafePerformIO almost always.
22:12 <geekosaur> for pure code, if two threads hit an unevaluated thunk at the same time, we let both evaluate it even though they will duplicate work; the cost of locking to prevent it is almost always higher than just letting it hapen
22:13 oisdk joined
22:13 <Cale> It really depends
22:13 <geekosaur> (that was tested in one ghc release and removed after it caused major slowdowns)
22:13 <Cale> If the IO action is doing something nontrivial, then the locking might be quite inexpensive.
22:13 <geekosaur> sometime in 6.6 or 6.8 series iirc
22:14 <hpc> yeah, compressing data is a big operation
22:14 <geekosaur> but for IO locking is done because the I/O manager isn;t 100% reentrant
22:14 <hpc> especially (as one often does) when compressing gigs of data
22:14 <contiver> so if I were to use unsafeDupablePerformIO, it would on average be faster, but from time to time the bytestring might be compressed by two threads?
22:14 <Cale> yeah
22:15 <geekosaur> and unsafePerformIO allows entry to the I/O manager without the normal checks. so it does extra locking, and unsafeDupablePerformIO avoids that when you don;t need to care about that (non)reentrancy
22:16 <geekosaur> contiver, I said with pure code. for calling into C to do compression, that's different and you do need to think about how long it will run and whether it's worth doing the extra locking or not
22:16 esad joined
22:16 <geekosaur> but you asked what the difference between the two was
22:18 <contiver> geekosaur, and I appreciate your answer :) I guess I'll stick to unsafePerformIO, if you are using Zopfli to compress you probably don't care about a couple more seconds.
22:18 <geekosaur> it will rarely be that much
22:19 <geekosaur> maybe if you call it a million times it;d add up to that
22:19 deepfire joined
22:20 mkoenig joined
22:20 soLucien joined
22:22 ebsen joined
22:23 tom7942 joined
22:26 sigmundv joined
22:27 IndigoTiger joined
22:28 binaryplease joined
22:28 epsilonhalbe left
22:30 rixile joined
22:31 hiratara joined
22:32 _ashbreeze_ joined
22:32 tommd joined
22:33 Jesin joined
22:35 binaryplease1 joined
22:35 Thra11 joined
22:38 sw1nn joined
22:38 m0rphism joined
22:39 JeanCarloMachado joined
22:40 meoblast001 joined
22:41 m0rphism joined
22:41 orbifx joined
22:44 Voldenet joined
22:44 Voldenet joined
22:44 janos joined
22:44 fractalsea joined
22:46 <okeuday_bak> when using https://hackage.haskell.org/package/binary- the usage of function runGetOrFail will somehow return the string fed to the fail function in the Left data, right?
22:46 <geekosaur> that sounds like the wrong way of thinking about it
22:47 <geekosaur> Either is what the name says
22:47 <okeuday_bak> or does the exception not get caught at that level?
22:47 <geekosaur> it is Either the Left or the Right, it is never both
22:47 jophish_ joined
22:48 <geekosaur> the error message from `fail` should be the String element of the tuple
22:48 <okeuday_bak> k
22:48 <geekosaur> (3rd element)
22:48 meoblast001 joined
22:50 coot joined
22:52 <MarcelineVQ> ertes: http://lpaste.net/353218
22:52 danthemyth joined
22:53 tel joined
22:54 louispan joined
22:55 bjz joined
22:55 meoblast joined
22:56 <ertes> MarcelineVQ: this may sound like nitpicking, but you really need to be precise here: "for all naturals n, there exists some natural number k such that n = k*2"
22:56 <ertes> counterexample: 1
22:56 patbecich joined
22:57 <ertes> instead you need to define what it means when you say "n is even", which is a definition: "n is even" is the same statement as "…"
22:57 fDev2179 joined
22:57 buglebudabey joined
22:57 <geekosaur> ...and this is why most people don't include proofs...
22:59 <ertes> MarcelineVQ: however, without nitpicking too much on your syntax, your actual proof is fine, so congratulations =)
22:59 alx741 joined
22:59 <ertes> if you're more rigorous about your syntax, a proof assistant would accept your proof (assuming that you have already proved distributivity)
23:01 JeanCarloMachado joined
23:02 bob3434 joined
23:02 edunham1 joined
23:03 ragepandemic joined
23:07 <MarcelineVQ> that's good, thank you. that rule was more precise before, I flubbbed it when combining lines it looks like. actually I had another issue where I couldnt decide whether to be specific enough to say, "for every even natural n there exists exactly one natural k such that n = k*2" or whether I could ignore that since it'd be a consequence of them being natural numbers, sort of like how having to define distributivity would need its
23:07 <MarcelineVQ> own proof that I'm not sure how to tackle
23:08 <MarcelineVQ> I can certainly see why, if you need to show every part, proofs would get prety big. Also this shows to me that a proof is only as good as the assumptions you're making, we start this of by saying what even means to us, but who knows, maybe at n = 1000000000 suddenlty even stops being true.
23:08 contiver_ joined
23:10 <ertes> MarcelineVQ: in mathematics you generally don't prove every detail… instead you refer to theorems, i.e. things that have already been proven
23:10 <ertes> sort of like you use libraries in programming
23:10 <ertes> when using a proof assistant those things literally become libraries =)
23:11 <ertes> distributivity is surprisingly complex to prove from scratch (not difficult, just very tedious)
23:11 steeze joined
23:13 eizua joined
23:14 mhagemeister joined
23:15 Nik05 joined
23:15 davezd joined
23:18 theDon joined
23:19 mvr_ joined
23:21 jophish_ joined
23:21 jan-sipr joined
23:21 steeze joined
23:24 deepfire joined
23:25 mda1 joined
23:26 anuxivm left
23:26 tromp__ joined
23:27 bjz joined
23:27 Kreest_ joined
23:29 <hrumph> it'hi
23:29 <hrumph> hi
23:29 <hrumph> what do i have to include to have MonadTrans available?
23:29 systadmin joined
23:33 coot joined
23:33 <johnw> Hoogle will tell you
23:34 <hrumph> i tried control.monad.trans but it's not available
23:34 <hrumph> should i install haskell-platform or something?
23:35 k0001 joined
23:35 <johnw> https://www.haskell.org/hoogle/?hoogle=MonadTrans
23:37 dabd joined
23:37 groscoe joined
23:38 <ertes> does the lens library provide a generalisation of splitAt to arbitrary sequence types?
23:39 lambda-11235 joined
23:39 zgrepc joined
23:39 <glguy> no
23:39 <ertes> ok, thanks
23:42 alx741_ joined
23:42 boek joined
23:45 loanatic joined
23:45 m0rphism joined
23:50 <Squarism> what am i doing wrong here : http://lpaste.net/353220
23:51 <glguy> You're using createGameServerInstance as a record selector
23:52 JeanCarloMachado joined
23:53 danthemyth joined
23:53 eacameron joined
23:54 <glguy> Squarism: To understand why that's an issue, consider what type createGameServerInstance would need to have to exist
23:55 danthemyth joined
23:55 oisdk_ joined
23:56 path[l] joined
23:58 <Squarism> glguy, well atm they could be anything
23:58 <glguy> I mean actually try to write the type
23:59 <glguy> like createGameServerInstance :: GameLauncher -> ?
23:59 silver_ joined