<     May 2017     >
Su Mo Tu We Th Fr Sa  
    1  2  3  4  5  6  
 7  8  9 10 11 12 13  
14 15 16 17 18 19 20  
21 22 23 24 25 26 _2_7  
28 29 30 31
00:00 atk joined
00:00 bydo joined
00:00 funrep joined
00:01 infinity0 joined
00:02 Reshi joined
00:03 ckubrak joined
00:03 juanpaucar joined
00:04 infinity0 joined
00:04 nachoman joined
00:06 eacameron joined
00:07 infinity0 joined
00:07 xcmw joined
00:07 SkyPatrol_ joined
00:09 <Rotaerk> hmm I see there exists a ContraFunctor, but no ContraApplicative or ContraAlternative
00:09 <Rotaerk> would such things be possible
00:10 eacamero_ joined
00:10 infinity0 joined
00:10 <c_wraith> Rotaerk: https://hackage.haskell.org/package/contravariant-1.4/docs/Data-Functor-Contravariant-Divisible.html#t:Divisible
00:11 <Rotaerk> ahh, thanks
00:11 Tesseraction joined
00:12 <Rotaerk> I was just imagining what if predicates were functors, and you used <|> on them to "or" them together
00:12 infinity0 joined
00:12 louispan joined
00:12 <Rotaerk> though looks like Decidable doesn't have a <|>
00:13 <c_wraith> No, it kind of has to go the other direction
00:13 <Rotaerk> k
00:14 afarmer joined
00:15 MasseR joined
00:15 augur joined
00:18 xcmw joined
00:18 <pacak> There's also acme-cofunctor.
00:19 Jin_ joined
00:19 Xlaech joined
00:21 funrep joined
00:22 kwic joined
00:22 anuxivm left
00:24 sighingnow joined
00:25 crobbins joined
00:27 nighty-- joined
00:29 eacameron joined
00:29 andyhuzhill joined
00:29 louispan joined
00:29 justinfokes joined
00:31 juanpaucar joined
00:31 koserge joined
00:31 justanotheruser joined
00:32 i-amd3 joined
00:32 gabe4k joined
00:33 UltimateNate joined
00:34 vztest123 joined
00:36 samu_ joined
00:37 dual joined
00:38 simukis_ joined
00:39 systadmin joined
00:40 plutoniix joined
00:40 plutoniix joined
00:41 samu__ joined
00:42 funrep joined
00:42 plutoniix joined
00:44 qwertydvorak joined
00:44 gabe4k joined
00:45 <sgronblo> Hello, could someone confirm one thing about Servant for me. While it seems to encode your types much more strongly it seems you could still easily have bugs where you accidentally swap two arguments in your handler function in the opposite order they are captured in the API type?
00:45 dfordivam joined
00:46 systemfault joined
00:47 justinfokes joined
00:47 aarvar joined
00:47 JoshS joined
00:48 <lknows> An odd question, does haskell ever become very naturally intuitive to use? Somehow the more I learn, the more I struggle to think in a "haskell" manner. Am I getting retarded or is this par for the course or something?
00:49 <geekosaur> pretty much par. I think it's easier if you've been trained to think in certain mathematical ways (no, I do not mean category theory; this is more meta, a "philosophy of math" type thing)
00:49 funrep joined
00:52 <geekosaur> sgronblo: there are servant-client and servant-foreign; you *can* run servant APIs in client mode instead of server
00:52 <geekosaur> which is kinda "flipping the arrows"
00:53 <geekosaur> they could design the types to protect you from doing that when building services, but then they'd need to provide a separate "coservant" whose core is the same as servant but whose APIs are typed for the client direction
00:53 <geekosaur> which would be kinda ridiculously wasteful
00:55 cyborg-one joined
00:57 mmachenry joined
00:58 <glguy> lknows: once you start building things you'll understand develop more intuition for it
00:59 carlomagno joined
01:01 filterfish_ joined
01:02 <EvanR> lknows: learning new ways to think of old things... is fun!
01:03 Hithroc joined
01:04 revprez_atlanta joined
01:05 SkyPatrol joined
01:06 harfangk joined
01:06 sgronblo joined
01:09 funrep joined
01:10 Supersonic112_ joined
01:10 baldrick1 joined
01:11 justinfokes joined
01:11 Xlaech joined
01:13 nachoman joined
01:18 sighingnow joined
01:18 <Lokathor> lknows, after a while you have a hard time thinking in a not-haskell way :P
01:19 cschneid_ joined
01:19 <Lokathor> though at the moment it seems i've forgot my monad transformer basics and am struggling to chain IO (Either String a) values
01:19 systadmin joined
01:22 meba joined
01:23 augur joined
01:23 Wizek_ joined
01:25 louispan joined
01:26 <glguy> step one, switch to using a monad transformer
01:26 cschneid_ joined
01:27 StoneToad joined
01:27 dual joined
01:28 beerdrop joined
01:29 <Lokathor> glguy, well yeah
01:30 insitu joined
01:30 WildfireXIII joined
01:30 <Lokathor> i have an IO (Either String GLuint) that i need to run twice, and then use those GLuint values with a MonadIO m () dealy and some other IO stuff
01:30 <Lokathor> all obvious stuff
01:30 jer1 joined
01:30 <Lokathor> right now there's too many other things going on around me to focus
01:33 roconnor joined
01:34 baldrick1 joined
01:34 prophile joined
01:35 juanpaucar joined
01:40 JeanCarloMachado joined
01:40 vaibhavsagar joined
01:41 JeanCarl1Machado joined
01:41 jao joined
01:44 eacameron joined
01:45 sgronblo joined
01:45 mizu_no_oto joined
01:46 funrep joined
01:46 varuaa joined
01:47 mmachenry joined
01:49 jer1 joined
01:51 sgronblo_ joined
01:51 dreco joined
01:52 Xlaech joined
01:54 ofdm joined
01:55 systadmin joined
01:56 xcmw joined
01:57 lambdamu_ joined
01:59 justinfokes joined
01:59 justinfokes joined
02:00 hucksy joined
02:01 funrep joined
02:01 StoneToad joined
02:03 juanpaucar joined
02:04 dejanr joined
02:04 <EvanR> global variables for fun and profit in haskell
02:05 <EvanR> dont blame me, the docs for newTChanIO, newTVarIO, etc specifically mention it
02:09 sellout- joined
02:10 jer1 joined
02:10 cpup joined
02:11 pranz4 joined
02:13 hydroacoustic joined
02:16 dual joined
02:17 StoneToad joined
02:17 dan_f joined
02:19 safe joined
02:20 darjeeli1 joined
02:21 funrep joined
02:23 jud^ joined
02:25 <orion> What exactly is "monoidal analysis", and what can you do besides count the number of layers?: https://www.stackage.org/haddock/lts-8.13/free-4.12.4/Control-Applicative-Free.html#v:runAp_
02:25 jer1 joined
02:25 Xlaech joined
02:26 lambda-calc joined
02:26 sproingie joined
02:26 exferenceBot joined
02:27 dual joined
02:27 <glguy> orion: look in Config.Schema.Docs for an example
02:27 <orion> glguy: Ah, you did mention that the other day.
02:27 mizu_no_oto joined
02:28 StoneToad joined
02:29 cpup joined
02:31 hexagoxel joined
02:32 burp joined
02:33 Xlaech left
02:34 jchia joined
02:34 wedens joined
02:35 hguest joined
02:35 <orion> glguy: How exactly does mappend work for DocBuilder?
02:35 dfranke joined
02:37 e14 joined
02:37 funrep joined
02:37 <glguy> it inherits the instance for tuples, so the elements of the tuple are combined pairwise with mappend
02:37 <glguy> for Map that's union
02:37 tefter joined
02:38 <orion> Oh, I see.
02:41 {emptyset} joined
02:42 <orion> Interesting, thanks!
02:44 JeanCarl1Machado joined
02:45 roconnor joined
02:46 aarvar joined
02:47 igniting joined
02:48 tommd joined
02:51 skeuomorf joined
02:52 rgc joined
02:52 jer1 joined
02:52 pavonia joined
02:52 brynedwards joined
02:54 thimoteus joined
02:56 baldrick1 joined
02:57 funrep joined
02:57 takle joined
03:01 augur joined
03:02 <athan> Hey all - STM alludes to "retrying" when it fails. Does that mean it busy-waits..?
03:02 xcmw joined
03:02 silentoxygen joined
03:03 justinfokes joined
03:03 flatmap13 joined
03:04 sternmull joined
03:04 juanpaucar joined
03:06 dual joined
03:07 bravo joined
03:07 andyhuzhill joined
03:07 argent0 joined
03:07 <peddie> athan: I don't think it's a "busy-wait" in the usual sense of spinning until something becomes available. it's transactional, so it has to re-read the TVar and try again to compute the new value and update if another thread updated it during this thread's transaction
03:09 jer1 joined
03:10 <pie_> is attoparsec suitable for bit-level stuff?
03:10 prophile joined
03:10 mithrandeer joined
03:10 <pie_> or is it only suitable if the primitives are bytes?
03:11 <peddie> @hackage binary-bits -- pie_, I've used this package for bit-level stuff before
03:11 <lambdabot> http://hackage.haskell.org/package/binary-bits -- pie_, I've used this package for bit-level stuff before
03:11 silentoxygen joined
03:12 xcmw joined
03:12 sgronblo joined
03:12 ystael joined
03:13 funrep joined
03:13 Xanather joined
03:17 <pie_> peddie, the problem is i can have stuff going across byte boundaries
03:17 <pie_> or is that fine for this
03:18 SeMas joined
03:18 <pie_> basically i might need to read 6 bits then 7 then 5 or something
03:18 eacameron joined
03:19 <peddie> pie_: if I recall correctly, that's no problem at all with this package, but check the docs and see whether it looks OK?
03:20 <pie_> i have no idea im a noob :P but ill look
03:20 <peddie> I think it has a lot of operations like "read n bits into a k-bit word"
03:20 <peddie> so you tell it exactly what to consume
03:21 <pie_> oh im still not used to how th eonline help catalog works
03:21 <pie_> i was looking at the wrong page
03:21 prophile joined
03:21 xcmw joined
03:22 <peddie> pie_: check out http://hackage.haskell.org/package/binary-bits-0.5/docs/Data-Binary-Bits-Get.html for example -- are you familiar with the `binary` package at all? this package is a simple extension to that one
03:22 <pie_> not familiar with any of the prelude xD
03:22 <pie_> or stdlib or whatever
03:22 <peddie> pie_: that's OK, `binary` is not part of the prelude or the `base` standard library :)
03:22 <peddie> @hackage binary
03:22 <lambdabot> http://hackage.haskell.org/package/binary
03:23 <peddie> pie_: out of curiosity, what are you going to parse?
03:23 <pie_> can i use this with attoparsec
03:23 <peddie> pie_: no, it's separate from attoparsec
03:23 <pie_> peddie, http://adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/swf/pdf/swf-file-format-spec.pdf xD
03:24 <pie_> help meeee
03:24 <peddie> that page is unavailable for me, but I gather you're parsing Flash files?
03:24 <pie_> i figured im never going to get anywhere unless i actually try
03:24 <pie_> never going to get anywhere with funtional languages that is
03:24 <pie_> yeah
03:24 prophile joined
03:24 freusque joined
03:24 <pie_> thats because i messed up the link https://wwwimages2.adobe.com/content/dam/Adobe/en/devnet/swf/pdf/swf-file-format-spec.pdf
03:25 hamishmack joined
03:25 sproingie joined
03:25 <peddie> pie_: if you have some code you can't get working, put it on lpaste and share the link here; usually there is someone around who is willing to take a look and help
03:25 <pie_> it seems detailed enough to be easy to follow for someone that knows what theyre doing
03:25 ericsagnes joined
03:25 <pie_> yeah i just didnt want to be annoying with my blatant cluelessness, but what the heck :)
03:25 <* hackage> tmapmvar 0.0.0 - A single-entity stateful Map in STM, similar to tmapchan https://hackage.haskell.org/package/tmapmvar-0.0.0 (athanclark)
03:25 <pie_> ill post what i have so fa
03:26 <pie_> peddie, https://pastebin.com/KNJVW54U
03:27 cschneid_ joined
03:27 <peddie> pie_: this program doesn't work?
03:27 <pie_> well it doesnt have enough stuff in it to do anythig
03:27 <pie_> im just trying to build up the types
03:28 <peddie> pie_: I don't totally understand why you have a bunch of fields that are `Parser <something>`. usually I write functions that are the ways to parse data that is just `<something>`
03:28 <pie_> peddie, re: i have no clue what im doing. if something looks like it doesnt make sense its probably because it doesnt
03:29 <pie_> peddie, these are supposed to be the fields/whatever in the swf
03:30 <pie_> well, word8 is relatively primitive, i probablt dont need parser for that, but i need parser for multibyte stuff so i can handle endianness no?
03:31 eacameron joined
03:31 sproingie joined
03:31 jer1 joined
03:31 mattn joined
03:31 xcmw joined
03:31 <peddie> pie_: usually your data types can be defined independently of how they're parsed from the file
03:32 <pie_> i think im trying to specify how to parse them from the file though?
03:32 <peddie> you had better, but that stuff doesn't have to affect how the data is defined
03:32 <peddie> one sec
03:33 funrep joined
03:33 <peddie> pie_: I might start by defining the SWF integers like this: http://lpaste.net/355514
03:33 <pie_> also id love if theres something to decrease the verbosity when im just changing the lenght of the integer, any tricks for that?
03:34 {emptyset} joined
03:34 <pie_> peddie, ok, how would the parsing side of that look? (just simple normal integers from bytes)
03:34 <peddie> how are you changing the length of the integer? I can think of some ideas, but it might make sense to get the verbose thing working
03:34 <peddie> pie_: let me write an example, one sec
03:34 <peddie> then I have to get back to real work :)
03:35 <pie_> sorry i meant like, the verbosity of the source code
03:35 <pie_> yeah thanks xD
03:35 <peddie> meanwhile check out https://hackage.haskell.org/package/binary-0.8.5.1/docs/Data-Binary-Get.html
03:35 <pie_> the bit packing thing is really gonna mess with my head though
03:35 robotroll joined
03:36 filterfish joined
03:36 takle joined
03:37 <pie_> peddie, looks to me like that only operates on bytes as well :I
03:37 <peddie> yes, true
03:38 <peddie> you just said "just simple normal integers from bytes" :P
03:39 <pie_> well google says https://wiki.haskell.org/Dealing_with_binary_data#The_BitGet_monad
03:39 <pie_> peddie, well yeah for the part you pasted xD
03:39 prophile joined
03:39 <pie_> (which is what you linked earlier)
03:41 mkoenig joined
03:41 Ralith_ joined
03:42 <* hackage> tmapmvar 0.0.1 - A single-entity stateful Map in STM, similar to tmapchan https://hackage.haskell.org/package/tmapmvar-0.0.1 (athanclark)
03:42 <pie_> peddie, for the bitjunk its basically the bottom of page 17 in the swf doc link :I
03:42 <EvanR> pie_: not sure about verbosity, but theres this thing, inline-c ! ;)
03:43 <EvanR> also some things can be made less verbose with quasi quoters
03:43 <pie_> EvanR, thanks ill check them out
03:43 anhduy joined
03:44 <pie_> though what im talking about either amounts to dependent types or metaprogramming proooobably...
03:44 <EvanR> are you parsing binary?
03:45 <pie_> attempting to yes
03:45 <EvanR> theres attoparsec and Binary
03:45 <pie_> yeah
03:45 <EvanR> and Cereal
03:45 <pie_> mmmm
03:46 <peddie> pie_: maybe http://lpaste.net/355514 is a very simple example
03:46 <peddie> haven't tried to compile it
03:46 anhduy joined
03:46 <peddie> but see if that makes some sense to you
03:46 shayan_ joined
03:46 <peddie> I just found some random thing in the PDF you linked
03:46 <pie_> peddie, this is for page 21 yeah?
03:46 <pie_> yeah ok ill look at it
03:47 <pie_> what does Binary(...) do?
03:47 <EvanR> import constructors for the type Binary
03:47 <peddie> pie_: it imports the type class name `Binary` along with all its methods (if you just wrote `Binary` without the `(...)`, it'd only import the name of the type class)
03:48 <pie_> ok
03:48 <EvanR> er, class and methods
03:48 <peddie> pie_: if `Binary` were a data type, it'd do what EvanR said above
03:48 <pie_> yeah i need to learn more haskell, the words and the structure make sense but i have no idea what the symbols do
03:48 etehtsea joined
03:48 funrep joined
03:49 <peddie> pie_: you can search for symbols on hoogle
03:49 <peddie> @where hoogle
03:49 <lambdabot> http://haskell.org/hoogle http://fpcomplete.com/hoogle – See also Hayoo, which searches more packages: http://hayoo.fh-wedel.de/
03:49 <pie_> hm ok
03:50 <peddie> pie_: to parse in bit-field structures, the parser should look pretty much the same, but you can use functions like Data.Binary.Bits.Get.word16be with an argument telling it to e.g. read only 11 bits or whatever
03:51 <pie_> well, ok. i guess that makes sense
03:51 <peddie> the <$> and <*> and *> are from the Functor and Applicative type classes
03:51 sword865 joined
03:51 <pie_> ah wait, does that also keep track of where it is in the input stream after reading the 11 bytes?
03:51 <pie_> beause that would be fine i guess
03:51 <pie_> also i tried but i dont see how to search for symbols yet
03:51 <peddie> pie_: yes, it keeps track of that kind of stuff under the hood
03:52 otto_s_ joined
03:52 <pie_> sooo, i could do the read 7 then 4 then 6 or whatever?
03:52 <peddie> pie_: the symbols are just regular haskell values. e.g. https://www.stackage.org/lts-8.13/hoogle?q=%3C*%3E&exact=on
03:52 <EvanR> <$> and <*> are so common and unfamiliar, probably any intro to haskell should get that overwith first
03:52 <pie_> huh i tried *> but it didnt work
03:52 <EvanR> or very soon
03:52 <EvanR> :t (*>)
03:52 <lambdabot> Applicative f => f a -> f b -> f b
03:53 mithrandeer joined
03:53 <EvanR> :t (>>)
03:53 <lambdabot> Monad m => m a -> m b -> m b
03:53 <peddie> pie_: I agree with EvanR that if you're not familiar with some of these pretty common bits of the standard library, you might want to run through some learning materials first; it'll speed you up a lot later
03:53 <pie_> yeah definitely
03:53 <peddie> pie_: if you check out UPenn's CIS194 course materials, a running example is building a parser, which might be just the thing :)
03:53 <peddie> @where cis194
03:53 <lambdabot> http://www.seas.upenn.edu/~cis194/spring13/
03:53 <pie_> im just tired of wanting to learn but never getting around to it :((
03:54 jer1 joined
03:54 <pie_> this is what wasnt working for me xP https://www.haskell.org/hoogle/?hoogle=*%3E
03:54 <EvanR> you have to say
03:54 <peddie> pie_: not sure why, but the `haskell.org` one wants you to surround the operator in parentheses: (*>)
03:54 <EvanR> (*>)
03:54 systadmin joined
03:55 anhduy joined
03:55 <pie_> ah
03:55 <EvanR> > ord <$> "fruit"
03:55 <lambdabot> [102,114,117,105,116]
03:55 <EvanR> > (<$>) ord "fruit"
03:55 <lambdabot> [102,114,117,105,116]
03:55 <peddie> pie_: if you want to start just writing some code, go for it, just keep the learning materials open in a tab and see whether you're missing something basic when you have a question :)
03:55 <pie_> \o/ yay apply to all the things
03:56 <pie_> peddie, "yes i am" xD
03:56 <EvanR> > (<$>) ord (Just 'f')
03:56 <lambdabot> Just 102
03:56 dual joined
03:56 <EvanR> delicious
03:56 <pie_> ok i think i kinda get how im supposed to do things from your paste
03:56 <peddie> pie_: I have to run, good luck for now! stick with it :)
03:57 <pie_> o/
03:57 <pie_> peddie, one last question xD
03:57 <peddie> adios
03:57 <peddie> go for it :)
03:57 <pie_> how does this relate to Parser?
03:57 <peddie> `Parser` is a type from the Attoparsec library
03:57 ^bschafer1 joined
03:57 <peddie> the binary library has the type `Get` which roughly analogous
03:58 <pie_> ok so i should be using that other library then
03:58 <pie_> i cant mix and match can i xD
03:59 <pie_> ok thanks again
03:59 <peddie> pie_: you could write a parser with attoparsec for the same data as you can with binary. this is one reason why it doesn't make sense to have the Parser or Get types in the data definitions for the things you want to parse. but it would be pretty gnarly and not worth it to try to parse some pieces of the file with an attoparsec parser and others with a binary parser.
04:00 <EvanR> pie_: they are not made to cooperate no
04:01 <EvanR> but you can make a frankenstein parser if you really put your mind to it!
04:01 <pie_> yeah no thanks xD
04:01 <peddie> pie_: binary gives a fairly uniform way to read and write the same data, so it should be pretty easy to add output support for SWF stuff as well that way
04:01 <peddie> pie_: ok, I'm out for now, best of luck
04:01 <peddie> have fnu
04:01 <peddie> fun even
04:01 <pie_> o/
04:03 <systadmin> ola
04:04 ghorn joined
04:04 drostie joined
04:05 isenmann joined
04:05 igniting joined
04:06 jimmyrcom joined
04:06 justinfokes joined
04:07 <systadmin> Tryin' to make a dice roller :/
04:07 cpup joined
04:07 <EvanR> cool
04:08 benl23 joined
04:08 eklavya joined
04:09 <ReinH> excellent plan
04:09 funrep joined
04:10 <EvanR> nothing that important should be left to chance
04:10 descender joined
04:11 qwertydvorak left
04:13 sgronblo joined
04:14 jer1 joined
04:15 infinity0 joined
04:16 ilyaigpetrov joined
04:18 juanpaucar joined
04:19 aarvar joined
04:19 srh joined
04:20 mithrandeer joined
04:20 takle joined
04:21 <dmj`> @typ randomRIO (1,6)
04:21 <lambdabot> (Num a, Random a) => IO a
04:22 benl23 joined
04:22 fosterite joined
04:22 seangrove joined
04:23 fosterite joined
04:23 <EvanR> haha that works with Doubles
04:23 <EvanR> for once ;)
04:24 fosterite joined
04:24 fosterite joined
04:25 fosterite joined
04:26 heebo joined
04:27 <EvanR> exceptions in IO are a given
04:27 <EvanR> are exceptions in STM expected? to be avoided? avoidable?
04:28 takle joined
04:30 <pie_> EvanR, in the case of something like this i would need to pass an argument to get somehow that specified the format of the integer yeah? i could case split on tht argument, but idk how to pass the argument
04:30 matthias` joined
04:30 <pie_> forgot the link https://pastebin.com/hi1nMeEy
04:31 <EvanR> you want to write a parser for the SwfInt type?
04:32 <pie_> yeah
04:32 <EvanR> you would not be passing a format argument, you would be passing it binary data and you would be figuring out the format from there
04:32 <pie_> going off peddie"s earlier example
04:32 <pie_> hm
04:32 <EvanR> if you want to try to parse different things, you need different types, different instances of Binary
04:33 <pie_> youre saying it would be decided higher up and the appropriate unction would be chosen
04:33 <EvanR> your sum type suggests you will detect the format from the dat
04:33 <EvanR> data
04:33 <pie_> yeah i dont think you can tell where a number ends just by looking at it :/
04:33 <EvanR> what exactly are you trying to do, i think i missed that
04:34 <pie_> trying to parse SWF based on the spec https://wwwimages2.adobe.com/content/dam/Adobe/en/devnet/swf/pdf/swf-file-format-spec.pdf
04:34 matthias` left
04:34 <EvanR> which part
04:35 <pie_> the very beginning at the moment
04:35 <EvanR> this is a 243 page doc
04:35 <pie_> like page 14 or something
04:35 <pie_> it starts with defining the types and gets into the actual structure later
04:35 matthias` joined
04:35 cpup joined
04:35 takle joined
04:36 <EvanR> it seems to be yes, the format is design to let you figure out what is what from looking at bits
04:36 <EvanR> a parser usually doesnt need an arguments but the raw data
04:36 <EvanR> any*
04:36 nullfxn joined
04:37 <pie_> well sure i mean
04:37 <pie_> if you have some kind of stucture, you know what kind of fields it has
04:37 <EvanR> so which part are you looking at right now
04:37 <pie_> so i need to split this sum type into its constituents?
04:38 <pie_> page 14.5
04:38 <EvanR> 14.5
04:38 <EvanR> paragraph 5 ?
04:38 <pie_> sorry, half way through page 14 :P
04:38 jer1 joined
04:38 <EvanR> not really anything here about the file format
04:39 <pie_> what would you like?
04:39 <pie_> theres a specific structure on page 54 for an example of how the basic types are used
04:39 <pie_> 52 sorry
04:40 <pie_> setbackgroundcolor
04:40 baldrick1 joined
04:40 <EvanR> nothing. you should be able to do what youre saying without passing any params or having different top level document types
04:40 <EvanR> next question
04:40 <pie_> ok
04:41 darjeeli1 joined
04:42 vlatkoB joined
04:42 matthias` left
04:42 ericsagnes joined
04:43 takle joined
04:45 funrep joined
04:49 <peddie> pie_: I'm not sure you need `SwfInt` for anything if the document is mostly defined in terms of things Haskell has already like `Word8` and `Int64` and so on
04:50 smwangi joined
04:51 <pie_> peddie, but its not the internal representation that i have an issue with its that i need to know how much to parse..?
04:51 <pie_> if its int64 i need to parse 4 bytes if its int8 i need to parse 1, etc
04:51 <EvanR> that is the point of the format
04:52 <EvanR> its design to tell you what youre looking at by looking at it
04:52 <peddie> pie_: in the RGB example, you know you're parsing an RGB structure, so you can just `getWord8` a few times. I didn't read enough of the document to know how the SWF format tells you what's coming up
04:52 <pie_> yeah
04:52 <pie_> but i still need to be able to call the appropriate parsing funciton...
04:52 <EvanR> but its your job to read the document and figure out how
04:52 <peddie> pie_: I didn't see any situations where you would actually have to parse a `SwfInt` from the file
04:52 anhduy joined
04:52 <pie_> peddie, oh wait i see what you mean
04:52 <peddie> everything seems to be defined in terms of other structures
04:53 <EvanR> you will have many actions of type Get Whatever, you can choose which ones to call during the process using the usual monadic style
04:53 <EvanR> not call, but use
04:53 <pie_> ok, i think i see
04:53 <pie_> but wha tif hypothetically i did need to do this
04:53 <EvanR> you use a Get and check the result, then branch based on that to the next Get
04:53 <pie_> (whatever "this" means)
04:54 <pie_> EvanR, yeah makes sense
04:54 {emptyset} joined
04:54 <EvanR> or fail because what you see makes no sense
04:54 mikeplus64 joined
04:55 <peddie> pie_: you will probably have to do something like this for arrays: maybe it says the size of the array first, then the elements follow. so you'll have to first read the size, see if it's reasonable, then call the element-parsing function that many times. (I don't know how arrays actually work in this format; I'm just trying to explain the general idea.)
04:55 <pie_> peddie, yeah definitely gonna have to do arrays
04:55 <pie_> ok makes sense
04:56 <pie_> would still be nice to have somehting in the source code for everything in the spec though IMO
04:56 <pie_> "its just boilerplate"?
04:56 thimoteus left
04:56 itihas joined
04:56 <pie_> but i mean i have very little coding experience so idk
04:57 thimoteus joined
04:57 <peddie> I would say, for the SWF unsigned-byte type, Word8 is the corresponding thing in the source code. you could abstract this, but I'm not sure what it would gain you
04:57 jer1 joined
04:57 <glguy> Probably better to just start experimenting with parsing some small stuff before you spend to much time pondering how to parse big stuff
04:58 <peddie> glguy++
04:58 <pie_> yeah :/
04:58 hydroacoustic joined
04:59 jhrcek joined
05:00 <peddie> pie_: why :/ ? I think the big stuff will make sense soon if you start piece-by-piece :)
05:00 takle joined
05:00 <pie_> big is small in a lot of pieces xD
05:00 funrep joined
05:01 <pie_> id have the same basic issues with a small one though no?
05:01 <pie_> i mean ok its fair to say what you said
05:01 revprez joined
05:01 <pie_> in fact its right xD
05:02 heebo joined
05:06 baldrick1 joined
05:07 dec0n joined
05:08 kamyar joined
05:09 justinfokes joined
05:09 sgronblo_ joined
05:10 <pie_> ok theres no native word24 type
05:11 <pie_> *built in
05:11 <EvanR> data Word24 = Word24 !Word8 !Word8 !Word8
05:11 <EvanR> otoh https://hackage.haskell.org/package/word24-2.0.1/docs/Data-Word-Word24.html
05:11 <pie_> hm
05:11 revtintin joined
05:12 <EvanR> which will be more efficient
05:12 <pie_> is that first one really OK?
05:12 funrep joined
05:12 athan joined
05:12 <glguy> Just store the value in a Word32
05:12 <EvanR> ok by me, though youd have to write your own small universe of instances for it
05:13 <pie_> glguy, oh right i can choose to parse it however i want
05:13 shayan_ joined
05:14 saurabhnanda joined
05:16 takle joined
05:18 saurabhn_ joined
05:18 drcode joined
05:18 hydroacoustic joined
05:19 jer1 joined
05:20 revprez joined
05:21 mrkgnao joined
05:21 revprez joined
05:21 Fubar^ joined
05:23 dunx joined
05:24 dual joined
05:24 meba joined
05:24 nomotif joined
05:26 Jeanne-Kamikaze joined
05:26 <peddie> pie_: I added an example for `CXFORM` records from page 24. if anything there doesn't make sense, I really suggest checking out those course notes I mentioned earlier. the assignments are largely to do with parsing and should be relevant to this.
05:27 meandi_2 joined
05:27 <pie_> ok \o/
05:27 justinfokes joined
05:29 sgronblo joined
05:31 <* hackage> postgresql-simple 0.5.3.0 - Mid-Level PostgreSQL client library https://hackage.haskell.org/package/postgresql-simple-0.5.3.0 (LeonSmith)
05:34 Jeanne-Kamikaze joined
05:39 benl23 joined
05:39 hamishmack joined
05:39 liste joined
05:41 igniting joined
05:41 liste joined
05:41 augur joined
05:42 takle joined
05:42 jer1 joined
05:42 slack1256 joined
05:42 jchia joined
05:43 liste joined
05:45 justinfokes joined
05:47 insitu joined
05:47 <* hackage> postgresql-libpq 0.9.3.1 - low-level binding to libpq https://hackage.haskell.org/package/postgresql-libpq-0.9.3.1 (LeonSmith)
05:49 jchia joined
05:50 lambda-calc joined
05:50 juanpaucar joined
05:51 takle joined
05:53 jchia joined
05:54 jer1 joined
05:56 leat joined
05:58 augur joined
05:59 fizruk joined
06:00 metaporia joined
06:01 ertes-w joined
06:01 yoneda joined
06:01 danvet joined
06:02 dual joined
06:03 ThomasLocke joined
06:03 ThomasLocke joined
06:03 jedws joined
06:03 flatmap13 joined
06:06 <EvanR> i was looking for a newtype that swaps the role of Left and Right
06:06 <EvanR> return the first Right that succeeds, otherwise try the next thing
06:06 <EvanR> i could swap Left and Right instead... but then Left would mean success
06:07 osa1 joined
06:07 osa1 joined
06:07 <EvanR> maybe a Either a b -> Either b a is in order
06:07 <capisce> EvanR: what do you mean first Right that succeeds?
06:07 <EvanR> the first right
06:08 <EvanR> trying to parse a sequence of files
06:08 <jle`> sounds like you just want asum
06:08 <EvanR> the later ones are fallbacks
06:08 <EvanR> asum...
06:08 <EvanR> ok
06:09 <jle`> or <|> etc.
06:09 hurkan joined
06:09 <EvanR> Either has no alternative instance
06:10 <jle`> 'Either e' does
06:11 <EvanR> > Right 'c' <|> Right 'c'
06:11 <lambdabot> error:
06:11 <lambdabot> • Ambiguous type variable ‘a0’ arising from a use of ‘show_M146135974615...
06:11 <lambdabot> prevents the constraint ‘(Show a0)’ from being solved.
06:11 <jle`> oh hey
06:11 <EvanR> > Right 'c' <|> Right 'c' :: Either Char Char
06:11 <lambdabot> error:
06:11 <lambdabot> • No instance for (Control.Monad.Trans.Error.Error Char)
06:11 <lambdabot> arising from a use of ‘<|>’
06:11 <EvanR> well thats
06:12 <jle`> interestingly enough, ExceptT e Identity has an instance
06:12 <EvanR> and where the heck is asum
06:12 <MarcelineVQ> Foldable
06:12 <jle`> it's in Foldable i believe
06:13 <EvanR> not helping with Either though...
06:13 takle joined
06:13 <jle`> yeah, i'm saying that the lack of an Alternative instance is a mistake
06:13 juanpaucar joined
06:13 <MarcelineVQ> what about asum . map eitherToMaybe
06:14 <EvanR> good call
06:14 sproingie joined
06:14 sproingie joined
06:14 <EvanR> actually i need to use the error message in between tries
06:14 <cocreature> EvanR: I think https://hackage.haskell.org/package/errors-2.2.0/docs/Data-EitherR.html#t:EitherR is the newtype you’re looking for
06:15 <EvanR> haha success monad!
06:15 <EvanR> and it has an Alternative instance
06:15 <EvanR> brilliant
06:15 takuan joined
06:18 zeroed joined
06:18 dsantiago joined
06:20 takle joined
06:20 zeroed joined
06:21 justinfokes joined
06:22 zeroed joined
06:24 Computist joined
06:24 quchen joined
06:26 leat joined
06:27 fosterite joined
06:28 quobo joined
06:29 sleffy joined
06:30 commanderinchief joined
06:31 alfredo joined
06:31 juanpaucar joined
06:33 <piyush-kurur> what is the easiest way to do the following I have a type Foo in an internal module. I want to export it from the current module but not its constructors. I also want to export all the numerous helper function from the module. I can think of doing it by two imports one in which I hide Foo and another in which i have import Foo.Internal ( Foo). Is there a better way of doing this?
06:36 <mrkgnao> I think you want module Module (Foo(), helper1, helper2, ...) where
06:36 razi1 joined
06:37 <mrkgnao> i.e. an explicit export list in the internal module
06:37 jer1 joined
06:37 <piyush-kurur> mrkgnao: if the export list is too long it is a pain to export all of them once again.
06:38 Mortomes|Work joined
06:38 <piyush-kurur> mrkgnao: besides the order of the export list determines the haddock generation.
06:39 <mrkgnao> well, you could then do import Foo.Internal hiding Foo(..), I *think*
06:39 xtreak joined
06:39 takle joined
06:39 umren joined
06:40 <mrkgnao> That should hide only the constructors.
06:40 justinfokes joined
06:40 <piyush-kurur> Is that true let me try it out.
06:40 <mrkgnao> no, it doesn't
06:41 prophile joined
06:41 <mrkgnao> you can explicitly only import the type, though.
06:41 <piyush-kurur> mrkgnao: okey, so the two step import is the only way out
06:41 <mrkgnao> e.g. import Data.Maybe (Maybe())
06:41 <mrkgnao> that hides the constructors and imports the type
06:41 <ongy> import Data.Maybe (Maybe) is enough
06:41 <piyush-kurur> it also hides the helpers and that would require a second import with out the type
06:42 aussie joined
06:42 flatmap13 joined
06:42 <piyush-kurur> that is the best I could figure out. This seems to be an important pattern and it is slightly irritating to not have an easy way to do this.
06:43 <mrkgnao> does import Foo.Internal hiding (Tycon1, Tycon2,...) not work for you? way too many constructors, I guess?
06:44 <mrkgnao> You'd have to repeat that everywhere, though.
06:44 <piyush-kurur> mrkgnao: No particularly if the type Foo is defined as data Foo = Foo Int
06:44 filterfish_ joined
06:45 <piyush-kurur> I mean newtype Foo = Foo Int
06:45 <glguy> the two mode of operation are, "I just started this module, everything is exported" and "I've been working on this module and I have an export list"
06:46 <glguy> so once you're ready for controlling what gets exported, omit the constructors
06:46 eminhi joined
06:47 <piyush-kurur> glguy: can you clarify what you meant?
06:47 <piyush-kurur> I will give you the situation. I have a type newtype Angle = Angle Int64.
06:48 <piyush-kurur> It is natural to have a module to capture all the angle operations and the datatypes
06:48 <piyush-kurur> Let us say that is Angle.Internal.
06:48 <piyush-kurur> There would be other module in the package that would want to look at the internal representation so we export the Angle type.
06:49 <piyush-kurur> s/Angle type/Angle constructors/
06:49 <piyush-kurur> but we would not like to export these constructors to the outside world for type safety
06:50 <piyush-kurur> I would rather like to control the interface/order of haddock documentation of angle in the internal module
06:50 <piyush-kurur> not in the ultimate module that exposes Angle to the outside world.
06:53 insitu joined
06:54 xall joined
06:54 jer1 joined
06:56 sz0 joined
06:56 <aussie> How can I map readMaybe over a list of Ints?
06:57 <ongy> aussie: what's the type of the function you want to build?
06:57 <aussie> Sorry, a string that is to be converted into a list of Ints
06:57 <aussie> readMaybe "1" :: Maybe Int works in the ghci, but I can't seem to map it over a string
06:57 <kadoban> aussie: What's the string formatted like? What's between the ints?
06:57 <aussie> Like "123" to [Just 1, Just 2, Just 3]
06:57 takle joined
06:57 <aussie> Each int is between 0 and 9
06:58 justinfokes joined
06:58 <ongy> > map (readMaybe . pure) "123" -- but I'm sure there's something better
06:58 <lambdabot> [Just *Exception: Prelude.read: no parse
06:58 bvad joined
06:58 <ongy> > map (readMaybe . pure) "123" :: [Int] -- but I'm sure there's something better
06:58 <lambdabot> error:
06:58 <lambdabot> • Couldn't match type ‘Maybe a0’ with ‘Int’
06:58 <lambdabot> Expected type: [Int]
06:59 <kadoban> > map digitToInt "123"
06:59 <lambdabot> [1,2,3]
06:59 <kadoban> Though it's partial, which isn't great.
06:59 guiben joined
06:59 <kadoban> Otherwise ongy's thing seems fine. You can use (:[]) instead of 'pure' if that floats your boat.
07:00 Itkovian joined
07:00 <aussie> I should've stated that the string may have non-digit chars in it, so "12a4" should become [Just 1, Just 2, Nothing, Just 4]
07:00 <[exa]> What is the best symbol for the reversed (.) function concatenation?
07:00 <[exa]> like in f.g.h = \x -> h (g (f x))
07:01 <MarcelineVQ> reversed composition? often that's denoted as &
07:01 <MarcelineVQ> er
07:01 <MarcelineVQ> I'm an idiot, I'm thinking of $
07:02 <kadoban> Isn't (&) flipped ($), ya.
07:02 <kadoban> [exa]: I use .- for that, but it's just something I made up. (>>>) exists and is a more polymorphic version of (flip (.)), but the precedence is not similar
07:02 <[exa]> .- looks cool, writes faster than &
07:03 <[exa]> will try all of them, gonna see. Thanks!
07:03 <kadoban> 'welcome. Don't get too used to it, it's a little weird for readability.
07:03 <kadoban> I really only use it for competitive programming
07:04 <[exa]> I actually struggle everytime I see . used; the order of functions isn't right. :]
07:04 <EvanR> heh
07:04 <kadoban> You get used to it. It's easy enough for me to read and write, but the actual typing is annoying and awkward.
07:05 <EvanR> f . g = f(g( ))
07:05 commanderinchief joined
07:05 <EvanR> cant argue with that
07:06 <[exa]> maybe I should stop visualising a.b.c.d as a unix pipe
07:06 <EvanR> yes, unix pipes are totally backwards!
07:06 <[exa]> :]
07:06 <EvanR> or f(x) is backwards
07:06 mjora7 joined
07:06 <EvanR> how about everything is official backwards
07:07 ventonegro joined
07:08 <jle`> [exa]: even when you originally wrote it, it's clear that it's backwards, heh
07:09 <jle`> you wrote f . g . h = \x -> h (g (f x)))
07:09 <jle`> wouldn't it make more sense for f . g . h = \x -> f (g (h x)) ...?
07:09 <jle`> then you do'nt have to flip anything around awkwardly
07:10 <jle`> it was your example, not mine :)
07:11 slomo joined
07:12 oish joined
07:14 xcmw joined
07:15 vlatkoB_ joined
07:15 <nshepperd> you can use >>> as reversed .
07:16 <nshepperd> from Control.Category
07:16 raichoo joined
07:16 justinfokes joined
07:16 jer1 joined
07:16 <nshepperd> oh kadoban already said that
07:17 conal joined
07:18 torgdor joined
07:19 <[exa]> the actual purpose is to be able to start the transformation with a value
07:19 <[exa]> like (dumb example:) (5.-(+1).-(*2).-(+1))
07:20 BartAdv joined
07:20 conal joined
07:20 <[exa]> and I expected that (.- f1 .- f2 .- f3) would parse in haskell as a function with auto-added lambda variable, but it complains about fixity
07:20 baldrick1 joined
07:21 <jle`> why didn't you ask that in the first place, heh
07:21 <jle`> sometimes people like doing 5 & (+1) & (*2) & (+1)
07:21 <jle`> but it's not quite idiomatic
07:22 armyriad joined
07:22 hurkan left
07:22 <[exa]> I like it for filter syntax, like bunchOfStuff & removeBad & convertToMyFormat & sort & uniq
07:22 <[exa]> (sorry couldn't resist the sortuniq god)
07:23 dec0n joined
07:23 mohsen_ joined
07:24 takle joined
07:26 ericsagnes joined
07:26 marr joined
07:26 mattyw joined
07:27 biglama joined
07:27 conal joined
07:27 exarkun joined
07:28 im0nde joined
07:29 <jle`> it can be nice, but it'll definitely make your code less readable to 95% of haskell users
07:29 <jle`> so if you don't care about writing idiomatic code, i can't stop you :)
07:29 thc202 joined
07:31 juanpaucar joined
07:31 coot____ joined
07:31 takle joined
07:31 <* [exa]> feeling minoritish
07:32 <cocreature> I think that style is becoming more popular recently
07:32 osa1 joined
07:32 <cocreature> we even have & in base by now
07:32 <Mibaz> Does anyone know what the arrow notation keyword "proc" stands for? Also, how do you think about "proc x -> do"? I get that it starts a block of notation but where did they come up with that specific notation?
07:33 <kadoban> Seems weird it's only & though. You never see strings of blah $ stuff $ whatever, yet whatever & stuff & blah is the only nice way to write it from base that direction.
07:33 <Mibaz> when I say "specific notation" I mean "proc x -> do". It's a coherent thought I swear.
07:33 orhan89 joined
07:33 <cocreature> kadoban: you never see “blah $ stuff $ whatever”? I see that quite often
07:34 <kadoban> Really? I only ever see blah . stuff $ whatever, maybe I'm just not reading enough varied haskell code.
07:34 <cocreature> it’s not a style I use but I definitely see it used by others
07:34 <cocreature> personally I’m a "(blah . stuff) whatever" kind of person
07:35 <kadoban> Hm, interesting. I don't see that much, but I don't mind that at all, seems to make some sense.
07:36 Trendrrr joined
07:36 <EvanR> you can also let p = f . g . h . i . j . k . l . m . n . o
07:36 <EvanR> and then later p x
07:36 Levex joined
07:36 jer1 joined
07:37 <* quchen> likes to do »(f . g . h) x«.
07:38 <quchen> But I’m a bit extreme with HLint failing when there’s a ($) in my code.
07:38 eklavya joined
07:41 niko joined
07:42 seanpars1 joined
07:42 connrs joined
07:42 <cocreature> quchen: ex-lisper? :)
07:43 fbergmann joined
07:43 freusque joined
07:44 <jle`> i am a prescriptionist and i will refuse to recognize x & f & g & h and h $ g $ f $ x as ok things
07:44 <jle`> you gotta draw the line somewhere
07:45 <jle`> this is my stand
07:45 <quchen> cocreature: Nope, I’m using infix (.) :-)
07:45 <cocreature> heh good point
07:45 Computist joined
07:45 chrisM_1 joined
07:45 <EvanR> question, can haskell accomplish overengineering in only 60 lines of code?
07:45 <EvanR> yes! haskell can do that!
07:45 <EvanR> http://lpaste.net/355522
07:46 conal joined
07:46 <quchen> Overengineering is a one-liner in Haskell!
07:47 zero_byte joined
07:47 <EvanR> it will refuse to accept an exception when saving high scores, keeping trying until healed, and keep the local cache of scores up to date
07:47 debian0501 joined
07:47 <quchen> What you posted is a god(awful) function.
07:47 <jle`> explicit mutual recursion so obviously it is underengineered
07:47 <EvanR> very goto
07:47 <quchen> Needs more Cont
07:47 Computist joined
07:47 <jle`> it is actually very accurately described as GOTO code
07:49 <EvanR> parallel branching goto code
07:49 Computist joined
07:50 Matajon joined
07:51 <[exa]> my favorite so far: treatment <- async doctor
07:51 Computist joined
07:51 merijn joined
07:51 dm3 joined
07:51 pikajude joined
07:51 <quchen> Where is this from?
07:52 <quchen> doctor = intro where intro = do ಠ_ಠ
07:52 LKoen joined
07:52 justinfokes joined
07:53 Computist joined
07:54 flatmap1_ joined
07:54 <EvanR> right well
07:55 <EvanR> got a better way to write that?
07:55 Computist joined
07:55 Itkovian joined
07:55 <EvanR> i guess a fix loop
07:55 <quchen> doctor = do
07:55 jutaro joined
07:55 <quchen> = is transitive ;-)
07:56 <EvanR> theres two things in that where clause
07:56 [[[[[ExTRa]]]]] joined
07:57 <cocreature> you can still use the where for go
07:57 oish joined
07:58 <EvanR> and it woul need to be awkwardly floating somewere south, south east of the do?
07:58 <EvanR> feel free to edit that lpaste
07:59 takle joined
08:00 xtreak joined
08:00 biglama joined
08:01 jer1 joined
08:01 <cocreature> I wonder if you can shove that code in MealyT
08:01 <EvanR> the doctor code?
08:02 Beetny joined
08:02 <ongy> what's Mealy?
08:02 <cocreature> no basically everything except the doctor code
08:02 <cocreature> it seems like you are implementing a state machine
08:02 <EvanR> well, two states
08:02 <EvanR> with some refactoring so i dont have to duplicate parts
08:03 leat joined
08:03 <EvanR> i would be interested to see if something like that decreased the amount of code
08:03 flatmap13 joined
08:03 <Lokathor> http://lpaste.net/355523 this is pretty much how normal ExceptT code looks, right?
08:04 <cocreature> doubt it but I’mve never really used machines, so maybe I’m wrong
08:04 Bugaroo joined
08:04 <* EvanR> looks up MealyT
08:04 <cocreature> https://hackage.haskell.org/package/machines-0.6.2/docs/Data-Machine-MealyT.html#t:MealyT
08:05 bennofs1 joined
08:05 <cocreature> Lokathor: you probably want to define loadShader' = ExceptT . loadShader if you use that more than once (which you already do in your example)
08:05 <merijn> Lokathor: FWIW, if you find yourself doing this a lot I'd just write wrappers for e.g. loadShader that already wrap ExceptT
08:05 <cocreature> and the same goes for linkProgram
08:05 <merijn> cocreature: I wouldn't use the prime, just import qualified and shadow the original name
08:06 <merijn> i.e. "loadShader = ExceptT . Library.loadShader"
08:06 Itkovian joined
08:06 <cocreature> if you only use it in ExceptT then sure but I don’t know if that’s the case
08:06 <EvanR> cocreature: looks like at each step a Mealy or MealyT outputs a value of type b. But i never output anything
08:07 <Lokathor> i just defined it as, loadShader :: GLenum -> String -> IO (Either String GLuint)
08:07 <EvanR> just side effects
08:07 <merijn> As usual, cosmetic fixes always depend on context :p
08:07 <cocreature> EvanR: just set it to ()
08:07 <merijn> Lokathor: other than that it seems fine
08:08 <EvanR> i never return at all
08:08 <EvanR> just tail calls
08:08 <cocreature> MealyT doesn’t return either
08:08 umren joined
08:09 systadmin joined
08:10 <EvanR> whats the input?
08:10 <Lokathor> merijn, can you elaborate on what you mean by "wrappers that already wrap ExceptT"?
08:10 <EvanR> MealyT is supposed to give you an m (output, next mealyT)
08:10 <Lokathor> I'm not sure i follow, because the use of ExceptT is already hidden away it seems
08:10 <EvanR> so you could never get to the second sep
08:10 <EvanR> step
08:10 justinfokes joined
08:11 <EvanR> since my IO action never completes
08:12 <* hackage> ghc-typelits-natnormalise 0.5.3 - GHC typechecker plugin for types of kind GHC.TypeLits.Nat https://hackage.haskell.org/package/ghc-typelits-natnormalise-0.5.3 (ChristiaanBaaij)
08:12 conal joined
08:13 <cocreature> EvanR: output is just () and next mealyT is your recursive call
08:13 <cocreature> but you’re probably right that your code doesn’t fit the pattern very well
08:13 <merijn> Lokathor: Like I said "import qualified ShaderLibrary as Library; loadShader = ExceptT . Library.loadShader" so that you can just use "loadShader" inside the do block without the ExceptT repetition :)
08:13 <cocreature> because the inputs for the transitions are different
08:14 <EvanR> mode1 takes no input, mode2 takes treatment
08:14 <Lokathor> merijn, well there's no library being imported, they're all in one module
08:14 <merijn> Lokathor: Then I'd simplify modify loadShader directly? :)
08:15 <merijn> Lokathor: If you never use it without ExceptT, that is
08:15 <merijn> Lokathor: If you're always wrapping it with ExceptT, then there's no point in not moving that repetition into the function itself
08:16 <EvanR> and mode2 enters mode1 half way. this is pretty convoluted
08:16 <Lokathor> well the full file is this, https://lokathor.gitbooks.io/using-haskell/content/opengl/hello-triangle2.hs
08:16 <Lokathor> i guess at the moment i'm on the fence that i'll never want to load just one shader, rather than a whole program loaded and linked
08:17 acidjnk22 joined
08:17 <merijn> Lokathor: Right, I'd just change it to "loadShader shaderType source = ExceptT $ do"
08:17 <EvanR> whoa what is gitbooks
08:17 <merijn> (and the type accordingly)
08:18 <EvanR> loadShader :: String -> Either ShaderError Shader ... >_>
08:18 <Lokathor> merijn, I'll keep this in mind, but i'm a little wary about it simply due to lack of famililarity with ExceptT compared to the non transformed version
08:19 <Lokathor> EvanR, no I don't want to hide away any of what's really going on, particularly since this is part of a tutorial
08:19 <merijn> Lokathor: ExceptT is litterally just "bail on the first error"
08:20 jer1 joined
08:20 <merijn> Wait!
08:20 <Lokathor> merijn, yes I know, but the instant that I make it EitherT, i'll also want to make it MonadIO, and so on, and the focus here should be on the gl library use I think
08:20 <merijn> GHC 8 has Fail moved out of Monad?!
08:20 jchia joined
08:21 <cocreature> merijn: no?
08:21 <merijn> oh, not yet
08:21 <EvanR> er i mean, IO (Either ...
08:21 <merijn> They just add MonadFail
08:21 pranitbauva1997 joined
08:21 <EvanR> yes you are free to use MonadFail
08:21 <EvanR> but probably no one will because the type sucks
08:22 <Lokathor> that bad?
08:22 <cocreature> the fact that it only allows for String errors makes it mostly useless imho
08:23 tomphp joined
08:23 <Lokathor> that does sound shitty
08:23 <EvanR> yes
08:23 <EvanR> its being moved out of Monad so it can be forgotten
08:23 Lord1 joined
08:24 nickolay joined
08:24 <cocreature> well, do notation will desugar to it so it can’t be forgotten completely
08:24 <Lokathor> if only we could move it out of Monad so that it could be improved
08:24 <cocreature> but you’re unlikely to use it for anything else
08:24 <TommyC> Query: Is there a term for a function that simply returns the value you give it? i.e. f(x) = x ?
08:24 mfukar joined
08:24 <merijn> EvanR: The great thing about MonadFail is that I'll finally get warnings about partial do patterns
08:24 <Lokathor> identity
08:25 <merijn> > id True
08:25 <Lokathor> and the built in version is simply called "id"
08:25 <lambdabot> True
08:25 <EvanR> @src id
08:25 <lambdabot> id x = x
08:26 jchia joined
08:27 starmix joined
08:27 Levex joined
08:27 cloudhead joined
08:28 <TommyC> Lokathor: Thank you.
08:28 xtreak joined
08:28 flatmap13 joined
08:29 justinfokes joined
08:29 zedik joined
08:29 <zedik> Hi everyone. Is it possible to do the next thing in Haskell? There is a txt file with a single column of numbers. The program reads the the first number from it and waits for 1 sec. After 1 sec it reads the second number and etc. If it is possible, please point out the direction to look at how it to implement.
08:29 flatmap13 joined
08:30 dmiles joined
08:30 LHoT10820 joined
08:30 <EvanR> yes! haskell can do that!
08:31 <* hackage> ghc-typelits-knownnat 0.3 - Derive KnownNat constraints from other KnownNat constraints https://hackage.haskell.org/package/ghc-typelits-knownnat-0.3 (ChristiaanBaaij)
08:31 <EvanR> what is it supposed to do with the number once it is read
08:31 <zedik> add it into the list
08:31 <mauke_> zedik: openFile, hGetLine, threadDelay
08:32 <cocreature> and readMaybe to convert the string to an int
08:33 <mauke_> conversion wasn't a requirement, just reading
08:33 <CoolerZ> i am having trouble using Data.Map.Strict.!?
08:33 <CoolerZ> it says its not exported
08:33 jrahmy_ joined
08:33 <zedik> Thanks!
08:33 <mauke_> cocreature: or readIO
08:33 <CoolerZ> Module 'Data.Map.Strict' does not export '!?'
08:34 baldrick1 joined
08:34 <CoolerZ> is that a new operator that was recently added?
08:34 sfcg joined
08:34 <cocreature> yes
08:34 <CoolerZ> do i need to update?
08:34 lep-delete joined
08:34 <cocreature> looking at the changelog it’s only in containers >= 0.5.9.1
08:35 mzf joined
08:35 <CoolerZ> how do i update?
08:35 <kadoban> CoolerZ: What build system are you using? (cabal-install or stack perhaps?)
08:35 <CoolerZ> cabal
08:35 juanpaucar joined
08:36 takle joined
08:36 <CoolerZ> do i "cabal install ghc"?
08:36 paolino joined
08:37 <mauke_> ghc? o_O
08:40 dual joined
08:40 kritzcreek joined
08:41 benl23 joined
08:41 Mortomes|Work joined
08:41 jer1 joined
08:42 pja joined
08:43 shoopaloop joined
08:43 mjora7 joined
08:44 tumdedum joined
08:45 <* hackage> ghc-typelits-extra 0.2.3 - Additional type-level operations on GHC.TypeLits.Nat https://hackage.haskell.org/package/ghc-typelits-extra-0.2.3 (ChristiaanBaaij)
08:46 CoolerX joined
08:49 cur8or joined
08:50 henriksod joined
08:51 inad922 joined
08:53 hamishmack joined
08:55 fosterite joined
08:57 butterthebuddha joined
08:57 LKoen_ joined
08:58 juanpaucar joined
08:58 rossberg joined
09:02 xcmw joined
09:03 jophish joined
09:03 Dookie12 joined
09:04 <ertes-w> i need the unix command version of 'inits': echo 1.2.3 | inits -d. = echo; echo 1; echo 1.2; echo 1.2.3
09:04 <ertes-w> any ideas?
09:05 jer1 joined
09:05 justinfokes joined
09:07 beerdrop joined
09:09 <mauke_> ertes-w: echo 1.2.3 | perl -F'\.' -lane 'print join ".", @F[0 .. $_] for -1 .. $#F'
09:11 bennofs joined
09:11 <pja> Ah, the "f*ckit, I’ll just invoke perl" approach. Always a winner.
09:11 <mauke_> echo 1.2.3 | perl -lne 'print substr($_, 0, pos) while /\A|(?=\.)|\z/g'
09:11 <pja> bonus points for using awk instead.
09:12 <mauke_> awk? more like awbsolete amirite
09:12 <ertes-w> hmm, if i'm gonna use perl, i might as well just use haskell
09:12 <* hackage> logging-facade-syslog 1 - A logging back-end to syslog(3) for the logging-facade library https://hackage.haskell.org/package/logging-facade-syslog-1 (PeterSimons)
09:12 hulufei joined
09:12 <mauke_> pretty sure haskell doesn't count as a "unix command"
09:13 <ertes-w> maybe i should just give in and use perl for shell scripting =)
09:13 <ertes-w> it's as ugly as shell, but it can actually do stuff
09:13 LKoen joined
09:14 oish joined
09:14 <merijn> pja: So, do I get bonus points? https://github.com/merijn/GPU-benchmarks/blob/master/numdiff.awk
09:14 <mauke_> my favorite feature: it has actual scoping
09:14 <mauke_> (like haskell)
09:14 <pja> I think my "quick hack" perl scripts were the things that stayed in production for the longest in my programming career :)
09:14 sproingie joined
09:14 sproingie joined
09:15 yellowj joined
09:15 <pja> merijn: :)
09:15 <ertes-w> it even has real functions, right?
09:15 <pja> perl or awk?
09:15 <ertes-w> perl
09:15 <ertes-w> does awk?
09:15 <merijn> ertes-w: Yes, see my link :p
09:15 <pja> yes, awk does too.
09:16 <mauke_> ertes-w: yes
09:16 eacameron joined
09:16 <mauke_> perl has a direct embedding of lambda calculus
09:16 <ertes-w> by "real functions" i mean first-class functions
09:16 <ertes-w> not just "being able to define named procedures" =)
09:16 <ertes-w> mauke_: that might sell it
09:16 <mauke_> identifier foo: $foo
09:17 <mauke_> application X Y: X->(Y)
09:17 <mauke_> abstraction \v.X: sub { my ($v) = @_; X }
09:17 <ertes-w> ugh! well… it's perl after all
09:18 im0nde joined
09:18 <mauke_> (the last part can also be written as sub ($v) { X } but only if you enable the (still experimental) "signatures" feature)
09:18 <ertes-w> reasonable function syntax is an extension?
09:18 <mauke_> still, it's straightforward and doesn't require a global transformation or anything
09:18 <mauke_> yes
09:19 <ertes-w> well… shell isn't much better, so yeah
09:19 ccomb joined
09:19 <mauke_> and there are even some people who like 'my (...) = @_;' better for some reason /shrug
09:19 <ertes-w> f($x, $y) { … } # the "$x, $y" syntax doesn't mean anything in shell, which is quite stupid
09:19 <mauke_> personally I'd prefer not having to type 'my' and '= @_' around every parameter list
09:21 <merijn> Is there a standard rose tree that has different types for roots and nodes somewhere?
09:22 <systadmin> o/
09:23 <dibblego> data Tree a b = Node a | Forest [Tree b] -- like this?
09:23 justinfokes joined
09:24 jer1 joined
09:24 baldrick2 joined
09:24 <mauke_> kind error
09:25 xtreak joined
09:25 <dibblego> heh
09:25 <ertes-w> mauke_: any reason a functional programmer such as myself might prefer perl over other languages there? i mean: to me PHP, perl, python and ruby all look the same from a distance
09:26 meba joined
09:26 flatstuff joined
09:27 <mauke_> ertes-w: PHP and python have awful scoping and I haven't tried ruby
09:28 <mauke_> ertes-w: but this sounds more like a topic for #haskell-blah
09:28 <merijn> dibblego: More like "data Tree a b = Node a | Forest b [Tree a b]", except without me having to write all the instances, etc.
09:28 <ertes-w> mauke_: yeah, probably… thanks for the inspiration
09:28 ed-ilyin-lv joined
09:29 <mauke_> ertes-w: want to continue there?
09:29 erikd joined
09:30 cpup joined
09:30 Grisha joined
09:30 CoderPuppy joined
09:30 <Grisha> Hello everyone
09:31 <dibblego> merijn: I don't know of it, sorry, but I have also wanted that, or something similar to that, before
09:33 <Grisha> I’m trying to figure out how to make a nice type family, mapping a type `a` to a type of functions that would, depending ona, accept a different number of, say, strings and produce another string. My main difficulty (or rather an aesthetical disagreement) is that I’ll have to substitute `() -> String` for funcs accepting zero strings. Would there be a way around that ugly ()?
09:33 mmn80 joined
09:33 <Grisha> for funcs accepting zero strings, I’d rather like to have constants of type `String`
09:35 zariuq joined
09:36 sirreal joined
09:36 Cogitabundus joined
09:36 nick8325-testing joined
09:37 rcat joined
09:38 renzhi joined
09:38 sgronblo joined
09:38 SkyPatrol_ joined
09:38 xtreak joined
09:39 netheranthem joined
09:41 SenpaiSilver joined
09:41 justinfokes joined
09:42 aring joined
09:44 <merijn> Is there a way to derive NFData/otherwise easily create an instance for it
09:45 jer1 joined
09:45 sighingnow joined
09:46 augur joined
09:47 zariuq joined
09:47 <Axman6> looks like it can be derived
09:47 <merijn> oh, via Generic, of course :)
09:47 <Axman6> https://hackage.haskell.org/package/deepseq-1.4.2.0/docs/Control-DeepSeq.html#t:NFData
09:52 <phz_> hey, what is the syntax to hardcode unicode points in haskell again?
09:52 <phz_> I thought it was \u1245
09:52 <merijn> phz_: What does that mean?
09:52 <phz_> merijn: literal unicode char
09:52 sfcg joined
09:52 <phz_> '\u1234'
09:52 osa1 joined
09:52 osa1 joined
09:52 <merijn> phz_: Well, if it's a printable character you can just write it in the source file as unicode directly
09:52 <mauke_> '\1234' in decimal
09:52 <Axman6> > '\x1234'
09:53 <lambdabot> '\4660'
09:53 <mauke_> > '€'
09:53 <Axman6> (hex and decimal versions)
09:53 <lambdabot> '\8364'
09:53 jer1 joined
09:53 <phz_> > '\x2E3B'
09:53 <lambdabot> '\11835'
09:53 <phz_> nope
09:53 <mauke_> yes
09:53 <phz_> I want the opposite
09:53 <Axman6> o.O
09:53 <mauke_> no
09:53 <phz_> > '€'
09:53 <Axman6> what do you want?
09:53 <lambdabot> '\8364'
09:53 <phz_> > '\x8364'
09:53 <lambdabot> '\33636'
09:53 <mauke_> you're confused
09:53 <phz_> I want the '€' back
09:54 <phz_> via its unicode representation
09:54 <mauke_> that is a €
09:54 <Axman6> > text "\1234"
09:54 <lambdabot> Ӓ
09:54 <mauke_> what you're seeing here is the pretty-printed representation you get from 'show'
09:54 <phz_> oh so the syntax is just \
09:54 <Axman6> what you're seeing is the Show instance for Char
09:54 <Axman6> it will be written as the correct character if you putStrLn etc. it
09:54 <phz_> > '\2E3B'
09:54 <lambdabot> <hint>:1:4: error:
09:54 <lambdabot> lexical error in string/character literal at character 'E'
09:54 <merijn> Ah, the classic print vs putStrLn error
09:55 <mauke_> > text "\x2E3B"
09:55 <lambdabot>
09:55 <phz_> hm, ok, thanks
09:55 ertes-w joined
09:55 <mauke_> long dash is long
09:56 <merijn> phz_: Show produces valid haskell as result, so generally if you see things like \4660 etc in your output it's because you're calling 'show' on a String, rather than outputting it directly
09:56 <merijn> phz_: Also, note that ghci automatically calls show on results, so what ghci shows is not the same as what, e.g. putStrLn prints to the terminal
09:56 <merijn> Same goes for lambdabot, which is why you want to use text for unicode with it
09:56 <phz_> yeah yeah, I remember that
09:56 <phz_> thanks
09:56 <phz_> :t text
09:56 <lambdabot> String -> Doc
09:57 <merijn> > "aha \4660 blah"
09:57 <lambdabot> "aha \4660 blah"
09:57 <merijn> > text "aha \4660 blah"
09:57 <lambdabot> aha ሴ blah
09:57 <merijn> Also note how the quotes disappear with text (which is how, e.g. putStrLn displays stuff)
09:57 <mauke_> we're only using text because it produces a Doc, which has a convenient Show instance
09:57 <mauke_> (for use in lambdabot)
09:58 ertesx-w joined
09:59 butterthebuddha joined
09:59 ADG joined
10:00 louispan joined
10:02 juanpaucar joined
10:03 albertus1 joined
10:05 gawen joined
10:07 twanvl joined
10:08 mattyw joined
10:08 TCZ joined
10:08 oish_ joined
10:10 sternmull joined
10:10 sfcg joined
10:10 LnL joined
10:15 tumdedum joined
10:16 augur joined
10:17 tlaxkit joined
10:17 ragepanda joined
10:18 [[ExTRa]] joined
10:18 justinfokes joined
10:18 plll joined
10:19 conal joined
10:20 <CoolerX> how do i open the REPL in emacs?
10:22 <plll> Hey, does anyone know how to send a string to the interactive-haskell REPL? The equivalent to comint-send-string (when dealing w inferior haskell).
10:22 <Grisha> I use vim-slime
10:22 <plll> CoolerX, C-c C-z. How do you currently have it configured?
10:23 petermw joined
10:23 <CoolerX> in haskell mode
10:23 LKoen joined
10:23 <CoolerX> interactive-haskell-mode
10:24 jer1 joined
10:24 Aruro joined
10:24 cpennington joined
10:25 xanadu joined
10:25 <plll> CoolerX, try C-c C-z. Or C-c C-l.
10:25 romank joined
10:25 <merijn> Style question: How do people linewrap long one-liners?
10:25 <lpaste> merijn pasted “linewrap?” at http://lpaste.net/355526
10:26 <merijn> Like that one
10:26 jedws joined
10:26 <lpaste> liste annotated “linewrap?” with “linewrap? (annotation)” at http://lpaste.net/355526#a355527
10:27 tumdedum joined
10:27 <Aruro> merijn: you call it long?
10:27 <merijn> Aruro: I try to stick to <80 chars
10:27 <CoolerX> C-c C-z works
10:27 <Aruro> you have 80 chars monitor? :)
10:28 <Aruro> no need to stick to 80, its oldfashioned.
10:28 <liste> 120+ lines are hard to read :<
10:28 <merijn> Aruro: No, but I want to be able to have 2-3 editors side by side
10:28 sighingnow joined
10:28 <Aruro> then you are not sticking to 80 you are fitting to your needs :)
10:29 <merijn> Also, research indicates reading becomes more tiring/annoying if you have to move long distances back to the start of the next line (which is why, e.g., newspapers stick to 66 chars per line)
10:29 oish_ joined
10:29 <Aruro> i like reading one page, so the longer line the better
10:29 <Aruro> merijn: same for multipage
10:30 <Aruro> "research" have shows that more than 4-5 pages is hard to follow, people forget
10:30 <merijn> I'm not sure I like moving the = to a newline
10:30 ericsagnes joined
10:31 <Aruro> yeah = has to be with its function
10:31 <Aruro> otherwise confusing
10:31 <lpaste> merijn annotated “linewrap?” with “I guess this works” at http://lpaste.net/355526#a355528
10:31 <merijn> Fortunately short haskell lines are generally easy
10:32 <merijn> Linewrapping C++ is a pain...
10:32 fred-fri joined
10:33 <Aruro> i think last is most readable
10:33 <Aruro> every line is leveling down
10:33 ckubrak joined
10:34 kamyar joined
10:36 Guest21267 joined
10:36 Itkovian joined
10:36 leat joined
10:36 justinfokes joined
10:38 gmcabrita joined
10:38 mk-61 joined
10:38 tomphp joined
10:38 <plll> Hey, how do you send a string to the interactive-haskell REPL? The equivalent to comint-send-string (when dealing w inferior haskell).
10:38 FreeBirdLjj joined
10:38 <Athas> My haskell-mode with Intero is very slow. According to the Emacs profiler, a huge amount of the time is spent on fontification. Have any of you encountered this?
10:39 <Athas> The 'haskell-syntax-propertize' function, apparently.
10:39 slomo joined
10:41 kamyar joined
10:41 eacameron joined
10:41 jer1 joined
10:42 petermw joined
10:44 takle joined
10:45 nesqi joined
10:45 whiteline joined
10:47 tortal joined
10:48 beanbagula joined
10:48 benl23 joined
10:49 eminhi joined
10:50 takle joined
10:50 xcmw joined
10:52 TCZ joined
10:52 eacameron joined
10:54 justinfokes joined
10:56 Cooler joined
10:57 <merijn> There's a union for lists, but is there a difference?
10:57 eacameron joined
10:57 <Cooler> help http://lpaste.net/355529
10:57 xtreak joined
10:58 <merijn> Cooler: What exactly do you need help with?
10:58 <Cooler> how do i find out whats wrong?
10:58 <merijn> Cooler: You asked for a non-existent key
10:58 ziyourenxiang joined
10:58 <Cooler> i know but which key
10:58 <LiaoTao> merijn: Do you mean (\\) ?
10:58 <merijn> Cooler: You should use Map.lookup, not Map.!
10:58 <merijn> LiaoTao: Ah, excellent!
10:59 <Cooler> merijn, that won't help
10:59 <Cooler> i have only used ! where the key is supposed to exist
10:59 <merijn> Cooler: Well, turns out that's apparently a wrong assumption ;)
11:00 <LiaoTao> Cooler: Not to be rude, but I think the compiler is more correct than you
11:00 <merijn> Cooler: You should lpaste a (minimal) example of the code
11:00 pk_ joined
11:01 <Cooler> merijn, thats the problem, which line
11:01 nighty-- joined
11:01 <Cooler> it doesn't post a callstack
11:01 maambmb joined
11:01 <merijn> I think you need to use the profiling runtime to get a full callstack
11:02 Snircle joined
11:02 <Cooler> the what?
11:04 kamyar joined
11:04 bluepixel joined
11:05 <Cooler> guys?
11:06 <Cooler> did i dc again?
11:06 zariuq joined
11:07 <mk-61> Cooler: no, you didn't.
11:07 juanpaucar joined
11:07 <Cooler> ok, whats the profiling runtime
11:07 <Cooler> isn't there also a debugger?
11:08 oish_ joined
11:09 flatmap1_ joined
11:11 butterthebuddha joined
11:12 flatmap13 joined
11:12 justinfokes joined
11:14 oisdk joined
11:14 sw1nn joined
11:15 erikd joined
11:15 sproingie joined
11:16 albertus1 joined
11:16 torstein joined
11:17 CoolerZ joined
11:18 flatmap13 joined
11:18 <torstein> binding a variable to a name when pattern matching does not force it, given that it's not used, right? I.e. fun (a, _) = a ~ fun (a, b) = a
11:19 <Axman6> torstein: correct
11:19 xanadu joined
11:20 kamyar joined
11:20 albertus1 joined
11:21 butterthebuddha joined
11:21 jer1 joined
11:21 <merijn> torstein: Note, that if you write something like "fun (Foo, _) = ...; fun (a, b) = ..." then the first match will force the first element of the tuple
11:22 <[exa]> Hm, is there some other reason for disallowing stuff like (+3+3) other than being a bit confusing?
11:22 <merijn> [exa]: You can do that, except needs different bracketing
11:22 <merijn> :t (+(3+3))
11:22 <lambdabot> Num a => a -> a
11:22 albertus1 joined
11:22 <merijn> [exa]: Otherwise it's ambigous which operator is sectioned which way
11:22 <[exa]> that's exactly what I don't want, I want the inner parent to get around the left plus
11:22 im0nde joined
11:23 <torstein> What's the purpose of associated data types and associates types, and what's the difference between the two? E.g. in https://wiki.haskell.org/GHC/Type_families#An_associated_data_type_example, why not use "data GMap k v = GMap k v" at top level instead of in a class?
11:23 <merijn> What does "inner parent" mean here?
11:23 fizruk joined
11:24 <[exa]> hm, do you have an example how it can be ambiguous? I always thought that (+x) is desugared like \v1 -> (v1+x)
11:24 <merijn> torstein: Associated types are just fancy syntax for "type families", as for "what are type families?", the simplest summary is "type level functions"
11:24 cfricke joined
11:25 <merijn> torstein: That is, they are types which depend on other types. Data families are data types whose representation depends on other types
11:25 <merijn> [exa]: Well, how would (+3+3) be desugared according to you?
11:25 <LiaoTao> [exa]: I thought that was just curried from (a->a->a) into (a->a)
11:25 <[exa]> in which case (+3+3) would get desugared as \v1->((v1+3)+3)
11:26 skeuomorf joined
11:26 dual joined
11:26 <merijn> [exa]: Sections are only defined on single operators, what you seem to want is to treat multi-operator sections as composition of individual sections
11:27 <merijn> I don't immediately know whether there's an issue with that, but I do feel it's a rather complicated desugaring
11:27 <[exa]> oh so.
11:27 <[exa]> Well, not that complicated, I actually have it in my pet compiler here, trying to figure out something similar in haskell now
11:27 <merijn> torstein: Are you familiar with GADTs and/or DataKinds?
11:27 kamyar joined
11:28 darlan joined
11:28 bjz joined
11:28 xanadu joined
11:28 <merijn> [exa]: Anyway, the short answer is probably that the reason for that not being in GHC/Haskell is: 1) confusing and 2) not that commonly useful
11:28 jaspervdj joined
11:28 <[exa]> a pretty good example is the horner's rule: foldl (*x+) 0
11:29 <eminhi> [exa]: (op y) is valid only if (x op y) and (x op (y)) are parsed the same way
11:29 <torstein> merijn, Yes, type families too, though I haven't had the need for associated data types yet (the ones declared inside class instance)
11:29 <eminhi> (*x+y) is invalid where as (+x*y) should be valid.
11:29 <merijn> torstein: ok, so if you're familiar with type families, associated types is just fancy syntax for regular type families to indicate the type family is closely related/tied to some typeclass
11:29 juanpaucar joined
11:30 cloudhead joined
11:30 <[exa]> well, nevermind, thanks for explanations, I was only suspecting whether there isn't some rationale behind that I wouldn't know about
11:30 jchia_1 joined
11:31 <merijn> torstein: data families exist so you can have a datatype depending on another type, the same way type families can. Consider the example in the link you pasted, the GMap class is able to use an optimised representation for "GMap Int" since the GMap datatype can change depending on the type you're instantiating the class for
11:32 <[exa]> anyway the thing I wanted to be expressed nicely was my struggle with flipped (.) from above; you can do stuff like (object & method1 & pipe & line) but you need to write explicit lambda instead of (& pi & pe & li & ne)
11:32 <[exa]> nvm. :]
11:32 <merijn> [exa]: There is a flipped (.), thought :)
11:32 <merijn> :t (>>>)
11:32 <lambdabot> forall k (c :: k) (a :: k) (cat :: k -> k -> *) (b :: k). Category cat => cat a b -> cat b c -> cat a c
11:32 <merijn> ugh
11:32 <merijn> That's an awful type :)
11:32 oish__ joined
11:33 <merijn> :t (>>>) `asAppliedTo` even
11:33 <lambdabot> Integral a => (a -> Bool) -> (Bool -> c) -> a -> c
11:33 <[exa]> whoa. :]
11:33 <merijn> :t (>>>) `asAppliedTo` (undefined :: a -> b)
11:33 <lambdabot> (a -> b) -> (b -> c) -> a -> c
11:33 <merijn> [exa]: Ignore the scary poly kind nonsense, it's really secretly "flip (.)" ;)
11:33 <merijn> :t flip (.)
11:33 <lambdabot> (a -> b) -> (b -> c) -> a -> c
11:33 asmyers joined
11:34 <torstein> merijn, makes sense thank you
11:34 bennofs joined
11:35 <merijn> torstein: And associated datatypes are, just like associated types, fancy notation to indicate a data family is tied to a typeclass. You can define standalone data families too
11:35 flatmap13 joined
11:36 jutaro joined
11:38 jchia_1 joined
11:39 jer1 joined
11:39 mmhat joined
11:40 erikd joined
11:41 <[exa]> :t (>>> (+3) >>> (+4))
11:41 <lambdabot> Num b => (a -> b) -> a -> b
11:41 justinfokes joined
11:41 <[exa]> well, closer.
11:41 flatmap13 joined
11:41 pie_ joined
11:42 JeanCarloMachado joined
11:42 JeanCarl1Machado joined
11:43 kamyar joined
11:44 oish_ joined
11:44 Levex joined
11:46 Kreest__ joined
11:47 <ertes-w> merijn: i wonder if there is any difference between an AT and a standalone family
11:47 <ertes-w> except that in the former case you can only define instances within the corresponding class instance
11:47 <merijn> not afaik
11:48 leat joined
11:48 xtreak joined
11:49 <CoolerZ> how do i use the debugger?
11:50 <merijn> CoolerZ: The GHC manual has a chapter on using the debugger in ghci
11:51 <CoolerZ> this ? https://wiki.haskell.org/Debugging
11:51 butterthebuddha joined
11:51 <merijn> No
11:52 <merijn> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/
11:52 silver joined
11:52 insitu joined
11:52 oish__ joined
11:52 fizruk joined
11:54 <CoolerZ> this? https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#the-ghci-debugger
11:55 NeverDie joined
11:56 asciiascetic joined
11:56 <merijn> yes
11:58 asm_ joined
11:59 justinfokes joined
12:00 <CoolerZ> i really want a gui debugger like chrome's developer tools
12:00 JeanCarloMachado joined
12:00 JeanCarl1Machado joined
12:00 <merijn> I'm not sure that exists
12:01 <CoolerZ> ik but it would be really cool
12:01 jer1 joined
12:01 makalu joined
12:02 <makalu> I have a line such as this at the beginning of my .hs file: "#!/usr/bin/env stack\n-- stack --resolver lts-8.13 script --package time". I get this error: "Invalid argument `script'". Has stack script interface changed?
12:02 Matajon joined
12:03 flatmap13 joined
12:05 oisdk joined
12:05 <makalu> oh, I had the opposite problem. My stack version was ancient.
12:07 JeanCarloMachado joined
12:08 JeanCarl1Machado joined
12:10 gawen joined
12:11 <* hackage> sqlcipher 1.0.1.1 - Haskell binding to sqlcipher https://hackage.haskell.org/package/sqlcipher-1.0.1.1 (figo)
12:11 kaiserA joined
12:11 juanpaucar joined
12:14 xanadu joined
12:17 coot____ joined
12:17 justinfokes joined
12:18 marr joined
12:20 fotonzade joined
12:20 jer1 joined
12:21 dsh joined
12:21 <CoolerZ> help
12:22 revprez_atlanta joined
12:22 <CoolerZ> trying to use the GHCi debugger, i put a :break on each line that contains Map.! but its still giving an exception
12:23 phaji joined
12:24 _deepfire joined
12:25 <pie_> hi guys, i installed binary-bits but for import qualified Data.Binary.Bits.Get as Bits ( getBool, getWord8, runBitGet, getWord16be ) im getting Failed to load interface for ‘Data.Binary.Bits.Get’
12:26 <* hackage> github-release 1.0.3 - Upload files to GitHub releases. https://hackage.haskell.org/package/github-release-1.0.3 (fozworth)
12:28 <eminhi> CoolerZ: paste an example
12:29 <CoolerZ> i set the flag -fbreak-on-exception in GHCi
12:29 <CoolerZ> and then ran main, its stopped at an execption
12:29 <CoolerZ> how do i find out which line of code it is stopped at?
12:29 ccomb joined
12:30 sdothum joined
12:31 <CoolerZ> i did :trace main
12:31 <pavonia> pie_: Are you sure the package is in scope (in whatever framework you're using)?
12:31 <CoolerZ> but doing :hist it says "empty history, perhaps you forgot to use :trace?"
12:31 <CoolerZ> wth
12:32 <eminhi> run :trace main
12:32 <CoolerZ> i just did
12:32 <pie_> pavonia, no
12:33 <* hackage> http-api-data 0.3.7.1 - Converting to/from HTTP API data like URL pieces, headers and query parameters. https://hackage.haskell.org/package/http-api-data-0.3.7.1 (NickolayKudasov)
12:34 <eminhi> CoolerZ: Any help will be a lot easier if you provide a minimal example of the problem
12:35 ziocroc joined
12:35 <CoolerZ> eminhi, i don't know which line is causing the problem
12:35 xtreak joined
12:35 <CoolerZ> heres the entire source if you want http://lpaste.net/355532
12:35 justinfokes joined
12:36 <CoolerZ> i thought it was lines 183 and 193 which use Map.!
12:36 xtreak joined
12:36 <CoolerZ> but setting breakpoints there didn't work, it still throws the exception
12:37 shayan_ joined
12:37 spacecadetbrown joined
12:38 knokh joined
12:38 <pie_> pavonia, line 3 http://lpaste.net/3688106528952287232
12:38 xcmw joined
12:39 tomphp joined
12:40 <CoolerZ> why is it saying empty history when i do :hist, right after i did :trace main
12:40 <CoolerZ> ?
12:40 <pavonia> pie_: Are you loading that from stack?
12:42 osa1 joined
12:42 osa1 joined
12:43 <osa1> if I re-export module A in module B and import module B in module C do I get instances of A?
12:43 <hvr> osa1: you don't even have to reexport A... just importing it suffices
12:43 <merijn> osa1: I think instance *always* get propagated
12:43 <osa1> I have classy lenses in module A but somehow module C can't use them when I just import module B (without module A). but the types are visible.
12:43 <osa1> hmmm
12:44 ompaul joined
12:44 <hvr> osa1: as soon as the module defining the instance becomes part of your transitive import graph, you get the instance into scope... whether you want it or now
12:44 <osa1> hmmm I think I found a bug then
12:45 wei2912 joined
12:46 <ventonegro> are there good introductory blog posts about free monads?
12:46 <osa1> this is annoying because I have a lot of modules that just import B without A. now they're all broken unless I switch to regular lenses + export everything (in module A)
12:47 sdothum joined
12:47 <osa1> ventonegro: google for "you could have invented free monads"
12:47 <ventonegro> osa1: thanks!
12:47 <merijn> Is that the Tekmo one?
12:47 <merijn> Because he had a good one on free monads too
12:47 <osa1> merijn: yes
12:48 <pie_> pavonia, yes
12:48 Sampuka joined
12:48 <pie_> ive done stack build in the project folder for the package
12:50 bennofs joined
12:50 sdothum joined
12:50 <* hackage> sproxy2 1.95.0 - Secure HTTP proxy for authenticating users via OAuth2 https://hackage.haskell.org/package/sproxy2-1.95.0 (ip1981)
12:51 <pavonia> pie_: Hhm, I'm not familiar with stack, though
12:52 butterthebuddha joined
12:52 fotonzade joined
12:52 <CoolerZ> when ghci prints :hist history
12:52 jer1 joined
12:53 <CoolerZ> does it print it in reverse order? the indices are -1,-2,-3,etc
12:53 cinimod` joined
12:54 justinfokes joined
12:54 <jchia_1> Does a ghc-compiled program use a stack? If so, what gets allocated on the stack and what gets allocated on the heap?
12:54 <merijn> jchia_1: It doesn't use a traditional function call stack, no
12:55 erikd joined
12:55 acidjnk22 joined
12:56 tusj joined
12:57 <quchen> jchia_1: The abstract machine that executes GHC code is called as the STG, the spineless tagless G-machine. Instead of a C-like function-return-address-stack, it has a pattern match stack.
12:57 <quchen> Unlike in C, executing a function does not necessarily allocate a stack frame.
12:57 <jchia_1> So, what does it mean by "stack size" in the context of the -k RTS option?
12:58 <quchen> There is a stack, but pattern matching (via case) fills it.
12:58 <quchen> main = id (id (id (pure ()))) -- takes 0 stack frames total.
12:59 <quchen> In C, it would take 4: one for each id, one for pure.
12:59 <CoolerZ> how do you list all variables that are in scope?
12:59 <cinimod`> I want apply a function to a value a fixed number of times e.g. f (f (f x))
12:59 <cinimod`> If I do last $ take n $ iterate f a then it takes a long time with lots of GC
13:00 sdothum joined
13:00 LAZAR joined
13:00 <merijn> cinimod`: 1) is your function strict? 2) why not use "iterate f a !! n"?
13:00 <jchia_1> I'm asking about the stack because of the technique for tracking down space leaks given on this page. Does it still work in GHC 8.0.1? http://neilmitchell.blogspot.jp/2015/09/detecting-space-leaks.html
13:00 <quchen> Instead of (last . take n), use (!! n). Instead of (!! n), use an algorithm that does not need to build the list in the first place ;-)
13:00 <cinimod`> But myIterate 0 _ a = a; myIterate n f a = myIterate (n-1) f (f a) just seems to create a big thunk which get evaluated at the end
13:00 <cinimod`>
13:01 <jchia_1> And also I'm trying to understand how this approach works.
13:01 <quchen> jchia_1: Sure, that stack is here to stay
13:01 <quchen> cinimod`: You’re building a (f (f (…))) thunk.
13:01 <cinimod`> Yes
13:01 <cinimod`> I know
13:01 <cinimod`> I don't wish to
13:01 <lyxia> cinimod`: you might want to seq a (myIterate (n-1) ...)
13:01 <quchen> cinimod`: You can avoid this by making your function strict in the (f a) value, by using seq or bang patterns
13:01 tefter joined
13:02 <quchen> cinimod`: Note that you’re *not* building a thunk because of the (n-1), because the comparison with 0 forces it on each iteration. :-)
13:02 shadowdaemon joined
13:02 <cinimod`> quchen ok but it is using 2G!
13:03 <quchen> Lots of small thunks use lots of small memory
13:03 nagyf joined
13:03 <quchen> myIterate n f x | n <= 0 = x | otherwise = myIterate (n-1) f $! f x
13:03 <quchen> There’s also the $! operator in the Prelude,
13:03 <quchen> ?src $!
13:03 <lambdabot> f $! x = x `seq` f x
13:03 <cinimod`> Why is the comparison better than pattern matching?
13:04 <quchen> cinimod`: myIterate (-1)
13:04 sdothum joined
13:04 <LAZAR> Can someone help me with this line of code? I am trying to use a local variable relying on Random in main but <- only works with IO and if I move it to where the generator is out of scope.... http://lpaste.net/355534
13:04 <cinimod`> fair enough - I thought it had some performance value
13:04 <quchen> A crashing program has poor performance.
13:04 cobreadmonster joined
13:04 <quchen> ;-)
13:05 <CoolerZ> whats a good way to pretty print a [(Int, Data.Map.Strict.Map)] ?
13:05 <quchen> show.
13:05 <quchen> Oh, sorry, pretty print
13:05 <cocreature> quchen: you should just replace your pretty printer library by show! :)
13:05 <quchen> Use a prettyprinter! We have a load of them. I recommend my own one. :-þ
13:06 <jchia_1> CoolerZ: I've used the groom package before, but not on Map.
13:06 <cinimod`> I still get "2889 MB total memory in use"
13:06 <quchen> CoolerZ: https://quchen.github.io/ansi-wl-pprint-docdump/wl-pprint-1/Data-Text-Prettyprint-Doc.html
13:06 <cinimod`> Ignore that
13:06 <merijn> cinimod`: How are you tracking memory usage?
13:06 <cinimod`> +RTS -s
13:06 <merijn> cinimod`: Which thing is listing 2889 MB?
13:07 <lyxia> LAZAR: where is gen used?
13:07 <cinimod`> And lots of GC
13:07 <cinimod`> MUT is 1.9 and GC is 8.1
13:07 <LAZAR> lyxia: gen <- getStdGen is used in my main do
13:07 <LAZAR> lyxia: and thus not accessible from the where block
13:07 <merijn> cinimod`: Did you update quchen's suggestions?
13:07 e14 joined
13:07 <lyxia> LAZAR: I see only one occurence of gen in each block, and that is it being bound, but not used
13:08 <cinimod`> I have myIterate n f x | n <= 0 = x | otherwise = myIterate (n-1) f $! f x
13:08 <merijn> quchen: Does that mean you released it? :p
13:08 <lyxia> LAZAR: you can write "let nums = getRandomNumbers"
13:08 <quchen> merijn: It’s on Github ლ(ಠ益ಠლ)
13:08 <cinimod`> Maybe because I am using Linear?
13:09 <cocreature> cinimod`: what’s the type of f?
13:09 <LAZAR> lyxia: Thanks, that was pretty stupid of me
13:09 <cocreature> cinimod`: also are the 2889mb max residency or allocations?
13:09 <cinimod`> (V2 Double, V2 Double) -> (V2 Double, V2 Double)
13:10 <cinimod`> 1,131,991,832 bytes maximum residency
13:10 <cocreature> then $! won’t help. that will only force the tuple constructor but not the values in the tuple
13:10 <cinimod`> So it's the V2
13:10 <cocreature> try using V2 (V2 Double, V2 Double)
13:10 <cocreature> eh V2 (V2 Double) (V2 Double)
13:10 jer1 joined
13:10 <cocreature> eh V2 (V2 Double)
13:10 <cinimod`> lol
13:11 <cocreature> I should start thinking before I type
13:11 iAmerikan joined
13:11 <cinimod`> I have a working accelerate version
13:11 <cinimod`> I just wanted to compare it to old school Haskell
13:12 justinfokes joined
13:12 SkyPatrol joined
13:12 mmn80 joined
13:12 <Athas> cinimod`: what are you using Accelerate for?
13:12 torstein joined
13:12 <quchen> cinimod`: »seq« only does enough work to show something for it, it does not do all the work.
13:13 <quchen> cinimod`: So it will only do some computation until there is some result.
13:13 k0001 joined
13:13 <quchen> In particular, it will compute until it finds out its argument is not an infinite loop or something.
13:13 <cinimod`> Athas: a symplectic integrator
13:13 <Athas> That looks like a typo, but apparently there is a thing by that name!
13:15 <pie_> pavonia, didnt have issues with other packages i needed to install :/
13:15 <cinimod`> That's better
13:15 <cinimod`> 1M rather than 2G
13:15 <cinimod`> Ok tuples are evil
13:16 <merijn> cinimod`: Not so much, it's the thunks building inside.
13:16 <merijn> Does Haskell/GHC have integer notation supporting thousan groupings?
13:17 <merijn> i.e. allowing something like 1,000,000 or 1_000_000 instead of 1000000
13:17 nagyf joined
13:17 k0001 joined
13:18 juanpaucar joined
13:18 <quchen> Nope.
13:19 <quchen> Quasiquoter *ducks*
13:19 sz0 joined
13:19 cdg joined
13:20 <LAZAR> What is wrong about this part? (assuming proper indentation) getLineInt = do line <- getLine case readMaybe line of Just x -> case x >= 0 of True -> x False -> putStrLn "That number is too low!" >> getLineInt Nothing -> putStrLn "Please enter a valid number!" >> getLineInt
13:20 eacameron joined
13:20 Bhootrk_ joined
13:20 <LAZAR> basically a nested case statement
13:20 <cinimod`> So accelerate is about 50% faster than ghc and both outperform Julia
13:20 justinfokes joined
13:20 juanpaucar joined
13:20 kmels joined
13:21 <cinimod`> Thanks merijn and quchen - that probably saved me an hour of investigation
13:22 <CoolerZ> how do i insert a newline into a string?
13:22 <CoolerZ> \n doesn't work
13:22 <jle`> what do you mean by insert?
13:22 <jle`> do you have a string and want to append a newline to the end?
13:22 <CoolerZ> yeah
13:22 kamyar joined
13:22 <LAZAR> CoolerZ: You mean mystring ++ "\n" ++ suffix?
13:23 <jle`> > "my string" ++ "\n"
13:23 <lambdabot> "my string\n"
13:23 <CoolerZ> nope doesn't work
13:23 <jle`> why doesn't it work?
13:23 <CoolerZ> it just prints \n
13:23 <jle`> how are you using the string?
13:23 roconnor joined
13:23 <LAZAR> Strange
13:23 <CoolerZ> putStrLn
13:23 <jle`> putStrLn "hello\nworld" looks fine to in my ghci
13:24 <jle`> what version of ghc are you using, and what operating system?
13:24 <CoolerZ> oh i am using another show after that, thats why
13:25 <LAZAR> What is wrong with my nested case statement here? http://lpaste.net/355536
13:25 <jle`> LAZAR: are you asking from a stylistic perspective?
13:25 <LAZAR> jle`: no it throws an error
13:25 <LAZAR> jle`: i just dont get why
13:25 <jle`> case blah of True -> ... etc. is probably better as if/then/else
13:26 <jle`> well
13:26 <jle`> what's the error?
13:26 <c_wraith> LAZAR, do you mean it doesn't compile?
13:26 <jle`> if you ever want help with an error, 99% of the time it would help to post the error :)
13:26 <LAZAR> positive, it does not compile with • No instance for (Read (IO Int)) arising from a use of ‘readMaybe’
13:26 <LAZAR> • No instance for (Ord (IO Int)) arising from a use of ‘>=’
13:26 <jle`> that's definitely not a problem with the case statement
13:27 <jle`> that's a type error :o
13:27 <LAZAR> • No instance for (Num (IO Int)) arising from the literal ‘0’
13:27 <LAZAR> yeah i figure
13:27 <LAZAR> i need to cast here?
13:27 <jle`> remember that each branch of a case statement must have the same type
13:27 <c_wraith> LAZAR, it's a weird inference report of not using return on x
13:27 xtreak joined
13:27 <jle`> on line 5, you're trying to return a...Int, maybe?
13:27 <jle`> i'm guessing
13:27 <LAZAR> Yeah its basically not using return lol
13:27 <jle`> (see, even I can't infer it)
13:27 <blackdog> one debugging technique woud be to replace one of the case arms with undefined
13:27 <LAZAR> im not returning anything
13:27 <jle`> on line 6 you're returning IO something
13:28 <jle`> on line 7 you're returning IO something
13:28 Xanather joined
13:28 <LAZAR> yeah i guess i need to return in any case?
13:28 <jle`> so the line 5 case branch is returning something of a different type than line 6 and 7
13:28 eacameron joined
13:28 <c_wraith> LAZAR, for what it's worth, compile errors aren't "throwing" anything. that's run time behavior.
13:28 <LAZAR> sing return x fixed it
13:28 <blackdog> so try "True -> undefined" - if that works, that lets you know that you were doing the wrong thing in that arm
13:28 <greymalkin> Does anyone have any insight into why https://pastebin.com/cE5pKmmu would cause a 'Could not deduce' error in the second function, but not the first?
13:29 <merijn> blackdog: Probably helps to paste the error too :)
13:29 <c_wraith> greymalkin, as always, exact errors help a lot. preferably in the paste.
13:29 <Athas> cinimod`: is that Accelerate on GPU?
13:29 <blackdog> merijn: well yes :) that one was a bit obvious, i'm just trying to do the "here's how you could debug it yourself" thing
13:29 <Athas> A 50% performance increase over GHC sounds really bad if so.
13:30 <merijn> quchen: Well with an extension you can do 1e6 for Integrals in GHC, but that only works nicely for round numbers
13:30 <greymalkin> c_wraith: Added.
13:30 theelous3 joined
13:30 <c_wraith> greymalkin, you left out the part that explains why the error happens.
13:31 <c_wraith> greymalkin, which is what I was going to use to explain why the error was happening.
13:31 <jle`> greymalkin: yeah, you pretty much did not give any more information than you did before, heh
13:31 locallycompact joined
13:31 <jle`> you cut out 90% of the useful information from the error message
13:31 <jle`> namely: the error message
13:32 jer1 joined
13:32 <ij> ertes-w, Okay, that's a humoungous image! 1.7!
13:33 meba joined
13:34 Bigcheese joined
13:34 <ertes-w> ij: keep watching
13:34 <ertes-w> i fix it just a moment later =)
13:35 <merijn> hmmm, I should probably make my benchmarks less exhaustive...
13:35 <merijn> I fear 3.1k of them might take a while >.>
13:35 <greymalkin> Okay, full error message included.
13:36 igniting joined
13:36 <cinimod`> Athas: on CPU but performance is roughly the same on GPU
13:36 <cinimod`> I just tried
13:36 dcoutts joined
13:37 <cinimod`> It's not a parallel problem
13:37 <ertes-w> ij: ideally images wouldn't actually contain anything beside an init script, and you would simply mount the nix store as a read-only volume, but the current dockerTools doesn't support that approach
13:37 <cinimod`> I am surprised it is as quick as it is on GPU
13:37 <ertes-w> ij: it's mainly for self-contained images, so static linking is the most viable option
13:37 <ij> ertes-w, Do I have to be on nix for this to work?
13:38 michaelw joined
13:38 <ertes-w> ij: you do need to have nix installed… you don't need to be on NixOS
13:38 <c_wraith> greymalkin, so, you're getting an ambiguous type.. ghc needs to select a class instance to use, but can't figure out what type you actually mean.
13:38 <ertes-w> ij: wait, you mean to run the images? no, they are self-contained
13:39 <Athas> cinimod`: why use Accelerate if the problem is not parallel?
13:39 nightglare joined
13:39 Big_G joined
13:39 <Athas> I think vector is a better choice if you just want fast strict arrays.
13:39 jangsutsr joined
13:39 BernhardPosselt joined
13:39 ystael joined
13:39 <BernhardPosselt> hi, does haskell also have those contravariance, covariance issues like java?
13:39 <BernhardPosselt> or do HKT solve that?
13:40 <c_wraith> greymalkin, and this is happening because there is nothing connecting the type of the ambiguous expression to the type in the signature
13:40 <merijn> BernhardPosselt: The only contravariance/covariance issue I'm aware of is wrt to subtyping
13:40 `^_^v joined
13:40 <c_wraith> BernhardPosselt, most of them go away when you remove subclassing and mutability.
13:40 <merijn> BernhardPosselt: Haskell doesn't have subtyping, so those don't exist
13:40 <BernhardPosselt> ah right :)
13:40 <ij> ertes-w, So nothing is being built inside the container?
13:41 <ertes-w> ij: what do you mean?
13:41 <merijn> BernhardPosselt: Similar things break structural subtyping, which is why most PLT people are settling on "subtyping is evil" and work on rowtype polymorphism :)
13:41 <nightglare> hi. i wanna get started learning haskell.
13:41 <ij> ertes-w, No containers are being run during the build, yes? I saw other approaches do this.
13:41 <cinimod`> Athas: the CG for numerical stuff is better
13:41 <nightglare> but how good is it for GUI programming?
13:41 <ertes-w> ij: correct… docker is not used for image building
13:41 <BernhardPosselt> yeah, ADT are a very neat way to avoid subtyping
13:42 <c_wraith> greymalkin, it's hard to pin it down further when there is no definition for jsonStringMap listed
13:42 <ertes-w> nightglare: very good as a language, bad as a platform
13:42 <carter> cinimod`: I've been recently finishing up getting my library of math tools in shape :)
13:43 <ertes-w> nightglare: our toolkit bindings are a bit lacking (GTK+ is the most comprehensive… i think it's pretty much complete)
13:43 <greymalkin> Oh, sorry. it's the 'getStringMap' above... cut-and-paste problem.
13:43 <ertes-w> nightglare: portability is often a hassle when windows support is required
13:43 <BernhardPosselt> btw, couldnt you say a typeclass instance is a sub type of the type class?
13:43 <merijn> BernhardPosselt: Not really
13:43 jdt joined
13:43 <greymalkin> So, adding `forall a.` to the type signature makes the error go away, but I would like to know why.
13:44 <ertes-w> nightglare: the situation is much better with media libraries like GLFW, GLUT, SDL, etc., but some of the windows issues remain
13:44 <BernhardPosselt> are typeclasses more related to HKT and instances to types?
13:44 <merijn> BernhardPosselt: For example, consider: "foo :: Bar a => [a]" that list cannot have different instances of the same typeclass inside it
13:44 <ertes-w> nightglare: as a language haskell is great for UI development… we have a few very nice approaches like (real) FRP, concurrency, etc.
13:44 <merijn> BernhardPosselt: The typeclass is more of a predicate/constraint on type variables
13:44 <jle`> greymalkin: it should only make a difference if you have scoped type variables on, and refer to the 'a' type variable inside the function body
13:45 gnull joined
13:45 <greymalkin> No, nevermind. it went away when I removed the String from the tuple.
13:45 <nightglare> ertes-w: thanks. all i really want is Gtk+3
13:46 <ertes-w> nightglare: yeah, that one is very good support, and there are reasonably easy build instructions for windows as well
13:46 <nightglare> ertes-w: does it work well enough on linux?
13:46 <jle`> haskell has subtyping. [Bool] is a subtype of (forall a. [a])
13:46 <ertes-w> nightglare: yes, linux is the best supported platform
13:46 <merijn> jle`: I wouldn't agree to call that subtyping
13:47 <ertes-w> nightglare: not the (best (supported platform)), but the ((best supported) platform) =)
13:47 <jle`> it fulfills substitutability, doesn't it?
13:47 <BernhardPosselt> regarding forall: is forall the same thing as in purescript?
13:47 <merijn> jle`: I don't think I consider a type system to have subtyping without a subsumption typing rule
13:47 erisco joined
13:47 <nightglare> ertes-w: thank you again. how do i get started?
13:47 <BernhardPosselt> forall a b. a -> b
13:48 <merijn> jle`: Well, you can't pass [Bool] to a function expecting (forall a . [a])
13:48 Shatnerz0 joined
13:48 <BernhardPosselt> placeholder for a and b
13:48 <BernhardPosselt> that is needed to avoid ambiguities when nesting the type variables?
13:48 <jle`> ah yeah, got it backwards. you can provide a (forall a. [a]) to any function epxecint [Bool]
13:48 <jle`> BernhardPosselt: it means something similar here yes
13:49 erikd joined
13:49 <ertes-w> nightglare: try this: https://www.seas.upenn.edu/~cis194/spring13/lectures.html
13:49 <jle`> *expecting a [Bool]
13:49 <ertes-w> nightglare: or perhaps this: https://www.cis.upenn.edu/~cis194/fall16/
13:49 <BernhardPosselt> ty
13:49 <wilornel> Where is `data (->) t1 t2` defined?
13:49 <jle`> but we're using it for a different purpose than that one specifically
13:49 <wilornel> for `:info (->)`. I can't find it here: https://hackage.haskell.org/package/ghc-prim-0.4.0.0/docs/GHC-Prim.html
13:49 fotonzade joined
13:50 <gnull> Hi everyone. Do you know of any haskell package that would allow to execute interactive console programs and interact with them? Maybe something similar to Tcl/expect? I'm not solving any particular problem, just curious.
13:50 <nightglare> ertes-w: so, on the whole, linux is badly supported by Haskell?
13:50 roconnor joined
13:50 <phadej> wilornel: it's built-in
13:50 mmachenry joined
13:50 FZ_ joined
13:50 <ertes-w> nightglare: no, linux is very well supported
13:50 CurryWurst joined
13:50 <erisco> annoying problem... I have some question formats (Q1 .. Qn) and answer formats (A1 .. An) in a game. A state in the game looks like (Q1, A1 -> Game) and a review of the game looks like [forall n. (Qn, An)]
13:51 <merijn> wilornel: Why are you expecting it to be defined anywhere?
13:51 <ertes-w> nightglare: actually windows is also well supported, but the trouble starts when you need to bind to foreign libraries
13:51 <erisco> well, that review type doesn't really work, so I can instead define a sum of all the Q&A tuples and get [QA]
13:51 <ertes-w> nightglare: like in this case UI toolkits
13:51 <wilornel> phadej: thank you. It's confusing because when I run `:info (->)`, it says it's "Defined in 'GHC.Prim'"
13:51 <wilornel> merijn: ^
13:51 Gurkenglas joined
13:52 <merijn> wilornel: GHC.Prim is secret code for "magic compiler voodoo" ;)
13:52 <erisco> but now I have this ugliness where I have (Qn, An -> Game) types and (Qn, An) types
13:52 <erisco> having to be separately defined...
13:52 <wilornel> That's also confusing because this exists https://hackage.haskell.org/package/ghc-prim-0.4.0.0/docs/GHC-Prim.html
13:52 al-damiri joined
13:52 <wilornel> And sure :) but what about this page? ^
13:52 <merijn> wilornel: If you have a look at the actual source of that module, you'll see the things it lists don't really exist :)
13:52 jer1 joined
13:53 <merijn> wilornel: To document the "magic compiler voodoo" that people can actually use :)
13:53 <phadej> wilornel: grep for 'data Int#'; it's kind of there; but not really
13:53 crobbins joined
13:53 <jle`> the module is mostly placeholder for the satisfaction of the typechecker
13:53 <cinimod`> Athas: my bad - the GPU is a *lot* slower as I would have expected
13:53 <nightglare> ertes-w: i see
13:53 <wilornel> but What do you mean? `data Int#' is there, and what does Int# have to do with (->)?
13:53 <ertes-w> nightglare: and this problem is not exclusive to haskell… windows is just bad as a development/build platform, unless you do everything with visual studio, as microsoft keeps telling us
13:53 <cinimod`> I don't have a stand-alone GPU so I can't experiment very much
13:53 <nightglare> ertes-w: thanks for the resources
13:54 <wilornel> You mean it's there but we don't get to see its definition?
13:54 <erisco> maybe I can get something like a dependent pair...
13:54 <wilornel> jle: Thanks
13:54 <phadej> wilornel: it's not really defined, and (->) is even more magical; so it isn't there
13:54 <merijn> wilornel: He's refering to Int# being defined as "data Int#" without any constructors :)
13:54 <wilornel> I see!
13:54 <wilornel> Ah that's the word I was missing , constructor. Alright, thanks phadej and merijn !
13:54 <phadej> also almost all function there are `let x = x in x`
13:54 <phadej> which is a way to say "undefined" without saying "undefined"
13:55 <cinimod`> carter: I look forward to trying them
13:55 <nightglare> ertes-w: thanks for the help and the resources. yes, i use linux.
13:55 <merijn> wilornel: Basically, those functions/datatypes are built into GHC, but the typechecker doesn't know that. So that module provides types + documentation for things that are builtin
13:55 <wilornel> What about (::) ? Is that for the compiler to understand ? I feel like there's different ways to intergret it
13:55 <ertes-w> nightglare: then you will have a smooth experience =)
13:55 qnull joined
13:56 <jle`> (::) is syntax
13:56 jathan joined
13:56 <wilornel> 15 :: Integer , or (+) :: Num a => a -> a -> a
13:56 <merijn> wilornel: How are those different according to you? :)
13:56 <wilornel> These :: act differently
13:56 <wilornel> Hmmm well in one I'm casting/resolving 15 to be an integer
13:56 <merijn> wilornel: No
13:56 <wilornel> and in the other I am defining that (+) must be a function of this shape
13:57 <ertes-w> wilornel: you are *claiming* that 15 is an Integer
13:57 <wilornel> ah sorry
13:57 <jle`> in both cases they are type annotations
13:57 <nightglare> ertes-w: :) bye. i will be back.
13:57 <merijn> wilornel: Oh, actually, I suppose you're slightly right
13:57 <wilornel> and with (+) :: Num a => a-> a-> a it's the same?
13:57 <wilornel> Alright, cool!
13:57 <jle`> well, you are right that :: can be used in a declaration, and also as a type annotation
13:57 <wilornel> aha!
13:57 <ertes-w> nightglare: great, have fun =)
13:57 <merijn> wilornel: :: can annotate both *names* and *expressions*
13:57 <wilornel> See? It's confusing
13:57 <wilornel> aaaah
13:57 <wilornel> so it's annotating
13:57 <merijn> wilornel: But it does the same thing for both of those. Which is, tell the compiler which type it has
13:58 <wilornel> that makes sense. Thank you!!
13:58 <ertes-w> wilornel: whenever you write "x :: A", you're saying, "this is x… oh, and i think x is of type A"
13:58 <jle`> so i suppose it is a part of expression syntax, as well as declaration syntax
13:58 <ertes-w> wilornel: the compiler will then check if you're correct
13:58 sdothum joined
13:58 <merijn> Well, not really "I think" but more "if 'x' is not type A, scream bloody murder" ;)
13:59 <jle`> in an expression context, (my expression :: T) means that you want to claim that `my expression` has type T
13:59 <jle`> in a declaration context, `foo :: T; foo = ...` means that you are defining foo which has type T
13:59 oisdk joined
13:59 henriksod joined
13:59 <ertes-w> wilornel: the point is that you never get to *choose* the types… every expression already has a certain type, and the only choice you have is to go from more general types to less general ones
13:59 <jle`> haskell doesn't allow naked expressions at the top level so i suppose the ambiguity isn't there
13:59 eschnett joined
13:59 <wilornel> makes sense! And because it's so similar (almost the same thing) it makes sense to use the same syntax
14:00 <ertes-w> wilornel: 15 is of type (Num a => a), but you are free to restrict it to Integer
14:00 <jle`> if you're at the "top level" or somehwere where haskell expects a declaration, it can assume that foo :: T is a part of a declaration
14:00 <CoolerZ> does \x->\y->x+y work?
14:00 <jle`> from a parsing standpoint
14:00 <jle`> CoolerZ: what happens when you try it
14:00 <wilornel> What about this (15 :: Integer ) + (15 :: Double) will work but (15 :: Double) + (15 :: Integer) will throw an error which says "Couldn't match expected type 'Double'"
14:00 <wilornel> So the Int cannot be casted to Double?
14:01 <jle`> um
14:01 <ertes-w> > (15 :: Integer) :: Double
14:01 <wilornel> Or the Double could not be cast to Int?
14:01 <lambdabot> error:
14:01 <lambdabot> • Couldn't match expected type ‘Double’ with actual type ‘Integer’
14:01 <lambdabot> • In the expression: (15 :: Integer) :: Double
14:01 <jle`> (15 :: Integer) + (15 :: Double) will not work
14:01 <CoolerZ> yeah it works
14:01 <tdammers> they're not casts
14:01 <tdammers> they're type annotations
14:01 <ertes-w> wilornel: you're not *casting*, you're only *claiming*
14:01 <CoolerZ> you need a space after the first -> though
14:01 <wilornel> ah sorry, I misread the book!
14:01 <paolino> :: set a constraint on the type resolution of your code
14:01 nightglare left
14:01 sdothum joined
14:01 <CoolerZ> is there a short hand for that?
14:01 <wilornel> yes yes so Int doesn't not claim to Double and Double does not claim to Int
14:01 <jle`> haskell does no implicit conversions
14:01 <wilornel> tdammers: Yes, sorry!
14:02 <CoolerZ> actually there is
14:02 <wilornel> I see
14:02 <ertes-w> wilornel: the reason your example doesn't work is:
14:02 <ertes-w> :t (+)
14:02 <lambdabot> Num a => a -> a -> a
14:02 <wilornel> It has to all be the same type!
14:02 <ertes-w> wilornel: it takes an argument of type 'a' and another argument of type 'a'
14:02 <jle`> CoolerZ: there's `\x y -> x + y`, or also just `(+)`
14:02 <ertes-w> wilornel: by your first argument you want to instantiate (a = Integer), but by the second argument you want to instantiate (a = Double)… that's a conflict
14:03 <CoolerZ> yeah
14:03 <wilornel> thanks ertes-w
14:03 <jle`> so many haskell syntax tokens are overloaded
14:03 <jle`> i didn't realize (::) was as well until now
14:04 <jle`> is there a haskell syntax token that *isn't* overloaded
14:04 <jle`> (answer: yes)
14:04 <ertes-w> jle`: infix, infixl, infixr
14:04 <wilornel> hahah, what is it?
14:04 <wilornel> . ? $ ? <*> ?
14:04 <jle`> wilornel: those aren't syntax tokens
14:04 <paolino> (=) ?
14:04 <jle`> they're just normal identifiers
14:04 <wilornel> I remember reading about these but I forgot how they work
14:05 <wilornel> Ah that's right
14:05 <jle`> they're user-defined
14:05 <ertes-w> paolino: (=) is highly overloaded
14:05 <ertes-w> f x = x + x
14:05 <jle`> i was thinking 'case'/'if'/'then'/'else'
14:05 <ertes-w> data T = …
14:05 dan_f joined
14:05 <ertes-w> with enough extensions all of those are overloaded =)
14:06 <jle`> oh :o
14:06 zariuq joined
14:06 <erisco> hm, this could work reasonably...
14:06 <jle`> are there any haskell syntax tokens that are operators that aren't overloaded
14:06 <ertes-w> for example with -XArrows they translate into ArrowChoice combinators
14:06 <jle`> "operators"
14:06 jathan joined
14:06 <jle`> er, maybe i should say symbols
14:06 takle joined
14:06 Michu joined
14:06 sdothum joined
14:07 <wilornel> is overloading a good thing? In my experience it makes things confusing
14:07 <ertes-w> the infix* tokens are the only ones i can think of in general that aren't overloaded as far as i know
14:07 mithrandeer joined
14:07 <ertes-w> even 'module' is overloaded
14:07 <carter> cinimod`: me toooo. I've been pleased with the error messages I get even when writing the internals. Stuff like Row and column not being equal etc :)
14:07 <jle`> wilornel: it's used in haskell to help with associating concepts
14:07 <jle`> but i agree that it can go too far in some situations
14:08 mizu_no_oto joined
14:08 leat joined
14:09 <wilornel> need to learn how to read the definitions of the operators you're using quickly (using haggle I suppose)
14:10 xanadu joined
14:10 <ertes-w> wilornel: in haskell they are usually overloaded in a sensible way, or at least in a way that isn't ambiguous
14:10 <jle`> hoogle won't help with syntax
14:10 <jle`> only operators
14:10 <jle`> and other user-defined stuff
14:11 mitchty joined
14:11 <jchia_1> Could someone recommend a plotting package that can draw simple 2D scatterplots on Linux that's not too complicated to program and use with Stack LTS-8.13?
14:11 <glguy> the haskell report will show you the syntax
14:11 <* hackage> threepenny-editors 0.2.0.6 - Composable algebraic editors https://hackage.haskell.org/package/threepenny-editors-0.2.0.6 (PepeIborra)
14:11 ja_ joined
14:12 Luke joined
14:12 sternmull joined
14:13 jer1 joined
14:14 tomphp joined
14:14 takle joined
14:14 <wilornel> glguy: https://www.haskell.org/onlinereport/haskell2010/ thank you!
14:15 <wilornel> thanks jle, ertes-w . Going to bed now
14:15 <erisco> if you have data families F and G then easily you have type (F x, G x)
14:15 <ski> `->' is overloaded
14:15 <jle`> wilornel: good night!
14:15 <erisco> not a bad emulation of dependent pairs
14:16 hurkan joined
14:16 <ertes-w> erisco: see the dependent-sum package
14:16 GlummyBit joined
14:16 asm_ joined
14:17 <erisco> don't know why I need a library for this
14:17 robotroll joined
14:19 jbalint joined
14:19 jbalint joined
14:19 <ertes-w> erisco: for the same reason you really want to have (,) in a library =)
14:19 <erisco> though yes they do not need be data families
14:19 <erisco> just any type constructor
14:19 Wizek_ joined
14:19 <erisco> okay, well if you want a generically named thing then sure, but I don't... was just using (,) for familiarity
14:20 <ski> one of them would commonly be a GADT, no ?
14:20 GlummyBit joined
14:20 <ertes-w> yeah
14:20 erikd joined
14:20 rblaze joined
14:21 uglyfigurine joined
14:21 tctara_ joined
14:21 sgronblo joined
14:21 nh2 joined
14:21 sdothum joined
14:21 <* hackage> ble 0.4.0.0 - Bluetooth Low Energy (BLE) peripherals https://hackage.haskell.org/package/ble-0.4.0.0 (jkarni)
14:22 mizu_no_oto joined
14:22 HarveyPwca joined
14:22 xall joined
14:22 <erisco> what is a package with type length lists
14:23 <jle`> i use type-combinators these days
14:23 <erisco> and not the one that makes the nested tuples... that is a bit strange
14:24 <jle`> are you really looking for lists, or are vectors ok too
14:24 butterthebuddha joined
14:24 <erisco> http://hackage.haskell.org/package/type-combinators-0.2.4.3/docs/Data-Type-Vector.html ?
14:24 <jle`> yeah, those are inductive length-indexed lists
14:25 <erisco> yup, and yes that is what I am looking for
14:25 <erisco> there is another Vec package which makes nested tuples so you may have heterogeneous vectors
14:25 hjklhjklhjkl joined
14:25 <erisco> this is alright but needlessly complicated for the homogeneous case
14:25 <jle`> type-combinators also has Prod
14:25 sighingnow joined
14:25 <jle`> which is the heterogeneous list
14:25 renzhi joined
14:26 <jle`> but if you really want a vector, you can also used vector-sized
14:26 k0001 joined
14:26 tomphp joined
14:26 sdothum joined
14:27 pera joined
14:27 xcmw joined
14:27 SkyPatrol_ joined
14:27 <merijn> I need, like, a CI service, but for benchmarking stuff, instead of running tests >.>
14:27 <erisco> meh... list is only up to 16 elements so it doesn't matter
14:27 <erisco> didn't know of that one either though so thanks
14:28 leat joined
14:28 <erisco> I better double check ghcjs to make sure these extensions work there
14:30 <LAZAR> Someone of you likes refactoring? ;P I just wrote a ~50 lines haskell implementation of the knapsack problem, I wonder what I could improve as a beginner: http://lpaste.net/355539
14:30 <ertes-w> erisco: the 'linear' package has the V type, which is based on 'vector' vectors
14:31 alanb99 joined
14:31 xtreak joined
14:31 <jle`> vector-sized is essentially V but with the full vector API
14:31 <jle`> and without a lens dependency
14:31 alanb99 left
14:31 <erisco> bonus
14:31 plutoniix joined
14:32 locallycompact joined
14:33 <merijn> LAZAR: I'm too lazy (and have to go soon) to do the whole thing, but I'll see if I can spot some easy things
14:33 <LAZAR> merijn: sure, would be cool... it works so its really just style and alike
14:33 jer1 joined
14:34 <merijn> LAZAR: You could rewrite line 13 as "compare = compare `on` getIndex"
14:34 thimoteus joined
14:34 <merijn> LAZAR: line 19, the parenthesis around fromIntegral both sides of / are redundant (function application is *always* higher precedence than operators)
14:35 tomphp joined
14:35 <merijn> Same for the (Item x y) on line 25
14:35 <erisco> what is the scene for JavaScript compilation right now? looking at ghcjs and Haste particularly
14:35 <LAZAR> Syntax error on 'on' Perhaps you intended to use TemplateHaskell or TemplateHaskellQuotes
14:35 <LAZAR> oh wait
14:35 <LAZAR> my mistake
14:35 <merijn> LAZAR: Wrong quotes ;)
14:36 <merijn> LAZAR: You can simplify the case on line 30 using guards
14:36 <LAZAR> shouldnt "on compare getIndex" work?
14:36 <erisco> can get a Windows binary for Haste so that is much easier to try... years ago when ghcjs was newer it was a PITA to get going on Windows (had to run it through a VM ultimately)
14:36 tomphp joined
14:37 <LAZAR> Variable not in scope: on... does it require some import?
14:37 <lpaste> merijn pasted “case with guards” at http://lpaste.net/355540
14:37 <merijn> LAZAR: Data.Function iirc
14:37 <erisco> import Data.Function (on)
14:37 <merijn> LAZAR: And yes, "on compare getIndex" works, but the infix notation reads nicely, like "1 `elem` [1..10]"
14:38 mohsen_ joined
14:38 <merijn> LAZAR: Why have a case inside guards on line 40? Why not just add two separate guards for that
14:38 <LAZAR> merijn: thats true
14:38 <quchen> LAZAR: http://lpaste.net/diff/355539/355541
14:38 ChristopherBurg joined
14:38 <ertes-w> erisco: no idea about haste, but GHCJS is used commercially
14:38 mk-61 joined
14:39 <merijn> quchen: null might be justified if it's a Set or something :)
14:39 Hunter1 joined
14:39 <blackdog> LAZAR: can pull fillKnapsack out - the only thing the case statement changes is whether the second argument is "sack" or "firstItem:sack"
14:39 <quchen> merijn: Yes. And?
14:39 <merijn> And I dislike replacing the $ with () at the end
14:39 <merijn> Tastes differ :p
14:39 <LAZAR> oh i just see i can use comparing getIndex
14:40 <merijn> LAZAR: oh, yeah, I always forget about comparing >.<
14:40 sproingie joined
14:41 Kreest_ joined
14:41 flatmap13 joined
14:41 cyborg-one joined
14:41 sleffy joined
14:42 Luke joined
14:42 renzhi joined
14:42 deadalnix joined
14:42 <LAZAR> merijn: but i actually reverse them in my implementation
14:43 <LAZAR> merijn: so both comparing and on will change the order
14:43 renzhi joined
14:43 eyck joined
14:43 <quchen> »on« is mostly used in places where »comparing« is clearer.
14:43 <merijn> "flip (comparing getIndex)" :)
14:43 _deepfire joined
14:44 dual joined
14:44 <deadalnix> Is there someone around here familiar with the phabricator continuous integration ?
14:45 <merijn> But yeah, you should also use try refactoring the null usage away and use pattern matches
14:45 <merijn> deadalnix: What's the actualy question? :)
14:46 <merijn> deadalnix: Also, if this is about contributing to GHC, there's #ghc where people are generally more knowledgable about that sorta thing (you may have to wait a while for a response)
14:47 <deadalnix> merijn, as far as I can see it's running shell script directly, which means that either I missed somethign or either it's very insecure.
14:47 robotroll joined
14:47 <LAZAR> blackdog: what do you mean?
14:47 MarioBranco joined
14:48 <deadalnix> So by asking about it, I hope that I'll either learn something, or help you guys makes things more secure.
14:49 <blackdog> LAZAR: the recursive call to fillKnapsack could be fillKnapsack (tail items) (case ... :sack) limit
14:49 <merijn> deadalnix: I'm not sure what you mean?
14:50 Hunter1 joined
14:50 <blackdog> though you shouldn't be using tail anyway, patternmatch the two cases
14:50 <deadalnix> merijn, see: https://phabricator.haskell.org/harbormaster/plan/7/
14:50 MarioBranco joined
14:50 <deadalnix> it"s checking out the source and running a script from the source tree directly. What if I submit a patch for review with something malicious on the validate script ?
14:51 <blackdog> but i think other people have weighed in on "not (null items)" being a bad pattern
14:51 <merijn> deadalnix: I would assume the validation runs in a sandboxed VM, same for services like TravisCI
14:51 <orion> In order for something to satisfy the Monoid laws, must the mappend operator commute?
14:51 <merijn> orion: Nope, just associativity
14:51 <deadalnix> merijn, i don't see any, so that's why i'm asking.
14:52 eklavya joined
14:52 <orion> merijn: Great, thanks.
14:52 <juanpaucar> Hi. Does anybody knows if there's a performance impact on aeson by using C ffi? since aeson 1.2 it is not enabled by default. However, I'm not sure if pure haskell JSON parsing is as fast as C
14:52 <merijn> orion: In fact, just doing "flip mappend" is a cheap way to get a new monoid :)
14:52 <orion> ha
14:52 <blackdog> orion: easy counterexample - [1] <> [2] isn't [2] <> [1]
14:52 <orion> blackdog: Ah, indeed!
14:52 <merijn> orion: This is the mathematical dual of the monoid, see Dual in Data.Monoid
14:53 <merijn> > [1,2,3] <> [4,5,6]
14:53 <lambdabot> [1,2,3,4,5,6]
14:53 burtons joined
14:53 <merijn> > Dual [1,2,3] <> Dual [4,5,6]
14:53 <lambdabot> Dual {getDual = [4,5,6,1,2,3]}
14:53 <merijn> deadalnix: Anyway, #ghc has more people knowledgable about this :)
14:53 <erisco> why did my cabal install suddenly break... Warning: cannot determine version of ... gcc.exe ... I am googling it
14:54 Hunter1 joined
14:54 <deadalnix> merijn, jumping there, thanks
14:54 jer1 joined
14:54 <lyxia> juanpaucar: aeson's Haskell parser is slower
14:55 insitu joined
14:56 <LAZAR> someone has an idea how to transform this using pattern matching? http://lpaste.net/355542 I figure I would need a lot of patterns (5)
14:56 <lyxia> juanpaucar: https://github.com/bos/aeson/issues/535 for the discussion
14:56 <erisco> oh... it was the recent Windows 10 update... thanks Microsoft
14:57 tomphp joined
14:57 <sproingie> fillKnapsack firstItem:restOfItems
14:57 <* hackage> Sit 0.2017.2.26 - Prototypical type checker for Type Theory with Sized Natural Numbers https://hackage.haskell.org/package/Sit-0.2017.2.26 (AndreasAbel)
14:57 <juanpaucar> lyxia: thank you very much. I didn't see that issue before. :)
14:57 <sproingie> LAZAR: also, you don't need a case expression on a boolean, you can simply use 'if'
14:57 ciniglio joined
14:58 <erisco> lol, all versions of GHC broke on Windows
14:58 erikd joined
14:58 <cocreature> erisco: there is a fix for at least 8.0.2 and I think also for 7.10.3
14:58 <erisco> https://github.com/Mistuke/ghc-compat
14:59 <sproingie> LAZAR: since you're using guard predicates, you can always take the true branch out and make it its own guard predicate, and write another declaration afterward for the false case. they'll always be checked top to bottom
14:59 <erisco> hm, but they don't have a fix for 8.0.2 there? =\
15:00 <LAZAR> weill this is the base case: fillKnapsack [] sack _ = sack
15:00 <sproingie> then you don't need that otherwise case or the (null items) test
15:01 <sproingie> just make sure that declaration comes before the one that pattern matches on the list
15:03 asm_ joined
15:03 <LAZAR> sproingie: Like this? http://lpaste.net/355542
15:04 flatmap13 joined
15:04 MarioBranco joined
15:04 flatmap13 joined
15:05 sepp2k joined
15:05 <sproingie> looks good. you don't relly need the 'otherwise' guard, since you could fall through to another declaration, but that's just nitpicky
15:05 <erisco> cocreature, any idea where the 8.0.2 patch could be?
15:06 <orion> merijn: Are you aware of any logical limits to "monoidal static analysis" on Free Applicatives? For example, if I want to statically analyze a Free Ap for validity with respect to an arbitrary set of rules, are there any limits to the complexity of said rules?
15:06 <cocreature> erisco: https://www.haskell.org/ghc/download_ghc_8_0_2.html#windows10-64
15:06 nh2 joined
15:07 cschneid_ joined
15:07 deadalnix left
15:08 jao joined
15:08 <erisco> just need the gcc.exe but if this is where I can get it then alright... thanks
15:09 igniting joined
15:09 <LAZAR> sproingie: well that would be better i guess since i could replace the guards with an if statement alltogether
15:09 LKoen joined
15:10 <sproingie> stack should work on windows, right? should plop a working install somewhere in the homedir
15:10 ragepanda joined
15:10 <CoolerZ> can you not do arr == [] ?
15:10 mizu_no_oto joined
15:11 <CoolerZ> i get a message saying possibly incorrect indentation or missing brackets
15:11 <CoolerZ> mismatched*
15:12 <cocreature> you can do that (although usually you would use "null arr" instead). the error is from something else
15:12 sellout- joined
15:12 <CoolerZ> cocreature, i get that error in ghci
15:12 StoneToad joined
15:12 <sproingie> LAZAR: there's a lot of different ways to write it. i'm a fan of multiple declarations and single guards, but ultimately you want a style you're comfortable with
15:13 <CoolerZ> parse error (possibly incorrect indentation or mismatched brackets)
15:13 <CoolerZ> all i did was arr = [1, 2]
15:13 <CoolerZ> and arr == []
15:13 <LAZAR> sproingie: Well after the second refactoring it is way more concise indeed! http://lpaste.net/355542
15:13 roconnor joined
15:13 sellout- joined
15:14 <cocreature> CoolerZ: works just fine for me. I’m pretty sure you have something weird somewhere else
15:14 <byorgey> CoolerZ: when I type those lines in ghci I get 'False'.
15:14 FreeBirdLjj joined
15:14 sellout- joined
15:14 <sproingie> LAZAR: that does look a lot more readable than the first version :)
15:14 <CoolerZ> cocreature, yeah its actually looking at the file because i have it open in sublimeREPL
15:14 jdnavarro joined
15:14 <CoolerZ> it works fine in a terminal GHCi
15:14 <sproingie> CoolerZ: with those errors, the problem might be before the offending line
15:15 osa1 joined
15:15 osa1 joined
15:15 im0nde joined
15:15 dm3 joined
15:15 <byorgey> CoolerZ: so you have the lines 'arr = [1,2]' and 'arr == []' by themselves in a .hs file?
15:15 <sproingie> in fact with that particular error it almost always is
15:15 jer1 joined
15:15 <byorgey> CoolerZ: unlike at the ghci prompt, you can't have expressions standing on a line by themselves in a .hs file. So putting arr == [] by itself in a .hs file is a syntax error.
15:16 <sproingie> er except 'arr == []' isn't a top-level statement it knows what to do with
15:16 <sproingie> it really could use a friendlier message, it should already be aware of being at the top leve
15:17 <CoolerZ> byorgey, no i don't have those in a file, i was just testing those in GHCi to see if you do compare arr == []
15:17 <CoolerZ> the file has some other unfinished code
15:17 hybrid joined
15:18 Ryozuki joined
15:19 Gurkenglas joined
15:19 takle joined
15:19 fotonzade joined
15:20 erikd joined
15:20 <* hackage> random-bytestring 0.0.1 - Efficient generation of random bytestrings https://hackage.haskell.org/package/random-bytestring-0.0.1 (larsk)
15:21 sampuka joined
15:22 eazar001 joined
15:22 SeMas joined
15:22 afarmer joined
15:23 alqatari joined
15:24 bennofs joined
15:25 <* hackage> Sit 0.2017.5.1 - Prototypical type checker for Type Theory with Sized Natural Numbers https://hackage.haskell.org/package/Sit-0.2017.5.1 (AndreasAbel)
15:26 <erisco> ehh that's unfortunate... GHC.TypeLits (Nat) and Data.Family.Nat (N) =\
15:27 <jle`> yeah, they are different types
15:27 zero_byte joined
15:27 xall joined
15:27 <erisco> and Data.Type.Vector is defined on the latter
15:28 <jle`> yeah, it makes more sense becuase it's a list
15:28 <jle`> the index matches the structure of the type
15:28 <jle`> and vector-sized is defined on GHC.TypeLits.Nat
15:28 <erisco> but my type literals
15:29 sfcg joined
15:29 sfcg joined
15:30 sfcg joined
15:31 sfcg joined
15:33 Levex joined
15:33 tlaxkit joined
15:34 trism joined
15:35 tomjaguarpaw joined
15:35 monte joined
15:35 kuribas joined
15:35 <cocreature> meh, looks like vector-sized still does not support unboxed vectors. I guess I need to stop being lazy and figure out how to implement them myself
15:36 jer1 joined
15:36 <jackhill> pun intended?
15:36 <cocreature> no :)
15:36 <jackhill> :)
15:36 Grisha joined
15:37 jathan joined
15:38 systadmin joined
15:39 alx741 joined
15:40 ertes joined
15:42 shlevy joined
15:42 oish_ joined
15:43 shlevy left
15:43 fbergmann joined
15:43 cloudhead joined
15:45 kmels joined
15:45 fresheyeball joined
15:45 sssilver joined
15:46 <fresheyeball> quick question
15:46 araujo joined
15:46 ragepandemic joined
15:46 <fresheyeball> Does the Linear package export a way to divide a vector by a vector?
15:46 <Grisha> fresheyeball: I don’t think this operation is a standard notion in linear algebra
15:46 <fresheyeball> div' (V2 x y) (V2 x' y') = V2 (x `quot` x) (x'
15:47 tomphp joined
15:47 <fresheyeball> Grisha: really?
15:47 <fresheyeball> multipication seems common
15:47 sfcg joined
15:47 <Grisha> fresheyeball: there’s a scalar, vector, etc. product of two vectors
15:47 <Grisha> but no standard division operation
15:48 <fresheyeball> div' (V2 x y) (V2 x' y') = V2 (x / x') (y / y')
15:48 <fresheyeball> such a thing is not standard?
15:48 <Grisha> at least, that’s what I remember from my linear algebra classes
15:48 <lyxia> liftA2 (/)
15:48 wedens joined
15:48 <lyxia> The Applicative instance gives componentwise operations
15:48 <Grisha> for me, it has a strong taste of the R language, where you can divide matrices by vectors
15:48 <Grisha> and noone knows what that is supposed to mean
15:49 teggi joined
15:49 tomphp joined
15:49 <Grisha> fresheyeball: why would you do that?
15:49 <fresheyeball> Grisha: I wish to scale a graphic to fit the screen size
15:50 <Grisha> fresheyeball: that’s multiplication by a scalar, isn’t it?
15:50 <ski> presumably the scaling factors in different directions are different
15:50 <Grisha> but the different scaling factors do not represent a vector
15:51 <Grisha> looks wierd to me
15:51 <Grisha> *weird
15:51 <fresheyeball> so I have a V2 with the screen size
15:51 <* ski> nods
15:51 skeet70 joined
15:51 <fresheyeball> and a V2 with the graphic's size
15:51 <fresheyeball> and I'm using gloss which has `Scale` which is relative
15:51 <fresheyeball> so I need the x value to multiply by to get the screen size
15:51 <Grisha> i’d rather write a more explicit function like scale xScale yScale v = …
15:52 <Grisha> or even better
15:52 fotonzade joined
15:52 <fresheyeball> this is my actual code
15:52 <fresheyeball> http://lpaste.net/355547
15:53 <Grisha> fresheyeball: have you touched OpenGL?
15:53 <Grisha> fresheyeball: they have matrices that represent the affine transforms
15:53 <fresheyeball> Grisha: I wrote a shader once, but it was very painful
15:53 <ph88^> anyone know a function to make a Conduit from stdin and stdout ?
15:53 <Grisha> fresheyeball: scaling things like this is an affine transform
15:54 <Grisha> for 2D vectors, it’s a 3x3 matrix
15:54 <ski> (even a linear one, in this case)
15:54 <fresheyeball> While I do like learning new words
15:54 <fresheyeball> I admit I don't understand what you mean by affine transformation
15:54 <Grisha> depends on the choice of origin
15:54 TCZ joined
15:54 <Grisha> x = ky is a linear one
15:54 <Grisha> x = ky + b is an affine one
15:55 <Grisha> for 1d vectors (aka scalars) `x` and `y`
15:55 <ski> `x' and `y' (and `b') may be vectors. `k' is then a linear transformation, or matrix
15:55 markus_ joined
15:56 jer1 joined
15:56 <ski> (in a linear/vector space, there's *the* origin. when using an affine space, there *may* be a *choice* of origin. linear and affine spaces are related, and people don't always distinguish clearly between them)
15:56 <Grisha> the trick is that you can rewrite x = ky + b as X = M Y for x = (X, 1), y = (Y, 1) and properly chosen 2x2 matrix M
15:57 <Grisha> ski: my linear algebra class was way ago, thank you for correcting
15:57 medicijnman joined
15:58 <ski> a very simple picture is that 1-, or 2-, or 3- dimensional space is an affine space. there's no inherent reason to prefer selecting one point in space as "origin", over any other
15:58 <Grisha> of course, there is
15:58 <Grisha> that’s the tip of my nose
15:59 <ski> but if we consider "directed distances" in such a space, then that's a vector space. the origin vector is the zero distance
16:00 <cocreature> ph88^: use sourceHandle and sinkHandle
16:00 osa1 joined
16:00 osa1 joined
16:00 <ph88^> thank you
16:00 <ski> altitudes can be thought as an affine space. while altitude *differences* are a vector space
16:00 insitu joined
16:00 <ski> you can add a vector to a point in space, displacing it some distance in some direction, getting a new point
16:01 <ski> but you can't add a point to a point. otoh, you can add a vector to a vector (getting a new vector back)
16:01 <Grisha> I’ve got a more haskelly question
16:01 <ski> similarly, you can subtract a vector from a point (or from a vector), and you can subtract a point from a point. but you can't subtract a point from a vector
16:01 <Grisha> a func of mine computes `maybe empty pure x` (for some x)
16:02 <ski> in some sense points in an affine space are "absolute", while vectors in a vector space represent "relative" differences between the former
16:02 <Grisha> and the constraint `Alternative f => …. -> f a` is not automatically deduced by ghc
16:02 <EvanR> they never introduced "points" in linear algebra class, you just used vectors for that
16:03 <EvanR> oh affine space
16:03 <ski> EvanR : unfortunately not, aye
16:03 <ski> @type maybe empty pure
16:03 <lambdabot> Alternative f => Maybe a -> f a
16:04 <Grisha> exactly
16:04 <LKoen> ski: you can't add two points, but you can take a linear combination whose coefficients sum up to 1!
16:04 <ski> LKoen : right. leading to barycentric coordinates :)
16:04 <nshepperd_> Grisha: DMR?
16:05 tristanp joined
16:05 urodna joined
16:05 <Grisha> I put a type signature :: SomeTypeClass ep =>… -> Reader Config IO (ReturnType ep)
16:05 <Grisha> and ReturnType ep is not automatically Alternative, as far as I can say
16:05 cdg joined
16:06 <Grisha> nshepperd_: dmr?
16:06 <ski> (imho, classes in linear algebra (or at least vector spaces) ought to teach some about affine spaces as well, introducing the distinction, since people will in practice need both concepts ..)
16:06 <nshepperd_> Oh, it's not going to override your explicit type signature
16:06 <ski> @where DMR
16:06 <lambdabot> http://www.haskell.org/haskellwiki/Monomorphism_restriction
16:06 jmelesky joined
16:06 <fresheyeball> ski: Grisha: just got back
16:06 <fresheyeball> is there a function for my division operation in Linear.Affine?
16:07 <ski> (the Dreaded Monomorphism Restriction, to be precise)
16:07 <Grisha> nshepperd_: ok, I’ll try to meditate over it
16:07 <ski> fresheyeball : not sure, haven't looked in detail at that
16:07 ptek joined
16:07 <Grisha> nshepperd_: but I don’t immediately see a connection
16:07 <lyxia> fresheyeball: liftA2 (/)
16:07 <fresheyeball> lyxia: thats what I did
16:08 <nshepperd_> You'll need to add Alternative to your type signature explicitly, if you have one
16:08 <ski> Grisha : do you have any explicit arguments on the left of `=' in your definition ?
16:08 <Grisha> fresheyeball: from the viewpoint of linear algebra, it’s a bit smelly
16:08 <ph88^> with optparse applicative how can i make it so that two options are mutually exclusive ?
16:08 <fresheyeball> what about this
16:08 <fresheyeball> f :: V2 a -> (a -> a -> a) -> a
16:08 <fresheyeball> is that a thing?
16:08 <Grisha> fresheyeball: you’re trying to make use of ad hoc methods to solve a standard problem
16:09 <fresheyeball> f (V2 x y) g = g x y
16:09 <fresheyeball> Grisha: yeah, I agree
16:09 <ski> even `f :: V2 a -> (a -> a -> o) -> o' should be definable
16:09 <lyxia> ph88^: either check after getting your record, or make a trivalued option
16:09 <Grisha> ski: I feel stuck with your question
16:09 <fresheyeball> Grisha: it doesn't feel good, which is why I'm asking for outside opinions
16:09 <ptek> hi everyone. What is the best practical way to do pretty printing to terminal nowadays? I am looking for a good show replacement
16:09 <fresheyeball> ptek: check out pPrint
16:09 <ski> Grisha : perhaps just show the code in question ?
16:10 <ph88^> lyxia, can't i just use <|> ?
16:10 <fresheyeball> ptek: from pretty-show package
16:10 <Grisha> ski: my func does some IO (http request), parses the reply with the help of Aeson and returns Maybe a
16:10 <Grisha> ski: a sec
16:10 <nshepperd_> Grisha: if you have a type signature, it's not the DMR. You just need to add Alternative to your type sig
16:10 descender joined
16:10 <cocreature> ptek: ansi-wl-pprint is the best released version and if you’re fine with grabbing a library from github, I highly recommend quchen’s pretty printing library on github
16:10 <ptek> fresheyeball: thanks!
16:10 <lyxia> ph88^: maybe
16:11 <fresheyeball> Grisha: is it smelly to `V2 a -> (a -> a -> a) -> a` ?
16:11 <cocreature> oh I missed the show replacement, sry
16:11 <cocreature> those libs are for when you want to implement your own pretty printing functions
16:11 <cocreature> fresheyeball: looks just fine to me
16:12 <Grisha> ski: http://lpaste.net/355549
16:12 mada joined
16:12 mattyw joined
16:12 <cocreature> fresheyeball: in fact "fold1" which you get via the Foldable1 instance of V2 is pretty much that
16:12 rory joined
16:12 <cocreature> wrapped up in a semigroup constraint
16:12 <Grisha> fresheyeball: the standard solution to your problem is to represent scaling (or scaling + shifting) by a linear (or by an affine) transformation
16:13 <ptek> cocreature, great, I'll check it out
16:13 <fresheyeball> Grisha: can I see that as code?
16:13 <cocreature> ptek: this is quchen’s library https://github.com/quchen/prettyprinter
16:13 Luke joined
16:13 raichoo joined
16:13 ericdwhite joined
16:14 <Grisha> ski: I fail to see that it typechecks without any `Alternative` restrictions
16:14 <ski> Grisha : do you get any type errors with that ? if so, could you annotate the paste with them ?
16:14 <Grisha> ski: it type checks alright
16:14 <Grisha> ski: that’s exactly what makes me nervous
16:14 <nshepperd_> Grisha: oh, that last line is using the Alternative instance of ReaderT Config IO
16:14 <ski> Grisha : `ReaderT Config IO' has an `Alternative' instance
16:15 <Grisha> oh yes
16:15 <Grisha> it’s not about `ReturnType` being an Alternative Instance
16:15 <Grisha> stupid me
16:15 <* ski> isn't really happy with the `Alternative IO' instance
16:15 Sonolin joined
16:15 <Grisha> thanks folks
16:15 tangled_z joined
16:16 <Grisha> ski, nshepperd_: but I really would like to do the parsing into eitherDecode
16:16 <Grisha> and can’t figure out how to lift it to to Reader Config IO context
16:17 <* ski> isn't sure what `eitherDecode' does
16:17 jer1 joined
16:17 <Grisha> fresheyeball: I don’t have any code, but would start with implementing a type (or a type class) for affine/linear transformation
16:17 <ski> what's its type ?
16:17 <Grisha> it returns `Either String a`
16:17 <Grisha> instead of `Maybe a`
16:17 <Grisha> fails with a String-y description
16:17 <ski> @type either (const Nothing) Just
16:17 <lambdabot> Either b a -> Maybe a
16:18 baldrick joined
16:18 <fresheyeball> Grisha: not good enough? https://hackage.haskell.org/package/linear-1.20.6/docs/Linear-Affine.html#t:Affine
16:18 <Grisha> fresheyeball: there are certainly packages around
16:18 <Grisha> ski: lemme think
16:18 <Grisha> ski: I would loose the String part then
16:19 <ski> what would you prefer ?
16:19 <Grisha> I don’t know yet
16:19 <Grisha> :-)
16:19 <Grisha> I guess I could bake in the Either part into the signature of fetch
16:20 <Grisha> but this solution seems a bit too unflexible to me
16:20 <Grisha> but `fetch` doesn’t do just fetching, it parses too
16:20 <Grisha> it’s probably not a good idea to do both things in one func
16:22 <Grisha> fresheyeball: I don’t know where you stand, but I would suggest you to read on how to do scaling/shfiting by applying affine transformations. Once you’ve got the idea, the code should fall into the place by itself
16:22 mattyw joined
16:23 <ski> fresheyeball,Grisha : depending, it may be more straightforward to apply a linear (rather than an affine) transformation, since "heterogenous" scaling doesn't need the extra affine machinery
16:23 revprez_atlanta joined
16:24 cobragoat joined
16:25 <juanpaucar> Is GHC able to apply more optimizations if I prefer the use of applicative instead of monad operations (whenever possible)
16:25 <juanpaucar> ?
16:26 ragepanda joined
16:27 <glguy> juanpaucar: Not necessarily. In some cases the results can be slower.
16:27 locallycompact joined
16:27 <juanpaucar> glguy: In which cases?
16:28 <glguy> In the cases were it's slower. There's no general rule.
16:28 <glguy> Using applicative operations isn't an optimization by default, it just might generate different code and that code can be slower
16:29 <juanpaucar> glguy: I was thinking that since monad have sequential operations but in applicatives there's no such constraint, then it could paralelize some stuff
16:29 <glguy> nope
16:29 AlexRussia joined
16:29 HarveyPwca joined
16:29 erikd joined
16:30 tommd joined
16:31 <juanpaucar> glguy: I see, i was trying to move a parser i have to applicative syntax... but i was reaking my head since i have nothing like (>>=) for applicatives
16:31 <juanpaucar> *breaking
16:32 <ptek> cocreature, while prettyprinter looks very interesting, it looks like the pPrint from pretty-show is the easiest way to go - it knew how to render my data straight away, whereas the prettyprinter needs some additional instances
16:32 <ptek> cocreature, thanks for the link though
16:33 <ptek> cocreature, maybe I can help adding the missing instances for containers
16:33 <cocreature> ptek: yeah prettyprinter is for the cases where the output of pretty-show is not sufficient for your usecase
16:33 <EvanR> i didnt realize you could put then and else on the same column as if, even in do notation
16:33 <glguy> juanpaucar: What's a small example of something you didn't know how to translate? http://lpaste.net
16:33 <cocreature> it doesn’t make an attempt to generate automatic pretty printers
16:33 jathan joined
16:33 <ptek> cocreature, yes, it gives a lot of control to the user
16:33 connrs joined
16:34 <juanpaucar> glguy: https://github.com/juanpaucar/vcf/blob/master/src/Bio/VCF/Parser/Parser.hs#L87
16:35 <juanpaucar> I made that parser a while ago, and was trying to optimize it
16:36 <glguy> juanpaucar: using applicative operations wouldn't be an optimization here. You can write this using applicative operations but it woudl require you to move the logic on lines 107-111 into the definition of parseFormat
16:37 jer1 joined
16:38 jespada joined
16:38 coot____ joined
16:38 <juanpaucar> glguy: i was afraid of that. Ok, i guess it should be it. Thank you very much
16:38 <Grisha> thanks a lot folks and see you around
16:39 oish_ joined
16:39 <Philonous> Is there a way to get rid of unused definition warnings without exporting that definition or disabling the warning alltogether?
16:40 <lyxia> why do you not want to disable the warning
16:40 <lyxia> and why do you want to keep an unused definition
16:40 <Philonous> Because I want to be warned when there is a genuinely unused definition in my source file.
16:41 <Philonous> But I have TH splices that create definitions that I don't care about
16:41 <cocreature> you can move the TH splices to a separate module and disable it there
16:41 <CoolerZ> whats the function to find index in a arr
16:41 sleffy joined
16:41 <cocreature> there is no way to enable/disable warnings below module level granularity
16:41 pie_ joined
16:42 <Philonous> That would work, yes
16:42 <Philonous> OK thanks
16:42 insitu joined
16:42 <CoolerZ> elemIndex
16:43 acidjnk22 joined
16:43 Matajon joined
16:44 <EvanR> if you spawn an async that should only throw if theres some sort of bug... then a strategy might be to wrap it in another async that retries N times before rethrowing. but then, what if there are bugs in the retrier? answer: get people on IRC to audit it http://lpaste.net/355551
16:46 <EvanR> how reliable do we think the async spawning mechanism is?
16:46 locallycompact joined
16:46 <EvanR> i remember someone complaining about async exceptions in some way
16:47 <MarcelineVQ> async or asyncronus? asyncronus exceptions aren't neccesarily related to the async package
16:48 <EvanR> the last async was talking about asynchronous exceptions
16:48 argent0 joined
16:50 <exarkun> What do I do about "Ambiguous module name"? http://codepad.org/zQyf3iPW
16:50 <glguy> exarkun: Either use the PackageImports extension, or add -hide-package flags to your ghc invocations, or use cabal to load your module
16:52 rkazak joined
16:54 <* exarkun> reads about cabal
16:54 <MarcelineVQ> EvanR: I'm not sure where the gotchas might be in your code but fwiw I've had to use uninterruptibleMask in the past to be able to deal with file cleanup when exceptions happen during mapConcurrently, if you find your function not working as expected you should have a look at uninterruptibleMask
16:55 SpinTensor joined
16:55 <MarcelineVQ> this may not be neccesary at all depending how waitCatch works but I wanted to mention it
16:55 <EvanR> doesnt async do that already?
16:55 <Philonous> EvanR, Asynchronous exception thrown to the parent async will leave the worker thread dangling.
16:55 <EvanR> o_O
16:56 <glguy> exarkun: If you haven't used it yet, the idea is you make a manifest that describes your package (like this one http://hackage.haskell.org/package/array-0.5.1.1/array.cabal ) and then you can use the cabal executable to compile your project or loada the project in GHCi
16:56 erikd joined
16:57 nopsx joined
16:57 xall joined
16:57 <glguy> Because you list your package dependencies in that file, the tool knows which packages to hide and which to make available resolving the ambiguity
16:57 <kamyar> آثممخ شمم
16:57 <kamyar> Hello all
16:58 <EvanR> haha
16:58 <kamyar> Please help em with this code
16:58 jer1 joined
16:58 <EvanR> backwards arabic
16:58 <kamyar> http://lpaste.net/355507
16:58 <kamyar> It is using groundhog with TH
16:59 <kamyar> EvanR: Yea I am Iranian and our alphabet is very similar
16:59 <glguy> Is this what the arabic was supposed to look like? http://imgur.com/a/jKcBR
16:59 <kamyar> EvanR: I just forgotten to change keyboard language
17:00 <MarcelineVQ> hmm I thought glguy said the other day that the issue there was probably that UUID didn't have an instance of PersistField in Database.Persist.Class https://hackage.haskell.org/package/persistent-2.7.0/docs/Database-Persist-Class.html#t:PersistField
17:00 Nik05 joined
17:00 <EvanR> Philonous: do you think this fixes it? http://lpaste.net/355552
17:00 <kamyar> PLease help me fix my code
17:00 t7 joined
17:00 <glguy> MarcelineVQ: That's what the error message said. I asked if the user expected that there was one
17:00 afarmer joined
17:01 <exarkun> glguy: thanks
17:01 <Philonous> EvanR, It solves this particular problem, yes
17:01 jutaro joined
17:01 kamyar joined
17:02 <EvanR> hrm
17:02 <kamyar> Sorry I got DC for a second
17:02 connrs joined
17:02 peterbecich joined
17:02 <kamyar> Anyone replied me?
17:02 <kamyar> http://lpaste.net/355507
17:03 jathan joined
17:03 slackman joined
17:04 {emptyset} joined
17:05 flatmap13 joined
17:07 <glguy> MarcelineVQ: Look like you've got the documentation for the wrong package.
17:07 <MarcelineVQ> quite possibly, I just searched based on the import list of the paste, I don't actually know much about these pieces :(
17:08 <kamyar> Hey
17:08 <kamyar> I beg
17:08 <kamyar> please help me
17:09 <kamyar> I have no clue
17:09 <maambmb> guys, in the Binary.Get package, how the flip do you get the reamining unconsumed bytestring. Do I have to use runGetOrFailure, runGet doesn't give you the state back like runState does
17:09 <CoolerZ> do you guys know about FIRST and FOLLOW?
17:09 caumeslasal joined
17:10 uglyfigurine joined
17:10 <CoolerZ> in the context of lr parsing?
17:10 <CoolerZ> having some trouble implementing these in haskell
17:11 <orion> glguy: I looked at your code last night. It seems like monoidal analysis is impossible to do in a stateful way.
17:12 <CoolerZ> how do you have a memo table?
17:12 <glguy> orion: If I had to guess at what you mean, I'd guess you're wrong
17:12 <glguy> but I'm not sure what you mean
17:12 <CoolerZ> do i need to use the state monad?
17:12 <orion> glguy: You're documenting the schema by joining Maps together.
17:13 <orion> That's the purpose of your analysis.
17:13 <glguy> Yes, that's what this particular analysis does
17:13 <orion> The purpose of my analysis is to walk through the program and validate that it doesn't violate a set of complex arbitrary rules.
17:14 <glguy> orion: OK, do that
17:14 <CoolerZ> this is so much easier with access to mutable global state
17:14 <EvanR> this doesnt sound like a job for mutable global state
17:15 <kamyar> Hey friends
17:15 <kamyar> No one can help me fix my code?
17:15 <EvanR> do you want to take a bunch of IORefs with you inside a hidden closure that is getting incremental tokens to parse?
17:15 <orion> glguy: Well, sure, but I am running into problems that I'm not sure how to solve. For example, when I've arrived at a particular instruction, I need to have some notion of State so that I can answer questions like, "Has the ABC instruction been seen yet? If it has, do x, if it hasn't do y."
17:15 <CoolerZ> EvanR, no
17:16 takle joined
17:16 <EvanR> whats global about parsing
17:16 <glguy> orion: That's fine. You get to pick any Monoid instance you want. so pick one that allows you to do that
17:16 <CoolerZ> well the way i implemented first and follow in javascript is to keep a memo table to stop infinite recursion
17:17 Swizec joined
17:17 <CoolerZ> a memo table of firsts and memo table of follows
17:17 <orion> glguy: Ah, well I started out with this: data InspectionReport = InspectionReport { hasRule7BeenViolated :: Bool }, and I defined a Monoid instance for it, where mappend is defined as a logical OR between the Bools inside the two InspectionReports.
17:18 takle_ joined
17:18 <CoolerZ> because if you have something like A -> BA then its going to recurse infinitely when it tries to find FOLLOW(A)
17:18 <orion> But that got out of hand quickly because the rules are complex and require me to know things about what instructions have occurred previously.
17:18 jer1 joined
17:19 Luke joined
17:19 erikd joined
17:19 <kamyar> Hey For God;s sake someone plese reply me
17:19 <Clint> kamyar: okay
17:19 <EvanR> CoolerZ: right so you might do well to set up a monad to operate an this ambient memo table
17:19 connrs joined
17:20 <EvanR> not using State directly
17:20 <EvanR> on this*
17:20 Wuzzy joined
17:21 <CoolerZ> a different monad like state?
17:21 <glguy> orion: sounds like you need to put more information into your inspection report type then
17:21 dm3 joined
17:21 Bassetts joined
17:21 <EvanR> CoolerZ: like state in that there is some mutable state, but not with an api as primitive as get and put
17:21 ludat joined
17:22 <glguy> orion: You can pick an arbitrary monoid, you can pick [Instruction] where Instruction is your instruction type, the sky's the limit. You don't even have to perform the whole analysis via a Monoid instance
17:22 <EvanR> it would be the commands in the language of your parser algorithm
17:22 <CoolerZ> do you need more than get and put?
17:22 <EvanR> yes you definitely do
17:22 phyrex1an joined
17:23 <EvanR> if you read imperative algorithms, they are not written in terms of get and put
17:23 <EvanR> to get and put a single global state
17:23 <CoolerZ> what imperative algos?
17:24 <EvanR> gonna go with LR parsing algorithms maybe?
17:24 <CoolerZ> yeah i wrote a lr parser
17:24 <CoolerZ> the first and follow is part of generating the table for the parser
17:25 <CoolerZ> the parser takes the productions, table and tokens and produces a AST
17:25 gillesmajor joined
17:25 gillesmajor left
17:26 <CoolerZ> why do you need a different monad that State? you can 'get' the memo table and then 'put' it
17:26 <CoolerZ> after updating it
17:27 <EvanR> that is a lot of code
17:27 <EvanR> unless you do that once in one place and thats the only state action you ever do
17:27 <EvanR> in which case, it doesnt seem right to use State at all
17:28 <CoolerZ> i am more worried about what happens to the surrounding code
17:28 exarkun joined
17:28 <EvanR> it just sounds like youre trying to insert a single-use mutable variable into a pure function?
17:29 gillesmajor joined
17:29 tabaqui joined
17:29 <CoolerZ> 'single-use' well its gonna be used in the FIRST function and the FOLLOW function definitions
17:29 <ij> ertes, So before anything docker-related I could just build my pkg with nix?
17:29 <orion> glguy: I see.
17:30 <EvanR> CoolerZ: are you sure you dont want to just pass the table in as an argument?
17:30 BlueRavenGT joined
17:30 <CoolerZ> thats probly easier than a monadic bind
17:30 <EvanR> probably
17:32 thunderrd joined
17:32 mattyw joined
17:32 psmolen joined
17:34 <ij> ertes, Okay, I think I can google through this on my own.
17:36 fizruk joined
17:36 skeuomorf joined
17:36 rory left
17:37 replay joined
17:37 bodisiw joined
17:37 insitu joined
17:37 <kamyar> Clint: ?
17:37 numberten joined
17:37 <kamyar> Clint: PLease see my code http://lpaste.net/355507
17:37 <Clint> kamyar: which part of the error message don't you understand?
17:38 <kamyar> Clint: All of it! It is a TH error wo it is not pointing to my code but generated code
17:38 locallycompact joined
17:38 <kamyar> Clint: I know there is some wrong part in my model-mapping
17:38 connrs joined
17:38 FreeBirdLjj joined
17:38 <kamyar> Clint: But dunno which part
17:39 jer1 joined
17:39 <ptek> I wonder if we have any place with packages which allow to quickly write generic programs. Like the pretty-show, hourglass, wreq or req etc...
17:41 <ptek> When one doesn't follow all the packages, a lot of interesting code comes up that simplifies a lot of work for the others.
17:41 Mell joined
17:42 <ptek> I just realised that the pretty-show package would probably remove a lot of code we have written internally for that purpose because it is good enough for us, but I never heard of that before today
17:46 carlomagno joined
17:46 revprez joined
17:46 <koala_man> I have a ipv6-only box with a http proxy. How do I make cabal use it? If I set it up with HTTP_PROXY, it tries using IPv4 and fails
17:46 sw1nn joined
17:47 erikd joined
17:47 <kamyar> I guess no one can help me
17:47 <kamyar> Alas!
17:47 takle joined
17:47 CosmicRay joined
17:48 Levex joined
17:53 oleks joined
17:54 revprez joined
17:55 RegEchse joined
17:56 revprez joined
17:56 verement joined
17:56 xanadu joined
17:56 michaelw joined
17:58 mmachenry1 joined
17:58 entuland joined
17:59 <exarkun> I have some code like `data Foo = Foo { x :: String }` and `bar (Foo x) = ...` and ghc 8 (just upgraded from 7.10ish) complains that the binding for `x` in the latter shadows something in the former.
17:59 mmachenry2 joined
17:59 chaosmasttter joined
17:59 jao joined
17:59 <exarkun> I don't see why this matters or is even shadowing. I didn't even realize the `x` in the `data` statement created a binding ... does it? To what?
18:00 jer1 joined
18:00 <EvanR> the accessor x
18:00 <jle`> exarkun: it's record syntax
18:00 <EvanR> its a top level function
18:00 <jle`> exarkun: are you familiar with like, data Person = MkPerson { name :: String, age :: Int } ?
18:00 takle joined
18:00 revprez joined
18:01 <jle`> that creates a function name :: Person -> String, and a function age :: Person -> Int
18:01 <exarkun> jle`: I understand that that defines a constructor `MkPerson` for a type `Person` with two fields, `name` and `age`
18:01 <Cale> exarkun: When you define a type like that, you're also defining a function x :: Foo -> String which extracts the field.
18:01 sssilver_ joined
18:01 <jle`> i'm surprised that older ghc's didn't warn people for this
18:01 <exarkun> I didn't realize that defined accessors too, that explains it, thanks.
18:01 revprez joined
18:01 romank joined
18:01 <jle`> mhm
18:01 <exarkun> That's a bit annoying ... the name of the field is the obvious name for the variable...
18:02 tosun joined
18:02 <jle`> there's actually some syntactical sugar that takes advantage of this
18:02 <EvanR> x is a bad name for a field
18:02 <EvanR> i mean, x is a bad name for an accessor
18:02 <EvanR> and we have them conflated in haskell
18:03 <EvanR> .x is different from x in elm, i hear
18:03 <jle`> bar (Foo { x }) = ... is syntactical sugar for the shadowy bar (Foo { x = x }) = ...
18:03 <jle`> it shadows the accessor x with the locally bound variable x
18:03 iAmerikan joined
18:03 <jle`> (this is RecordPuns)
18:04 <jle`> and also the infamous RecordWildCards, where bar (Foo{..}) is sugar for bar (Foo {x = x}) = ... (but for all the fields)
18:04 <jle`> but yes, typical naming conventions make situations like this rare
18:04 <exarkun> is RecordPuns good? Should I use it?
18:04 oish joined
18:04 <exarkun> Or should I have a different naming convention?
18:04 <jle`> people usually use "long" and very uniquey record names
18:04 <jle`> and bind it to short variable names
18:05 <jle`> data Person = MkPerson { personName :: String, personAge :: Int }
18:05 <exarkun> https://github.com/LeastAuthority/s4-wormhole-convergence-agent/blob/haskell/MagicWormholeModel.hs is my actual code and has about a million billion cases of this
18:05 <jle`> foo (Person name age) = ...
18:05 <Cale> exarkun: Usually I either don't use record syntax, or I just bind the entire record to a variable and use the field accessors in the body of the function.
18:05 <jle`> but i do use RecordWildCards a lot, and it's endorsed by Simon Marlow so it can't be bad right
18:05 <Cale> It's a bit awkward to pattern match the record fields using the record syntax
18:06 revprez joined
18:06 buttbutter joined
18:06 <Cale> RecordWildCards can be neat for certain styles of programming, but it has a major downside in that it quietly binds a bunch of names which don't appear locally in the code
18:06 sproingie joined
18:06 sproingie joined
18:07 bennofs joined
18:07 <MarcelineVQ> RecordWildCards stress me out when I'm reading something someone else wrote
18:07 <jle`> (note that my comment was slightly tongue in cheek, it's definitely not the case that everybody uses it)
18:07 <tosun> As of the latest GHC, is it possible to get External Core generated from Haskell code? I believe there used to be an -fext-core flag.
18:07 <Cale> MarcelineVQ: exactly!
18:07 ystael joined
18:07 <exarkun> thanks all
18:07 <jle`> RecordWildCards is also kind of weird because it shadows variables with things that have different types
18:08 <Cale> Yeah, the shadowing makes it tricky to refactor code which uses RWC
18:08 <jle`> it's nice when you only have "one" input of the given data type. but if you have two, it becomes unusable and you have to switch from record wild cards style
18:09 maarhart joined
18:09 LHoT10820 joined
18:09 <cocreature> tosun: it’s no longer possible. you can dump the core generated by GHC via -ddump-simpl but that’s only intended for debugging purposes and there is no way to feed it back into ghc to compile it
18:10 <zaquest> when i started with haskell i was surprised that ghc warns about it at all, it seems like a job for some linter, not a compiler, and certainly doesnt seem like a good default (arguably even for a linter) to me
18:10 <cocreature> also the syntax of that output is not described anywhere afaik and can break at any time
18:10 Yuras joined
18:10 <jle`> warning shadowed variables?
18:10 <exarkun> What does the syntax for defining a function that binds the whole record look like?
18:10 <cocreature> zaquest: it’s not the default, it’s only in -Wall
18:10 <jle`> exarkun: foo b = ...
18:10 <exarkun> hmm
18:10 <exarkun> in a way that works with pattern matching?
18:10 <zaquest> jle`, yes
18:11 <exarkun> eg to fix https://github.com/LeastAuthority/s4-wormhole-convergence-agent/blob/haskell/MagicWormholeModel.hs#L83-L84
18:11 <jle`> exarkun: the point of this is to not pattern match and to use accessors instead
18:11 <zaquest> cocreature, oh, i see
18:11 <exarkun> jle`: ah
18:11 <exarkun> ok, maybe I can't do that until I fix my data structure to make more sense
18:11 Monoide joined
18:12 <jle`> exarkun: for what it's worth, Message looks like an unideal candidate for a record
18:12 <cocreature> zaquest: but I agree that it can be annoying. it’s probably the warning I’m most split about regardless of the language. in Haskell I tend to enable it, in other languages I often don’t
18:12 <jle`> exarkun: since literally all of your accessors are partial
18:12 <exarkun> jle`: I had been starting to get that feeling
18:12 <jle`> so it's like, literally the least ideal candidate for a record
18:12 hackebeilchen joined
18:12 <jle`> i'm using literally as an intensifier here but it is also possibly an accurate description
18:13 <exarkun> Heh heh.
18:13 <jle`> exarkun: in your case you don't ever really use the accessors or the record names
18:13 <exarkun> I haven't had any inspiration about what would replace it yet
18:13 <jle`> so you can just get rid of the accessors
18:13 <exarkun> yea. I didn't even _know_ there _were_ accessors ;)
18:14 <jle`> data Message = Welcome Double | Ack Double (Maybe Text) | ...
18:14 <tosun> cocreature: thanks. also, what exactly is the difference between `-ddump-simpl` and `-ddump-ds`? Which one should I use if I want to deal with Core?
18:14 <cocreature> tosun: if you actually want to process the Core you should use a GHC plugin and not use either of those flags.
18:14 <jle`> exarkun: for the heavy constructors like 'Letter', you can define a data type that has the fields you want
18:15 <jle`> data LetterContents = LC { letterSide :: Text, letterPhase :: Text ...}
18:15 sproingie joined
18:15 sproingie joined
18:15 <jle`> and then data Message = ... | Letter LetterContents | ...
18:15 dm3 joined
18:15 <exarkun> makes sense
18:15 <cocreature> tosun: ddump-ds dumps the core after the desugarer has run while ddump-simpl applies the simplifier first so you’ll get the optimized core
18:15 k0001 joined
18:15 <cocreature> tosun: that’s why if you want to figure out why you’re code is slow, you should typically use ddump-simpl
18:16 <MarcelineVQ> where does -ddump-prep fit into that?
18:16 {emptyset} joined
18:16 <MarcelineVQ> is prep just before stg so it should be the most final version of the core?
18:17 <tosun> cocreature: I see. I am interested in the semantics of Core. I guess I should be dealing directly with the `Expr` type from `CoreSyn.hs`?
18:17 <cocreature> tosun: I’m the wrong person to ask for that :)
18:18 <tosun> cocreature: thank you anyways!
18:18 <cocreature> MarcelineVQ: https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/HscMain claims that you’re right. not sure how large the difference is to ddump-simpl. for some reason that seems to be what everybody uses so I use it as well :)
18:20 jer1 joined
18:21 xall joined
18:22 jbalint joined
18:22 jbalint joined
18:23 shlevy joined
18:23 revprez_atlanta joined
18:24 erikd joined
18:24 sssilver joined
18:24 africanus joined
18:24 <africanus> Lauren Kendall Graham
18:25 kirillow joined
18:25 <africanus> golf
18:25 <MarcelineVQ> lkg
18:25 tzh joined
18:27 SkyPatrol joined
18:29 jathan joined
18:29 eschnett joined
18:30 bloogie joined
18:30 `Guest00000 joined
18:30 <bloogie> :t floor . floor
18:30 <lambdabot> error:
18:30 <lambdabot> • Could not deduce (RealFrac a0) arising from a use of ‘floor’
18:30 <lambdabot> from the context: (Integral c, RealFrac a)
18:30 <bloogie> :( why?
18:31 <Tuplanolla> :t floor . fromInteger . floor -- You want this, bloogie.
18:31 <lambdabot> (RealFrac a, Integral c) => a -> c
18:31 <bloogie> thank you
18:31 mac10688 joined
18:31 <jle`> :t floor
18:31 <lambdabot> (Integral b, RealFrac a) => a -> b
18:31 <Cale> but why?
18:32 <kadoban> Why would you do that anyway? Isn't that going to be at-best the same as doing floor once?
18:32 <jle`> bloogie: in floor . floor, it's not clear what the intermediate type is
18:32 <Cale> When you floor, the result has an Integral type which is going to be incapable of representing a fractional part
18:32 <Cale> (e.g. Integer)
18:32 <Cale> So doing floor again doesn't make sense
18:32 <jle`> floor isn't the same as it is in most other languages, where it returns something of the same type or something compatible with the original type
18:33 <jle`> well, it can possibly do that
18:34 <bloogie> kadoban: what I wanted to do was floor . sqrt . floor . log
18:34 <kadoban> Ah
18:34 <jle`> :t floor . (id :: Integer -> Integer) . floor
18:34 <lambdabot> error:
18:34 <lambdabot> • Could not deduce (RealFrac Integer) arising from a use of ‘floor’
18:34 <lambdabot> from the context: (RealFrac a, Integral c)
18:34 atomicturtle joined
18:34 <jle`> oops
18:34 renzhi joined
18:34 <jle`> bloogie: yeah, check out the type of floor
18:34 jathan joined
18:35 <bloogie> bloogie: it's confusing because I don't know the type class heirarchies :/
18:35 <jle`> you can always use ghci
18:35 <Tuplanolla> > floor (1e+309 :: Double)
18:35 <lambdabot> 1797693134862315907729305190789024733617976978942306572734300811577326758055...
18:36 <WarmCookie> bloogie: https://i.stack.imgur.com/TrbOX.jpg
18:36 <jle`> bloogie: your original thing and your second thing are actually somewhat different problems
18:36 renzhi joined
18:36 <bloogie> jle`: true, but I think I have enough information to solve it now
18:36 <jle`> in the original case, you're flooring something to get something of another type, and then flooring that to get something of a third total type
18:36 <bloogie> WarmCookie: wow, thanks
18:36 <jle`> and haskell can't infer what the second, intermediate type is
18:36 <Tuplanolla> Using floating-point math there is questionable, bloogie.
18:36 <bloogie> oh
18:36 <bloogie> what do I do then?
18:37 <jle`> so it's unrelated to the numerical hierarchy
18:37 sssilver joined
18:37 <jle`> in the second case, you have the same issue, but you also have another issue that there isn't any type that floor can give that you can also square root
18:37 <bloogie> ugh
18:37 <jle`> floor only gives Integrals, so you can pick something like Int or Integer
18:37 <jle`> but you can't square root those
18:38 <Cale> bloogie: Are you certain you want to double floor like that? What are you computing?
18:38 eschnett joined
18:38 <bloogie> uh, exactly that?
18:38 <bloogie> @Cale^
18:38 <lambdabot> Unknown command, try @list
18:39 <jle`> what are you using this for? there might be a better way to accomplish this, at the big-picture level
18:39 <Cale> I mean, that's fair enough, if you know it's the correct thing -- it just seems a little odd
18:39 <bloogie> hmm, okay wait
18:39 <jle`> for example, some people use square roots as an upper limit for searching for factors of a number
18:39 metaporia joined
18:40 bsermons joined
18:41 <jle`> > let isPrime n = any (\x -> x `mod` n == 0) (takeWhile (\x -> fromIntegral x < sqrt (fromIntegral n)) [2..] in isPrime 100
18:41 dsh joined
18:41 <lambdabot> <hint>:1:108: error: parse error on input ‘in’
18:41 <bloogie> so if you feel like a fun exercise: http://lpaste.net/355553
18:41 jer1 joined
18:41 <jle`> > let isPrime n = any (\x -> x `mod` n == 0) (takeWhile (\x -> fromIntegral x < sqrt (fromIntegral n)) [2..]) in isPrime 100
18:41 <lambdabot> False
18:41 <jle`> but you don't have to do the awkward conversions
18:41 <jle`> > let isPrime n = any (\x -> x `mod` n == 0) (takeWhile (\x -> x * x < n) [2..]) in isPrime 100
18:41 <lambdabot> False
18:41 <jle`> simpler :)
18:41 torstein joined
18:41 sssilver joined
18:41 <bloogie> I'm conjecturing that the mystery function g2 is equal to something like even . floor . sqrt . floor . log
18:42 <ph88^> how can i make an option like --myoption=alt1|alt2 with optparse-applicative ? i would like to map that to data MyOption = Alt1 | Alt2
18:42 metaporia joined
18:42 tommd joined
18:43 africanus joined
18:43 <bloogie> Cale: so I don't really know if it's the correct thing, but yeah, I doubt you'll get much big picture optimization out of it, if I turn out to be correct.
18:43 <Tuplanolla> > floor (64 ** (1 / 3)) -- You risk bogus results whenever you use floating-point numbers for discrete math, bloogie.
18:43 <lambdabot> 3
18:44 eschnett joined
18:45 <jle`> ph88^: (Alt1 <$ str "alt1") <|> (Alt2 <$ str "alt2")
18:45 <Tuplanolla> > 4 ^ 3 -- The correct result would obviously be `4`.
18:45 <lambdabot> 64
18:45 <bloogie> Tuplanolla: so is there something you can recommend for evaluating the same expression?
18:45 Ryozuki joined
18:45 <bloogie> ... correctly.
18:45 <jle`> ph88^: er wait
18:45 epsilonhalbe joined
18:45 <Tuplanolla> Use a number theory library or write your own algorithm, bloogie.
18:46 <kadoban> bloogie: You can do floored/ceiling log/sqrt in integrals directly. I don't think they're in base though.
18:46 <bloogie> really? isn't that overkill?
18:46 <Tuplanolla> No. It's the Right Thing.
18:46 <bloogie> kadoban: that sounds helpful
18:46 <kadoban> It depends how much it matters to you probably.
18:46 bsmt joined
18:46 <jle`> ph88^: i guess you can do parseAlt "alt1" = Just Alt1; parseAlt "alt2" = Just Alt2; parseAlt _ = Nothing, and do option (maybeReader parseAlt)
18:46 <bloogie> Tuplanolla: is it likely that there's some equivalent formulation that I'm missing?
18:47 <Tuplanolla> The fact that we have floating-point `sqrt` but not integer `sqrt` in `base` is a historical mistake. One that people keep repeating when designing new languages, I might add.
18:47 africanus left
18:48 <Tuplanolla> @let isqrt n = let f x y | y < x = f y ((y + n `quot` y) `quot` 2) | otherwise = x in f n ((n + 1) `quot` 2)
18:48 <lambdabot> Defined.
18:48 <Tuplanolla> > fmap isqrt [0 .. 20]
18:49 <lambdabot> [0,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4]
18:49 <Tuplanolla> Have this one on the house, bloogie.
18:49 <Cale> Tuplanolla: hey, at least we have gcd in the Prelude ;)
18:49 <ski> > gcd 0 0
18:49 <lambdabot> 0
18:49 <Tuplanolla> Nice. I use it so often I didn't even remember, Cale.
18:50 <MarcelineVQ> hmm
18:50 takle joined
18:50 <MarcelineVQ> > map (truncate . sqrt . fromIntegral) [0..20] == map isqrt [0..20]
18:50 <lambdabot> True
18:50 LAZAR joined
18:50 <ski> > 5 `mod` 0 -- still errors out, though :/
18:50 <lambdabot> *Exception: divide by zero
18:50 <jle`> @check \x -> (truncate . sqrt . fromIntegral) x == isqrt x
18:50 <lambdabot> *** Failed! Falsifiable (after 2 tests):
18:50 <lambdabot> -1
18:51 <jle`> @check \x -> (x>0) ==> ((truncate . sqrt . fromIntegral) x == isqrt x)
18:51 <lambdabot> +++ OK, passed 100 tests.
18:51 <Cale> ski: Should it be the identity map?
18:51 verement joined
18:51 <LAZAR> Anyone has an idea how I can incorporate the getRandomNumbers function into the generateItems? http://lpaste.net/355554
18:51 <ski> imho, that would be nice, yes
18:52 <jle`> LAZAR: how do you want to incorporate it
18:52 <ski> (of course `div' would still error out)
18:52 <LAZAR> jle`: It is basically only used there so i can as well refactor it inside
18:53 <jle`> i do not know how to interpret that
18:53 thebardian joined
18:53 <LAZAR> jle`: I would basically need to generate individual numbers in the generateItems itself
18:53 <jle`> it looks like you already did it in line 79?
18:54 <jle`> you used them together :o
18:54 <Tuplanolla> I wonder if we could use lambdabot to automate floating-point math and other such rants.
18:54 <Cale> ski: Or it maybe could just give 0...
18:55 <jle`> LAZAR: generateRandomItems n = generateItems (getRandomNumbers gen n)
18:55 wolfsif joined
18:55 <LAZAR> jle`: yeah the point is it would be cleaner to remove the getRandomNumbers altogether... but i have no idea how to generate single Integers from a generator
18:56 <wolfsif> Hi all
18:56 <jle`> LAZAR: ah i see
18:56 <wolfsif> Can anyone explain why the monad instance for functions is what it is? I understand what it does, it just seems a little arbitrary
18:56 iAmerikan joined
18:56 <jle`> wolfsif: well, it's the "only" possible instance
18:56 <jle`> so in a sense it is anti-arbitrary
18:56 <* hackage> crdt 0.2 - Conflict-free replicated data types https://hackage.haskell.org/package/crdt-0.2 (cblp)
18:56 <Cale> wolfsif: Well, let's derive it
18:57 <Cale> First of all return :: a -> (e -> a)
18:57 <jle`> LAZAR: you can use randomR
18:57 <wolfsif> so that must be const
18:57 <jle`> :t randomR
18:57 <lambdabot> (RandomGen g, Random a) => (a, a) -> g -> (a, g)
18:57 <Cale> We're given a value of type a, and a value of type e, and asked to produce a result of type a. The only sensible thing we can possibly do is give the first argument back
18:58 <Cale> return v e = v
18:58 Ryozuki left
18:58 <Cale> Now (>>=) :: (e -> a) -> (a -> (e -> b)) -> (e -> b)
18:58 <ski> Cale : well .. i tend to not like arbitrary choices :)
18:58 <Cale> (f >>= g) e = ...
18:58 <Cale> So we have f :: e -> a
18:58 <Cale> g :: a -> e -> b
18:59 <ph88^> jle`, what's maybeReader ?
18:59 <Cale> and e :: e
18:59 <jle`> ph88^: maybeReader turns a (String -> Maybe a) into a ReadM a
18:59 <Cale> and the right hand side has type b
18:59 gawen joined
18:59 <jle`> so it turns it into a parser of a's
18:59 <Cale> The only way to produce a value of type b is to apply g
18:59 <bloogie> Cale: isn't it easier to show this kind of stuff for join rather than bind?
18:59 <Tuplanolla> Isn't it easier to start from `Functor`, Cale?
18:59 <Cale> bloogie: Perhaps, but (>>=) is how you actually get the instance written
19:00 <Cale> Right now I'm just deriving the implementation from the type
19:00 exarkun joined
19:00 <wolfsif> it's ok, >>= makes sense
19:00 mstruebing joined
19:00 <wolfsif> I see now why it's the only possible instance
19:00 <bloogie> huh? can't you pick one of bind and join when deriving it?
19:00 <jle`> i think Cale's insight can be trusted in this case
19:00 <jle`> no need to second-guess with alternative explanations in the middle of a perfectly good one :)
19:01 anton____ joined
19:01 <Cale> bloogie: Now, if you want to approach it from a completely different direction, there are a few more intuitive explanations we could pick from...
19:01 <* hackage> namecoin-update 0.2.1.0 - Tool to keep namecoin names updated and well https://hackage.haskell.org/package/namecoin-update-0.2.1.0 (rnhmjoj)
19:01 phaji_ joined
19:01 <Cale> er, wolfsif :)
19:01 jer1 joined
19:02 <ph88^> jle`, that wraps my data type into a Maybe .. but what is the meaning of this Maybe ? in case that option was wrong i want to print to stderr and exit program
19:02 <wolfsif> Cale: sure, what are a few of those intuitive approaches?
19:02 <Cale> One is that to "run" a function means to apply it to the parameter of the function we're writing
19:02 <Cale> e.g.
19:03 <jle`> ph88^: the Nothing is interpreted by readMaybe/option/the library as a failed parse
19:03 <Cale> > (do x <- id; y <- reverse; z <- map toUpper; return (x,y,z)) "hello"
19:03 <lambdabot> ("hello","olleh","HELLO")
19:03 <jle`> so it can be handled by the library
19:03 erikd joined
19:03 <Cale> Here, x is bound to "hello", y to "olleh" and z to "HELLO"
19:04 <jle`> ph88^: that way the library can handle failures in the way it does
19:04 <Cale> So, what does x >>= f normally do when run? Well, it first runs x, then it applies f to the result of that, and runs the resulting action.
19:04 <ph88^> jle`, aah ok
19:04 <jle`> ph88^: so you'd get a nice error like "this option cannot be parsed", and you can even work with the Alternative instance
19:04 <Cale> So if "running" means "applying to our chosen argument"
19:04 <Cale> (x >>= f) e -- when we run (x >>= f)
19:04 sfcg joined
19:05 rblaze joined
19:05 sssilver joined
19:05 <Cale> = let v = x e in ... -- we'll first run x, obtaining some result v
19:05 <Cale> = let v = x e in f v ... -- then we'll apply f to it in order to get another action to be run
19:05 <Cale> = let v = x e in f v e -- and run that
19:06 sproingie joined
19:07 <Cale> and then a different perspective can also be had, by thinking of functions e -> a as being like arrays indexed by values of type e, holding values of type a
19:07 <Cale> This is perhaps a little easier to grasp from the Functor instance first
19:07 <wolfsif> Cale: hold on a sec, need to take a minute to process what you've written so far
19:07 <Cale> okay :)
19:08 <bloogie> Cale: that was wonderful, is there a paper that deals with this?
19:08 insitu joined
19:08 <LAZAR> When i have System.Random imported, why does it complain • Variable not in scope: gen :: StdGen
19:09 augur joined
19:09 <ph88^> jle`, how can i make an option --mynumber and when the number is -1 i want Nothing and if it's 0 or greater i want Just 0 ?
19:09 smwangi joined
19:09 <exarkun> What do I do when I have a Lazy Bytestring and a function that takes a regular ByteString?
19:10 <Rembane> exarkun: Convert it to a regular ByteString with toStrict.
19:10 <Rembane> exarkun: toStrict lives in the Lazy ByteString module.
19:10 <ski> bloogie : have you tried the original Wadler papers on monads ?
19:10 osa1 joined
19:10 osa1 joined
19:10 <Cale> Not in exactly the way that I just treated it, but as far back as the earliest papers by Moggi and Wadler about the relationship between monads and programming, there will be talk of this particular monad
19:10 <exarkun> Rembane: thanks
19:10 augur joined
19:10 <bloogie> does that go into the function monad, ski ?
19:10 <bloogie> this is Reader, right?
19:10 <ski> iirc, yes
19:10 <ski> but they call it "environment" or "input", i think
19:10 <Rembane> exarkun: np.
19:11 <ski> bloogie : aye, basically
19:11 <LAZAR> When usin randomR repeatedly, how do I make sure the generator is updated each time?
19:11 <ski> (they also call `Writer', "output")
19:11 oish joined
19:11 <* ski> prefers the generic name "environment"
19:11 <EvanR> :t randomR
19:11 <Cale> So one thing to notice about the corresponding Functor instance:
19:11 <lambdabot> (RandomGen g, Random a) => (a, a) -> g -> (a, g)
19:11 <Cale> fmap :: (a -> b) -> (e -> a) -> (e -> b)
19:12 <Cale> this can only be function composition
19:12 <EvanR> LAZAR: it returns the updated generator, each time
19:12 <ski> LAZAR : thread the generator through the computation .. possibly with the help of `State' or `StateT'
19:12 <jle`> ph88^: i don't think that's normal functionality, but you make a parser for a flag using flag
19:12 gabe4k joined
19:12 <ski> LAZAR : there's also `randomRs', if you just locally need some number of random values of the same type
19:12 <Cale> But also, it makes sense intuitively, if you think of a function (e -> a) as a container indexed by values of type e
19:12 <jle`> ph88^: then you can use traverse to create bunches of different flags
19:12 <EvanR> or use Data.Monad.Random
19:12 quobo joined
19:13 <Cale> You're applying the function of type (a -> b) to all the "elements" of that container (e -> a)
19:13 <wolfsif> that makes sense
19:13 <jle`> but then you'd be making a flag parser for every integer heh
19:13 <Cale> in order to obtain a container of type (e -> b)
19:13 <ph88^> jle`, what do you mean parser for a flag using a flag ?
19:13 <jle`> the 'flag' function
19:13 <ph88^> oh a function
19:13 <wolfsif> my first thought was that the monad instance would just be composition, actually
19:13 <jle`> typically optparse-applicative works best when you have a finite number of flags
19:13 darjeeli1 joined
19:14 <Cale> Now from that perspective, maybe it's more natural to describe join first
19:14 <ph88^> i just need this logic if val == -1 then Nothing else Just val
19:14 <ski> > (`evalState` mkStdGen 1234) (replicateM 5 (state (randomR (0,9)))) -- in actual practice, use `newStdGen' rather than `mkStdGen'
19:14 <Cale> join :: (e -> (e -> a)) -> (e -> a)
19:14 <lambdabot> [7,5,1,6,1]
19:14 <jle`> ph88^: can you do something like --myoption 1, --myption 2, --myption 3, etc.?
19:14 <jle`> instead of --1, --2, --3
19:14 <ph88^> no
19:14 <ph88^> the user gives the float precision he wants
19:15 <shlevy> Is there any way to declare a type family injective given one of its params is fixed/known?
19:15 <jle`> --precision 10
19:15 <Cale> it's going to take a container of containers, and somehow collapse it to a single-level container -- what does it do? Well, it extracts the ith index of the ith container
19:15 <ph88^> --precision=3 is default
19:15 <jle`> that's fine
19:15 <ph88^> --precision=-1 disable
19:15 <Cale> join f i = f i i
19:16 <Cale> and then from fmap and join, you can recover bind yet again
19:16 <wolfsif> makes sense :)
19:16 <jle`> ph88^: that'd be option (mfilter (> 0) auto) (long "precision" <> short 'p' ....)
19:16 chaosmasttter joined
19:16 <Cale> and note that return v is then the container that contains v at every index
19:17 yqt joined
19:18 phyrex1an joined
19:18 <jle`> that error message probably wouldn't be the cleanest
19:18 <Cale> For any given monad in Haskell, there tend to be at least two ways to think about its values -- a computational way, and a container-ish way. Sometimes one will make more sense than the other, usually the computation-y way will win, because that's closer to how we're usually thinking, given that we're writing programs.
19:18 <ph88^> jle`, doesn't that just validate that the option should be bigger than 0 ? i would like to be able to disable this precision stuff, the default should be 3
19:18 gabe4k joined
19:19 sssilver joined
19:19 cyborg-one joined
19:19 mada joined
19:19 <jle`> ah yea,h sorry, you can have a default value
19:19 <Cale> Often the "containers" will get very baroque and involve a lot of the sort of imagination required to think of functions as containers.
19:19 <jle`> option myParser (long "precision" <> short 'p' <> value 3)
19:19 AlexRussia joined
19:19 <ph88^> jle`, in my code i use showpFFloat from https://hackage.haskell.org/package/bytestring-show-0.3.5.6/docs/Text-Show-ByteString.html
19:19 <jle`> and fi you had ... <> showDefault, then it'll display the default option in the help
19:20 <wolfsif> the containers approach makes more sense to me for some instances -- specifically for Maybe
19:20 <jle`> when you do --help, it'll show that the default is 3
19:20 <Cale> Yeah, for Maybe and lists, it makes good sense
19:20 <wolfsif> Cale: thanks for the explanation, was very helpful
19:20 <Cale> But it's important to understand the computational side of those too
19:20 <wolfsif> does the monad for functions come up much in practice?
19:21 <Cale> wolfsif: Not directly all that often...
19:21 sgflt joined
19:21 gnurp joined
19:21 <ph88^> jle`, should i build my own parser with one of these functions? https://hackage.haskell.org/package/optparse-applicative-0.13.2.0/docs/Options-Applicative-Builder.html#g:3
19:21 <Cale> But ReaderT does get used in practice.
19:21 <jle`> you could
19:21 <jle`> 'auto' is already one that just uses read
19:21 <ski> for lists, it means "trying all alternatives","nested looping"
19:21 <wolfsif> I was about to say it seems like a less general Reader hahah
19:21 <jle`> ph88^: auto = maybeReader readMaybe, pretty much
19:21 <Cale> > do x <- [1,2,3]; y <- [4,5]; z <- [6,7,8]; return (x,y,z)
19:21 <lambdabot> [(1,4,6),(1,4,7),(1,4,8),(1,5,6),(1,5,7),(1,5,8),(2,4,6),(2,4,7),(2,4,8),(2,...
19:22 thunderrd joined
19:22 <jle`> ph88^: but if you want you can use eitherReader to give a nicer error message
19:22 <Cale> "Running" a list means to pick an element from it (in all possible ways)
19:22 <ski> now throw in a `guard' in there ..
19:22 jer1 joined
19:22 <Tuplanolla> @let toFunc xs = \ i -> xs !! i -- I think this is a nice way to see functions as containers, wolfsif.
19:22 <lambdabot> Defined.
19:22 <Cale> > do x <- [1,2,3]; y <- [4,5]; z <- [6,7,8]; guard (even (x + y + z)); return (x,y,z)
19:22 <lambdabot> [(1,4,7),(1,5,6),(1,5,8),(2,4,6),(2,4,8),(2,5,7),(3,4,7),(3,5,6),(3,5,8)]
19:22 <ph88^> jle`, i don't think i can use readMaybe here because i need to implement this logic if val == -1 then Nothing else Just val
19:22 <Tuplanolla> :t toFunc "nice"
19:22 <ski> if you're familiar with Prolog, then this is a bit like backtracking there
19:22 <lambdabot> Int -> Char
19:23 <shapr> mm, prolog
19:23 iAmerikan joined
19:23 <ph88^> hi shapr
19:23 <shapr> hi ph88^ ! How's code?
19:23 dm3 joined
19:23 <ph88^> good :P
19:23 <* ski> nods to shapr
19:23 <shapr> tjena ski!
19:23 <ph88^> i'm making a small program to some dsp
19:23 <shapr> oh neat
19:24 <ph88^> measuring TIE
19:24 <jle`> ph88^: maybeReader (mfilter (> 0) . readMaybe)), or \x -> case readMaybe x of Just y | y > 0 -> Just y; _ -> Nothing
19:24 <jle`> if you like it with points
19:24 <shapr> I bought a hat and I'm trying to figure out how to power 100 watts of LEDs on the hat.
19:24 <ph88^> lol
19:24 <ph88^> thx jle`
19:24 <srk> :D
19:24 <* ski> points
19:24 <srk> shapr: ws2812?
19:24 <jle`> which is just mfilter (> 0) auto
19:24 juanpaucar joined
19:24 <shapr> srk: yes, two 144x strips
19:24 <srk> want a hat like that as well ^^ :D
19:25 <srk> with audio input and fft
19:25 <srk> :D
19:25 slack1256 joined
19:25 <Cale> shapr: What kind of hat is it?
19:25 <shapr> srk: yeah, exactly!
19:25 <jle`> but if you like error messages, you can do `auto >>= \x -> if x > 0 then return x else readerError (show x ++ " is too little")`
19:25 mstruebing joined
19:25 <shapr> Cale: it's a kavu chillba
19:25 darjeeli1 joined
19:25 <Cale> ah, cool!
19:26 mstruebing joined
19:26 Kreest__ joined
19:26 <shapr> I did the area calculation to figure out how many LEDs it would hold, looks like I could fit about 250 watts of LEDs, but there's no way I could get more than 15 watts of power in the hat.
19:26 <ski> for safety reasons ?
19:27 <ph88^> jle`, that code you gave me gives me: No instance for (Num (Maybe Int)) arising from the literal ‘0’
19:27 coot____ joined
19:27 <shapr> for weight reasons! Six lipo cells is about as much weight as I can possibly consider putting on my head.
19:27 <jle`> ph88^: which one
19:27 sw1nn joined
19:27 <slack1256> diagrams isn't really for a one off diagram like tikz right?
19:27 <Tuplanolla> How about manpower, shapr?
19:27 <slack1256> it has other use cases in mind
19:27 <slack1256> ?
19:27 JelloRaptor joined
19:27 uglyfigurine joined
19:27 <shapr> I got some verilog code to drive ws2812b chips, but I'd rather rewrite it in clash-lang so Haskell would be driving my hat.
19:27 shayan_ joined
19:28 <shapr> Haskell on Hats! That would be awesome!
19:28 <Cale> I've taken to wearing top hats. There'd be a fair amount of room in there for batteries, but I'm not sure how well it'd fit with the aesthetic. :)
19:28 <byorgey> slack1256: sure it is
19:28 jbalint joined
19:28 jbalint joined
19:28 quobo joined
19:28 <byorgey> slack1256: I use it for that all the time
19:28 <Cale> https://www.historicalemporium.com/store/media/006616/006616_01.jpg
19:28 <* ski> imagines a unicycle with a generator powering shapr's hat
19:28 <shapr> Cale: If you put a hundred watts of LEDs on a top hat, I am certain you would fit in at the music festivals I attend.
19:28 <shapr> ESPECIALLY if it's running Haskell code!
19:29 <Cale> That's a lot of watts for LEDs
19:29 <JelloRaptor> Okay I can't figure this out :/ I've got this project (https://github.com/rohit507/sbv-synthesis-toy/blob/master/src/API.hs) where I try to derive Generic on a standard enum and i get " Illegal deriving item ‘Generic'" I've got the extension on, so I have no clue what's doing it
19:29 <shapr> yah, I think I may need a capacitor for bursts of color.
19:30 <lyxia> JelloRaptor: you might have gotten the wrong "Generics"
19:30 <ph88^> jle`, option (maybeReader (mfilter (> 0) . readMaybe)) ( long "precision" ..
19:30 <shapr> Cale: there's plenty of space on that hat you linked for LEDs, I'd suggest the 144 neopixel strips from adafruit.
19:30 <Cale> haha
19:30 <ph88^> jle`, but this gave the same error: option (mfilter (> 0) auto) ( long "precision" ..
19:31 <shapr> Cale: have you written any clash-lang code?
19:31 <JelloRaptor> lyxia: is there a separate one, other than one in syb?
19:31 <lyxia> JelloRaptor: Data.Generics is "Scrap your boilerplate"-generics, driven by the Data typeclass. The Generic typeclass comes from GHC.Generics.
19:31 <slack1256> byorgey: where do I look for just user facing api? Diagrams.Prelude?
19:31 oisdk joined
19:31 <shapr> oh, I need to check on the HacBoston venue again, I want to bring Haskell on Hat to HacBoston
19:31 <shapr> HATBOSTON
19:31 <byorgey> slack1256: yes
19:31 <slack1256> I am more interested on the drawing that learning what TrailLike does
19:31 <* shapr> hops cheerfully
19:32 <* ski> . o O ( HaskBoston )
19:32 <Cale> shapr: I haven't, but one of the people who I work with at Obsidian (John Ericson) does
19:32 <byorgey> slack1256: and take a look at the tutorials and user manual
19:32 <jle`> ph88^: it seems to work for me
19:32 <jle`> it's a `Parser a`
19:32 <jle`> oh wait, do you expect it to be a `Parser (Maybe a)` instead?
19:32 <shapr> Cale: we could have a Haskell on Hat meetup!
19:32 wolfsif joined
19:33 <Cale> hahaha
19:33 <ski> @where Hat
19:33 <lambdabot> http://www.haskell.org/hat/
19:33 <jle`> ph88^: right now it's a `Parser a`, and if you use it with optparse-applicative, it will always return a succesful number
19:33 eschnett joined
19:33 <Cale> There would be no question which tool to use to debug the programs running on our hats
19:33 <jle`> ph88^: oh i see. so if you give -1, it should error, and if you give nothing, it will be 3
19:34 <jle`> ?
19:34 <lyxia> JelloRaptor: GHC.Generics is the newer approach.
19:34 <ph88^> jle`, i don't want it to error at -1 .. this is a valid option to disable the floating point rounding
19:34 zero_byte joined
19:35 <jle`> so, what should happen when you give --precision=-1 ?
19:35 <wolfsif> Cale: do you have any writing on Haskell online?
19:35 <ph88^> jle`, i would like to use this logic if val == -1 then Nothing else Just val and then use that for the input of the showpFFloat https://hackage.haskell.org/package/bytestring-show-0.3.5.6/docs/Text-Show-ByteString.html
19:35 <ph88^> jle`, with -1 i should get Nothing, with 0 or higher i should get Just 0
19:36 <ph88^> jle`, with -2 or less i don't care what happens
19:36 <jle`> ah, i see
19:36 <jle`> and with nothing specified, you'll get 3 ?
19:36 mstruebi1 joined
19:36 <lyxia> JelloRaptor: if you just want to derive Data, you can import Data.Data (from base) rather than Data.Generics
19:36 <JelloRaptor> lyxia: aha, two libs I use ask for two different approaches.
19:36 <jle`> * Just 3
19:37 <Cale> wolfsif: A little here and there. For the most part, I tend to give my bits and pieces interactively via IRC :)
19:37 <JelloRaptor> lyxia: cool, that's a lot nicer
19:37 <ph88^> jle`, if the option is not on the command line, that is --precision is missing it would be like --precision=3
19:37 <shapr> srk: although I suspect a band pass filter and a noise filter would work just as well as an FFT
19:37 <wolfsif> Cale: ok :) -- only problem with IRC is that I can't read all of it hahah
19:38 <srk> shapr: indeed but you need variable gain
19:38 <jle`> ph88^: that'd be option (\x -> (if x == (-1) then Nothing else Just x) <$> auto) (long "precision" <> value 3 <> showValue)
19:38 <ski> @wiki Monads as computation
19:38 <lambdabot> https://wiki.haskell.org/Monads_as_computation
19:38 <ski> @wiki Monads as containers
19:38 <lambdabot> https://wiki.haskell.org/Monads_as_containers
19:38 <jle`> ph88^: or (\x -> (if x == (-1) then Nothing else Just x)) <$> option auto (long "precision" <> value 3)
19:39 <shapr> @wiki Monads_as_burritos
19:39 <lambdabot> https://wiki.haskell.org/Monads_as_burritos
19:39 <jle`> oh the first one should be value (Just 3)
19:39 <lyxia> JelloRaptor: what libs are you using
19:39 takle joined
19:40 mstruebi1 joined
19:40 <jle`> ph88^: basically you can just do `option auto (long "precision" <> value 3)` to get a Parser Int
19:40 <jle`> and you can fmap whatever function you want on it
19:40 <lyxia> JelloRaptor: oh I see sbv depends on syb.
19:40 <jle`> fmap :: (Int -> Maybe Int) -> Parser Int -> Parser (Maybe Int)
19:41 <jle`> ph88^: that part is pretty much independent of the parsing part, it's just normal haskell sutff
19:43 jer1 joined
19:43 erikd joined
19:44 <shapr> srk: ok, I'm convinced. and I discovered that my teensys have FFT libs, so that's likely what I'll use to drive a pile of neopixels for the moment.
19:44 <ph88^> aaah ok
19:44 <ph88^> i'm familiar with this stuff from megaparsec .. just didn't think of it this way for optparse
19:44 ixian joined
19:45 <jle`> ph88^: ah yeah. a `Parser a` is something that can pull an option configuring a value of type 'a' from command line arguments
19:45 <ph88^> sweet !
19:45 <jle`> so `(f :: a -> b) <$> (p :: Parser a) :: Parser b` maps f over the result of the parser
19:45 <ph88^> no more type errors
19:46 <ph88^> haven't implemented the logic yet to test the actual option .. but i trust it will be ok now it type check
19:46 <jle`> the applicativey part is that Parsers are all run "in parallel"
19:46 fotonzade joined
19:46 <jle`> in that they all operate on the same command line argument list
19:46 <ph88^> jle`, can i also map validator function over it so that the parsing can fail ?
19:47 Gurkenglas joined
19:47 ziocroc joined
19:47 kau joined
19:47 flatmap13 joined
19:48 <Ulrar> Mh, trying to install twitter-conduit warns me that it's going to break a lot of packages reinstalling stuff
19:48 <jle`> ph88^: i don't think you can do it directly on a parser
19:48 <Ulrar> Is there some trick I should know about that ?
19:48 <jle`> failure is a part of the construction of a parser
19:49 <ph88^> jle`, after parsing i get a data structure of Options i could then do some further validation and make a new data structure
19:49 <jle`> yes
19:50 MarioBranco joined
19:50 <jle`> but that'll be outside of the Parser system
19:50 <jle`> er, outside of optparse-applicative
19:50 xcmw joined
19:51 <lyxia> Ulrar: using cabal?
19:52 <Ulrar> lyxia: Yes
19:52 sssilver_ joined
19:52 <Ulrar> Looks like most of the listed things are : bytestring-0.10.0.2 -> 0.10.8.1
19:53 <lyxia> use a sandbox, or the experimental new-build
19:53 <Ulrar> lyxia: Well I'm developing an app, there is nothing else on that machine
19:53 baldrick joined
19:53 <Ulrar> So it's conflicting with libs I actually use, looks like
19:54 Luke joined
19:54 MarioBranco joined
19:54 obadz joined
19:54 sqrt2 joined
19:55 <Ulrar> lyxia: If I use --force-reinstalls, it will at least try to re-install borken packages, right ?
19:55 <Ulrar> Who knows, it might work
19:56 juanpaucar joined
19:57 oisdk joined
19:57 mojjo joined
19:57 <lyxia> I don't remember what it does if you still go that way.
19:57 doomlord joined
19:58 <Ulrar> Guess I'll remove the .cabal and .ghc and just add twitter-conduit to my cabal file
19:58 gokussjx joined
19:58 <Ulrar> See if it manages to install everything together from scratch
19:59 <Ulrar> Looks like the resolution went fine, that's a good sign
20:00 <* hackage> hans 3.0.2 - Network Stack https://hackage.haskell.org/package/hans-3.0.2 (TrevorElliott)
20:00 <lyxia> my guess is that the app is going to run fine, but you are going to run into problems if you do long term development on that machine
20:01 <Ulrar> Well tbh, if I just have to rm -Rf .cabal .ghc from time to time, I don't really mind
20:01 <Ulrar> It's a big server anyway, it'll compile all of that fast
20:02 <* hackage> split 0.2.3.2 - Combinator library for splitting lists. https://hackage.haskell.org/package/split-0.2.3.2 (BrentYorgey)
20:02 <Ulrar> I just didn't realise cabal didn't like updates
20:03 takle joined
20:03 commanderinchief joined
20:07 jer1 joined
20:07 fendor joined
20:08 juanpaucar joined
20:08 sssilver joined
20:10 zero_byte joined
20:11 fendoer joined
20:11 tefter joined
20:11 twomix joined
20:12 <hvr> Ulrar: that's what's going to change w/ http://cabal.readthedocs.io/en/latest/nix-local-build-overview.html
20:13 <MarcelineVQ> is there a fixed sized version of Set where an insertion into a full set replaces the most similar occupant? say some size 3 set with the already inserted values [0.0,0.1,2.0] where insert 0.3 would give you [0.0,0.3,2.0]
20:14 <MarcelineVQ> *most similar/ordinally closest
20:14 <t7> is there a name for the thing a function returns that is not a function?
20:15 <t7> like the last thing
20:15 Eduard_Munteanu joined
20:15 cloudhead joined
20:16 <Ulrar> Oh that's cool
20:16 <Ulrar> I like nix
20:17 cdg joined
20:17 <glguy> t7: Functions always take one argument and return one result, so there's no special concept of the "last" return.
20:17 <EvanR> i thought i was cool trying to show an abbreviated form of the exception by using show . typeOf
20:17 <EvanR> but its SomeException...
20:18 jrahmy_ joined
20:20 kamyar joined
20:20 juanpaucar joined
20:20 <kamyar> Helo fellows
20:20 <cheater> is stm considered lock-free?
20:21 takle joined
20:22 <t7> i think so
20:22 <t7> doesnt it retry on fail?
20:23 <t7> i watched an spj talk years ago
20:23 <cheater> it does retry on fail
20:23 <cheater> but like, it does take locks at some point, right?
20:24 <kamyar> http://lpaste.net/355558
20:26 oisdk joined
20:26 <fryguybob> cheater: The implementation is close to being lock-free and it is based on one that is, but it isn't quite
20:26 <cheater> close to, but yeah, locks at some point
20:26 CoderPuppy joined
20:26 jer1 joined
20:26 <kamyar> I am trying to change Persistent code to Groundhog. But I have error
20:27 <fryguybob> cheater: There is a moment where two committing transactions can cause eachother to abort.
20:27 dm3 joined
20:28 <fryguybob> cheater: So in that rare instance, progress is not made.
20:28 <cheater> is stm considered wait-free?
20:29 <cheater> fryguybob: yeah, i'm not talking about a case like that, that's degenerate and eventually will resolve itself
20:29 <fryguybob> cheater: No
20:29 <cheater> as i understand
20:29 <cheater> why is stm not wait-free?
20:29 sepp2k1 joined
20:29 <fryguybob> cheater: There is no guarantee that it will resolve itself
20:30 <cheater> oh really?
20:30 <fryguybob> cheater: "Really not likely in a real world execution" is different from that execution being possible.
20:31 <exarkun> Where do I get a SHA256 to pass to https://hackage.haskell.org/package/hkdf-0.0.1.1/docs/Crypto-HKDF.html ?
20:31 <fryguybob> cheater: You can craft transactions that will hit that condition repeadedly.
20:31 <cheater> oh
20:31 <cheater> interesting
20:31 erikd joined
20:31 <cheater> can you make a version of stm that adds random waits to prevent this?
20:31 <fryguybob> cheater: Wait-free means that every thread will always make progress.
20:32 <fryguybob> cheater: That would mean no thread could be impeeded by another thread.
20:32 <cheater> right
20:32 <fryguybob> cheater: You could just fix the problem directly.
20:32 justinfokes joined
20:32 <cheater> yea but in a complex system you can't really *predict* that this degenerate case won't happen
20:33 <cheater> it sounds to me like it's a situation where a system attains a non-optimal local minimum
20:33 <cheater> and can be kicked out of it with some heat
20:33 <fryguybob> It is a bit more complicated, but when two transactions are committing and they see the other transaction's lock, they synchronize on an outcome to ensure that at least one of them succeeds.
20:33 <cheater> do you know what i mean?
20:34 <fryguybob> cheater: Yes that sort of thing is often used in contention management.
20:34 <cheater> do you think this could reduce this issue in stm?
20:34 <fryguybob> Exponential backoff locks being an example
20:35 <fryguybob> cheater: I don't think it is something in Haskell STM that causes anyone issues. If it is I would love to have a bug report!
20:35 <davean> wait-free every member will *eventually* make progress
20:35 <cheater> cool fryguybob
20:35 <cheater> are you the maintainer of stm now?
20:35 <cheater> davean: aha..
20:35 <davean> every member always making progress is closer to wait-free population oblivious?
20:35 <fryguybob> cheater: I'm a researcher working on implementations.
20:35 <cheater> cool!
20:36 <cheater> i tried showing someone stm recently, there's a short 16 min video of spj on youtube, but it's without slides :( so they hated it
20:36 <fryguybob> davean: Yes eventually being a finite number of steps.
20:36 <hexagoxel> MarcelineVQ: you mean something that is 3 times faster than building that function on top of Data.Set? no idea.
20:36 <cheater> finite but unbounded by a maximum, right?
20:36 xcmw joined
20:36 <davean> fryguybob: I'm commenting because thays not how I read what you said: "fryguybob cheater: That would mean no thread could be impeeded by another thread."
20:37 <fryguybob> davean: :D By impeeded I mean blocked.
20:37 <davean> fryguybob: ah, funny use of the term. I'd not have guessed that.
20:38 cpup joined
20:39 <fryguybob> davean: Yeah, slowed down for a bit is fine and that probably fits better with "impeeded". Sorry for the confusion.
20:39 <davean> Of course. "Slowed down" is why we have the term wait-free :)
20:39 justinfokes joined
20:39 <davean> wait-free can be slowed down quite a lot in practice :/
20:40 <davean> ... still waiting for good multicore scaling
20:42 aring joined
20:42 armyriad joined
20:43 <MarcelineVQ> hexagoxel: mostly I'm just curious, there seems to be a lib for everything if a person can find it :>
20:44 RGamma joined
20:45 <hexagoxel> MarcelineVQ: there might even be some package around provides some useful searching for hackage, but nobody has found it yet :>
20:46 RGamma joined
20:47 justinfokes joined
20:48 takle joined
20:49 fizruk joined
20:49 cretiq joined
20:49 RGamma joined
20:49 justinfokes joined
20:51 <ph88^> when is sourceHandle going to throw an exception if the file can not be opened? https://hackage.haskell.org/package/conduit-0.2.2/docs/Data-Conduit-Binary.html
20:51 <* hackage> zip-stream 0.1.0.1 - ZIP archive streaming using conduits https://hackage.haskell.org/package/zip-stream-0.1.0.1 (DylanSimon)
20:51 <ph88^> i mean sourceFile
20:51 planck_ joined
20:52 baldrick joined
20:52 jer1 joined
20:52 <ph88^> at runResourceT ?
20:54 {emptyset} joined
20:54 kau joined
20:55 <JelloRaptor> .pf (\ i -> f (g i) i)
20:55 <JelloRaptor> .pointfree (\ i -> f (g i) i)
20:56 <JelloRaptor> .pointless (\ i -> f (g i) i)
20:56 <JelloRaptor> <_<'
20:56 <JelloRaptor> what's the bot's command again?
20:56 <hexagoxel> @pl (\ i -> f (g i) i)
20:56 <lambdabot> f =<< g
20:56 <shapr> @pl \x -> x + 1
20:56 <lambdabot> (1 +)
20:57 <JelloRaptor> huh, i suppose it is a reader
20:57 <jle`> @pl \x -> x `f` 1
20:57 <lambdabot> (`f` 1)
20:58 RGamma joined
20:58 <jle`> @pl \x -> x ++ 1
20:58 <lambdabot> (++ 1)
20:58 <jle`> pl must have some really weird special case for +
21:00 bigos joined
21:00 jabesed joined
21:00 theorbtwo joined
21:01 justinfokes joined
21:02 oleksiyp joined
21:02 bjz joined
21:02 <jabesed> so I was drafting the design for my structures (which I want modular) and a pattern started to emerge and I'm wonder if it's idiomatic
21:05 ertes joined
21:05 gillesmajor left
21:06 <jabesed> the basic idea is to use GADT's to tag the shape of the structure with appropriate types, and then a substructure is obtained via a wrapper structure and type families
21:06 bennofs1 joined
21:06 mrcrjs joined
21:06 aring joined
21:07 sproingie joined
21:07 sproingie joined
21:07 <glguy> jabesed: That might not be specific enough to get solid feedback
21:08 entuland joined
21:08 <jabesed> so one could have e.g. BaseType1, BaseType2, Exp, :=>:
21:09 <jabesed> this means my structures could be typed e.g. BaseType2 :=>: Exp (Exp BaseType1)
21:09 JeanCarloMachado joined
21:09 JeanCarl1Machado joined
21:09 <jabesed> but now I only want substructures of the form t ::= BaseType1 | Exp t :=> t
21:10 jer1 joined
21:10 epsi10n joined
21:11 ChaiTRex joined
21:11 <jabesed> so one would define BT1, :=>>: and use a type family to assign BT1 to BaseType1 and =:> to Exp t :=>;
21:11 <jabesed> ops
21:11 <jabesed> so one would define BT1, :=>>: and use a type family to assign BT1 to BaseType1 and t1 :=>>: t2 to Exp t1 :=>: t2
21:12 <jabesed> If this is too vague to get the idea, I'll code it and come back later
21:13 <jabesed> the idea though is to have two GADTs using the usual approach to typing each term according to their structure
21:13 <jabesed> but have the first defined via calls to the second using type families
21:13 <jabesed> which effectively results in a subset of the shapes allowed for the original one
21:14 laplacian joined
21:14 grumble joined
21:14 ccomb joined
21:14 anuxivm joined
21:16 doomlord joined
21:19 themagician joined
21:20 <Unode> If I wanted to fmap something like (||) over a [Bool] what should I use?
21:21 <thang1> :t any
21:21 <lambdabot> Foldable t => (a -> Bool) -> t a -> Bool
21:21 <thang1> (I think this is the one you want)
21:21 <thang1> > any (||) [True, False, True, True, False, False]
21:21 <lambdabot> error:
21:21 <lambdabot> • Couldn't match type ‘Bool -> Bool’ with ‘Bool’
21:21 <lambdabot> Expected type: Bool -> Bool
21:21 sleffy joined
21:21 <Unode> thang1: thanks that's useful but I'm trying to understand the cardinality part
21:22 <Unode> i.e, (||) takes 2 arguments..
21:22 <thang1> oh right
21:22 <jle`> Unode: you can't really fmap (||) over a list of Bool's
21:22 <jle`> but you can do things like
21:22 <jle`> > fmap (|| True) [False, True, False]
21:22 <lambdabot> [True,True,True]
21:22 <thang1> My brain isn't fully awake yet, what jle` said
21:22 <ChaiTRex> > any id [True, False, True]
21:23 <lambdabot> True
21:23 <jle`> you can fmap (|| True) since it takes a single Bool argument and returns another one
21:23 <ChaiTRex> > any id [False, False, False]
21:23 <exio4> Unode: I think you might want a fold(r)
21:23 <lambdabot> False
21:23 oisdk joined
21:23 <jle`> if you wanted to fold up (||) over a list of Bools
21:23 <Unode> jle`: right, well what I want is more like [1,2,3,4] -> [1 || 2, 2 || 3, 3 || 4]
21:23 <jle`> > foldr (||) False [False,True,False]
21:23 <lambdabot> True
21:23 <jle`> Unode: ah i see
21:23 <ChaiTRex> Unode: You mean like bitwise or?
21:23 <exio4> oh, well, that's zip (||) xs (drop 1 xs) :P
21:23 <Unode> jle`: yes the fold is my next step, but trying to do it stepwise.
21:23 <jle`> you can get a list of consecutive pairs using zip xs (drop 1 xs)
21:23 <exio4> zipWith}
21:24 <thang1> Unode: the next step? What are you trying to do overall?
21:24 <jle`> > zip [1,2,3,4] (drop 1 [1,2,3,4])
21:24 <lambdabot> [(1,2),(2,3),(3,4)]
21:24 <jle`> and then yuo can do functions with them
21:24 <jle`> > (\xs -> zipWith (||) xs (drop 1 xs)) [True,False,True,True]
21:24 <lambdabot> [True,True,True]
21:24 <jle`> > (\xs -> zipWith (||) xs (drop 1 xs)) [True,False,False,True]
21:24 <Unode> thang1: the actual thing is [FilePath] -> IO Bool
21:24 <lambdabot> [True,False,True]
21:24 <* hackage> data-tree-print 0.1.0.0 - Print Data instances as a nested tree https://hackage.haskell.org/package/data-tree-print-0.1.0.0 (lspitzner)
21:25 <thang1> So you're taking a list of FilePaths and you want to figure out if they're all valid?
21:26 aring joined
21:26 <Unode> thang1: I was trying something like "(||) . doesFileExist" but that is wrong it many ways.
21:26 metaporia joined
21:26 davr0s joined
21:27 <thang1> So each FilePath in your [FilePath] is a path to a file and you want to determine if all files exist? Or do you just want to operate on all the files that do exist and silently skip empty directories?
21:27 mrcrjs joined
21:27 afarmer joined
21:28 <Unode> thang1: no, I actually want a summary over all files. I.e. know if all files exist, otherwise return False.
21:28 epsi10n left
21:28 juanpaucar joined
21:29 <* hackage> snap-server 1.0.2.2 - A web server for the Snap Framework https://hackage.haskell.org/package/snap-server-1.0.2.2 (GregoryCollins)
21:29 <thang1> Okay, I see now. First thing that jumps out to me is that Haskell has an incredibly expressive typesystem compared to most languages and so using boolean feels wrong to me. If you want to know if all files exist or not, why wouldn't you have a type that directly reflects that?
21:29 srh_ joined
21:29 <Unode> jle`: so drop 1 leaves the 1st element out and zip stops as soon as the first list is out of elements, got it. Thanks.
21:29 <thang1> (But that's a tangent and minor nitpick)
21:30 <Unode> thang1: well, I literally want a yes/no answer so bool read fine.
21:31 pera joined
21:31 <ChaiTRex> Unode: Maybe something like: fmap (all id) . mapM doesFileExist $ xs
21:31 jutaro joined
21:31 jabesed joined
21:31 jer1 joined
21:32 anodium joined
21:32 <glguy> (and = all id)
21:32 flatmap13 joined
21:33 <c_wraith> ChaiTRex, that works, but short-circuiting might be a nice addition
21:33 dalek_ joined
21:34 zv joined
21:35 <Unode> c_wraith: short-circuiting?
21:35 <c_wraith> Unode, stopping as soon as it finds a failing case.
21:35 <Unode> ah
21:36 JeanCarloMachado joined
21:36 <Unode> and zipWith does that?
21:36 <EvanR> zipWith is lazy
21:37 <Unode> wait, the lazyness should take care of that right? so you are saying mapM isn't lazy?
21:37 <hexagoxel> (monad-loops has andM)
21:37 aring joined
21:37 <c_wraith> Unode, mapM is not lazy in IO
21:37 <EvanR> @src = mapM
21:37 <lambdabot> Source not found. :(
21:37 <EvanR> @src mapM
21:37 <lambdabot> mapM f as = sequence (map f as)
21:38 <EvanR> whether sequence is lazy depends on the monad
21:38 kritzcreek joined
21:38 tomphp joined
21:38 <Unode> c_wraith: is that also true of other maps over IO ?
21:38 <Unode> I haven't read that far into the IO chapter :)
21:39 eschnett joined
21:39 <c_wraith> sort of.. it's true if you have to perform the IO actions to get the results
21:39 <Unode> I see
21:39 nickager joined
21:39 <c_wraith> but something like fmap (map (+1)) doesn't care what it's working in.. the inner map will be lazy.
21:41 <Unode> and the outer one would be a "depends"?
21:41 <c_wraith> yeah.
21:42 <EvanR> Unode: if mapM didnt work like this, for IO, then you would get a list back whose results havent been computed yet. but they depend on IO. so youd be in a position where evaluating the list nodes would cause the IO
21:42 <Unode> EvanR: that would sort of make sense no?
21:42 <EvanR> it might make sense, but only if you were expecting that
21:42 <c_wraith> sometimes. it's how "lazy IO" works.
21:42 <c_wraith> and that has a history of immense pitfalls.
21:42 carlomagno joined
21:42 <Unode> EvanR: I see where you are getting at
21:43 <EvanR> if you stored that list for a while, then in a few days checked it, you may be surprised to find it firing missiles
21:43 <hpc> the biggest pitfall is you lose purity
21:43 <Unode> looping over a list multiple times ends up repeating a whole bunch of IO actions. Got it.
21:43 <hpc> IO is tied to evaluation, which is the very single exact thing you can't have in pure code
21:43 <EvanR> it wouldnt, see youre confused! ;)
21:43 darjeeli1 joined
21:43 <Unode> So int this case would [FilePath] -> Bool actually be possible?
21:44 <Unode> in*
21:44 <EvanR> no IO ?
21:44 <hpc> depends on what you want to do with that type
21:44 <hpc> :t null
21:44 <lambdabot> Foldable t => t a -> Bool
21:44 <hpc> > null ["/etc/passwd"]
21:44 <lambdabot> False
21:44 <c_wraith> if you want to check the file system, no. :)
21:44 <hpc> > null []
21:44 <lambdabot> True
21:45 takle joined
21:45 JeanCarloMachado joined
21:45 justinfokes joined
21:46 <Unode> EvanR: wait, you said I'm confused. I thought you just said that evaluating list nodes would cause the IO. I know map is over structure only... but from what you said I understood that re-visiting the same element would repeat that IO.
21:46 justinfokes joined
21:46 asm_ joined
21:47 <Unode> c_wraith: right, just making sure.
21:47 <c_wraith> Unode, if you really want to experiment with it, you can write your own lazy IO functions with unsafeInterleaveIO
21:47 <hpc> Unode: you can't know for sure
21:47 justinfo_ joined
21:47 <hpc> Unode: it depends on if reusing the element is actual reuse, or recompuation
21:47 flatmap13 joined
21:48 <hpc> and that's not something you can reason about without going "what version of what compiler on what architecture?"
21:48 <Unode> c_wraith: I don't yet fully understand IO the unsafe variants make it more confusing. Actually it might be the "purity" that is still not quite there.
21:50 <ChaiTRex> Unode: Here's one that should short circuit: let allExist :: [FilePath] -> IO Bool; allExist [] = return True; allExist (x:xs) = do { v <- doesFileExist x; if v then allExist xs else return False }
21:50 JeanCarl1Machado joined
21:51 <thang1> Which feels and looks pretty much like straight up imperitive coding with aslightly stronger type system, to me.
21:51 <c_wraith> that looks right.
21:51 <Unode> thang1: yeah... the do syntax.
21:52 <thang1> Well you can replace do syntax with monads and binding everywhere, but that doesn't really look any better to me :p
21:52 jer1 joined
21:52 cloudhead joined
21:52 <thang1> it's the "if then else" that makes it look imperitive to me. However, that's the short circuiting part, so you can't easily do away with that
21:52 <c_wraith> the way you make it feel more functional is separating the loop logic from the predicate.
21:53 <hpc> thang1: imo i wouldn't do away with it
21:53 hiratara joined
21:53 <c_wraith> then the use of it is fine. :)
21:53 <hpc> haskell is probably my favorite imperative language
21:54 <athan> is there a `putForcefullyTMVar`?
21:54 <thang1> Right. I'm not saying it's a bad way to code, it's just amusing to me how much it looks like imperative code. I tend to like extremely abstract, high level, blisteringly terse styles of code.
21:54 <athan> `figginJustTakeTheValueDamnYaTMVar`
21:54 <thang1> So seeing do { if then else } tickles me funny; nothing wrong with it, it just looks odd next to maps and folds and what not.
21:55 irco joined
21:55 <dmwit> http://hackage.haskell.org/package/monad-loops-0.4.3/docs/Control-Monad-Loops.html#v:andM
21:55 <c_wraith> now I'm thinking about my unsafeInterleaveST terrors... http://lpaste.net/92226#a110207
21:55 <thang1> ಠ_ಠ
21:56 <dmwit> allM doesFileExist :: [FilePath] -> IO Bool -- and short circuits correctly
21:56 <hpc> c_wraith: that's like defusing a bomb by putting thermite on the detonator
21:56 <davean> hpc: to be fair we mostly defuse bombs by blowing them up
21:56 <davean> hpc: so ...
21:57 <monochrom> There is no thermite. You computer does not catch fire.
21:57 <thang1> The difference between defuse and explosion is how much damage happened that we didn't want to have happen :p
21:57 leat joined
21:57 <c_wraith> I mostly keep that code around as a demonstration that "unsafe" really means it.
21:57 <thang1> c_wraith: what does it even do?
21:57 takle_ joined
21:57 JagaJaga joined
21:58 <c_wraith> thang1, they're supposedly "pure" functions whose results depend on the evaluation order of the results.
21:58 <monochrom> But you could try this analogy: To disrupt XSS malware by ransomware.
21:58 ForgedPancake joined
21:59 <thang1> ahh, I see. Fun stuff there :p
21:59 hamishmack joined
22:00 hamishmack joined
22:04 <tdammers> doesn't "defuse" technically mean "removing the fuse"?
22:04 ryantm joined
22:05 <ski> @wn defuse
22:05 <lambdabot> *** "defuse" wn "WordNet (r) 3.0 (2006)"
22:05 <lambdabot> defuse
22:05 <lambdabot> v 1: remove the triggering device from [ant: {fuse}]
22:07 <c_wraith> there are some exceptionally stable explosives. like, C4 won't explode if lit on fire. it just burns. it needs a hearty concussion to detonate. you could defuse it safely with thermite.
22:07 <monochrom> Defusing the bomb by fusing two streams.
22:07 <ski> monochrom : istr you had some `unsafeInterleaveST' terrors as well, right ?
22:07 <monochrom> YES!
22:07 takle joined
22:08 rkazak joined
22:08 <monochrom> But it's unsafeInterleaveIO.
22:08 SeMas joined
22:09 <monochrom> And it is not horrow. It is bwahahahahha.
22:09 <monochrom> s/horrow/horror/
22:11 ForgedPancake joined
22:12 flatmap13 joined
22:12 jer1 joined
22:13 troydm joined
22:16 <* hackage> unfoldable-restricted 0.0.3 - An alternative to the Unfoldable typeclass https://hackage.haskell.org/package/unfoldable-restricted-0.0.3 (athanclark)
22:22 aring joined
22:24 mmachenry joined
22:24 dedgrant joined
22:25 aring joined
22:26 jer1 joined
22:26 tabaqui joined
22:27 TheFuzzball joined
22:27 fortruce joined
22:28 blym joined
22:29 <lpaste> fortruce pasted “ghc-mod Haste” at http://lpaste.net/355559
22:29 <fortruce> Is there a way to get ghc-mod to be aware of Haste? I just see the above ^
22:30 augur joined
22:30 iAmerikan joined
22:30 flatmap13 joined
22:31 hiratara joined
22:32 dsfox1 joined
22:35 mmachenry1 joined
22:37 hamishmack joined
22:42 theelous3 joined
22:43 twanvl joined
22:43 baldrick joined
22:43 Hunter1 joined
22:49 Noldorin joined
22:50 uglyfigurine joined
22:51 Levex joined
22:52 sigmundv__ joined
22:52 aib joined
22:52 TheFuzzball joined
22:53 jer1 joined
22:59 <* hackage> hopenssl 2 - FFI bindings to OpenSSL's EVP digest interface https://hackage.haskell.org/package/hopenssl-2 (PeterSimons)
23:07 verement joined
23:07 sproingie joined
23:07 sproingie joined
23:07 Koterpillar joined
23:10 oish joined
23:10 qwertydvorak joined
23:11 theelous3 joined
23:11 theelous3_ joined
23:11 jer1 joined
23:11 safe joined
23:12 butterthebuddha joined
23:14 hybrid joined
23:14 shesek joined
23:14 sgronblo joined
23:17 dfeuer joined
23:18 TheFuzzball joined
23:18 sleffy joined
23:20 connrs joined
23:21 wolfsif joined
23:22 ContessaTP joined
23:22 dan_f joined
23:23 cschneid_ joined
23:24 kmels joined
23:26 xall joined
23:27 butterthebuddha joined
23:27 Hunter1 joined
23:27 roconnor joined
23:30 baldrick joined
23:30 mizu_no_oto joined
23:30 augur joined
23:32 zv joined
23:32 aib joined
23:32 shayan_ joined
23:33 jer1 joined
23:34 nickager left
23:35 mjora7 joined
23:36 {emptyset} joined
23:37 theDon_ joined
23:38 hydroacoustic joined
23:38 markus1189 joined
23:39 markus1199 joined
23:39 louispan joined
23:40 oisdk joined
23:42 replay joined
23:44 nh2 joined
23:46 justan0theruser joined
23:49 leat joined
23:49 xcmw joined
23:51 ddere joined
23:52 YongJoon joined
23:52 michaelw joined
23:53 jer1 joined
23:54 LordBrain joined
23:54 Hunter1 joined
23:55 <LordBrain> Is there a tool to measure the exposure a haskell (cabal) project has on one of its dependencies?
23:55 lknows joined
23:55 <LordBrain> such as.. list all references to such and such library
23:56 <LordBrain> can ghc do it?
23:57 alqatari joined
23:57 nakal_ joined
23:57 lavalike joined
23:57 alveric1 joined
23:59 infinity0_ joined
23:59 infinity0 joined
23:59 louispan joined
23:59 jathan joined