<     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 _2_5 26 27  
28 29 30 31
00:00 Dance joined
00:02 kykim joined
00:08 eacameron joined
00:08 haskelleksah joined
00:09 conal joined
00:11 louispan joined
00:22 dni- joined
00:23 romank joined
00:30 shayan_ joined
00:32 MotherFlojo joined
00:34 Big_G joined
00:35 haskelleksah joined
00:53 cschneid_ joined
00:57 eacameron joined
01:04 takle joined
01:10 eacameron joined
01:21 NoCreativity joined
01:23 takle joined
01:39 uglyfigurine joined
01:59 Kuros` joined
02:00 takle joined
02:01 eacameron joined
02:03 Manuca joined
02:09 exferenceBot joined
02:10 kykim left
02:11 dni- joined
02:18 Dance joined
02:21 uglyfigurine joined
02:27 c4r50nz joined
02:30 ryantm joined
02:31 <ryantm> How do I use `getLine` with classy-prelude?
02:31 exferenceBot joined
02:31 eacameron joined
02:31 MotherFlojo joined
02:32 <ryantm> The compiler error message I am getting is : "Variable not in scope: getLine :: IO Text
02:33 Dance joined
02:35 <ryantm> I fixed it by importing "Data.Text.IO's getLine, but that seems surprising to me.
02:36 hexagoxel joined
02:39 Youmu joined
02:47 takle joined
02:48 uglyfigurine joined
02:49 louispan joined
02:52 <ryantm> It looks like a better solution is to use Data.IOData from chunked-data.
02:59 takle joined
03:06 permagreen joined
03:09 cschneid_ joined
03:09 <jle`> ryantm: you can use hGetContents stdin
03:10 <jle`> but it's a little weird that that isn't offered by default
03:10 <glguy> Yikes, hGetContents stdin will get a lot more than getLine would have
03:12 <ryantm> maybe this is an example of not including partial functions
03:12 <glguy> getLine isn't a function, so it can't be a partial function
03:13 <jle`> getLine is not a function
03:13 <jle`> oh sorry
03:16 systemfault joined
03:16 <ryantm> I was going to say, well it can fail if the stdin is closed before the end of a line, but these other ones like hGetContents can fail too, I think.
03:16 aqualogic joined
03:17 <jle`> those wouldn't be partial functions though; those would be total IO actions whose effects are IO exceptions
03:17 systemfault joined
03:18 <ryantm> that makes sense, thanks!
03:18 <jle`> i might take it up with the classy-prelude folks
03:19 <jle`> getLine feels like it should be offered, if hGetContents and putStrLn and say etc. are
03:19 takle joined
03:19 <jle`> oh
03:20 <jle`> it looks like putStrLn is not directly exported, and is instead offered through the Say module
03:20 aqualogic joined
03:20 <jle`> and it looks like say's versions of putStrLn (say, sayString) are special ones that respect concurrency
03:21 <jle`> it might be that getLine is withheld because it's not 'thread-safe'
03:22 <jle`> since 'say' is more thread-friendly than putStrLn
03:22 eacameron joined
03:25 uglyfigurine joined
03:27 eacameron joined
03:27 zachary12 joined
03:27 aqualogic joined
03:29 <ryantm> putStrLn is exported by classy-prelude via basic-prelude
03:30 <jle`> ah yeah i see it now
03:30 <jle`> basic-prelude should probably be exporting getLine then
03:30 <jle`> oh, it's in basic-prelude, in BasicPrelude
03:31 <jle`> http://hackage.haskell.org/package/basic-prelude-
03:31 <* jle`> shrugs
03:31 zachary12 joined
03:31 MotherFlojo joined
03:32 zachary12 joined
03:32 <jle`> it looks like the decision to omit getLine from CorePrelude (which ClassyPrelude exports) was a conscious one, so i'm puzzled
03:33 <ryantm> That getLine isn't quite classy enough for classy-prelude.
03:38 takle joined
03:38 zachary12 joined
03:42 goldnd joined
03:43 <goldnd> Hi all, I'm working my way through the monad challenges and need to convert a type alias type Gen a = (Seed -> (a, Seed))
03:43 <goldnd> to a newtype
03:43 <goldnd> I'm stuck
03:43 uglyfigurine joined
03:43 <goldnd> can anyone give me a decent explanation of how to use newtype in this situation?
03:46 <glguy> goldnd: You can paste what you have to far to http://lpaste.net
03:49 louispan joined
03:51 andyhoang joined
03:52 goldnd joined
03:53 uglyfigurine joined
03:53 <goldnd> so Gen a is a function that takes a and returns a function that maps a Seed to a tuple with a and a seed
03:53 <goldnd> I can't figure out how to make a function type using newtype
03:57 takle joined
04:00 dni- joined
04:04 goldnd joined
04:04 goldnd left
04:05 cur8or joined
04:06 Nycatelos joined
04:07 c4r50nz joined
04:15 Dance joined
04:27 cschneid_ joined
04:35 cschneid joined
04:41 fluffystub joined
04:46 takle joined
04:51 mengu joined
04:54 mengu joined
05:05 shayan_ joined
05:18 systemfault joined
05:20 systemfault joined
05:21 systemfault joined
05:22 systemfault joined
05:22 takle joined
05:23 jbgi joined
05:29 viralstitch joined
05:30 exferenceBot joined
05:31 MotherFlojo joined
05:36 andyhoang joined
05:38 Sose joined
05:39 haskelleksah joined
05:40 takle joined
05:46 ThomasLocke joined
05:46 ThomasLocke joined
05:47 haskelleksah joined
05:49 dni- joined
05:51 Dance joined
05:55 IdiopathicGravit joined
05:56 mstruebing joined
05:58 jbgi joined
06:02 delexi joined
06:04 qwebirc246828 joined
06:05 <IdiopathicGravit> exit
06:05 IdiopathicGravit left
06:05 <jle`> same
06:10 patbecich joined
06:11 louispan joined
06:12 IdiopathicGravit joined
06:13 IdiopathicGravit left
06:19 moei joined
06:20 IdiopathicGravit joined
06:21 patbecich joined
06:23 takle joined
06:29 cschneid_ joined
06:29 dni- joined
06:38 nickolay_ joined
06:47 patbecich joined
06:47 takle joined
06:57 takle joined
07:04 bvad joined
07:17 aqualogic joined
07:21 takle joined
07:22 cur8or joined
07:28 mattyw joined
07:29 madjestic joined
07:30 Levex joined
07:35 nickolay joined
07:40 bvad joined
07:40 fotonzade joined
07:42 Pupnik joined
07:43 merijn joined
07:43 Levex joined
07:45 galderz joined
07:45 eatman joined
07:49 fbergmann joined
07:51 Durbley joined
07:51 eatman joined
07:52 patbecich joined
07:57 ridho joined
08:00 cschneid_ joined
08:02 patbecich joined
08:03 thc202 joined
08:03 c4r50nz joined
08:07 Gurkenglas joined
08:09 takle joined
08:10 eatman joined
08:12 colt44 joined
08:14 nacon joined
08:14 nacon joined
08:23 slomo joined
08:23 slomo joined
08:25 Levex joined
08:30 bvad joined
08:36 grdryn joined
08:46 takle joined
08:52 mattyw joined
08:56 ski joined
09:03 patbecich joined
09:10 takle_ joined
09:14 takle joined
09:14 Durbley joined
09:18 deank joined
09:23 dni- joined
09:26 louispan joined
09:26 Dance joined
09:37 zero_byte joined
09:37 qu1j0t3 joined
09:39 louispan joined
09:43 <LiaoTao> Are Zippers going to turn out to be some super general thing that will make my brain explode?
09:43 <merijn> LiaoTao: Yes :p
09:44 <LiaoTao> Oh well, I wasn't using it much anyway
09:44 <merijn> LiaoTao: list zippers are pretty simple, but turns out those are just a very niche special case of a way more general thing
09:45 <merijn> LiaoTao: You know haskell has "Algebraic Data Types"? Note the "algebraic" part. Turns out (note, even I don't quite grok this) zippers are the equivalent of taking the derivative of a datatyep
09:46 <merijn> LiaoTao: If you're not familiar with why ADTs are algebraic, here's a fairly simple intro: https://chris-taylor.github.io/blog/2013/02/10/the-algebra-of-algebraic-data-types/
09:46 <LiaoTao> A...derivative?
09:47 <LiaoTao> I think I need to go lie down
09:47 fotonzade joined
09:48 <merijn> LiaoTao: Basically, people invented zippers as a neat way to modify lists "in place", then some mathematician looked at algebraic datatypes and went "huh, I wonder what the equivalent of a derivative would be..." and people figured out "these things are the same thing"
09:48 kritzcreek joined
09:48 <merijn> LiaoTao: honestly, I only get the basics of the algebraic thing and I don't actually understand the algebraic explanation of zippers, if that's any consolation :p
09:48 <LiaoTao> But a derivative wrt what?
09:49 <merijn> LiaoTao: ADTs form an algebra, so the derivative wrt that algebra of ADTs
09:49 <merijn> LiaoTao: See the link above
09:49 <LiaoTao> Reading it right now
09:50 <merijn> (Note: Most of this stuff is optional for actually doing anything useful)
09:51 <LiaoTao> Sure
09:55 <LiaoTao> So, you can define fields and rings over data types?
09:55 <merijn> LiaoTao: Sure. Although I'm not the best person to ask about that :)
09:59 <LiaoTao> The distributive law actually makes a lot of sense
09:59 <LiaoTao> Although I suppose it's different from the second functor law
10:08 harfangk joined
10:09 slomo joined
10:20 ski joined
10:20 mojjo joined
10:20 heyj joined
10:20 yellowj joined
10:23 <LiaoTao> "In the paper Seven Trees In One, Andreas Blass not only shows how to find an explicit map from seven trees to one and back again (essentially he tells you how to write the from and to functions from the previous post), but he shows that the functions never have to look more than four levels deep into any of the trees."
10:23 <LiaoTao> This is some next-level poop
10:26 <Iceland_jack> LiaoTao: :)
10:28 <tuturto> that reads like a plot for 80s kungfu movie
10:31 <Iceland_jack> Data.Functor.Bind: The Monad of No Return
10:32 <Geekingfrog> :D
10:33 romank joined
10:34 <Iceland_jack> In a world . .
10:35 <LiaoTao> Where computation is stateful
10:40 louispan joined
10:41 ridho joined
10:44 <Iceland_jack> Purity . . comes at a cost
10:44 <Iceland_jack> Hair Shirt: the Story of Haskell
10:45 <* Iceland_jack> inception bewrrrawawwrrrrrrrrr
10:46 <Akii> purrity?
10:46 <Iceland_jack> In a world . . dominated by cats
10:47 MotherFlojo joined
10:48 andyhoang joined
10:49 bram_ joined
10:50 MotherFl1 joined
10:51 jbgi joined
10:52 <lpaste> bram_ pasted “Read files into leveldb” at http://lpaste.net/355419
10:52 <bram_> Hi all. I'm trying to read words from multiple files into a leveldb using Haskell. But I don't know how to combine LevelDB (alias of LevelDBT IO) with IO and back again. Could somebody help me to combine the two? http://lpaste.net/355419
10:54 <merijn> bram_: Blind guess, but I'm assuming LevelDBT is an instance of MonadIO, which lets you use "liftIO :: MonadIO m => IO a -> m a"
10:54 <merijn> Or in this case "liftIO :: IO a -> LevelDB a"
10:54 <merijn> So I'd try that
10:57 <LiaoTao> Heh
10:57 <LiaoTao> Just took a look at the list Zipper
10:57 <LiaoTao> I implemented it earlier by accident when working on a better prime sieve
10:57 <LiaoTao> Funny how things lend themselves to rediscovery
10:58 <bram_> @merijn but how do I get back to LevelDB monad when I want to insert the keys? Wait, I'll just try and see how far I get....
10:58 <lambdabot> Unknown command, try @list
11:06 patbecich joined
11:08 Dance joined
11:11 dni- joined
11:13 ski joined
11:15 Levex joined
11:17 <bram_> merijn: with liftIO I get into IO() but then when I want to "put" a value, how do I get back to LevelDB () again? http://lpaste.net/355421
11:18 <merijn> oh, yeah, that's not going to work with withFile, no
11:22 fotonzade joined
11:23 alem0lars joined
11:29 ridho joined
11:30 <bram_> merijn: ok, so back to separate DB handle or file handles to combine the two? Or is there some way to join the two monads somehow?
11:32 <merijn> bram_: There's some stuff like MonadBaseControl, or whatever it's called to work around things like withFile, but I forget the details, tbh
11:35 xacktm joined
11:37 dmj` joined
11:40 <LiaoTao> Huh?
11:40 <LiaoTao> LYAH doesn't go beyond zippers?
11:40 MotherFl1 joined
11:40 flojo joined
11:41 <merijn> LiaoTao: LYAH isn't very in-depth, tbh
11:41 <LiaoTao> I thought it was only just starting to get interesting
11:41 Dance joined
11:41 <LiaoTao> Are there any other recommended, free resources?
11:41 malaclyps joined
11:42 <merijn> LiaoTao: Depends on which areas interest you
11:42 <LiaoTao> Doing stuff!
11:42 <LiaoTao> Like, interacting with system libraries
11:42 MotherFlojo joined
11:43 <LiaoTao> Reactive programming
11:44 <merijn> LiaoTao: Mostly the same way you learn that stuff in other languages, you start writing things :)
11:45 <LiaoTao> Hmm
11:45 <LiaoTao> There's no trick to it?
11:45 <LiaoTao> It's Monads all the way down?
11:45 <merijn> Not really, it's still just programming
11:45 <merijn> LiaoTao: Know any other languages? Which ones?
11:46 <LiaoTao> I know C/C++ pretty well
11:46 <LiaoTao> Done some C#
11:46 <merijn> LiaoTao: What did you write in C/C++?
11:46 <LiaoTao> Game bots :x
11:47 <LiaoTao> Don't think that's ideal for Haskell
11:47 <merijn> LiaoTao: How so?
11:48 <* mniip> remembers seeing rocket league replay parsing utils on hackage
11:48 <LiaoTao> I just get the feeling that using the Windows API in and doing DLL injection doesn't come natural to high-level beast Haskell
11:48 <LiaoTao> -in
11:49 <merijn> LiaoTao: Haskell's C FFI is surprisingly easy to use, tbh
11:49 c4r50nz joined
11:50 <mniip> DLL injection with haskell might prove tricky
11:50 <merijn> LiaoTao: The DLL injection is maybe not so easy, but if you know how to do the C/linking bits, making Haskell look like "just another dynamic library" is pretty easy
11:50 <merijn> LiaoTao: So you could use your existing experience, but replace the actual application logic with Haskell
11:51 <merijn> Honestly, I think that'd be easier to dive into the complication of 15 abstract web frameworks like everyone else likes doing :)
11:51 <merijn> The hardest part is understanding the C/linking bits, but if you already know those...
11:51 <LiaoTao> Seems like a whole lot of glue code, though
11:51 <LiaoTao> I'd rather spend that time writing something in pure Haskell
11:52 <LiaoTao> But maybe some GUI tool?
11:52 <merijn> LiaoTao: I don't think the glue code would be so bad. But writing reasonably low level stuff like servers/binary twiddling is actually what I like using Haskell for :)
11:53 <LiaoTao> Are people using stuff like QT and GTK with Haskell or are there separate Haskell-specific libraries like tkinter?
11:53 <merijn> LiaoTao: Incidentally, I usually recommend C/C++ programmers to just read the Haskell 2010 Report directly
11:53 <LiaoTao> Any recommendations? :)
11:53 <LiaoTao> merijn: Oh, sure
11:53 <merijn> LiaoTao: There's QT/GTK bindings, but they're not...ideal
11:53 <merijn> LiaoTao: Mostly because of the impedance mismatch between, say, QT's OO model and Haskell
11:54 <merijn> LiaoTao: Especially Chapter 8 (on the FFI)
11:54 <LiaoTao> What about things like OpenGL then?
11:54 <merijn> edwardk has pretty extensive OpenGL bindings
11:55 <merijn> LiaoTao: https://hackage.haskell.org/package/gl
11:55 <merijn> LiaoTao: There's higher level bindings on top of that, afaik
11:55 deank joined
11:56 fotonzade joined
11:57 <flojo> key bind meta-n /bar toggle nicklist
11:57 <flojo> sorry :P
11:57 <merijn> LiaoTao: Here's some shader toys written using that: https://github.com/ekmett/quine
11:58 <LiaoTao> merijn: Thanks a lot for the recommendations
11:58 conal joined
11:59 eacameron joined
12:01 <LiaoTao> merijn: On the other hand, how do I come into contact with all the technobabble-ish terms you guys throw around in #haskell?
12:01 <LiaoTao> Seems like I'm missing out on an ocean of complexity by not reading some other book
12:02 <merijn> Honestly a lot of it is just diving in, doing stuff. Getting confused, get pointed to a paper, read it, repeat :)
12:02 <merijn> LiaoTao: Just idling in #haskell can teach a lot :p
12:02 <LiaoTao> It's rather impenetrable at the moment
12:02 cschneid_ joined
12:02 <merijn> It's easier to keep focussed if you're learning things as they become relevant for whatever you want to do
12:02 <merijn> LiaoTao: Got some examples?
12:02 <LiaoTao> Oh, definitely
12:03 <LiaoTao> Not off the top of my head, no
12:03 <LiaoTao> But I see stuff I don't understand regularly
12:03 netheranthem joined
12:03 <merijn> Note, I still run into stuff I don't understand often in #haskell :p
12:03 <merijn> Haskell has a high skill-ceiling, if we wanna use gaming terminology ;)
12:04 <LiaoTao> relevant: https://www.cse.unsw.edu.au/~pls/thesis/munc-thesis.pdf
12:05 <merijn> LiaoTao: Also, one thing I'd recommend (in addition to the Haskell 2010 Report) for C/C++ programmers is reading the STG paper
12:05 <merijn> @where haskell2010
12:05 <lambdabot> http://www.haskell.org/onlinereport/haskell2010/
12:05 <merijn> This one: http://citeseerx.ist.psu.edu/viewdoc/download?doi=
12:05 <LiaoTao> STG paper?
12:05 <LiaoTao> Okay!
12:05 <LiaoTao> Lots of reading!
12:05 <merijn> LiaoTao: Basically a (slightly outdated) paper of "how would you compile something like Haskell to ASM/C"
12:06 <merijn> It helps a lot to get an intuition of how things work in GHC, especially for people with C backgrounds
12:06 <LiaoTao> Is it full of wizardry? :x
12:06 <merijn> naah
12:06 joel135 joined
12:06 <LiaoTao> Because GHC seems like magic
12:07 <merijn> Mostly *very* basic Haskell and *very* basic C/ASM
12:07 <merijn> LiaoTao: If you know about stacks and heaps in C/ASM and you understand: case-of, function application and lambda's, you basically know everything in there already
12:07 <LiaoTao> merijn: That sounds neat
12:08 <mniip> 1494504229 [15:03:49] <merijn> Haskell has a high skill-ceiling, if we wanna use gaming terminology ;)
12:08 <mniip> does a ceiling exist
12:08 <merijn> mniip: Who knows ;)
12:08 <mniip> does anyone have evidence of a ceiling
12:08 <LiaoTao> mniip: It's defined in terms of an infinite list
12:10 louispan joined
12:10 <mniip> being an academic language I think the ceiling of haskell is modern day research articles in relevant fields
12:10 patbecich joined
12:11 <mniip> LiaoTao, with haskell you never stop learning, but in a pleasant way
12:11 <mniip> you always learn something exciting that totally shifts your worldview
12:12 <LiaoTao> As long as you can accomplish stuff while learning!
12:12 <LiaoTao> Otherwise it's easy to get bogged down
12:12 <mniip> fsvo "accomplish"
12:12 <mniip> I remember how excited I was when I derived the category of vector spaces completely on my own
12:13 <mniip> and then implemented it in haskell using the awkwardest gadts
12:19 Guanin joined
12:21 <Guanin> hi
12:21 <Iceland_jack> hey Guanin
12:21 <Guanin> I decided to try and solve some homeworks for a lecture in haskell to learn it. I completed the first assignment and would love to have some feedback.
12:21 louispan joined
12:22 <Guanin> also I think it has some major performance issues and I am hoping to find help here
12:22 <Guanin> The assignment was an attack on a bad AES implementation, based on the time side channel. The attack to implement was a t-Test
12:22 <Guanin> my code with a small sample of the traces can be found here: https://gist.github.com/Amarandus/824a857967182c851d899eaa3c4b91a7
12:23 fbergmann joined
12:24 <Guanin> so the code works fine, it just runs in around 2 hours, which seems a bit too long for me
12:24 <colt44> I'm trying to read a json that contains a base64 encoded string (representing a binary file). is the best way to accomplish this, read it into a ByteString? if so, how can I do it? I'm failing miserably to provide a FromJSON instance to ByteString
12:25 bkonkle joined
12:28 <Geekingfrog> Guanin: I don't know about your specific problem, but if you're looking into perf gain, try replacing lists by vectors and Strings by Text (or ByteString when relevant).
12:28 <Guanin> okay, that is a good point to start for me :)
12:30 <Guanin> Do you mean Data.Vector from the package "vector"?
12:30 <Geekingfrog> yes
12:30 <Geekingfrog> and Data.Text from the text package
12:31 <Guanin> okay
12:31 <Guanin> is the reading with readFile a reasonable choice?
12:32 <Geekingfrog> It's likely a completely negligible part of the total time
12:32 <Geekingfrog> But you have Data.Text.readFile if you want
12:32 <Guanin> okay
12:33 <Geekingfrog> For me, the map (!!n) x look like a good candidate for optimisation
12:33 <Geekingfrog> if you have large list and do that a lot, it becomes very costly
12:33 louispan joined
12:33 chlong joined
12:34 <Geekingfrog> Also, if I'm reading your code correctly, everything is fixed size (and finite), so vectors are clearly superior to lists here.
12:34 <Guanin> ok, that one is executed 350000 * 16 times
12:34 <Guanin> yes
12:34 ski joined
12:34 <Guanin> I have always 17 entries per line, where I can treat the first 16 seperately
12:35 <Guanin> so the first 16 values are completely independent of each other
12:35 <Guanin> the last one is the timing for the calculation (side channel attack)
12:36 <Geekingfrog> colt44: I'm not sure I understand your problem correctly. But JSON doesn't allow binary value, so you cannot possibly define a FromJSON instance to ByteString.
12:37 takle joined
12:38 <colt44> Geekingfrog: the data in the json is a binary file represented by a base64 encoded string
12:39 <colt44> at the end of the day I need a way to read this base64 encoded string and get the binary data to save the file
12:39 louispan joined
12:39 <Geekingfrog> You're going to need to do that in two phases: 1) parse data into a json structure 2) parse the binary data
12:40 <Geekingfrog> For the first part, the field is going to be a simple Text, and then you parse that with something like Text -> ByteString (base64decode basically)
12:42 louispan joined
12:42 cmdv joined
12:43 edmoore joined
12:43 Dance joined
12:45 Big_G joined
12:46 eacameron joined
12:49 <colt44> Geekingfrog: thanks for shedding some light on this
12:52 MotherFlojo joined
12:54 <Guanin> Geekingfrog, thank you, I will try what I can do with your hints :)
12:56 <Guanin> ah, one more question: what would be a decent approach to implement an incremental calculation of varaince and mean?
12:57 Dance left
12:58 <Guanin> I think this would allow for a greatly reduced amount of needed memory and calculation power, but right now I am not really sure how to do it, as it requires a "state" (not really dived that much into haskell, so I am happy that I can do basic stuff, to be honest)
13:00 dni- joined
13:08 iAmerikan joined
13:09 `micro joined
13:10 Guest37310 joined
13:12 TCZ joined
13:14 dni- joined
13:14 JoelleVanDyne joined
13:17 carlomagno1 joined
13:17 permagreen joined
13:17 simony joined
13:21 fbergmann joined
13:23 Guanin left
13:23 vmeson joined
13:27 pbrant joined
13:28 Guanin joined
13:32 jathan joined
13:41 Guanin left
13:45 malaclyps joined
14:01 nacon joined
14:01 nacon joined
14:03 Guanin joined
14:03 cschneid_ joined
14:05 xificurC joined
14:05 redcedar joined
14:11 Rodya_ joined
14:12 myrkraverk joined
14:13 patbecich joined
14:18 alem0lars joined
14:21 juanpaucar joined
14:32 juanpaucar joined
14:32 juanpauc_ joined
14:33 juanpaucar joined
14:37 ralu joined
14:40 shayan_ joined
14:41 drewr joined
14:43 juanpauc_ joined
14:43 abhiroop joined
14:45 michbad joined
14:50 cschneid_ joined
14:51 uglyfigurine joined
14:52 <lpaste> bram_ pasted “List all keys from a leveldb” at http://lpaste.net/355428
14:52 <bram_> I'm using higher-leveldb and would like to print all Keys in my leveldb, I can't see how to get IO inside scan: should I be using scan at all? http://lpaste.net/355428
14:52 <bram_> (docs are https://hackage.haskell.org/package/higher-leveldb- )
14:55 blissdev joined
14:55 DataComputist joined
14:56 <Geekingfrog> bram_: inside Scan, the monad is MonadLevelDB, which has a MonadIO constraint. So you can simply do liftIO yourIOAction and that's it.
14:59 <bram_> Geekingfrog: I get an Ambiguous type variable ‘m0’ arising from a use of ‘liftIO’ from what I try to do in the lpaste
14:59 <bram_> offending line is: scanMap = \(key, value) -> liftIO $ BS.putStrLn key
15:00 <abhiroop> are there any docs on how to distribute a haskell package in debian?
15:00 <abhiroop> I found this package called dh-haskell
15:01 <abhiroop> https://packages.debian.org/sid/dh-haskell
15:01 <abhiroop> But didn't find any documentation on how to use it
15:01 <abhiroop> I have a simple package built using stack
15:02 <bram_> abhiroop: debian packages are installed via apt-get install <package name>; they are separate from stack
15:02 <abhiroop> Yeah i have a haskell package
15:02 <abhiroop> That I want to distribute through `apt-get`
15:02 <abhiroop> is it possible?
15:04 dni- joined
15:04 <bram_> Sure, read the debian package maintaners manuals, find a sponsor and go for it. Then after knowning how to create debian packages get into haskell specific packages
15:05 <bram_> If you just want to create a debian package for yourself, read the debian package maintaners manuals... https://www.debian.org/doc/manuals/maint-guide/
15:05 rlr joined
15:06 <bram_> Geekingfrog: Yeah, fixed it with scanMap = \(key, value) -> (liftIO $ BS.putStrLn key ) :: LevelDB (). Thank you for the nudge!
15:13 Rodya_ joined
15:17 <lpaste> bram_ pasted “Lazyness is killing my listing?” at http://lpaste.net/355429
15:17 <bram_> Lazyness is killing my putStrLn I think... How can I fold a list of () like mapM_ does??
15:17 mstruebing joined
15:18 patbecich joined
15:18 <bram_> (I think I have a bit to many _-s in my code)
15:22 bvad joined
15:25 cschneid_ joined
15:26 Gurkenglas joined
15:26 Iceland_jack joined
15:28 deank joined
15:43 zero_byte joined
15:44 yellowj joined
15:48 Guanin left
15:48 Guanin joined
15:50 meng_ joined
15:52 skeet70 joined
15:53 MotherFlojo joined
15:55 meng_ joined
15:59 DataComputist joined
16:03 juanpaucar joined
16:05 DataComputist joined
16:09 exferenceBot joined
16:14 meandi_2 joined
16:14 netheranthem joined
16:19 netheranthem joined
16:20 cschneid_ joined
16:20 patbecich joined
16:30 govg joined
16:52 dni- joined
16:59 pilne joined
17:08 ebw joined
17:08 bvad joined
17:14 DataComputist joined
17:18 joncfoo joined
17:20 shayan_ joined
17:24 patbecich joined
17:26 icicled joined
17:28 juanpaucar joined
17:31 albertus1 joined
17:32 juanpauc_ joined
17:34 joncfoo joined
17:36 juanpaucar joined
17:41 juanpauc_ joined
17:41 icicled joined
17:46 juanpaucar joined
17:48 michbad joined
17:50 joncfoo joined
17:50 juanpaucar joined
17:55 juanpauc_ joined
17:57 govg joined
17:57 icicled joined
17:58 MotherFlojo joined
17:59 patbecich joined
18:00 juanpaucar joined
18:01 ebw joined
18:03 Durbley joined
18:04 juanpauc_ joined
18:04 juanpaucar joined
18:05 joncfoo joined
18:10 fotonzade joined
18:12 icicled joined
18:20 joncfoo joined
18:21 kfollesdal joined
18:22 przemo_li joined
18:22 <przemo_li> Hello, I'm having problem understanding haskell errors for simple foldr
18:23 <przemo_li> here is code http://lpaste.net/355439
18:28 icicled joined
18:29 <monochrom> It should be f e' a
18:30 <przemo_li> :facepalm:
18:30 <przemo_li> Yes, that was the issue
18:36 joncfoo joined
18:38 delexi joined
18:40 goldnd joined
18:41 dni- joined
18:42 cschnei__ joined
18:42 ekinmur joined
18:43 icicled joined
18:45 ekasc joined
18:46 <ekasc> im learning haskell, in python I used a partial ternary util pretty often, lambda x: f(x) if predicate(x) else g(x)
18:47 <ekasc> is there a name/abstraction for this in haskell?
18:47 <ekasc> havent gotten to the algebras stuff yet
18:49 <ekasc> ive been calling it rail for lack of better name
18:49 <geekosaur> :t bool
18:49 <lambdabot> a -> a -> Bool -> a
18:50 <DataComputist> This might be relavent: https://wiki.haskell.org/Ternary_operator
18:51 <geekosaur> not quite it but I think you get there by composition. there's also guard but that's also not quite it since one leg is forced to mzero (thus, MonadPlus required)
18:51 joncfoo joined
18:55 juanpaucar joined
18:58 im0nde joined
18:58 icicled joined
18:59 juanpauc_ joined
19:02 juanpaucar joined
19:03 juanpaucar joined
19:06 shayan_ joined
19:06 <Cale> ekasc: if predicate x then f x else g x
19:07 <Cale> ekasc: or to preserve the lambda, \x -> if predicate x then f x else g x
19:07 joncfoo joined
19:13 ebw joined
19:14 icicled joined
19:19 goldnd joined
19:22 joncfoo joined
19:24 ekinmur joined
19:25 goldnd joined
19:29 icicled joined
19:36 bkboggy joined
19:37 joncfoo joined
19:45 icicled joined
19:52 ski joined
19:53 joncfoo joined
20:00 icicled joined
20:06 Rodya_ joined
20:07 <Guanin> hi, I am reading a bit about fold{r,l,l'} here https://wiki.haskell.org/Foldr_Foldl_Foldl%27 and have a question
20:07 <sbrg> shoot!
20:07 <Guanin> how can the possibility of a quick exit for the "foldr (\e a -> if mod e 10==0 then 0 else (mod e 10)*a) 1 [1..10^7]" (last section) be detected
20:08 <Guanin> oh, not the last but the one before
20:08 joncfoo joined
20:08 <Guanin> is this the result of functions not having side effects?
20:09 <nickolay> any help appreciated: http://lpaste.net/355445
20:09 jle` joined
20:09 jle` joined
20:10 <Guanin> or let me reformulate it: how is the possibility of the "short circuit" detected?
20:13 efm joined
20:13 <nickolay> Guanin: probably memoization of some kind
20:14 slomo joined
20:14 slomo joined
20:15 juanpaucar joined
20:15 <kadoban> Guanin: The (*) for the Num instance would have to be written in a way that knows that _ * 0 = 0, that's about it
20:15 <kadoban> I think anyway.
20:15 icicled joined
20:16 <jle`> Guanin: be detected based on what
20:17 <jle`> the definition of foldr?
20:17 <jle`> or by looking at the function?
20:17 <jle`> we know that foldr can short-circuit if th function is non-strict on the second argument
20:17 <jle`> so something like (||)
20:17 <jle`> or (&&)
20:17 <jle`> @src (||)
20:17 <lambdabot> True || _ = True
20:17 <lambdabot> False || x = x
20:17 <jle`> @src (&&)
20:17 <lambdabot> True && x = x
20:17 <lambdabot> False && _ = False
20:18 juanpauc_ joined
20:18 <Guanin> ah thanks, that made it clear
20:18 juanpauc_ joined
20:23 joncfoo joined
20:23 ebw joined
20:25 <glguy> Guanin: Your example only depends on the 'a' argument if the case that mod e 10 /= 0
20:25 <Guanin> yes, the keyword "non-strict" made it obvious :)
20:26 <glguy> I just wanted to point out that it didn't have to do with the strictness of (*)
20:29 <glguy> nickolay: did you get an answer?
20:29 <nickolay> glguy: nope
20:29 <glguy> nickolay: You can do 'type Identifier m = T.Element -> m [Segment]'
20:29 <glguy> When you use Identifier you can mention the MonadJSM constraint
20:30 <nickolay> glguy: constraint can't be used in "type" synonim?
20:30 <nickolay> glguy: trying that
20:30 icicled joined
20:30 dni- joined
20:32 <glguy> nickolay: You can put constraints into type synonyms when you start using RankNTypes, but there are other consequences to that extension
20:32 MotherFlojo joined
20:35 iAmerikan joined
20:36 <nickolay> glguy: thank you, the solution you suggested works
20:37 <nickolay> going to try with RankNTypes also now, just for experiment
20:39 joncfoo joined
20:42 <nickolay> okay, as I get it - if I use a type variable on the right side of equation - it has to appear in the left side, is that correct?
20:44 <glguy> In a type/data/newtype, type variables have to be bound on the left-side of the =, or by an explicit forall quantifier
20:45 <glguy> One of the consequences of writing this with the RankNTypes extension, for example, is that you won't be able to have lists of these Identity values
20:45 iAmerikan joined
20:46 <glguy> and that type inference will break in some extra cases using functions that take an Identity as an argument
20:46 icicled joined
20:53 fading joined
20:54 joncfoo joined
20:54 <nickolay> glguy: I'm exactly on that problem now (not possible having a list)..
20:55 Iceland_jack joined
20:57 <nickolay> I guess I'll have to carry that additional constraint in function signatures..
20:57 emanuelbuholzer joined
20:57 <glguy> yeah, that's the correct solution
20:58 <nickolay> glguy: thanks for the help!
20:59 carlomagno joined
21:01 <glguy> yw
21:01 icicled joined
21:09 joncfoo joined
21:11 efm__ joined
21:17 icicled joined
21:19 carlomagno joined
21:21 juanpaucar joined
21:23 carlomagno1 joined
21:25 icicled joined
21:27 <lpaste> goldnd pasted “Monad challenge question” at http://lpaste.net/355446
21:28 <goldnd> I'm trying to work through the monad chanllenges and I'm stuck here
21:28 <goldnd> I'm supposed to switch from using a type alias to a new type
21:28 <goldnd> I've defined a mkGen function for the type alias that works but the same thing doesn't work for the newtype
21:29 <jle`> you just need the constructor
21:29 <jle`> are yuo familiar with 'data' / ADT's?
21:29 <jle`> data Maybe a = Nothing | Just a ...?
21:29 <goldnd> yes
21:30 <jle`> newtype Gen2 a = Gen2 (Seed -> (a, Seed))
21:30 <jle`> is similar to data Gen2 a = Gen2 (Seed -> (a, Seed))
21:30 <jle`> it "contains" a (Seed -> (a, Seed)), just like how Maybe can contain an a
21:30 <jle`> but you have to use the data constructor
21:30 <jle`> for Maybe, the constructors are Nothing and Just
21:30 <jle`> Just wraps an 'a' in a Maybe a
21:30 <monochrom> Use a newtype for Gen.
21:31 <jle`> for Gen2, the constructor is 'Gen2'
21:31 <monochrom> It is similar to how Seed is a newtype around Integer.
21:31 <jle`> Gen2 wraps a (Seed -> (a, Seed)) in a 'Gen a'
21:31 <jle`> *Gen2
21:31 <jle`> you need the construtor
21:31 <jle`> goldnd: you can't just type in True and expect it to be typechecked as a Maybe Bool
21:32 <jle`> you'd need to use `Just True :: Maybe Bool`
21:32 <jle`> the constructor is the key ~
21:32 joncfoo joined
21:34 <jle`> @let newtype MyNewtype a = MyNewtypeConstr (a -> a)
21:34 <lambdabot> Defined.
21:34 <jle`> :t not
21:34 <lambdabot> Bool -> Bool
21:34 <jle`> :t MyNewtypeConstr not
21:34 <lambdabot> MyNewtype Bool
21:36 <goldnd> so the constructor requirement makes sense but I'm apparently not getting the syntax right
21:37 <jle`> that's because you didn't use the constructor :o
21:37 <jle`> unless you ar elooking at something different than we are
21:37 <goldnd> I need to write a function called Gen2 that takes a function Seed -> (a, Seed)<goldnd> I'm trying to work through the monad chanllenges and I'm stuck here
21:37 <goldnd> [15:28]
21:37 <goldnd> <goldnd> I'm supposed to switch from using a type alias to a new type
21:37 <goldnd> <goldnd> I've defined a mkGen function for the type alias that works but the
21:37 <goldnd> same thing doesn't work for the newtype
21:37 <goldnd> <jle`> you just need the constructor [15:29]
21:37 <goldnd> <jle`> are yuo familiar with 'data' / ADT's?
21:37 <goldnd> <jle`> data Maybe a = Nothing | Just a ...?
21:37 was kicked by glguy: goldnd
21:37 <glguy> inviting back
21:39 goldnd joined
21:39 <goldnd> sorry, not sure what happened there
21:39 <jle`> if you're still looking at http://lpaste.net/355446, then you haven't used the data constructors for Gen2 yet
21:40 <goldnd> in general, I'm not sure how to define a constructor for newtype
21:40 <goldnd> I think I understand it for data
21:41 carlomagno joined
21:41 <jle`> you already did
21:41 <jle`> for newtype Foo a = Bar (a -> a)
21:41 <jle`> the data constructor is Bar
21:41 icicled joined
21:41 <jle`> it's the same as for data Foo a = Bar (a -> a)
21:41 <jle`> newtype and data are syntactically the same
21:41 <jle`> for the most part
21:42 NoCreativity joined
21:42 <goldnd> what is the meaning of runGen2? I lifted this off a tutorial but I don't understand the syntax because everyone seems to use a different name in the runGen2 slot
21:43 <jle`> are you familiar with record yntax
21:43 <jle`> syntax
21:43 <jle`> data Person = MkP { name :: String, age :: Int }
21:43 <goldnd> right
21:43 <jle`> it's that
21:43 <jle`> a record can have any name
21:43 <jle`> you can call it 'name', 'age'...
21:43 <jle`> you can even call it 'runGen2'
21:43 <jle`> or 'floopyboop'
21:43 <goldnd> ok
21:44 <jle`> as long as it's a valid variable identifier
21:44 <jle`> you could have called it data Gen2 a = Gen2 { floopyboop :: Seed -> (a, Seed) }
21:44 <jle`> it's a record accessor
21:44 <goldnd> that's what I was just typing
21:44 <goldnd> so that lets you access a given field
21:44 <jle`> it means that a `Gen2 a` is a container with a single constructor, Gen2
21:45 <jle`> that has a single field, floopyboop
21:45 <jle`> that contains a Seed -> (a, Seed)
21:45 <jle`> yeah
21:45 <goldnd> so, now the constructor, it's called Gen2, right?
21:45 <jle`> yeah
21:45 <jle`> it's slightly confusing because you named your data constructor the same thing as you named your type constructor
21:45 <jle`> but i've seen worse things
21:45 <goldnd> what would be better
21:46 <jle`> give it a different name
21:46 <jle`> like MkGen2 or something
21:46 <jle`> or G2
21:46 <jle`> well, Gen2 is a perfectly fine data constructor name
21:46 <goldnd> is the leading cap a convention for constructors?
21:46 <jle`> i'm just saying that it makes it confusing, here
21:46 <jle`> it's actually enforced by the syntax
21:47 juanpaucar joined
21:48 <glguy> it's how we distinguish variables from constructors
21:48 <goldnd> so is the first occurence of Gen2 the constructor or the second?
21:49 <glguy> They're both constructors, the value and type namespaces are separate in Haskell, the first one is in the type namespace, the second one is in the value namespace
21:49 <jle`> the first one is the type constructor
21:49 <jle`> the second one is the data constructor
21:49 <jle`> like:
21:49 <jle`> data Maybe a = Nothing | Just a
21:49 <goldnd> OK, that makes sense
21:49 juanpauc_ joined
21:50 kadoban joined
21:50 NoCreativity_ joined
21:51 moei joined
21:53 hiratara joined
21:56 juanpaucar joined
21:57 <goldnd> how do I pattern match on a function?
21:57 <goldnd> I'm trying to write a function that unpacks a Gen2 and returns the internal value
21:57 acarrico joined
21:59 <goldnd> I tried using a lambda to specify the pattern but get a parse error in the pattern
21:59 <goldnd> I updated the paste
22:00 efm joined
22:00 <jle`> you cannot pattern match on a function
22:00 <jle`> you can use the function...
22:00 <goldnd> I see
22:00 <jle`> evalGen2 (MkGen2 f) = f (some seed)
22:01 <goldnd> so I evaluate and then pick off the value
22:01 <jle`> yeah
22:01 <jle`> usually you'd also take a seed as a parameter
22:01 <jle`> to evalGen2
22:02 <goldnd> that makes more sense
22:03 <goldnd> I accidentally deleted the Seed parameter slot
22:04 kadoban_ joined
22:10 takle joined
22:14 <goldnd> thank you very much for your help
22:14 juanpaucar joined
22:16 conal joined
22:19 dni- joined
22:20 iAmerikan joined
22:24 conal joined
22:26 albertus1 joined
22:29 bvad joined
22:35 juanpaucar joined
22:36 <Guanin> Can someone explain me the difference between ! (Indexing) and !? (Safe Indexing) in Data.Vector?
22:36 <Guanin> ah okay
22:36 <Guanin> I just noticed the data type
22:37 juanpauc_ joined
22:38 juanpaucar joined
22:48 MotherFlojo joined
22:48 juanpaucar joined
22:54 uglyfigurine joined
23:04 ekasc joined
23:05 cschneid_ joined
23:10 MotherFlojo joined
23:12 shayan_ joined
23:20 <simony> hm, bitemyapp linked me this when I was asking about newtype rationale/etc. https://www.haskell.org/definition/from12to13.html#newtype
23:21 <simony> it's not clear to me what the strictness bit is all about. why did they decide to add a strictness annotation to the example data declaration?
23:22 erisco joined
23:22 <erisco> how many beginners actually find this channel? curious
23:25 <simony> FWIW i did find it somewhat early on
23:28 <erisco> looking at the list it seems more like the classroom is full of teachers waiting for a student to arrive ;)
23:29 <glguy> Well, beginner seem to have no problem stumbling in with questions in general, so it's working out ;)
23:29 IdiopathicGravit joined
23:30 cschneid_ joined
23:38 zero_byte joined
23:40 Cale joined
23:47 aarvar joined