<     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 27  
28 29 30 31
00:01 Brunplunsu joined
00:04 jgertm joined
00:05 rockfordal joined
00:05 infinity0 joined
00:06 eacameron joined
00:06 <adamCS> Is it possible to write a type family (or something) that would turn a type-level-list of length n into the equivalent tuple? E.g., '[a, b, c] -> (a,b,c) ?
00:07 <wayne> adamCS: i think the GHC has/had a tuple limit of 60 or something
00:07 <wayne> even if the language standard didn't?
00:08 <wayne> and most of the tuple instances are only supported up to 15 elements
00:08 <adamCS> wayne: Suppose I'm comfortable with that limitation?
00:08 <adamCS> I don't think I need to actually do anything with the tuples.
00:08 Lemmata joined
00:08 <wayne> hardcoding could be the easiest, but if you must, you can probably do something with templatehaskell
00:08 <adamCS> Can't hardcode. I need to do it in general.
00:09 infinity0 joined
00:09 <wayne> i think i saw one on SO before..
00:09 <athan> hmm. Say I'd like to block forever on some TChan. How should I do this, without making GHC freak out about it blocking forever?
00:09 <wayne> https://stackoverflow.com/a/2923574
00:09 <wayne> ^ adamCS
00:09 louispan joined
00:10 <adamCS> Not a regular list. I'm asking about an operation on types. I have a typelist, a list of types, of kind [*] and I want something "equivalent" of kind *, a normal type.
00:10 <adamCS> TH might still work, though I've no idea how to do TH on a type-level-list.
00:11 sigmundv joined
00:11 <glguy> adamCS: You'll need to write one type instance for each length of list
00:11 <athan> hmm. Say I'd like to block forever on some TChan. How should I do this, without making GHC freak out about it blocking forever?
00:11 <athan> agh sorry
00:11 FreeBirdLjj joined
00:11 takle joined
00:11 infinity0 joined
00:11 <monochrom> If GHC freaks out, that means all writers have died.
00:12 <adamCS> glguy: That is painful. Not the writing but having to be limited. But is probably good enough. And simpler. Thanks!
00:12 <monochrom> Do you still want to block on a dead end?
00:12 <glguy> adamCS: The different length tuples have nothing to do with one and other
00:13 <adamCS> glguy: True. But I can do other wacky things by writing recursive type families so I thought maybe there was a way. Like, I think I could do type-list to nested tuples: '[a, b, c] -> (a, (b,c))
00:13 ed-ilyin-lv joined
00:13 <adamCS> But that wouldn't really solve my problem.
00:13 <athan> monochrom: ideally yeah, so long as it doesn't consume many resources
00:13 dan_f joined
00:14 geekg_000_ joined
00:14 <monochrom> I forgot how to do it.
00:14 <athan> if it could just "wake up" when I write to it some long time in the future or something
00:14 <athan> there's some kind of trick you can do I think
00:14 <athan> ezyang has a cool blog post on it
00:14 infinity0 joined
00:15 wroathe joined
00:15 <monochrom> If there is a possible future writer, then GHC doesn't freak out.
00:15 <athan> but what if I want my code symmetric ._.
00:16 <athan> I'm using them as mock i/o channels from some arbitrary user, and in my unit tests I don't use all of them, if that makes sense
00:16 buoto joined
00:16 segmond joined
00:17 saussure joined
00:17 przembot joined
00:17 infinity0 joined
00:20 <Brunplunsu> Hi! I'm going to buy a book about Haskell, but I do not lknow which; any suggestion?
00:20 ixti joined
00:21 jleon joined
00:22 gugah joined
00:23 anuxivm joined
00:24 nighty-- joined
00:25 afarmer joined
00:26 Lemmata joined
00:26 saussure joined
00:26 afarmer joined
00:27 afarmer joined
00:29 eacameron joined
00:29 cschneid_ joined
00:29 neoo joined
00:30 Lemmata joined
00:31 neoo joined
00:32 tromp joined
00:33 neoo joined
00:33 yirabbit_ joined
00:35 buglebudabey joined
00:35 <tobiasBora> dmwit: Thank you, the compare using lists seems to work... But I've now some problems with explosion of memory, I'll try to figure why I've that problem
00:35 eacameron joined
00:35 neoo joined
00:36 <thang1> Brunplunsu, I'd recommend "Haskell from first principles" as the first book. By the time you're done with that, some good intermediate stuff should be out there
00:36 <tobiasBora> However, to do so, I'd need to force the *full* evaluation, (like a deep seq), not just the head normal form of my list
00:36 wroathe joined
00:36 darjeeli1 joined
00:36 takle joined
00:36 <tobiasBora> to see if the problem is the list itself, or the ordering
00:37 montagy joined
00:37 <tobiasBora> I saw deepseq from the deepseq package
00:37 <tobiasBora> is it what I need ?
00:37 andyhuzhill joined
00:38 Elhamer_ joined
00:38 <dfeuer> Strange fact about my brain: I hate overlapping instances with a *passion*. Although I definitely understand that there are situatiions where people find it quite useful, I want to see it removed altogether.
00:38 <dfeuer> And yet
00:38 joco42 joined
00:38 neoo joined
00:39 <dfeuer> I kind of think it might make sense, sometimes, to allow multiple method defaults, with the choice determined by what instances are available.
00:39 joco42 joined
00:39 <thang1> Eh, most people's brains work in contradictions. Not strange at all :p
00:40 neoo joined
00:40 joco42 joined
00:41 twopoint718 joined
00:41 neoo joined
00:41 kaychaks joined
00:42 eacameron joined
00:44 saussure joined
00:45 yamad joined
00:46 <tobiasBora> ok, deepseq seems to do the job
00:46 yirabbit_ joined
00:46 IanKelling joined
00:49 joco42 joined
00:50 eacameron joined
00:50 chao-tic joined
00:51 systemfault joined
00:53 uglyfigurine joined
00:53 buglebudabey joined
00:54 whaletechno joined
00:54 systadmin joined
00:56 andyhuzhill joined
00:56 MarioBranco joined
00:56 wroathe joined
00:57 codesoup joined
00:57 <hanna> I have an acid-state problem: I was working on a project, let's say FooBar.hs, and I had everything inside a single big file. I now decided to refactor this and split it up into modules, e.g. FooBar.Types, which is where my acid-state stuff went. Trying to re-open the database from the previous version of the project now fails with this error: `This method is required but not available: "Main.UpdateSite".
00:57 <hanna> Did you perhaps remove it before creating a checkpoint?”
00:57 <hanna> Of course, UpdateSite still exists - it's just now called FooBar.Types.UpdateSite
00:58 <hanna> And apparently acid-state is very stringent when it comes to the full name; is there any solution other than rolling back my code, opening the database, creating a checkpoint, closing it, rolling forwards my code? Would that even work?
00:59 <hanna> Indeed, that seems to have done the trick
00:59 <hanna> Much ado about nothing
00:59 gestone joined
01:02 oisdk joined
01:02 saussure joined
01:03 rickygee joined
01:06 otulp joined
01:06 sighingnow joined
01:08 dfeuer joined
01:09 afarmer joined
01:10 falafel joined
01:11 sighingnow_ joined
01:11 Flechette joined
01:11 FreeBirdLjj joined
01:12 saussure joined
01:14 drewbert joined
01:14 vaibhavsagar joined
01:15 <hanna> I realize this is probably a very open-ended question but what is the premier “parse command line options” package these days? Still optparse-applicative?
01:15 meba joined
01:16 <hanna> I don't need much more than a few boolean --flags and a [String] (list of names provided on the command line)
01:17 wroathe joined
01:20 P1RATEZ joined
01:20 <Zer000> I have a few function definitions that look like this: http://dpaste.com/3PS4W68 it's kind of messy, how should I format/indent them?
01:20 <hanna> Actually come to think of it, I don't want just a [String], I also want to parse them for validity (and I can return a list of valid names on error)
01:21 mizu_no_oto joined
01:22 Goplat joined
01:24 cschneid_ joined
01:24 <hanna> Seems like optparse-applicative is the way to go, I guess
01:26 alasi joined
01:26 <lpaste> glguy pasted “for zero000” at http://lpaste.net/355766
01:27 <glguy> Zer000: That's a start
01:28 Lemmata joined
01:29 jerbome_ joined
01:29 <Zer000> glguy, that is better, thanks
01:29 ketil_ joined
01:30 saussure joined
01:30 acertain joined
01:32 SeMas joined
01:34 ebsen joined
01:35 pera joined
01:38 ketil_ joined
01:38 wroathe joined
01:39 eacameron joined
01:40 cdg joined
01:42 Costar joined
01:42 ketil_ joined
01:42 <Axman6> is there no unions function? or, foldr union <some empty value> [bd "y" "q", bd "q ...]?
01:42 <Costar> Hey all
01:44 beerdrop joined
01:44 <Axman6> hello!
01:46 anuxivm left
01:47 otulp joined
01:48 saussure joined
01:48 lambdamu_ joined
01:51 renzhi joined
01:52 treehaqr joined
01:52 markasoftware joined
01:53 <byorgey> Axman6: unions of what? sets? maps?
01:54 <glguy> byorgey: It's in regard to a question about laying out some code earlier
01:54 <Axman6> whatever is in Zer000's paste from above
01:54 AndoBando joined
01:55 <Axman6> hanna: yeah optparse-applicative IIRC should be able to provide what you want. It's curious that acid-state fix worked!
01:55 D-rex joined
01:55 asdasd123 joined
01:56 D-rex left
01:57 louispan joined
01:57 saussure joined
01:58 joe9 joined
01:58 Supersonic112_ joined
01:59 saussure joined
01:59 <joe9> I have an old package that I renamed. but, stack gives me an error about Ambiguous name with the old package name and the new package naem. Any suggestions on how I can clean up the ~/.stack folder? I rm -rf .stack-work in the local package and it did not help.
01:59 wroathe joined
02:00 hucksy joined
02:02 <Lokathor> so here's a question: how big a deal is it to get a function added to base?
02:04 Scip joined
02:04 <Zer000> Axman6, nope there's no unions function, just union
02:04 pie_ joined
02:06 ^bschafer1 joined
02:08 <hanna> One thing I can't seem to figure out how to achieve with optparse-applicative is to have a situation where you need to *either* specify --update *or* at least positional argument, or both
02:08 <c_wraith> Lokathor: it's not that hard in the best case. you send an email to the libraries mailing list, there's some discussion, and everyone votes it in.
02:08 <hanna> But having no positional arguments and not specifying --update would be illegal
02:08 <c_wraith> Lokathor: the hard part is when not everyone is in favor of it. :)
02:09 <Lokathor> c_wraith, well, my proposal is simple I think: readFile (and the like) are lazy, and there should simply be a readFile' version that's strict
02:09 <Lokathor> I'm sure there are already deep flaws in my logic :P
02:09 <glguy> Better than to add that to is for it to be in a package so that you don't have to wait a few years to be able to us it in a backward compatible way
02:10 <joe9> Lokathor: protolude might be using the strict version.
02:11 <Lokathor> glguy, there is a package with it, and it's a 1 liner really. you just seq length on the contents and then give back the contents and it's all forced right away
02:11 <glguy> Not using String based file IO is even better
02:11 AndoBando joined
02:11 <Lokathor> glguy, well sure I guess :P
02:11 <Lokathor> joe9, i'm not familiar with protolude, but i assume it's one of the many "alternate prelude" things?
02:12 <Costar> Monads and Applicatives model computation, right? In what sense this computations is? Automata? Lambda Calculus? Turing Machines?
02:12 <Costar> maybe its a silly question
02:12 <Costar> but i cannot stop thinking about it
02:12 twopoint718 joined
02:12 carlomagno joined
02:13 rickygee joined
02:13 <glguy> Why do you think they model computation?
02:14 <Costar> glguy: they dont?
02:14 <glguy> Are you changing your mind?
02:14 <* hackage> portager 0.1.1.0, portager 0.1.0.0 (JiriMarsicek): https://qbin.io/hx7701hc2
02:14 <* hackage> hopenssl 2.2, titlecase 1, hopenssl 2.1 (PeterSimons): https://qbin.io/arv5zahj7
02:14 <* hackage> hexml 0.3.2, hlint 2.0.8 (NeilMitchell): https://qbin.io/9ezf22o
02:14 <* hackage> Villefort 0.1.0.8 - Villefort is a task manager and time tracker written in haskell. https://hackage.haskell.org/package/Villefort-0.1.0.8 (ChrisReuter)
02:14 <* hackage> lame 0.1.1, identicon 0.2.2, htaglib 1.1.1, flac-picture 0.1.1, flac 0.1.2, data-check 0.1.1, cue-sheet 0.1.1 (mrkkrp): https://qbin.io/h0o58dioy
02:14 <* hackage> xturtle 0.2.0.0, yjsvg 0.2.0.1 (YoshikuniJujo): https://qbin.io/xkrmknjel
02:14 <* hackage> sitepipe 0.1.0 - A simple to understand static site generator https://hackage.haskell.org/package/sitepipe-0.1.0 (ChrisPenner)
02:14 <* hackage> threepenny-editors 0.2.0.8 - Composable algebraic editors https://hackage.haskell.org/package/threepenny-editors-0.2.0.8 (PepeIborra)
02:14 <* hackage> unfoldable 0.9.3 - Class of data structures that can be unfolded. https://hackage.haskell.org/package/unfoldable-0.9.3 (SjoerdVisscher)
02:14 <glguy> bye hackage :(
02:14 <* hackage> telegram-api 0.6.3.0, telegram-api 0.6.2.0 (klappvisor): https://qbin.io/9xmvhd7m6
02:14 <* hackage> persistent-relational-record 0.1.1.0 - relational-record on persisten backends. https://hackage.haskell.org/package/persistent-relational-record-0.1.1.0 (TakahiroHimura)
02:14 <* hackage> feature-flipper 0.1.0.0 - A minimally obtrusive feature flag library https://hackage.haskell.org/package/feature-flipper-0.1.0.0 (toddmohney)
02:15 <* hackage> ngx-export 0.3.1.0 - Helper module for Nginx haskell module https://hackage.haskell.org/package/ngx-export-0.3.1.0 (lyokha)
02:15 <Costar> glguy: im taking a automata/computability class
02:15 <* hackage> fltkhs 0.5.1.6 - FLTK bindings https://hackage.haskell.org/package/fltkhs-0.5.1.6 (deech)
02:15 <Costar> glguy: and made me think
02:15 <glguy> mniip: ^
02:15 <mniip> dammit
02:16 saussure joined
02:16 coltfred_ joined
02:16 <Costar> glguy: probably im wrong
02:17 hackage joined
02:17 <mniip> well at least I've figured out the problem
02:17 sellout- joined
02:18 <glguy> Costar: I was just asking why you thought that
02:18 exferenceBot joined
02:18 <glguy> mniip: Cool :) Is the problem easy to explain?
02:18 <mniip> basically, it fails to parse a certain row in an rss feed
02:19 <Costar> glguy: I read it somewhere. And when this class started, i remembered that.
02:19 <mniip> and so it chokes until the row disappears from "recent"
02:19 <mniip> and once it does the whole "recent" is new packages so it dumps them at once
02:19 <glguy> mniip: Does it have any way to limit the announcement rate for the case where there are actually 20 unique packages released all at once?
02:19 <glguy> from different authors
02:20 <mniip> uhhh not really
02:20 <mniip> I should probably add something like that?
02:20 <mniip> assuming we aren't going to see a unique package every minute in near future
02:20 <glguy> I guess it's not that common, but it could save it from Sigyn
02:20 <mniip> well, there are other ways to save it from sigyn
02:22 <mniip> and the reason it failed to parse is pretty stupid
02:22 hexagoxel joined
02:22 <mniip> someone back in the day decided it's a good idea to make . not match newlines...
02:22 darlan joined
02:23 <glguy> Which package has a newline in its synopsis?
02:23 hackage joined
02:23 <mniip> '<i>Added by BryanOSullivan, Sun May 21 01:54:39 UTC 2017.</i><p>Generator and shrink functions for testing\nUnicode-related software.'
02:23 <mniip> whatever package that was
02:24 <mniip> http://hackage.haskell.org/package/quickcheck-unicode
02:24 brynedwards joined
02:26 wroathe joined
02:27 Cale joined
02:28 mw joined
02:31 shanemikel_ joined
02:31 wroathe joined
02:33 hybrid joined
02:34 saussure joined
02:35 <* hackage> HStringTemplate 0.8.6 - StringTemplate implementation in Haskell. https://hackage.haskell.org/package/HStringTemplate-0.8.6 (SterlingClover)
02:36 {emptyset} joined
02:39 systadmin joined
02:41 cschneid_ joined
02:41 daniel-s joined
02:42 <glguy> We're already allowed to use type synonyms when declaring GADTs, but not or declaring their fields (e.g. Allowed: type S = T; data T where C :: Int -> S -- but not -- data T where C :: S; type S = Int -> T )
02:42 <glguy> I wonder if that's intentional or an oversight
02:43 saussure joined
02:45 DrMentats joined
02:46 <* ski> would assume the latter
02:47 descender joined
02:48 jbalint joined
02:49 Xanather joined
02:52 CoderPuppy joined
02:53 <Lokathor> I'm trying to transform all these matrixes
02:54 <Lokathor> but the linear package isn't making it easy
02:54 <Lokathor> it makes me /actually learn math/ instead
02:54 <Lokathor> booo
02:55 aarvar joined
02:57 andyhuzhill joined
02:57 wroathe joined
02:59 chao-tic joined
02:59 flatmap13 joined
03:01 saussure joined
03:01 conal joined
03:03 <thang1> Lokathor: what part are you getting stuck on?
03:04 <Lokathor> thang1, well it's just that i'm following along with some tutorals that use a C++ lib called GLM, which is specifically oriented to matrixes that control OpenGL
03:04 <thang1> ahh right, so you have to convert a bunch of shortcuts and helper functions into the "real math" :p
03:04 <Lokathor> so they've got a lot of functions that are, in haskell terms, doThing :: ThingDescription -> Matrix -> Matrix
03:05 <Lokathor> yeah
03:05 <thang1> Love the documentation for the linear package. Just read the types bro /s
03:05 <Lokathor> well, in the case of linear, it's what i'd call justified
03:06 <Lokathor> if there was a package about quadratic equations, it'd hardly be able to tell you in a haddock all bout why you'd use one
03:06 m1911 joined
03:06 <Lokathor> same for linear algebra
03:06 <thang1> True, it's literally just functions that implement linear algebra
03:06 monadicD1ck joined
03:07 <EvanR> is there an extension i need to enable to make (\(e :: ExceptionX) -> ...) valid syntax?
03:07 <Lokathor> thankfully, the module names and opengl terms match up enough that i was able to fumble my way about
03:07 <thang1> That's nice
03:07 monadicD1ck joined
03:08 <EvanR> monadicD1ck: hmm might want to fix your nick
03:08 <Lokathor> I think I'll still end up writing some sort of, (adjustMatrix :: [AdjustmentOperation] -> Matrix -> Matrix) helper if I end up doing a lot of 3d
03:08 <thang1> Change it to monadicR1ch4rd
03:08 justan0theruser joined
03:08 <Lokathor> monadicGumsho3
03:09 <duckqlz> it is suppose to be duck someone took my name sorry
03:09 <duckqlz> >_<
03:09 <* hackage> tmapmvar 0.0.3 - A single-entity stateful Map in STM, similar to tmapchan https://hackage.haskell.org/package/tmapmvar-0.0.3 (athanclark)
03:10 <thang1> Lokathor: maybe you can just write a translation of the GLM library into Haskell?
03:10 <EvanR> linear man
03:10 <EvanR> it seems almost made for opengl
03:10 tommd joined
03:10 <Lokathor> thang1, unlikely, since I don't know crap about C++, and when I looked at the source it was like 20 template files :P
03:10 <Lokathor> EvanR, since the same author made gl, perhaps there was a logic behind it
03:11 <EvanR> yes
03:11 <Lokathor> though linear uses a row-major ordering, and OGL uses a column-major ordering, i'm told
03:11 <thang1> Right, I just meant that GLM has a binch of shortcut functions and helper functions and stuff like that and I just meant more defining those same shortcuts in a module and calling it a library
03:11 <EvanR> Lokathor: i recall just doing a transpose before dumping to gl
03:11 <Lokathor> yeah taht's what i did
03:12 <thang1> Why the hell would anyone ever use column major ordering?
03:12 <EvanR> its kind of arbitrary
03:12 <Lokathor> thang1, a theoretical "adjustMatrix" would take a list of adjustments (data AdjustOperation = Rotate axis angle | Translate vector | Scale scale) and then fold them down onto the starting matrix
03:13 <thang1> Row major ordering has much nicer memory layouts on the hardware for most things, so it's almost always much faster
03:13 <EvanR> Lokathor: hmm, thats just 3 separate functions
03:13 <Lokathor> that would probably be simple enough to write, and also simple enough to use in pracice
03:13 <EvanR> you dont really need a data type to select that
03:13 felixsch_ joined
03:13 <Lokathor> EvanR, but I like the part where you can put them in a list as a single call
03:13 leat joined
03:13 <EvanR> you can put the functions in a list
03:13 <EvanR> if you wanted
03:13 <Lokathor> hmm
03:13 <Lokathor> true
03:14 <EvanR> the completed calls that is
03:14 <EvanR> which is what those really are
03:14 <Lokathor> well you could have a [Matrix -> Matrix], and fold that down onto your starting Matrix, just as easily
03:14 <EvanR> yep
03:14 xall joined
03:15 <EvanR> foldl' ($)
03:15 <Lokathor> hmm
03:15 <Lokathor> left?
03:15 <EvanR> more importantly '
03:15 <Lokathor> yeah left
03:15 <Lokathor> oh well the result would almost immediately be dumped into a Ptr value, so it's forced anyway
03:16 <EvanR> for 3 matrices dunno if it matters
03:16 obruT1 joined
03:16 <EvanR> but i just use ' by default when doing a fold of this kind
03:16 <Lokathor> time for lots of microbenchmarks!
03:16 <Lokathor> surely
03:17 kvda_ joined
03:18 wroathe joined
03:18 jgertm joined
03:18 sleffy joined
03:19 saussure joined
03:20 jimmyrcom_ joined
03:20 <thang1> woo! bikeshedding!
03:21 CoderPuppy joined
03:22 revtintin joined
03:23 ertesx joined
03:24 jimmyrcom_ joined
03:24 louispan joined
03:25 <dfeuer> I do not like unsafePerformIO. I really wish we had some cleaner way(s) to accomplish its purposes.
03:26 <EvanR> like, more things like it that did something more specific or
03:26 alexelcu joined
03:26 <EvanR> did something in a more well define way, or whats the issue with UPIO
03:26 dtornabene joined
03:27 <thang1> I'm guessing it's more along the lines of "if we had more functions for UnsafePerformX we could make certain guarantees for things, and so limit the potential danger when using them"
03:29 saussure joined
03:30 <EvanR> i just noticed that the docs say "atomically cannot be used inside of unsafePerformIO"
03:30 <EvanR> and that i am doing it anyway, and its working
03:31 <EvanR> as long as i dont try to begin a transaction while inside another
03:31 <EvanR> mamamia
03:31 <Cale> dfeuer: The point of unsafePerformIO is to save you from having to modify GHC in order to obtain some of those things
03:32 <CyberShadow> given funa $ funb $ func x, what's the simplest way to make funb conditional on a bool?
03:32 <Cale> CyberShadow: if/then/else?
03:32 flatmap13 joined
03:32 <CyberShadow> Okay. func is longer in my code though
03:33 <CyberShadow> Wondering if there's a simple way that doesn't involve defining a function
03:33 <Cale> CyberShadow: I don't know what you mean
03:33 <CyberShadow> Sorry
03:33 <Cale> case would also do it
03:34 <dfeuer> Cale: thang1, EvanR, what bothering me is noDuplicate#.
03:34 <Cale> If you prefer pattern matching on the Bool
03:34 <dfeuer> (at the moment)
03:34 <CyberShadow> funa $ (if cond then funb else id) $ func x
03:34 <CyberShadow> Does that make sense?
03:34 <Cale> yes
03:34 <CyberShadow> Thanks
03:34 <dfeuer> It's not easy to understand noDuplicate# from a source Haskell perspective.
03:35 <dfeuer> And that gets into the weirdness of unsafePerformIO, which makes you have to think about when/where thunks are created, and how to make sure that you're talking about the thunk you want to be.
03:36 <EvanR> youre doing something that depends on sharing or not?
03:36 <Cale> dfeuer: Well, it exists to prevent the case where two threads both begin evaluation of the expression within a few cycles of one another, and so bypass the blackholing mechanism
03:36 <dfeuer> Yes.
03:36 <dfeuer> But it's all terribly awkward.
03:37 <Cale> There's unsafeDupableIO iirc, if you don't want that check.
03:37 <dfeuer> Here's an alternative to unsafePerformIO that feels like it should be less horrible:
03:38 <dfeuer> (Slightly less horrible, anyway): unsafePerformIO' :: IO a -> (# a #)
03:38 <Cale> what is that?
03:38 <dfeuer> So instead of let res = unsafePerformIO m in e, you'd have case unsafePerformIO m of (# res #) -> e
03:38 <Cale> An unboxed 1-tuple... containing a polymorphic value somehow?
03:39 pavonia joined
03:39 <dfeuer> Polymorphic?
03:39 <hanna> It's 2017, is there a good way to call C++ from haskell yet or is the status quo still writing your own C library?
03:39 <EvanR> the way anything calls to C++
03:39 <dfeuer> Cale: unboxed tuples can hold polymorphic values....
03:39 <EvanR> via extern C linkage
03:40 joco42 joined
03:40 <Cale> hanna: heh, you could do what Ed Kmett is working on and compile Haskell to C++... then you'd get a pretty good story for C++ FFI.
03:40 <dfeuer> The vague idea (which may or may not be the right one)
03:40 <hanna> “The FFI specification mentions, but does not require, an alternative calling mechanism for C++; no Haskell compiler has ever implemented this.” heh
03:40 <tefter> problem is name mangling that is compiler specific
03:41 <Cale> Yeah, C++ isn't exactly designed to be easy to FFI to
03:41 <tefter> yep
03:41 <glguy> dfeuer: How does the unboxed tuple help with replacing noDuplicate#?
03:42 <Cale> dfeuer: Oh, I suppose I can see that -- it's the tuple itself which is unboxed after all.
03:42 <dfeuer> glguy: the idea (which may or may not really make sense) is to replace noDuplicate# (check that no other thread is evaluating any thunks I am) with creation of a thunk that, on entry, blackholes itself.
03:42 twopoint718 joined
03:42 segmond joined
03:43 <Cale> dfeuer: Every thunk does that already though...
03:43 <dfeuer> Cale: no, blackholing only happens when a thread is descheduled, generally (as I understand it).
03:43 <Cale> uhh... that's interesting
03:45 <Cale> Well, at one point in time, I'm certain it was the case that every thunk entry caused blackholing to occur
03:45 <dfeuer> glguy: that thunk is the one that's extracted from the unboxed tuple. So instead of having a thunk created *around* weirdness, it's created *inside* it. The semantics surely still suck, but it feels more manageable.
03:45 <Cale> and this machinery was still needed in the presence of unsafePerformIO
03:46 <tefter> heh idris compiler does not turns recursion in a loop always
03:46 <dfeuer> Cale: there have been several design changes over time, but I couldn't tell you exactly what the history is.
03:46 <tefter> so cycle repeat take all blow up stack
03:46 <Cale> because even if you do the blackholing, you can have the rare case where one thread enters a thunk, then the other, and then the first thread does the blackholing, and so does the second, and so they're both in there, evaluating away
03:47 saussure joined
03:47 <dfeuer> Cale: ah, yes, blackholing isn't sufficient. You're right.
03:47 <thang1> One thing I'd much rather see is a Rust FFI instead of a C++ FFI. Them types would help a lot...
03:47 <dfeuer> But....
03:47 <dfeuer> Maybe the thunk would use a different approach (CAS) to blackholing itself?
03:48 <dfeuer> I'm forgetting some details.
03:48 <dfeuer> And never learned others.s
03:49 yamad joined
03:49 <Lokathor> so is using WebGL practical at the moment?
03:49 <Lokathor> (in Haskell that is, of course)
03:51 <Cale> Lokathor: I haven't tried it, but my understanding is that it is somewhat doable
03:51 <Cale> Lokathor: Hey, check this out https://hackage.haskell.org/package/ombra
03:51 <* hackage> haskus-utils 0.6.0.0 - Haskus utility modules https://hackage.haskell.org/package/haskus-utils-0.6.0.0 (SylvainHenry)
03:52 uglyfigurine joined
03:53 <Lokathor> oh my
03:53 andyhuzhill joined
03:53 <Lokathor> silly me, forgetting that i'd need to use GHCJS
03:53 <Lokathor> I'll step away from that dragon for now
03:56 t joined
03:56 Xanather joined
03:57 louispan joined
03:59 Lemmata joined
04:01 gestone joined
04:01 geekg_000_ joined
04:02 flatmap13 joined
04:03 <thang1> Maybe purescript?
04:03 Welkin joined
04:05 saussure joined
04:07 Koterpillar joined
04:10 descender joined
04:11 afarmer joined
04:12 codygman joined
04:12 louispan joined
04:12 <duckqlz> no use elm
04:13 <Axman6> for a week, until you get sick of writing the same function again and again
04:14 <codygman> I have a list of dependencies [("a","b"),("a","c"),("a","d"),("b","e"),("c","e"),("d","f"),("d","e"),("f","e")] and I'd like to be able to get the full list of dependencies for a given dependency. I think I need a Graph, but Data.Graph.buildG seems to only take ints.
04:15 Koterpillar joined
04:15 <glguy> Data.Graph's graph is just for tracking nodes and edges. You'd need to keep a separate mapping of nodes or edges to labels
04:15 <glguy> fgl is probably the easiest way to go
04:15 <Axman6> it's a little gross, but you could hash the values
04:16 <duckqlz> Data.Graph.Inductive.Graph can have labeled nodes
04:16 <glguy> You'd have to make sure the hashes didn't collide
04:18 <Axman6> yeah
04:19 kvda joined
04:19 <athan> Hey all - when I try running an action in a `MonadIO m => m ()`, but before I do the thing, I run `liftIO $ putStrLn ""` and get different results (a locking mvar, or weird blocking, for instance). Is there a good name for code that behaives like this?
04:19 Sh4rPEYE joined
04:19 <Sh4rPEYE> Hey. What does it mean to parse "decimal" number? What's the difference between that and an integer?
04:20 <glguy> Sh4rPEYE: decimal is specifying that it's a base 10 number, using the digits 0-9
04:20 augur_ joined
04:20 <Sh4rPEYE> And that's it?
04:20 <erisco> codygman, can there be cycles?
04:20 <Sh4rPEYE> Ok, thanks.
04:20 wroathe joined
04:21 SkyPatrol joined
04:21 <Welkin> lol duckqlz
04:21 <Welkin> why elm?
04:21 pavonia_ joined
04:21 <codygman> erisco: No
04:21 <athan> basically - doing IO before the thing produces different results (due to garbage collection or something). What would you call this?
04:21 <duckqlz> athan: decimal ∈ R , integer ∈ N ??
04:21 <Welkin> I built an app that is online right now using elm, and I decided to never use it again
04:22 <duckqlz> I really enjoy elm
04:22 <athan> duckqlz: kinda more like
04:22 tzh joined
04:22 <Welkin> duckqlz: try purescript, you will leave elm behind
04:22 <athan> duckqlz: decimal \in positiveDecimals , integer \in positive integers
04:22 <athan> given that \in is backwards :v
04:22 <erisco> > (Map.fromListWith Set.union . (fmap . fmap) Set.singleton) [("a","b"),("a","c"),("a","d"),("b","e"),("c","e"),("d","f"),("d","e"),("f","e")]
04:22 <lambdabot> error:
04:22 <lambdabot> Not in scope: ‘Map.fromListWith’
04:22 <lambdabot> Perhaps you meant one of these:
04:22 <erisco> @import qualified Data.Map as Map
04:22 <lambdabot> Unknown command, try @list
04:22 <athan> Welkin: atta boy
04:23 <erisco> what...
04:23 saussure joined
04:24 <erisco> I thought someone did this earlier
04:24 M2tias joined
04:24 <erisco> > (M.fromListWith Set.union . (fmap . fmap) Set.singleton) [("a","b"),("a","c"),("a","d"),("b","e"),("c","e"),("d","f"),("d","e"),("f","e")]
04:24 <Welkin> try Data.Map.fromListWith
04:24 <lambdabot> error:
04:24 <lambdabot> Not in scope: ‘Set.union’
04:24 <lambdabot> Perhaps you meant ‘S.union’ (imported from Data.Set)
04:24 baldrick joined
04:24 <erisco> I don't understand
04:24 <Welkin> fully qualify the names
04:24 <erisco> > (M.fromListWith S.union . (fmap . fmap) S.singleton) [("a","b"),("a","c"),("a","d"),("b","e"),("c","e"),("d","f"),("d","e"),("f","e")]
04:24 <lambdabot> fromList [("a",fromList ["b","c","d"]),("b",fromList ["e"]),("c",fromList ["...
04:24 <Welkin> :t Data.Map.fromListWith
04:24 <lambdabot> Ord k => (a -> a -> a) -> [(k, a)] -> M.Map k a
04:25 ent joined
04:25 <erisco> no, someone imported these as qualified earlier
04:25 <athan> artisanal hotdogs
04:25 <erisco> or I am grossly misremembering
04:25 medical joined
04:25 kriztw joined
04:25 unsymbol joined
04:25 jrp6 joined
04:25 <duckqlz> Welkin: Just read a bit a bout purescript and I am already hooked. Thanks for the advice!
04:26 <erisco> codygman, so the next question is if you actually want the transitive closure
04:26 amosbird joined
04:26 <codygman> erisco: TBH I don't know what that means
04:26 Argue joined
04:26 <erisco> codygman, do you know what transitivity is?
04:26 happy0 joined
04:27 <Welkin> I have been laughing as I've been reading the docs for purescript
04:27 magthe joined
04:27 <Welkin> it feels like it was written by a category theorist
04:27 <Welkin> but the weird thing is that it's not over my head (mostly)
04:28 <codygman> erisco: No
04:28 <erisco> codygman, transitivity is the property that if a R b and b R c then a R c
04:28 hamishmack joined
04:28 tsahyt joined
04:28 <erisco> codygman, a common place you see this is with R as =
04:28 <thang1> yay math!
04:28 <erisco> or ==
04:28 atk joined
04:28 mimi_vx joined
04:29 vtomole joined
04:29 <erisco> in your scenario, R is "depends on"
04:29 <Sh4rPEYE> In the chapter about parsers in Haskell Book they say:
04:29 <Sh4rPEYE> try :: m a -> m a
04:29 <Sh4rPEYE> This takes a parser that may consume input and, on failure, goes back to where it started and fails if we didn’t consume input
04:29 halogenandtoast joined
04:29 <codygman> erisco: Actually, I slightly remember that one from a logical fallacy.
04:30 <Sh4rPEYE> So, well, if the parser doesn't consume the input, it goes to the beginning f the input and... fails everytime?
04:30 <codygman> or perhaps just logic
04:30 SkyPatrol_ joined
04:30 Guest37310 joined
04:31 <vaibhavsagar> Sh4rPEYE: it only runs once, not in a loop
04:31 <erisco> codygman, the "closure" part is not that important here. That just acknowledges that you have some set of objects which you're forming the dependency relation on
04:31 Ring0` joined
04:31 <erisco> codygman, more simplistically we can just ask if your relation is transitive, and if it is not then how do we make it so
04:31 <erisco> or, maybe you do not need it to be
04:32 eacameron joined
04:33 saussure joined
04:33 <Sh4rPEYE> vaibhavsagar: I worded it badly. I know it runs only once, I just didn't understand how it is useful when it fails if we fail to cosume the input. But I guess the parser can consume the whole input, but don't return Success, in which case the try "returns" back to the beginning of the parsed string.
04:34 <monochrom> Sh4rPEYE: consider "try x <|> y"
04:34 joe9 joined
04:34 Lemmata joined
04:34 <joe9> can anyone please help with this error? http://codepad.org/mIx7tGYq . I am trying to install stack for the first time.
04:35 yirabbit_ joined
04:35 <Sh4rPEYE> monochrom: Actually, I've written this and been surprised it'd worked. That's why I came here :-D
04:35 <Sh4rPEYE> (Right <$> try parseFraction) <|> (Left <$> parseDecimal)
04:35 <Lokathor> is there a reason for there to not be an Ix instance that allows any Bounded Enum to be used as Ix, other than sanity?
04:36 <glguy> Mainly because that's not how instances work
04:36 <codygman> erisco: I'm not quite sure, perhaps if I give the problem I'm trying to solve you or others can help me fill in other holes in my knowledge as well? I have some chronos (job scheduler) jobs which have parents. I start job A which has no parents, then when it finishes all the jobs that list A as a parent are started. then each of the jobs that list those as parents are started. I want to get every single dependency in that chain
04:36 <glguy> You provide them for specific types
04:36 <codygman> and check their status
04:36 <codygman> then do an action when the entire dep chainc ompleted
04:36 <Welkin> joe9: looks like maybe a corrupt configuration? How are you installing stack?
04:36 connrs joined
04:37 intelux joined
04:37 <Welkin> joe9: I'd recommend just downloading the binary for your system
04:37 <Lokathor> glguy, ah, so you can't make a type have an instance as long as it supports some other set of instances?
04:37 <Welkin> from there you can upgrade to a newer version if necessary
04:38 <joe9> Welkin: ok, Thanks.
04:38 <Welkin> joe9: https://docs.haskellstack.org/en/stable/README/#how-to-install
04:38 <monochrom> Sh4rPEYE: Ah. So actually, compare "(p >> q) <|> y" and "try (p >> q) <|> y".
04:38 <erisco> codygman, ah, then the transitive closure is probably not what you want
04:38 tnks joined
04:38 <erisco> you want to just take immediate dependencies
04:38 sleffy joined
04:38 Xanather joined
04:38 <athan> is there a `x :: IO ()` that is semantically == pure (), but contributes a touch into the IO environment?
04:38 <monochrom> Suppose p consumes input and succeeds. Then "(p >> q) <|> y" will commit to q and forget y. If q fails, there is no backtracking to y.
04:39 treehaqr joined
04:39 <erisco> in that case Map.fromListWith Set.union . (fmap . fmap) Set.singleton should work well
04:39 SkyPatrol joined
04:39 plutoniix joined
04:39 <athan> like a unitary operation, but is actually an IO operation that could cause other code to be discombobulated or something
04:39 <Welkin> erisco: not <$$>?
04:39 <codygman> erisco: Hm, alright I'll try that
04:39 <erisco> this is a more natural progression to lens
04:39 <erisco> or something... I don't know lens :P
04:40 <monochrom> "try (p >> q)" fixes that. When q fails, now "try" resets to the point before p started and waives the commitment. Now y will be attempted.
04:40 plutoniix joined
04:40 joco42 joined
04:41 macrover joined
04:41 wroathe joined
04:42 plutoniix joined
04:42 <monochrom> What is discombobulated? :)
04:42 <erisco> an inculcating word
04:42 <Welkin> scrmabled
04:42 <Welkin> scrambled about*
04:42 <CyberShadow> Given an IO String and a Bool, how do I convert them to an IO (String, Bool) ?
04:42 baldrick joined
04:42 <joe9> Welkin: I got the static build for linux (which I am on). http://codepad.org/bSUQvSJ1 when I run ./stack install stack. I have ghc 8.0.2 installed by my package manager http://codepad.org/DVZUdg9Z
04:43 <Sh4rPEYE> monochrom: Yes, thank you
04:43 <EvanR> not uncombobulated
04:43 <joe9> Welkin: but, I still get the same error http://codepad.org/WLBWu7jR
04:43 <vaibhavsagar> CyberShadow: fmap (,boolean) <$> ioString
04:43 <joe9> https://gist.github.com/2033169fdfb44bea864c36ca904f57b5 Welkin, this is the global-project/stack.yaml file
04:43 <vaibhavsagar> actually you don't need the fmap
04:44 <cocreature> joe9: by default stack ignores installations of ghc not managed by itself
04:44 <joe9> http://codepad.org/mglMBvFp this is from the ./stack/config.yaml
04:44 <Welkin> joe9: all you need to do is run `curl -sSL https://get.haskellstack.org/ | sh`
04:44 <Welkin> I don't know why you are using ./stack install stack
04:45 <duckqlz> [question] What are haskellers using for a backend for web apps?
04:45 <CyberShadow> vaibhavsagar: I get "Illegal tuple section: use TupleSections"
04:45 <joe9> Welkin: but, that wants root password and I do not want to give it that.
04:45 <cocreature> joe9: the error message pretty much covers the options you have, either install ghc via stack using "stack setup" or use --system-ghc or set that option permanently using "stack config set system-ghc --global true"
04:45 <Welkin> joe9: then download the file and inspect it yourself
04:45 <Welkin> of course it needs root permission, because it writes outside of your home directory
04:45 <joe9> cocreature: yes, I set the stack config system-ghc --global true, http://codepad.org/AIEKtf7b
04:46 <vaibhavsagar> CyberShadow: try fmap (flip (,) boolean) ioString
04:46 <Welkin> you can alos always install stack from your package manager too
04:46 <Welkin> and then run `stack upgrade`
04:46 <Welkin> lots of options here
04:46 <codygman> > (fmap . fmap) (+1) $ [(0,0)] -- Why does this increment the second 0?
04:46 <lambdabot> [(0,1)]
04:46 <* hackage> haskus-binary 0.6.0.0 - Haskus binary format manipulation https://hackage.haskell.org/package/haskus-binary-0.6.0.0 (SylvainHenry)
04:46 <cocreature> it seems like joe9 already has a stack binary so you can just copy that to ~/.local/bin/stack and be done with it
04:46 <cocreature> and maybe run stack upgrade
04:47 <EvanR> > (fmap . fmap) (+1) $ [(True,0)]
04:47 <lambdabot> [(True,1)]
04:47 <EvanR> the first component can be any other type
04:47 <monochrom> codygman: The inner fmap is (a,?)'s
04:47 <cocreature> > fmap fmap fmap (+1) $ [(True, 0)]
04:47 <lambdabot> [(True,1)]
04:47 <Welkin> cocreature: are you asking or teaching?
04:47 eacameron joined
04:47 <CyberShadow> vaibhavsagar: That works, but wow
04:48 neoo joined
04:48 <CyberShadow> Why is it so complicated?
04:48 <Welkin> er
04:48 <monochrom> Or rather, ((,) a)'s. instance Functor ((,) a) where ...
04:48 <Welkin> codygman: ^
04:48 <monochrom> ... fmap f (x,y) = can only do (x, f y)
04:48 <EvanR> oh wait is the nick supposed to be co-dynman
04:48 eklavya joined
04:48 <joe9> cocreature: ok, got it. Thanks. Welkin.
04:49 <cocreature> EvanR: dynman as in the opposite of staticman?
04:49 Xanather_ joined
04:49 <codygman> > fmap (+1) (0,0) -- I *kind* of understand, but I think this one was closer to my question and it's because ((,) a)'s Functor instance as monochrom said.
04:49 <lambdabot> (0,1)
04:50 neoo joined
04:50 jedws joined
04:50 louispan joined
04:50 <EvanR> > bimap (+1) (+1) (0,0)
04:50 seliopou joined
04:50 <lambdabot> (1,1)
04:50 <EvanR> lets you use both sides
04:50 <* cocreature> waits for someone to complain about the Foldable instance of (a,)
04:50 <Welkin> > (fmap . fmap . fmap) (+1) (Just [("lofi", 0)])
04:50 <lambdabot> Just [("lofi",1)]
04:50 <codygman> EvanR: Oh, cool.
04:50 <EvanR> we need a bifoldable
04:50 <Axman6> Can I anti-complain?
04:50 saussure joined
04:50 fakenerd joined
04:50 <cocreature> EvanR: is that really not a thing already?
04:51 <monochrom> Yes! You can praise!
04:51 <EvanR> haha i dont know
04:51 <cocreature> EvanR: https://hackage.haskell.org/package/bifunctors-5.4.2/docs/Data-Bifoldable.html#t:Bifoldable
04:51 <codygman> Welkin: lol, well that makes sense.
04:51 neoo joined
04:51 <EvanR> Bifoldable ((,,,) x y)
04:51 <EvanR> :|
04:52 <Axman6> too many ,'s?
04:52 <Axman6> hmm, maybe not
04:52 <EvanR> the right number
04:52 <Axman6> yeah
04:52 <halogenandtoast> Does anyone know how to do a 301 redirect in Spock, the `redirect` command seems to do a 302.
04:52 <glguy> Maybe the right number is also too many?
04:52 <* EvanR> sends this package to bifrost
04:52 <Welkin> halogenandtoast: you can specify explicit status codes using wai
04:53 neoo joined
04:53 <Axman6> I feel we're approaching https://raw.githubusercontent.com/mxswd/flip-plus/master/Control/FlipPlus.hs
04:53 <Axman6> @where+ flip-plus https://raw.githubusercontent.com/mxswd/flip-plus/master/Control/FlipPlus.hs
04:53 <lambdabot> Done.
04:53 <Welkin> halogenandtoast: http://hackage.haskell.org/package/http-types-0.9.1/docs/Network-HTTP-Types-Status.html#t:Status
04:53 <monochrom> What you need is "class NFoldable (n :: Nat) f | f -> n" and "instance NFoldable 3 (,,,)"
04:54 <halogenandtoast> Welkin: Alright, I'll try to figure that out.
04:54 connrs joined
04:54 <halogenandtoast> I assume I have to wrap that in an Action somehow.
04:54 <benzrf> Axman6: hahahha
04:55 <Welkin> halogenandtoast: well, spock (like almost every other haskell web server library) is built on warp/wai
04:55 <Welkin> so you can always use these
04:55 <benzrf> Axman6: but why are they operators?
04:55 <Welkin> some libraries (not sure about spock) will have higher level wrappers
04:55 <Welkin> or you can build your own
04:55 neoo joined
04:55 <Axman6> ¯\_(ツ)_/¯
04:55 ddere joined
04:55 caumeslasal joined
04:56 neoo joined
04:58 <Welkin> halogenandtoast: this could be useful http://hackage.haskell.org/package/wai-3.2.1.1/docs/Network-Wai.html#v:responseLBS
04:58 neoo joined
05:00 warrshrike joined
05:00 <Welkin> halogenandtoast: inside of Network.Wai.Application you can use this `respond $ responseLBS HTTP.status301 headers ""`
05:02 <halogenandtoast> Thanks Welkin I'll try that out.
05:02 wroathe joined
05:02 xall joined
05:02 <halogenandtoast> Seems better than what I was trying to do
05:03 mmn80 joined
05:04 dfordivam joined
05:04 <EvanR> checked the source code for getContents, still dont really understand how it works. unsafeInterleaveIO doesnt seem to explain its streaming capability
05:05 YongJoon joined
05:06 Swizec joined
05:06 Lemmata joined
05:07 <glguy> Do you not understand what unsafeInterleaveIO does or not understand how it's used? something else?
05:08 <EvanR> it returns an unevaluated value, evaluating it causes the IO to happen
05:08 <EvanR> once
05:09 saussure joined
05:09 peterbecich joined
05:09 <EvanR> but there must be lots of IO happening to get all the contents
05:09 <EvanR> multiple times
05:09 <glguy> Yeah, so you use lots of unsafeInterleaveIO
05:09 <monochrom> You need to dig deeper. The source code of unsafeInterleaveIO itself.
05:10 <glguy> It's used one per chunk read
05:10 <glguy> each use is nested within the previous
05:10 <monochrom> Eventually you will run into a primitive, at which point you need to dig into GHC itself, too.
05:10 <* EvanR> looks again
05:11 <opqdonut> seems to me call chain is getContents -> hGetContents -> lazyRead -> lazyReadBuffered which recurses to lazyRead
05:11 fakenerd joined
05:11 <opqdonut> and the unsafeInterleaveIO is in lazyRead, so it gets called for every recursion
05:12 <opqdonut> I'm reading it from here: http://hackage.haskell.org/package/base-4.9.1.0/docs/src/GHC.IO.Handle.Text.html#hGetContents
05:12 <glguy> consider a simple example: getChars = unsafeInterleaveIO (liftA2 (:) getChar getChars)
05:12 <EvanR> i see it now, lazyRead is being called from within itself
05:12 <opqdonut> yeah that should be equivalent
05:13 <EvanR> which = unsafeInterleaveIO $ some stuff
05:14 jutaro joined
05:15 jutaro joined
05:15 vlatkoB joined
05:16 andyhuzhill joined
05:16 <EvanR> well
05:16 <hanna> In general, can I assume fromIntegral will be rewritten to more efficient implementations for common cases like converting between Word sizes, or converting between Int and Int64 etc.?
05:16 <EvanR> then the actuall appending is somehow happening in unpack
05:17 <EvanR> the 4th argument is a "lazy" rest of string...
05:17 dec0n joined
05:18 <halogenandtoast> Seems better than what I was trying to do
05:18 <halogenandtoast> oops O_o
05:18 saussure joined
05:18 meandi_2 joined
05:18 <monochrom> hanna: I think yes.
05:20 sword865 joined
05:23 Jeanne-Kamikaze joined
05:24 eklavya joined
05:25 <Axman6> yeah I believe there are rewrite rules for all of those
05:26 <EvanR> i see, so basically, UIIO, read a char, rest<-loop, return c : rest
05:26 <EvanR> but with a bunch of crunch buffering going on because of unicode
05:27 <EvanR> crunchy
05:27 <EvanR> that is wacky
05:27 <Lokathor> i give up
05:27 <Lokathor> where is the thing to normalize a vector in the linear package
05:28 <Lokathor> it seems like it'd be there, but it's seemingly not
05:28 Costar joined
05:28 Sh4rPEYE joined
05:28 <peddie> Lokathor: Linear.Metric I think
05:29 <peddie> Lokathor: https://hackage.haskell.org/package/linear-1.20.6/docs/Linear-Metric.html#v:normalize
05:29 <peddie> Lokathor: hit #3 when I hoogle search `normalize` . . . :P
05:29 cschneid_ joined
05:29 <Lokathor> oh that hoogle
05:29 <EvanR> man linear has gotten a lot more lensy these days
05:30 Kuros` joined
05:30 <hanna> Aaw, I can't use ForeignPtr "Xapian::Document"
05:33 primal joined
05:33 osa1 joined
05:35 Altair_Baltair joined
05:35 <Altair_Baltair> Good afternoon
05:36 baldrick joined
05:36 saussure joined
05:37 freusque joined
05:37 Altair_Baltair left
05:38 Lemmata joined
05:38 systadmin joined
05:41 freusque joined
05:41 Lemmata joined
05:41 <Axman6> EvanR: Lens exists because of Linear
05:42 <Axman6> so sayeth edwardk
05:42 <* edwardk> looks up
05:42 <EvanR> and linear exists because of gl ?
05:42 <EvanR> or what is the lineage legend
05:42 <edwardk> linear exists because i needed a way to talk about physics in a purely functional physics engine for an aborted game engine
05:43 <edwardk> every time i obsess about graphics in between larger projects the haskel community gets something interesting. =)
05:43 <edwardk> gl happened because of another such obsession window
05:43 <edwardk> but it was later
05:44 wroathe joined
05:46 saussure joined
05:46 <Axman6> If only you were interested in making a game backed by a database and decided you needed a type safe database library which isn't a pain
05:48 ThomasLocke joined
05:52 <LiaoTao> *hint hint*
05:52 rickygee joined
05:54 renzhi joined
05:55 <Axman6> >_>
05:56 <systemfault> What do you people think of free monads? Some articles are basically saying they're the best thing since sliced bread.
05:56 davr0s joined
05:56 louispan joined
05:57 gestone joined
05:58 <hanna> I'm trying to wrap a pure C++ function that has the signature std::string fun(double val) -- and I want to get it as a CStringLen so I can convert it to String; what would be the best approach to do this? When something expects std::string as a parameter I've just been passing (const char *str, size_t len) to the function and applying the std::string constructor in the C wrapper, but this doesn't work in the
05:58 <hanna> opposite direction due to lack of multiple return
05:58 <* hackage> preamble 0.0.36 - Yet another prelude. https://hackage.haskell.org/package/preamble-0.0.36 (markfine)
05:58 <hanna> While I *could* do something ugly like passing a *size_t to write the size into, I don't know how to safely “unpack” a std::string for consumption by Haskell
05:59 <EvanR> please use a C string instead
05:59 <Axman6> I don't believe the FFI supports C++ directly, so you'd probably need at least a C wrapper around that, and probably to convert it to a char*
05:59 charco joined
06:00 <hanna> Well I can't change the API of the library, so I *must* somehow take a std::string and make haskell happy with it
06:00 zcourts joined
06:00 <LiaoTao> hanna: A wrapper seems appropriate
06:00 <Axman6> I'm pretty surer you can't
06:00 <hanna> LiaoTao: A wrapper is what I'm trying to write
06:00 <hanna> But I don't know how
06:00 <Axman6> the C++ ABI isn't compatible with the C ABI the FFI supports
06:00 <EvanR> you need some C shims
06:00 darjeeli1 joined
06:01 lavalike_ joined
06:01 Mortomes|Work joined
06:02 Gurkenglas joined
06:02 peterjg joined
06:03 <cocreature> strdup your way to glory
06:04 saussure joined
06:04 danvet_ joined
06:05 <cocreature> hanna: allocate a Ptr (Ptr Char) on the Haskell side, pass that to your C wrapper. the C wrapper strdups s.data() where s is your std::string to that pointer and returns the length of the string
06:05 <cocreature> hanna: on the haskell side, you first marshal the string to a Haskell value and then free it
06:06 xtreak joined
06:06 ErinvanderVeen joined
06:06 <ongy> you also need a small std::string -> Word function to get the size
06:07 <ongy> unless you know you can just allocate X amount of bytes for all your strings
06:07 <hanna> cocreature: Ah, that seems sensible
06:08 <hanna> I'm not familiar with C++, if I just have a std::string str = result_from_function(); then it's stack-allocated and would get freed when I leave the function, right?
06:09 <ongy> the string is on the stack and will call it's destructor, which does free the value
06:09 <cocreature> the std::string object is stack allocated but for larger strings the actual data will be heap allocated
06:09 <cocreature> however it will still be freed because the destructor is called it the end of the function
06:10 <hanna> Hmm; so either as ongy said the haskell code needs to know how big the string is going to be or I need to allocate it from C++ and then include a second call to free() the string afterwards
06:10 maxx joined
06:10 <cocreature> right, strdup is the solution for the latter
06:11 <ongy> hanna: if you have an upper bound (and don't expect to get to memory bounds) there's nothing stopping you from allocating a few kilobytes first, and then trim it later on the haskell side
06:11 <hanna> I do have a reasonable upper bound
06:12 eacameron joined
06:13 <hanna> It's annoying because the Double -> String function is basically pure
06:13 <cocreature> unsafePerformIO :)
06:13 <hanna> So having to go through malloc() and free() and land in IO hell just because of it is annoying
06:14 <ongy> there's something like createAndTrim (not sure on exact name) for ByteString, I'd expect something similar for Text (with string thing's are even more fun)
06:14 Zer000 joined
06:14 <cocreature> the FFI is one of the few cases where using unsafePerformIO can be sane
06:14 xtreak_ joined
06:14 mohsen_ joined
06:15 <ongy> but be careful with inlining and stuff, it's not trivial
06:15 lambdamu joined
06:15 quchen joined
06:16 xtreak joined
06:16 fakenerd joined
06:18 <cocreature> if your API is actually pure, then I don’t think you need to worry about inlining
06:18 theelous3 joined
06:19 <hanna> You know what, I think it's easier to just move my abstraction a bit and avoid the problem altogether
06:20 <EvanR> howl's moving abstraction
06:20 <hanna> instead of having a Double -> String and a String -> IO () I'll just make specialized Double -> IO () that keeps the std::string in C++
06:20 <hanna> More overhead but less work
06:20 <hanna> and less brain damage
06:21 <cocreature> that seems like less overhead instead of more. you avoid an additional roundtrip via the ffi
06:21 <ongy> cocreature: There was some weird thing when unsafePerformIO is inlined, but I read that back when I didn't have an as good idea of what happens in the haskell world
06:21 <cocreature> ongy: that weird thing is about performing effects more than once. but if your API is pure you don’t care about that
06:21 <hanna> overhead as in number of functions I need to wrap
06:22 saussure joined
06:22 <cocreature> ongy: i.e., you might call your ffi function twice but who cares if it always returns the same result
06:22 <cocreature> (from a correctness point of view. for performance it can ofc still matter)
06:23 <ongy> cocreature: I do, maybe it's expensive to compute :)
06:23 <ongy> but I guess then I should explicitly let bind it either way
06:23 <cocreature> ongy: but then it’s not really different from any other Haskell computation that you don’t want to accidentally recompute
06:23 <duckqlz> seems misguided to import an expensive function through ffi :P
06:24 connrs joined
06:25 sternmull joined
06:25 wroathe joined
06:27 filterfish joined
06:28 filterfish joined
06:29 hurkan joined
06:30 fsargent joined
06:36 yamad joined
06:37 slack1256 joined
06:38 <ongy> duckqlz: why? If I have a library that does a task, why wouldn't I call it over FFI?
06:39 baldrick joined
06:39 dtornabene joined
06:41 exferenceBot joined
06:41 joco42 joined
06:42 eacameron joined
06:42 alfredo joined
06:43 primal_ joined
06:43 Majiir joined
06:45 tromp joined
06:54 <hanna> Hmm. So all said and done; I wrote my C shim, I wrote my haskell FFI front-end, the C shim compiles (gcc -c), the haskell code compiles, but `cabal build` fails: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/libstdc++.so.6: error adding symbols: DSO missing from command line
06:55 <LiaoTao> hanna: You need -lstdc++
06:55 jakub_ joined
06:56 <hanna> Hmm - that's what's throwing me off though; I looked at other examples of C++ wrappers for haskell and they don't mention stdc++ in the list of extra-libraries
06:56 <jakub_> Hi what is the name of the extension that lets you select types using '@' (I hope I remember that right)
06:56 <jakub_> ahh typeapplications right?
06:56 guiben joined
06:56 <ongy> hanna: do those include a .o file, or .so? and what are you doing?
06:57 <hanna> With the stdc++ added, it still fails linking: lots of “undefined reference `my_function`”
06:57 <LiaoTao> hanna: Use g++ instead of gcc?
06:57 <LiaoTao> That should add libstdc++ by default
06:57 <hanna> LiaoTao: I'm not invoking gcc/g++ manually at all
06:57 gestone joined
06:57 <hanna> This is Cabal's doing
06:57 <LiaoTao> Yeah, I figured as much
06:58 <hanna> ongy: I don't know, look at for example https://github.com/ocharles/Xapian-Haskell/blob/master/xapian-haskell.cabal
06:58 <cocreature> hanna: is my_function in an "extern C" block?
06:58 <hanna> it just has c-sources: <list of .cc files>, extra-libraries: xapian and that's more or less it
06:58 <hanna> cocreature: oh, no
06:59 <LiaoTao> cocreature: Good catch!
06:59 <LiaoTao> hanna: Yeah, be careful of the C++ name mangling
07:00 Itkovian joined
07:00 <hanna> Hooray, with the `extern` added it builds!
07:00 <cocreature> LiaoTao: I’m maintaining Haskell bindings for llvm, so I’m quite used to those kind of problems :)
07:00 wroathe joined
07:00 <hanna> Still confused about why that xapian-haskell thing doesn't need to mention libstdc++
07:00 yoneda joined
07:00 mschristiansen joined
07:00 <ongy> if you are linking an .so file, you get that from the .so file. When you just link a bunch of objects, you don't have that information
07:01 mohsen_ joined
07:02 <LiaoTao> cocreature: That sounds like a lot of work for such a fast moving target
07:02 <cocreature> LiaoTao: tell me about it :)
07:03 <hanna> cocreature: you wouldn't happen to know how I can `cabal repl` without it crashing with an error message like “can't relocate, recompile with -fPIC”? :D
07:03 hybrid joined
07:03 <hanna> for the record I already tried adding -fPIC to my cc-options
07:04 <cocreature> hanna: are you on 8.0.1 or earlier? iirc there was some bug that has been fixed in 8.0.2
07:05 <hanna> I'm on 8.0.2
07:06 rickygee joined
07:06 <hanna> It seems like there's no cbits.dyn_o at all either
07:06 <hanna> looking at for example https://github.com/vimus/vimus/blob/master/cbits.o
07:07 <hanna> ah it invokes ghci with -lncursesw and the name of the .dyn_o
07:07 andyhuzhill joined
07:07 mattyw joined
07:08 YongJoon joined
07:08 <hanna> it works with cabal repl --ghc-options="-lxapian -lstdc++"
07:08 <hanna> that seems like a cabal-install bug report
07:08 <hanna> It should load the extra-libraries when running `cabal repl`
07:08 <Lokathor> so sometimes you don't want to INLINE a function because it can make functions too large to fit properly in the cache and stuff, right?
07:08 <Lokathor> but is there a downside to putting INLINABLE on everything?
07:09 <cocreature> ghci and external C libraries seems to break half of the time for reasons that I haven’t yet figured out
07:09 ragepandemic joined
07:09 thc202 joined
07:10 ianandrich joined
07:10 paolino joined
07:11 YongJoon joined
07:12 zcourts joined
07:13 zcourts_ joined
07:16 eklavya joined
07:16 vlatkoB_ joined
07:16 zcourts_ joined
07:17 <quchen> Lokathor: I’m not sure what INLINABLE does, but could it lead to giant header files all the time?
07:17 saussure joined
07:17 FortunaTP joined
07:18 <Lokathor> quchen, yeah, INLINABLE keeps the definition around in the header files of packages you're depending on so that GHC will consider inlining it later on during a final build
07:18 noan__ joined
07:18 takuan joined
07:18 <Lokathor> but, like, disk space is pretty cheap and all
07:19 bvad joined
07:20 jacereda joined
07:20 inad922 joined
07:24 merijn joined
07:24 raichoo joined
07:26 fakenerd joined
07:27 <EvanR> heh... ghci... which "ignores -threaded"... will take a threadDelay 1000000 and sleep for a clean 2 seconds
07:27 <EvanR> lovin it
07:27 moongazer joined
07:28 Falkor_ joined
07:28 uglyfigurine joined
07:28 <EvanR> i do have several other threads
07:28 <EvanR> but wow
07:29 beanbagula joined
07:30 <merijn> Well, threadDelay does specify it won't sleep *less* than specified, it *might* sleep more than specified
07:31 <EvanR> it should sleep more than specified
07:31 <EvanR> not less
07:31 renzhi joined
07:31 <merijn> sleeping 2 seconds for 1,000,000 is more?
07:32 <EvanR> and i get the same effect with compiled -threaded... so much be a bug on my part
07:32 <merijn> EvanR: Are you making the rookie mistake of assuming threadDelay takes seconds as argument?
07:32 <EvanR> o_O
07:32 <merijn> EvanR: Docs say it takes microseconds :)
07:32 <merijn> So 1,000,000 == 1 second :)
07:32 <EvanR> millions of seconds? i would have had to be debugging this for a while
07:33 <EvanR> merijn: it wakes up 2 seconds later, 2000000
07:33 <merijn> EvanR: Right, but that's more then 1 second, so that's fine
07:33 <EvanR> no it is not
07:33 juhp joined
07:33 Trendrrr joined
07:33 <EvanR> ive never seen that kind of lag with -threaded, its a bug, probably my mistake
07:33 <merijn> Well, maybe not for your usecase. But it's within the definition of threadDelay
07:34 alexelcu joined
07:34 magthe joined
07:34 <merijn> "There is no guarantee that the thread will be rescheduled promptly when the delay has expired, but the thread will never continue to run earlier than specified."
07:34 <EvanR> i have seen threads do hundreds of ms over without -threaded
07:34 <EvanR> its usually much better with -threaded
07:35 saussure joined
07:35 CacoS joined
07:35 <merijn> EvanR: Well, it's the single threaded runtime and you have multiple threads, yes?
07:35 <EvanR> same effect with ghc and -threaded
07:35 <merijn> EvanR: When the time out expires the thread is marked as "runnable" again, but if there's other threads in the queue those will run first and delay it
07:36 runway77 joined
07:36 <merijn> EvanR: If you have the threaded runtime there's less chance of the queue of runnable thread being full and thus needing to wait long
07:36 <EvanR> yes ive gotten really good response times with -threaded
07:37 <Lokathor> i always forget that you can't shadow a variable based on its own definition in Haskell
07:37 <EvanR> able to wake up in time to schedule events for the audio system
07:37 biglama joined
07:37 <merijn> EvanR: Yeah, I wouldn't use threadDelay for that
07:37 <EvanR> its fine because you include the timestamps
07:37 <EvanR> as long as you dont wake up too late
07:37 <merijn> EvanR: I'd probably dedicate a capability to that thread and spinloop with unsafe foreign sleeps
07:38 connrs joined
07:38 <EvanR> worked great in my audio tests
07:38 <merijn> EvanR: "as long as you dont wake up too late" <- well, that's exactly what threadDelay doesn't guarantee :)
07:38 <EvanR> nothing guarantees it
07:38 <EvanR> multitasking OS
07:39 <merijn> EvanR: Sure, but you can get closer than that :p
07:39 <EvanR> yeah, by figuring out how i messed up
07:39 baldrick joined
07:39 <EvanR> its almost exactly 2x too long
07:40 <merijn> Actually, I would probably fork a new pthread in C, mark it high priority with the kernel and do the looping there, so you have almost no chance of missing the deadline
07:40 filterfish joined
07:40 <EvanR> thats... so unnecessary
07:40 louispan joined
07:40 kirelagin joined
07:40 mbrock joined
07:40 <merijn> Unnecessary engineering is my middle name :)
07:40 <EvanR> and renders the thread unable to be killed
07:42 plutoniix joined
07:42 <EvanR> and spinlooping defeats the entire purpose of sleeping
07:43 <merijn> Not a tight spinloop, a sleeploop, but with high prio thread so it gets run immediately on wakeup
07:43 plutoniix joined
07:43 wroathe joined
07:45 <EvanR> example of it "should work", in the first half of my test i get 1.000000000 1.005546132. first number is when something should happen, second number is when i woke up and realized it
07:45 <EvanR> how it*
07:46 <EvanR> using STM
07:46 ventonegro joined
07:46 Trendrrr joined
07:47 ErinvanderVeen joined
07:47 dihuteno joined
07:48 marr joined
07:48 balor joined
07:48 tommd joined
07:51 bennofs joined
07:53 grayjoc joined
07:53 saussure joined
07:53 cloudhead joined
07:53 Flechette joined
07:54 felixphew joined
07:54 Wizek_ joined
07:55 raichoo joined
07:57 Sigyn joined
07:57 nickolay joined
07:57 Trendrrr joined
07:58 <felixphew> hi!
07:59 <felixphew> I'm trying to get my head around parsec, but I don't seem to be getting it
07:59 filterfish joined
07:59 <felixphew> I think it may be because the language I'm trying to parse is more complex than I think it is
07:59 Bhootrk_ joined
07:59 <felixphew> as an example, the first line of each "group" can take one of these formats:
07:59 <felixphew> http://lpaste.net/4977949018270203904
08:00 <felixphew> is it possible to parse something like this with parsec? How would I go about it?
08:02 bollu joined
08:02 <quchen> felixphew: First, you must know what you want to parse to, i.e. have a data type that you want to generate from the text.
08:02 <merijn> felixphew: Well, whether you can parse it depends on a few things
08:02 saussure joined
08:02 ErinvanderVeen joined
08:02 <merijn> felixphew: Specifically, how are Name and Nickname different?
08:03 <merijn> felixphew: If the answer is "they aren't", you're boned
08:03 <felixphew> every set must have a "Name"
08:03 <merijn> oh, wait, maybe I wasn't reading the example right
08:03 jutaro joined
08:03 <merijn> felixphew: Yes, but are names the same thing as nicknames? i.e. can something be both a valid name and a valid nickname?
08:04 <felixphew> yes, unfortunately
08:04 <felixphew> there are ~700 valid names
08:04 <merijn> What's M?
08:04 <felixphew> but a nickname can contain anything except a newline, basically
08:04 <LiaoTao> merijn: Are you sure he's boned?
08:04 <felixphew> M is a gender (as opposed to F), and is optional
08:04 <LiaoTao> I don't think there are any ambiguities
08:04 dec0n joined
08:05 <merijn> LiaoTao: Yeah, I thought there was an inverted case, but it's not there
08:05 wroathe joined
08:05 <merijn> Should be fine, albeit a bit inefficient to parse (lots of backtracking)
08:05 <merijn> felixphew: I'd recommend as a first step to write an EBNF of your language
08:05 <quchen> felixphew: 1. write individual parsers that parse Name, Nickname, Item, M.
08:05 <felixphew> The complicating factors as far as I can see it are 1) the number of forms, and 2) the fact that Nickname can contain both @ and ()
08:06 <merijn> felixphew: I'
08:06 <LiaoTao> ^ This is a bigger problem
08:06 <merijn> oh...
08:06 <merijn> felixphew: Can nicknames contain spaces?
08:06 <felixphew> yes
08:06 <quchen> Wait, so the line »Nickname Nickname Nickname (Name Name)« is valid for line 2?
08:06 <quchen> You’re boned.
08:06 <felixphew> Only 1 name
08:06 <merijn> You're boned
08:06 <quchen> :-S
08:06 <LiaoTao> Yeah
08:06 <merijn> Absolutely zero chance
08:06 <quchen> Is »Name Name« a valid name?
08:06 <quchen> Uuuuh.
08:07 <felixphew> Let me clarify a few things
08:07 <merijn> felixphew: Where are you getting this data from?
08:07 <felixphew> it's actually a format used to store Pokemon sets (no joke)
08:07 <felixphew> I didn't invent this stupid grammar
08:07 <quchen> Hello, my name is »Nickname (Name) (M) @ Item«
08:08 <felixphew> some examples of what it looks like:
08:08 <felixphew> http://pokepast.es/6fe3927d2f283a23
08:08 <taksuyu> Pokemon data should have byte limits
08:08 <merijn> felixphew: Sure, I realise that. Because even a complete beginner would design an easier grammar ;)
08:08 <merijn> felixphew: The question is: Is there an unambiguous separator that separates names/nicknames?
08:09 <felixphew> brackets
08:09 <quchen> That doesn’t look like »Nickname (Name)« at all! That looks like an HTML page with pictures.
08:09 <felixphew> ha ha
08:09 <merijn> felixphew: That's not unambiguous, since brackets are valid in names according to you?
08:09 <felixphew> those are 6 examples of the grammar I want to parse
08:09 <felixphew> brackets are valid in nicknames, but not names
08:09 <felixphew> and if a nickname is specified a name must also be specified
08:09 halogenandtoast joined
08:09 <felixphew> so the name will always be surrounded by the rightmost pair of brackets (if there are any brackets)
08:10 <merijn> felixphew: And nicknames cannot contain spaces?
08:10 <felixphew> nicknames can, unfortunately
08:10 <felixphew> so can names
08:10 <felixphew> and so can items
08:10 <quchen> … some example data would be in order.
08:10 <felixphew> that link contains 6 examples, but they're all in the same form
08:10 <quchen> The HTML page you linked does not match your examples from the paste above.
08:10 zero_byte joined
08:10 <merijn> well, how would you deal with the nickname "foo ) bar"?
08:10 <felixphew> look at the first line of each block
08:10 <felixphew> they do match
08:10 <LiaoTao> felixphew: Are you sure the names can contain spaces? Can't think of any pokemen with a two-word name
08:11 <merijn> felixphew: That'd look like "(foo ) bar)"
08:11 Trendrrr joined
08:11 <merijn> But you'd probably parse that as "foo "
08:11 <felixphew> Tapu Koko / Tapu Lele / Tapu Bulu / Tapu Fini
08:11 <LiaoTao> Bleh
08:11 cyborg-one joined
08:11 <felixphew> are the 4 space-containing pokemon names
08:11 <LiaoTao> Life was easier in the nineties
08:11 <merijn> Rather then trying to reverse engineer this grammar, I repeat my suggestion that felixphew writes down an EBNF
08:11 <felixphew> merijn: I'll try and do that
08:12 <merijn> felixphew: Here's a good description of EBNF (it's a bit focussed on binary format, so feel free to tweak it a bit to be more sensible for letters): https://tools.ietf.org/html/rfc5234
08:12 <LiaoTao> You may be able to match against those names to filter out all the names with spaces and then do the general case
08:12 <merijn> felixphew: This will also help you think about what you *really* mean :)
08:12 <LiaoTao> Listen to merijn, though, he _knows_ stuff
08:13 dec0n joined
08:13 <merijn> Not sure you should listen to me, I'm currently considering the introduction of higher order bash functions and building a "library" of bash functions to cleanup my config. So I'm clearly not quite sane :p
08:13 <felixphew> thanks everyone!
08:13 <felixphew> I'll be back (hopefully) with some EBNF
08:15 Trendrrr joined
08:16 <EvanR> merijn: explanation... i was actually waking up too early, because of lazy evaluation. the choice to sleep caused the time to force,which took exactly 1 second, so i didnt know what time it was. the fact that i was already printing the time out... i didnt notice it block because of line buffering!
08:16 Yuras joined
08:17 <EvanR> so blocking too a second, and then it did a thread delay, adding additional delay
08:17 <EvanR> confluence of weirdness
08:17 <EvanR> ! fixed it
08:17 <merijn> o.O
08:18 <merijn> EvanR: That must've shaved some days of your life due to frustration :p
08:18 acidjnk22 joined
08:18 <EvanR> "are your debug prints working properly"
08:18 <EvanR> i take this for granted
08:19 <EvanR> stupid
08:20 <EvanR> time be a harsh mistress
08:20 saussure joined
08:21 romank joined
08:21 <bollu> is it "worth" reading about lazy data structures? in the sense that, does it teach you cool things that you would not have known?
08:21 <bollu> I was considering taking up an independent study
08:22 <bollu> but I'm not sure if it's worth the time. Thoughts?
08:22 <merijn> There's some cool tricks
08:22 <merijn> But there's lots of cool tricks. I'd recommend focusing on the ones that'll help do what you want
08:23 <bollu> merijn: well, I have no real "aim", just want to understand how to exploit laziness
08:24 ErinvanderVeen joined
08:25 romank_ joined
08:25 wroathe joined
08:26 <halogenandtoast> Can anyone make suggestions on how they would separate the code in this Spock app? I can't decide which files are worth creating and I'm not sure of existing conventions. https://github.com/halogenandtoast/mirin/blob/master/app/Main.hs
08:26 <EvanR> bollu: i was just looking at a reversible incremental fold...
08:26 <halogenandtoast> So currently everything is in one file, and I'm not happy abou tit.
08:26 <EvanR> laziness is awesome
08:27 <EvanR> unless it causes debug prints to appear to happen at a different time than they do
08:27 <halogenandtoast> EvanR: That's a feature!
08:27 <halogenandtoast> :p
08:28 <merijn> halogenandtoast: That's only a 100 lines, why would you split it?
08:28 <halogenandtoast> merijn: I generally like splitting concepts.
08:28 <halogenandtoast> Even if it's small
08:28 <EvanR> if its small, seeing everything on the same page is a +
08:29 <merijn> halogenandtoast: splitting a 100 line file of which only like 65 are code I'd really advice not to
08:29 <halogenandtoast> Fair enough.
08:29 <halogenandtoast> "I wouldn't split it" is a valid response
08:29 <halogenandtoast> I'll leave it as is.
08:30 saussure joined
08:30 <merijn> If you start expanding things beyond this, then I'd start to think about it, but only if it was expanding significantly
08:30 <halogenandtoast> merijn: Sure, and then I'd assume I'd look at the "patterns" of expansion.
08:30 <halogenandtoast> And isolate them.
08:32 <halogenandtoast> Thanks for the advice merijn and EvanR
08:32 twopoint718 joined
08:32 <merijn> Is there a good vim syntax highlight file for GHC core?
08:34 <halogenandtoast> merijn: is there something the built in haskell syntax highlighter doesn't do?
08:35 jerbome_ joined
08:36 freusque joined
08:36 romank joined
08:36 andyhuzhill joined
08:37 <merijn> hmmm, I tried ghc-core's output before, but maybe the haskell highlight works passably too...
08:39 mlehmk joined
08:39 juhp joined
08:40 lep-delete joined
08:41 eklavya joined
08:42 quinor joined
08:42 joco42 joined
08:42 Elhamer_ joined
08:43 primal joined
08:43 <quinor> hey, any neat way to divide [Type] by constructor of Type being used?
08:43 <EvanR> there are type families
08:44 <EvanR> which are like type functions
08:44 <quinor> what I'm trying to do is to write simple programming language parser and toplevel definitions are mixed expressions, type declarations etc
08:44 <quinor> and I'd like to process ie. all type declarations at once
08:44 <merijn> quinor: oh, I get what you mean
08:44 <merijn> quinor: Yes, you can!
08:45 <merijn> > [x | x@Left{} <- [Left True, Right 'c', Left False, Right 'a']]
08:45 <lambdabot> [Left True,Left False]
08:45 <merijn> Replace Left with the constructor of your choice :)
08:45 <quinor> so just filter by each of the expected constructors, right?
08:46 <merijn> quinor: That's what it's doing, yes
08:46 tromp joined
08:46 <merijn> quinor: Simplest way I'm aware off. You traverse the list multiple times, but in a programming language that list shouldn't be long enough for that to matter
08:46 <EvanR> i dont even see the matrix quit messages anymore, just blond brunette..
08:47 <quinor> thanks merijn, sounds like a reasonable way
08:47 <quinor> though I'll probably use partition or something
08:47 <merijn> quinor: Also, note the neat trick of using {} on non-record constructor to future proof it. That way it works even if you change the number of parameters of the constructor you use :)
08:48 saussure joined
08:48 <quinor> merijn: missed that, but seems very nice
08:49 <quinor> what element of syntax is that?
08:49 Aidan[m] joined
08:49 <merijn> quinor: Record syntax, it just happens that record syntax is legal on constructors that weren't defined using record syntax too :)
08:50 <merijn> It's very nice if you only care about a specific constructor, because if you have like "foo (Lambda _ _) = something" and you decide you need an extra field in Lambda, that function breaks and you have to update it
08:50 nikivi joined
08:50 kgadek joined
08:50 <merijn> If you write "foo Lambda{} = something" it works, even if the number of fields changes :)
08:51 loupgaroublond joined
08:51 stefan-__ joined
08:51 eL_Bart0 joined
08:51 owickstrom joined
08:51 baetheus joined
08:51 <merijn> Underappreciated Haskell trick of the day :)
08:51 romank joined
08:51 <quinor> Haskell is full of tricks
08:51 aaron7 joined
08:51 <quinor> can I do mixed record/constructor type?
08:52 ynyounuo joined
08:52 rickygee joined
08:52 <vaibhavsagar> what do you mean?
08:52 <merijn> Yes, but it's generally not recommend since applying the record fields to the wrong constructor crashes
08:52 eklavya joined
08:52 <merijn> @let data Foo = Foo { fooInt :: Int, fooChar :: char } | Bar Bool deriving (Show)
08:52 <lambdabot> .L.hs:159:42: error:
08:52 <lambdabot> Not in scope: type variable ‘char’
08:52 <lambdabot> Perhaps you meant type constructor or class ‘Char’ (imported from Data.C...
08:53 alibabzo joined
08:53 sternmull joined
08:53 <merijn> @let data Foo = Foo { fooInt :: Int, fooChar :: Char } | Bar Bool deriving (Show)
08:53 <lambdabot> Defined.
08:53 gregoire joined
08:53 runway77 joined
08:53 <merijn> > fooInt $ Foo 4 'c'
08:53 <lambdabot> 4
08:53 ErinvanderVeen joined
08:53 <merijn> > fooInt $ Bar True -- whoops
08:53 <lambdabot> *Exception: No match in record selector fooInt
08:53 <quinor> I see
08:54 vqrs joined
08:54 <quinor> I've thought of more like shared parameters for all of the constructors
08:54 <merijn> That works, yes
08:55 oish joined
08:55 <merijn> But if there's record fields which don't apply to each constructor you have the same problem
08:55 <quinor> data Foo = {fooName :: String, Foo | Bar} ?
08:55 im0nde joined
08:55 <EvanR> wacky
08:55 <merijn> You have to write it out explicitly
08:55 <merijn> @undefine
08:55 <lambdabot> Undefined.
08:55 <EvanR> you can define an accessor function separately
08:56 <merijn> @let data Foo = Foo { fooName :: String } | Bar { fooName :: String } deriving (Show)
08:56 <lambdabot> Defined.
08:56 <EvanR> then you dont have to commit to having (partial) accessors for the other fields
08:56 <merijn> > fooName $ Foo "test"
08:56 <lambdabot> "test"
08:56 james9999 joined
08:56 <merijn> > fooName $ Bar "test"
08:56 <lambdabot> "test"
08:56 Denthir joined
08:57 <quinor> I see :)
08:57 bb010g joined
08:57 closures999[m] joined
08:57 reactormonk[m] joined
08:57 M-wamaral joined
08:57 monomon[m] joined
08:57 riaqn joined
08:57 NickHu joined
08:57 Naughtmare[m] joined
08:57 alaradia[m] joined
08:57 davidar joined
08:57 Lex[m] joined
08:57 sn[m] joined
08:57 angelbeats[m] joined
08:57 jyp[m] joined
08:57 nick2000 joined
08:57 bobjason[m] joined
08:57 roadrunner168[m] joined
08:57 herzmeister[m] joined
08:57 herre[m] joined
08:57 karroffel joined
08:57 corintho[m] joined
08:57 FederalRick[m] joined
08:57 TylerCecil[m] joined
08:57 cbHXBY1D[m] joined
08:57 unknownln joined
08:57 hakan[m] joined
08:57 goodboy[m] joined
08:57 Soif[m] joined
08:57 curry[m] joined
08:57 M-BostonEnginerd joined
08:57 tfc[m] joined
08:57 turt2live joined
08:57 unlmtd joined
08:57 ptek[m] joined
08:57 unclechu joined
08:57 elwan7[m] joined
08:57 myfreeweb joined
08:57 m4lvin[m] joined
08:57 iffsid[m] joined
08:57 tester668[m] joined
08:57 seequ_ joined
08:57 rdesfo[m] joined
08:57 miviotros[m] joined
08:57 pellegrino joined
08:57 jacqueline[m] joined
08:57 jmnoz[m] joined
08:57 zaphar_ps[m] joined
08:57 aspiwack[m] joined
08:57 hendrik[m] joined
08:57 ollieh joined
08:57 aer[m] joined
08:57 sirius[m] joined
08:57 sudoreboot[m] joined
08:57 korayal[m] joined
08:57 saussure joined
08:57 hiq[m] joined
08:57 M-schmittlauch joined
08:57 M-Illandan joined
08:57 mmmrrr[m] joined
08:57 davidar_ joined
08:57 hpd_m joined
08:57 Magnap joined
08:57 M-berdario joined
08:57 srenatus[m] joined
08:57 MatrixTraveler[m joined
08:57 M-Quora joined
08:57 Gloomy joined
08:57 wr3n[m] joined
08:57 colton[m] joined
08:57 jhinkle[m] joined
08:57 rfabbri[m] joined
08:57 jascot[m] joined
08:57 QoMe joined
08:57 zar[m] joined
08:57 M-kevinliao joined
08:57 TesX[m] joined
08:57 rakete joined
08:57 gentam[m] joined
08:57 M-krsiehl joined
08:57 tomkerk[m] joined
08:57 ProofTechnique[m joined
08:57 moonarch joined
08:57 noraesae joined
08:57 gkaplan[m] joined
08:57 TheWizardTower joined
08:57 M92854[m] joined
08:57 NopeMarker[m] joined
08:57 Guest91110[m] joined
08:57 Yves[m] joined
08:57 drasich[m] joined
08:57 JCGrant[m] joined
08:58 andyhuzhill joined
09:01 jacereda joined
09:02 simukis joined
09:03 <quinor> oh hod why
09:03 <quinor> is it like that always? -.-
09:04 andyhuzhill1 joined
09:04 <EvanR> IRC gateways are annoying
09:04 <merijn> Just hide joins/parts :)
09:05 yellowj joined
09:05 <bollu> I wonder if we can move this to Discord
09:05 <EvanR> lol
09:05 <bollu> #haskell, that is
09:05 <bollu> what? it's not _that_ crazy :P
09:05 <vaibhavsagar> hi, what can I add to the nix section of stack.yaml to make libmagic available?
09:05 <EvanR> yet another suggestion to move a huge open source project to a proprietary platform
09:05 <opqdonut> yeah :(
09:06 <vaibhavsagar> found it: 'file'
09:06 augur joined
09:06 <bollu> wait, discord is not open source?
09:06 <bollu> damn, I thought it was
09:06 <bollu> >_<
09:07 <vaibhavsagar> bollu: Zulip!
09:07 beanbagula joined
09:07 wroathe joined
09:07 neoo joined
09:07 <bollu> vaibhavsagar: I don't know what that is :)
09:07 <EvanR> its a for profit company
09:07 <EvanR> like slack
09:07 <vaibhavsagar> also an open source project
09:07 <vaibhavsagar> https://github.com/zulip/zulip
09:07 <vaibhavsagar> it's quite nice, I like it a lot
09:07 <halogenandtoast> quinor: I turned off all of those messages.
09:08 <halogenandtoast> I never see when someone joins/leaves/etc.
09:08 <vaibhavsagar> https://zulip.org/index.html
09:08 saurabhnanda joined
09:08 <halogenandtoast> so for a bit I had no idea what you were going on about.
09:08 <felixphew> I'm back!
09:08 neoo joined
09:08 ragepandemic joined
09:08 <halogenandtoast> felixphew: congrats!
09:08 <saurabhnanda> How to have a sum-type (ADT) with a known set of string literals? https://stackoverflow.com/questions/44130436/how-to-have-a-sum-type-adt-with-a-known-set-of-string-literals
09:08 <felixphew> my attempt at an EBNF grammar for the pokemon thing:
09:08 <felixphew> http://lpaste.net/3317955982411169792
09:08 <saurabhnanda> I'm trying to work directly with the string literals that a remote API provides, instead of first mapping them to a regular Haskell sum-type/ADT and having to write serialisation and deserialisation functions for it.
09:09 <felixphew> it's simplified, but accurately portrays all the parts I was having trouble with
09:09 kuribas joined
09:09 <bollu> vaibhavsagar: ah, cool
09:09 <opqdonut> saurabhnanda: no, that's not possible
09:09 <saurabhnanda> opqdonut: what about type-level literals?
09:09 romank joined
09:09 <EvanR> bollu: i owe most of my life to freenode IRC, the amount of people and information all in one place... i see slack teams and discord one-off topic servers as not the right way to run a community
09:10 <opqdonut> saurabhnanda: hmm ok I don't know if those have strings yet
09:10 <opqdonut> oh they do
09:10 <merijn> felixphew: The hard bit will be distinguishing when a nickname has ended, the rest should be pretty trivial
09:10 <bollu> EvanR: I agree, I love IRC as well. But I've had people reject IRC because it's too old
09:10 <bollu> EvanR: so I'd like to move to a new platform for people who find IRC hard to adopt
09:10 <halogenandtoast> bollu: that seems silly
09:10 WhereIsMySpoon joined
09:10 <bollu> saurabhnanda: howdy, how's it going?
09:10 <bollu> halogenandtoast: indeed
09:10 <cocreature> I’ve rejected people because they said irc is too old
09:10 <EvanR> bollu: so you go from 100000 people to 3... for that person
09:10 <bollu> cocreature: :P
09:10 <felixphew> the way I was previously doing it was scanning for the rightmost ( in the line
09:11 WhereIsMySpoon joined
09:11 <halogenandtoast> cocreature: had my wife said that, I would have left her
09:11 neoo joined
09:11 <halogenandtoast> luckily for me she doesn't know what irc is
09:11 <bollu> lol
09:11 <saurabhnanda> bollu: going good, but slow with Haskell.
09:11 <merijn> felixphew: Example, nickname "foo) (M" leads to -> "(foo) (M) (M)"
09:11 <bollu> saurabhnanda: I see :)
09:11 <saurabhnanda> EvanR: merijn: cocreature: pinging wrt https://stackoverflow.com/questions/44130436/how-to-have-a-sum-type-adt-with-a-known-set-of-string-literals
09:11 <EvanR> freenode is *the* place for open source project real time chat
09:11 <halogenandtoast> felixphew: merijn could you have a non printing terminator for names?
09:12 <merijn> halogenandtoast: He has an existing format, afaict
09:12 fendor joined
09:12 <halogenandtoast> Ah
09:12 <felixphew> unfortunately yes
09:12 <cocreature> saurabhnanda: I think opqdonut already answered your question. you can’t do this
09:12 <bollu> type level strings?
09:12 <halogenandtoast> When I did something like this for NLP using a BNF (not in Haskell) I had compilation stages
09:12 <halogenandtoast> where it would do passes and fill in unknowns
09:12 neoo joined
09:13 <EvanR> saurabhnanda: you can take the API documentation and generate the (normal) sum types using TH
09:13 <halogenandtoast> or combine nodes, etc.
09:13 <halogenandtoast> not sure that helps here.
09:13 <felixphew> merijn: that example doesn't actually work, unless you're thinking that M is the pokemon name
09:13 <saurabhnanda> cocreature: is that final? No extension, no type-level voodoo is going to help me here? Is this a good use-case for Haskell Prime?
09:13 <halogenandtoast> felixphew: do you have your sample input available?
09:13 <saurabhnanda> EvanR: not more boilerplate!
09:13 <EvanR> boilerplate?
09:13 <merijn> felixphew: The point is, how do you decide where the nickname ended?
09:13 <EvanR> this is boilerplate generation
09:13 <cocreature> I guess you might be able to do some terrible typelevel hackery but I doubt it’s worth it
09:13 <EvanR> what good are those string leterals?
09:14 <merijn> saurabhnanda: What do you mean "use-case for Haskell Prime"? Haskell Prime is the committee for the new report and they're unlikely to introduce new untested big changes
09:14 <EvanR> saurabhnanda: the same is done to retool code against a database schem, which may contain 100s of record types
09:14 <felixphew> I have some sample input if you want it
09:14 <cocreature> and pattern matching would most likely look like crap
09:15 neoo joined
09:15 <halogenandtoast> felixphew: yes
09:15 xtreak joined
09:15 saussure joined
09:15 <EvanR> im not sure what the cases being strings gets you
09:15 <saurabhnanda> EvanR: boilerplate for boilerplate generation. I'm trying to avoid boilerplate in the first place. String literal <=> Haskell constructor is boilerplate.
09:15 <EvanR> i dont think either of us knows what the other is talking about
09:17 WhereIsMySpoon left
09:17 neoo joined
09:17 <EvanR> saurabhnanda: what im talking about would be automated
09:18 <EvanR> you dont write out any strings or constructors
09:18 <saurabhnanda> Isn't this a very real-life use-case? You have a field which can have a bunch of pre-defined string values. Why can't one use those string values and expect the compiler to ensure that only those string values are used everywhere?
09:18 <bollu> is it not possible to write TH that does this?
09:18 <felixphew> here's some example inputs:
09:18 <felixphew> Buzz buzz buzz (Buzzwole) @ Leftovers
09:18 <felixphew> Ability: Beast Boost
09:18 <felixphew> EVs: 252 HP / 252 Atk / 4 SpD
09:18 <felixphew> Adamant Nature
09:18 <felixphew> - Leech Life
09:18 <bollu> takes the strings and creates a sum type?
09:18 <EvanR> bollu: yes
09:18 neoo joined
09:18 <EvanR> thats what im getting at
09:19 felixphew joined
09:19 <felixphew> sorry about that, pasted the wrong thing
09:19 <felixphew> here's the sample input:
09:19 <felixphew> http://lpaste.net/8274617510674825216
09:19 bigos joined
09:19 <bollu> TH is cumbersome, though
09:19 <saurabhnanda> bollu: yes, it is possible to write TH. But that is not ideal. THAT is boilerplate. I need to solve a domain problem, and now I need to take a detour and write TH for some random boilerplate. Haskell is not helping me achieve higher real-life productivity.
09:19 <bollu> and the docs are… bad
09:19 <bollu> saurabhnanda: what is the domain problem?
09:20 <EvanR> saurabhnanda: what youre asking doesnt even make sense...
09:20 <EvanR> its both a string, and a type
09:20 <saurabhnanda> bollu: that is not completely relevant. Domain problem = stuff that gets me closer to what the market/customer wants. TH is not that direction.
09:20 <EvanR> its works like a string, and its checkable by the compiler
09:20 <saurabhnanda> EvanR: I'm sorry to disagree. Typescript already has this.
09:20 <EvanR> stringly typed code isnt checkable by a computer
09:20 Silentd joined
09:20 <saurabhnanda> EvanR: again, check Typescript.
09:20 <opqdonut> untagged unions and singleton types
09:20 <bollu> saurabhnanda: can you show me the typeScript code that does this?
09:21 <opqdonut> would enable this
09:21 <EvanR> unless youre simply asking that the constructors be spelled with a lowercase letter and have quotes in their name?
09:21 <saurabhnanda> EvanR: yes -- it could essentially be that.
09:21 <EvanR> and youre asking to be able to spell it all out, as boilerplate... the opposite of my suggestion
09:21 bjz joined
09:21 felixphew joined
09:22 felixphew joined
09:22 <bollu> saurabhnanda: if there was a library that solved this for you, would that be "acceptable"?
09:22 <vaibhavsagar> saurabhnanda: define and ADT and a special Read instance
09:22 <bollu> saurabhnanda: like, I'm trying to understand what part of the ecosystem is annoying
09:22 <saurabhnanda> typescript -- https://www.typescriptlang.org/docs/handbook/advanced-types.html
09:22 <EvanR> saurabhnanda: you can easily write a replace in the editor to convert the strings into proper constructor names
09:22 <EvanR> as a regex
09:23 <vaibhavsagar> data EventTable = Table1 | Table2 | SomeOtherTable
09:23 <opqdonut> EvanR: the issue isn't constructor names, it's the function String -> Maybe ("foo" | "bar") function
09:23 <EvanR> the parser?
09:23 codebam joined
09:23 <opqdonut> yeah
09:23 <saurabhnanda> EvanR: nope -- doesn't solve the problem. The FromJSON/ToJSON instances still need to be written.
09:23 <EvanR> why?
09:24 <bollu> saurabhnanda: what do you gain by having strings? like, I'm trying to understand the use-case for this
09:24 <saurabhnanda> data EventTable = ItineraryBookings | HotelBookings deriving (Eq, Show, Generic) ==> need to serialised/deserialised as “itinerary_bookings | “hotel_bookings” — what’s the fastest way to get this done? and btw, there are 30 such fields, with each field having at least 10 possible values
09:25 <EvanR> saurabhnanda is not literally asking for this... but some tool which lets you access the api easier than writing the code for it
09:25 <felixphew> I guess the question I should really be asking is: is Parsec the right tool for this kind of job?
09:25 <saurabhnanda> bollu: faster development cycle.
09:25 <saurabhnanda> **just look at how Typescript does this**
09:25 takle joined
09:25 <EvanR> you have to write the translations, if someone didnt already do it for you
09:25 <EvanR> ive done this countless times in ruby, because its not something than can be automated
09:25 <merijn> felixphew: Not more or less right than any other
09:26 <EvanR> sometimes because the vendor messed up and gave crap libraries
09:26 <EvanR> sucks but there you have it
09:26 joco42 joined
09:26 <saurabhnanda> EvanR: very impractical answer. I can already see an alternative by using string literals. Typescript allows me to do that -- I don't understand why Haskell doesn't allow me to do that.
09:26 <merijn> felixphew: The difficulty in your problem is not really something created by parsec, but something that will be hard in almost any parsing solution
09:26 <cocreature> you probably also don’t want your code to operate on actual string literals if there is only a fixed number of them. using separate constructors for that will be a lot faster
09:26 <EvanR> saurabhnanda: you can just use string literals if you want
09:26 <bollu> saurabhnanda: I believe it's a type system thing
09:27 <merijn> felixphew: So it's going to suck to write, regardless of what you write it in, sadly
09:27 <saurabhnanda> cocreature: that was my core question. I don't care what the compiler sees the literals as. I want to type & read what I see in the API docs. Not some mapping that I have to first spend time writing, and then maintaing.
09:27 <EvanR> then youll have even less code for it than type script
09:27 <EvanR> saurabhnanda: thats why you generate the bindings, which is something youd really want to do in other languages too
09:27 <halogenandtoast> felixphew: you're back. Yeah having written stuff with parsers before I agree with merijn it's going to suck
09:27 <bollu> saurabhnanda: do you have a consistent naming convention conversion? like, MicrosoftCase <-> camel_case? then you'll have to write some boilerplate TH, I think.
09:27 <EvanR> i guarantee you the vendor is doing that for languages they care about
09:28 <hanna> 09:08 <hanna> it works with cabal repl --ghc-options="-lxapian -lstdc++"
09:28 <halogenandtoast> felixphew: is user chars and game chars were swapped
09:28 wroathe joined
09:28 <halogenandtoast> it would be easier
09:28 <EvanR> this usage of the word boilerplate makes no sense
09:28 <hanna> This seems like it was a red herring; what actually made it work was adding -fPIC
09:28 <halogenandtoast> but according to your grammar ( and ) can be in nicknames
09:28 <felixphew> I wish
09:28 <hanna> But the time I used cabal repl --ghc-options made it rebuild with fPIC
09:28 <felixphew> I guess in the meantime I could write a version that doesn't correctly handle brackets in nicknames
09:28 <hanna> I don't know why `cabal repl` didn't work the first time I added fPIC; maybe I forgot to save or maybe it needed a `cabal clean`
09:29 <felixphew> I could get away with that for a little bit
09:29 <EvanR> saurabhnanda: you can also write a script to convert the docs into code using whatever language you like
09:29 CurryWurst_ joined
09:29 <bollu> technically, isn't this a Pi type? Pi(x: String) -> U ?
09:30 <bollu> where U is the "ADT" version of the strings?
09:30 <halogenandtoast> felixphew: you can cheat a bit
09:30 silentcontrib joined
09:30 <felixphew> halogenandtoast: how?
09:30 <halogenandtoast> The names of Pokemon is currently a finite list.
09:30 <halogenandtoast> s/is/are/
09:30 <EvanR> bollu: if youre going there.. its not right
09:30 <saurabhnanda> EvanR: No. You're not getting the point. I know it's possible via TH. But Haskell should make this stuff easier. It has a very real-life use-case. A problem which many other programmers would need to solve many times.
09:30 <EvanR> since not all strings are correct
09:31 Elhamer__ joined
09:31 <felixphew> It will always be a finite list, but given that (in this scenario) different formes have different names, there are something like 1000 potential valid pokemon names
09:31 <bollu> EvanR: hm, I se
09:31 <bollu> see*
09:31 <saurabhnanda> Why can't I simply do ''some_random_literal and get the compiler to accept it like any other ADT value?
09:31 <EvanR> saurabhnanda: yeah, and now we have 19 different API generator frameworks... with how much benefit
09:31 <bollu> EvanR: you're not being practical
09:31 <bollu> EvanR: this is an actual problem
09:31 <halogenandtoast> felixphew: yeah and you could have some jerk who names their Pokemon (Buzzwhole)
09:31 takle joined
09:31 <halogenandtoast> err (Buzzwole)
09:31 <EvanR> more work was put into those frameworks than just writing the code to interface to the API
09:32 <EvanR> bollu: how?
09:32 <EvanR> saurabhnanda does not want to take any of the suggestions
09:32 <saurabhnanda> okay, I have a deadline to meet. This is becoming a round-robin argument now. Take a step back and prioritise real-life productivity and you will reach similar conclusions.
09:33 <EvanR> it could be worse, there could be no TH at all
09:33 Elhamer joined
09:33 <opqdonut> saurabhnanda: the bottom line is that haskell isn't very good at ad-hoc typing. it's a "types first" language
09:33 saussure joined
09:33 <opqdonut> saurabhnanda: compared to the various JS typing systems or clojure's spec or ...
09:34 locallycompact joined
09:34 <merijn> This discussion is becoming kinda pointless "This tool should exist to save me time" -> "well it doesn't" -> goto 1
09:34 <bollu> saurabhnanda: personal recommendation: write the TH you need, publish as a library.
09:34 <EvanR> or skip the type system and just use strings
09:34 <EvanR> and aeson Value
09:34 <saurabhnanda> last question -- what magic incantation do I need to give Aeson to serialise/deserialise `data EventTable = ItineraryBooking | HotelBooking` to "itinerary_booking" / "hotel_booking"
09:34 <bollu> saurabhnanda: that way, yes you're putting in time you don't *really* have, but it's something that will help other people who adopt the language
09:34 <merijn> If tools don't exist, there's no point in complaining about it. You can either write the tool, or not and use some different solution
09:34 <felixphew> thanks for the help everyone, I learned plenty
09:35 <opqdonut> EvanR: to clarify, in typescript you could do something like this (paraphrasing): "foo" :: Val "foo"; "bar" :: Val "bar"; type FooOrBar = Val "foo" | Val "bar"; "foo" :: FooOrBar;
09:35 <bollu> saurabhnanda: I'd be happy to help with packaging hacked up TH neatly into a library, if you need volunteers or something
09:35 <hanna> Hmm. Is there some easy magic way to try building my library under different GHC / library versions to see how permissive I can make my .cabal?
09:35 <opqdonut> EvanR: and then have the compiler check that this is exhaustive: case x :: FooOrBar of "foo" -> True; "bar" -> False
09:35 quobo joined
09:35 <hanna> The one `cabal init` generated for me is basically restricted to 8.0.2 only
09:35 <hanna> but I suspect it should work for 7.x as well
09:36 <EvanR> opqdonut: i dont see how different this is from haskell
09:36 <EvanR> besides the spelling
09:36 <opqdonut> EvanR: and also get some sort of String -> FooOrBar function for free
09:36 <opqdonut> EvanR: or rather, String -> Maybe FooOrBar
09:36 <EvanR> automatic parsers?
09:36 <halogenandtoast> Is there any way to remove this duplication somehow: https://github.com/halogenandtoast/mirin/blob/master/app/Main.hs#L102-L104
09:36 <winter_> Why not use Generics @saurabhnanda
09:36 <merijn> hanna: Restricted in what way?
09:36 <opqdonut> EvanR: it's not different in terms of expressiveness, it's different in terms of developer experience
09:36 <EvanR> Generics might be able to pull that off, but i bet you need to do some work to set it tup
09:37 <halogenandtoast> I might be missing something obvious with using request inside of the call for getProvider.
09:37 <bollu> opqdonut: yes, thank you for putting it that way
09:37 <halogenandtoast> but me and IO haven't gotten along lately.
09:37 romank joined
09:37 <EvanR> saurabhnanda: you should learn about Generics, which lets you automatically produce support for normal ADTs using yes... strings
09:37 <EvanR> and its easier than TH ime
09:37 <winter_> Yeah~
09:38 <hanna> merijn: restricted in the sense that it requires e.g. directory >=1.3 && <1.4; which conflicts with earlier versions of GHC
09:38 <hanna> even though the only function I need is “doesFileExist” which presumably exists in basically every version of `directory`
09:39 filterfish joined
09:39 <hanna> Rather than go through and audit every API call by hand I figure it should be easy to try loosening the deps automatically by incrementlly trying older versions of ghc/library until it no longer works
09:39 <hanna> no longer works in the sense of no longer building
09:39 <EvanR> if youre having trouble for just one doesFileExist function, you could write your own
09:39 <saurabhnanda> I'll investigate all the funky stuff later... can someone please help me in a very pedestrian problem -- how do I get Aeson's generic JSON functions to serialise/deserialise `data EventTable = ItineraryBooking | HotelBooking` to "itinerary_booking" / "hotel_booking"
09:39 <EvanR> try to open the file, catch the exception and return False
09:39 <bollu> EvanR: I really don't think asking people to reach for more type-level stuff is the answer here :/
09:39 <EvanR> bollu: eh?
09:40 <hanna> EvanR: That's not the point; the point is that I have 20 dependencies and they're all so strict that even `hackport` rejects them (because it's not compatible with GHC 8.0.1!)
09:40 <EvanR> generics is powerful stuff
09:40 <bollu> saurabhnanda: you can write your own instances right? From/ToJSON?
09:40 <bollu> saurabhnanda: but you want something scalable I assume
09:40 raichoo joined
09:40 <saurabhnanda> okay -- I found it... `constructorTagModifier` it was
09:41 <vaibhavsagar> halogenandtoast: if you define a function boiler = do {settings <- getState; req <- request; provider <- runSQL $ getProvider req; return (settings, req, provider)}
09:41 <hanna> Seems like maybe `stack` might be able to do what I want?
09:41 <vaibhavsagar> then you can use it in both places like `(settings, req, provider) <- boiler` maybe?
09:41 <bollu> saurabhnanda: neat
09:41 runway77 joined
09:42 <saurabhnanda> and the 100% correct answer was `{constructorTagModifier=(camelTo2 '_')}`
09:42 <saurabhnanda> need a frikkin' big cookbook to get anything done fast in Haskell.
09:42 <bollu> saurabhnanda: to which question?
09:42 <saurabhnanda> how do I get Aeson's generic JSON functions to serialise/deserialise `data EventTable = ItineraryBooking | HotelBooking` to "itinerary_booking" / "hotel_booking"
09:42 davr0s joined
09:42 <EvanR> the more time you waste complaining in here, the less likely youll meet the deadline
09:43 <halogenandtoast> vaibhavsagar: hmm, not as clean as I'd like but okay.
09:43 james999 joined
09:43 <halogenandtoast> I think I could get away without returning req though
09:43 saussure joined
09:43 <bollu> saurabhnanda: I see
09:43 <halogenandtoast> since I don't need it outside
09:43 maffh joined
09:43 <saurabhnanda> EvanR: over and out :)
09:44 bdeferme joined
09:44 <vaibhavsagar> halogenandtoast: you could define a record type for your fields if that would make things easier
09:44 FreeBirdLjj joined
09:45 Levex joined
09:47 inad922 joined
09:48 wroathe joined
09:49 tommd joined
09:49 Mortomes|Work joined
09:50 <tobiasBora> Hello,
09:50 fotonzade joined
09:50 <saurabhnanda> hit a GHC bug it seems
09:51 <saurabhnanda> intero: panic! (the 'impossible' happened) (GHC version 8.0.2 for x86_64-apple-darwin): initTc: unsolved constraints
09:51 <saurabhnanda> WC {wc_insol = [W] processEventLog_a2bkY :: _a2bkX[tau:1] (CHoleCan: processEventLog)} Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
09:52 bs_ joined
09:52 <halogenandtoast> saurabhnanda: do you have another ghci/haskell session running
09:52 <saurabhnanda> what's the easiest way to check that? FYI I'm using intero and it's standard REPL
09:53 yamad joined
09:53 <halogenandtoast> I've had that happen with Yesod which auto compiles when I make changes and then trying to compile my yesod app myself while it's running.
09:53 hamishmack joined
09:53 <halogenandtoast> So do you have a web server of something running that auto compiles?
09:53 <hanna> I actually ran into a remarkably similar bug not too long ago; I think it may have been the same error
09:54 <hanna> That one was triggered by doing acid-state related stuff without {-# LANGUAGE FlexibleInstances #-}
09:54 <hanna> the template haskell expansions blew up
09:57 AfC joined
09:57 <tobiasBora> I think that my program used way to much memory. Basically the main structure of my program is a Matrix (Cell Rational Rational Rational Rational), of size 2x2. And I create a list of 4^7 elements of these matrix. I would expect my program to run using a memory of around 4^7 * 4 (the number of cells in the matrix) * 4 (the number of rational per cell) * 2 (a rational can be written as 2 integer) * 4 (an
09:57 <tobiasBora> integer fit in 4bytes).
09:57 <tobiasBora> = 2.10^6
09:57 <tobiasBora> bytes
09:57 alx741_ joined
09:58 <tobiasBora> However, it seems to use much more that that. To be sure, I tried to run my program with the profiler:
09:58 <tobiasBora> myprog +RTS -N -hc -M500M
09:58 bollu joined
09:59 bollu joined
10:00 <halogenandtoast> vaibhavsagar: it was a bit of work, but I made it work
10:01 <saurabhnanda> halogenandtoast: I'm constantly reloading in the REPL with -fobject-code
10:01 saussure joined
10:01 <hanna> tobiasBora: Seems like you're forgetting to account for the overhead of the constructors
10:01 <tobiasBora> and indeed, it uses around 140M of memory
10:01 <halogenandtoast> vaibhavsagar: for your reference if you care: https://github.com/halogenandtoast/mirin/blob/master/app/Main.hs#L83-L88
10:02 <halogenandtoast> getting the type correct was difficult as usual
10:02 <tobiasBora> (I forgot to say that I need in fact two times this structure)
10:02 <hanna> if the memory usage is *significantly* more than you expect even when accounting for constructors, then maybe you're storing lots of thunks instead of forcing the value?
10:03 <tobiasBora> anc 4.10^6 << 1.4
10:03 <tobiasBora> oups
10:03 slackman joined
10:03 <tobiasBora> 4e6 << 1.4e8
10:03 <vaibhavsagar> halogenandtoast: awesome! thanks for the update :)
10:03 govg joined
10:03 Bhootrk_ joined
10:04 uglyfigurine joined
10:04 <* hackage> BioHMM 1.1.5 - Libary for Hidden Markov Models in HMMER3 format. https://hackage.haskell.org/package/BioHMM-1.1.5 (FlorianEggenhofer)
10:04 <tobiasBora> hanna: even with the overhead of the constructors I can't have a factor of 70 between the theoretical value and the experimentation no?
10:04 <hanna> Seems unlikely. Even the absolute worst case (String) is only like 10x
10:05 <hanna> Isn't there a tool to analyze memory issues like this? threadscope iirc?
10:05 <vaibhavsagar> halogenandtoast: also you have a typo on line 107
10:05 Bhootrk_ joined
10:05 <hanna> But when working with data this big it's probably a good idea to use memory-efficient structures to begin with
10:05 <hanna> i.e. Vector instead of []
10:05 <vaibhavsagar> 'settingsWithProvidder' -> 'settingsWithProvider'
10:06 <hanna> And using unpacked data types as your elements
10:06 <tobiasBora> hanna: Vectors are usable when the list is around 4^7 elements ?
10:06 <tobiasBora> well actually much more
10:06 <tobiasBora> here it's just a small example
10:07 <hanna> Vector has no practical length limit
10:07 <tobiasBora> but I'd like to go further 4^13 elements
10:07 <hanna> Are you trying to store it all in memory or are you trying to stream fuse it so you only need small parts in memory at once?
10:07 <tobiasBora> hanna: I need to perform a sort on these data, so I need to store all of them in memory
10:08 <hanna> Oh btw, something else to account for: Rational is Ratio Integer, not Ratio Int
10:08 <hanna> Integers are bignums
10:08 jedws joined
10:08 bollu joined
10:08 anodium joined
10:09 rickygee joined
10:09 <tobiasBora> hanna: I saw that if the numbers are small enough, it's stored in a native int no?
10:09 <* hackage> ngx-export 0.3.2.0 - Helper module for Nginx haskell module https://hackage.haskell.org/package/ngx-export-0.3.2.0 (lyokha)
10:09 ErinvanderVeen joined
10:09 <hanna> tobiasBora: that's true; maybe it's flipping to gmp representation for some reason though?
10:09 wroathe joined
10:10 JagaJaga joined
10:10 <tobiasBora> hanna: I'll try to use Ratio Int explicitely
10:10 cschneid_ joined
10:10 <hanna> Anyway, for both performance and memory usage it would probably be a good idea to switch to Data.Vector.Unboxed
10:10 <hanna> And using an in-place sort
10:11 unK_ joined
10:11 <tobiasBora> inplace sort is a good idea indeed
10:11 <hanna> `vector` can do this
10:12 twanvl joined
10:12 james999 joined
10:14 FortunaTP joined
10:14 <tobiasBora> Hum... How is it possible to convert a Ratio Int into a Double ? I used fromRational when I used Ratio Integer, but it does not work anymore
10:15 <hanna> tobiasBora: realToFrac
10:16 chrissound joined
10:16 <hanna> which is absolutely horribly named
10:16 <tobiasBora> Waou really? Amazing, thank you
10:16 <hanna> tobiasBora: or you could do it the old fashioned way
10:16 <hanna> (\(n :% d) -> fromIntegral n / fromIntegral d)
10:17 kadoban joined
10:17 <hanna> (which realToFrac basically amounts to)
10:18 <tobiasBora> ok thank you
10:18 <tobiasBora> hanna: When you talk about vector that can do inplace sort, I should use this one: Data.Vector.Unboxed ?
10:18 <hanna> Unboxed will be the most efficient
10:18 <hanna> but Generic is easier to use
10:18 solatis joined
10:19 <tobiasBora> ok I'll try. By the way, Rational <-> Ratio Int does not change anything
10:19 saussure joined
10:20 Nikotiini joined
10:21 torstein joined
10:21 <tobiasBora> hanna: Hum I'm thinking
10:22 <tobiasBora> Wouah
10:24 <tobiasBora> I just tried to replace a sort uniq function done manually based on sort, and I just replaced it with nubOrd (actually I used it before but I got some trouble using it), and now it uses much less data, only 10M
10:24 ErinvanderVeen joined
10:24 <tobiasBora> I'll try the version using vector
10:25 takle joined
10:25 <hanna> well there's your problem
10:25 <hanna> 12:02 <hanna> if the memory usage is *significantly* more than you expect even when accounting for constructors, then maybe you're storing lots of thunks instead of forcing the value?
10:25 <hanna> seems like this was the case
10:25 joco42 joined
10:28 <tobiasBora> hanna: I don't see why? I used a deepseq when I perform the sorting
10:29 <hanna> That's all I can guess without seeing the code
10:30 <tobiasBora> ok
10:30 <tobiasBora> By the way, I'll try the version using vector
10:30 <tobiasBora> but I don't see the sort option
10:30 <hanna> it's in package vector-algorithms
10:31 <tobiasBora> Data.Vector.Algorithms.Intro ?
10:31 wroathe joined
10:31 <hanna> Every one of those modules implements some sorting algorithm :D
10:32 <hanna> if you're sorting huge lists of numbers you could try radix sort
10:32 <hanna> but that requires more work
10:32 <hanna> to implement the Radix function on your data type
10:32 twopoint718 joined
10:32 davr0s joined
10:33 <tobiasBora> Ok. Does one of them perform nicely in multithreading?
10:33 jadrian joined
10:33 <hanna> I would imagine all divide-and-conquer algorithms work well with multithreading in principle but I don't know if any of them support it out of the box
10:34 takle joined
10:34 <jadrian> am trying to install / use stack, but first try to run `stack setup` returned "Unable to find installation URLs for OS key: linux32-tinfo6"
10:34 romank joined
10:35 <jadrian> the best I could find about this was that tinfo seems to be related with ncurses, but I do have it installed (including devel packages)
10:35 <jadrian> this is stack installed via curl, and no ghc in my system
10:35 <jadrian> any suggestions on how to go about fixing this?
10:36 CyberShadow left
10:36 jerbome_ joined
10:37 <quchen> jadrian: If the automatic script does not work, you can also download the binaries directly.
10:37 saussure joined
10:37 jacereda joined
10:38 <* hackage> concurrent-extra 0.7.0.11 - Extra concurrency primitives https://hackage.haskell.org/package/concurrent-extra-0.7.0.11 (BasVanDijk)
10:39 <quchen> jadrian: It seems you have a system Stack does not recognize.
10:39 <hanna> tobiasBora: upon closer inspection I don't think any of them will benefit from threads; since they all run in ST or IO - both of which impose a total order on modifications
10:39 <hanna> I don't think whether it would be easy to use threads with ST eitheR
10:39 <quchen> jadrian: But there are 32-bit binaries available! https://docs.haskellstack.org/en/stable/README/
10:40 <* hackage> nonce 1.0.3 - Generate cryptographic nonces. https://hackage.haskell.org/package/nonce-1.0.3 (ErikDeCastroLopo)
10:40 <jadrian> quchen: I have openSUSE Tumblweed on a HP core i5
10:40 <quchen> jadrian: https://docs.haskellstack.org/en/stable/install_and_upgrade/#suse
10:41 <hanna> tobiasBora: If you absolutely want high performance sorts and threading, you could try using `repa`. That could also help you get rid of the nesting, i.e. you could use a single multidimensional repa array to store the entire spine of your structure down to matrices / 2x2 cells
10:41 <quchen> Oh, wait – you have Stack already, and it fails to setup! Sorry, I misread the entire thing.
10:41 netheranthem joined
10:41 <tobiasBora> hanna: Why? I don't see why a sort that sort the first half part and the second half in parallel wouldn't help (like fusion sort)
10:42 <quchen> jadrian: Have you tried running »stack upgrade« to get the newest version, should the package be outdated?
10:42 <jadrian> quchen: I thought of using the openSUSE binaries but this seemed safer
10:42 <quchen> jadrian: If that doesn’t work, go for the generic tarball and install it manually
10:42 <hanna> tobiasBora: Yes I understand the theory, I'm saying that `vector-algorithms` will not benefit from threads
10:42 <jadrian> quchen: not really, just downloaded it now with curl so I thought it would be up to date, but let me try
10:42 CyberShadow joined
10:42 <tobiasBora> hanna: oh ok
10:42 <quchen> If *that* doesn’t work then I’m out of ideas. hvr might know more, I think he battled OpenSUSE recently
10:43 <tobiasBora> hanna: Thank you for repa, I'll see what I can do with that
10:43 <jadrian> quchen: yeah it's up to date
10:43 <quchen> jadrian: Oh, the curl-from-haskellstack.org is up to date
10:44 primal_ joined
10:44 Elhamer_ joined
10:45 bollu joined
10:46 <hanna> tobiasBora: with `repa` you could use a multi-dimensional array of size (10^6 :. 4 :. 4) that stores your rationals directly - you'd probably also want to use (Int, Int) instead of Ratio Int so you can use the unboxed representation
10:46 <jadrian> quchen: completely OT, this is an Intel i5-6200U... but `uname -m` reutrns i686
10:47 <jadrian> thought this should be 64 bit
10:47 <* hackage> pagination 0.2.0 - Framework-agnostic pagination boilerplate https://hackage.haskell.org/package/pagination-0.2.0 (mrkkrp)
10:49 nighty-- joined
10:49 bjz_ joined
10:49 yellowj joined
10:50 jhenligne joined
10:50 <hanna> tobiasBora: ah, actually, I don't think repa supports sorting
10:51 bollu joined
10:51 wroathe joined
10:54 xall joined
10:55 Kreest__ joined
10:55 saussure joined
10:55 <tobiasBora> hanna: Hum ok too bad. By the way, do you have any idea to make "data Cell = Cell Q Q Q Q" an instance of the Unbox class?
10:57 <tobiasBora> I saw that https://hackage.haskell.org/package/vector-th-unbox-0.2.1.6/docs/Data-Vector-Unboxed-Deriving.html
10:57 <tobiasBora> not sure it's what I need
10:58 <hanna> seems like that would help you
10:58 <hanna> (you can probably also use Storable instead of Unbox)
10:58 refold joined
10:59 <hanna> but that derivingUnbox example seems like you could copy/paste it and make a few tweaks
10:59 <hanna> 4-tuples are already Unbox instances so you can use the same trick of transforming it to tuples and back
11:02 Snircle joined
11:05 shesek joined
11:05 saussure joined
11:07 <jadrian> quchen: I just realised I installed a 32 bit openSUSE distro on a 64 bit laptop... maaaybe that has something to do with it
11:07 JScully joined
11:07 <tobiasBora> Hum... I tried this: https://paste.debian.net/935539/
11:07 <tobiasBora> but I've an error Expecting four fewer arguments to ‘Cell’, Expected kind ‘* -> * -> * -> * -> *’, but ‘Cell’ has kind ‘*’
11:07 baldrick joined
11:08 mada joined
11:09 romank joined
11:10 <tobiasBora> Oh I think I got it
11:10 <tobiasBora> yes
11:10 <tobiasBora> now much darkers errors:
11:10 <tobiasBora> The exact Name ‘a_acql’ is not in scope Probable cause: you used a unique Template Haskell name (NameU),perhaps via newName, but did not bind it
11:12 <tobiasBora> using this code: https://paste.debian.net/935552/
11:13 sz0 joined
11:13 Kreest_ joined
11:15 mr_sm1th joined
11:16 ertes-w joined
11:16 james999 joined
11:17 <ClaudiusMaximus> tobiasBora: should you have a => in the type after the unbox stuff instead of -> (hard to tell with my font and the unicode)
11:17 <ClaudiusMaximus> oh nevermind you do
11:17 <hanna> tobiasBora: what happens if you insert a space after the \ but before the (Cell a b c d)
11:17 <tobiasBora> hanna: same error
11:18 <hanna> I'm honestly sort of confused by the unicode though, i.e. the ∀ stuff
11:18 <tobiasBora> me too
11:18 <tobiasBora> I'll convert in non-unicode
11:18 <tobiasBora> I was just using the example
11:18 sdothum joined
11:19 fendor joined
11:20 Elhamer_ joined
11:20 <tobiasBora> hanna: ClaudiusMaximus: Here is a better formating: https://paste.debian.net/935554/
11:20 Denthir joined
11:21 <tobiasBora> and the errors: https://paste.debian.net/935555/
11:22 ziyourenxiang joined
11:23 saussure joined
11:23 govg joined
11:24 jedws joined
11:24 rickygee joined
11:25 <hanna> tobiasBora: err
11:25 Kreest joined
11:25 <* tobiasBora> need to go, but he will read everything when he'll be back
11:25 darjeeli1 joined
11:25 <hanna> tobiasBora: your Cell thing is not polymorphic
11:26 silentcontrib_ joined
11:26 <hanna> you just need to write [t| Cell -> (Q, Q, Q, Q) |]
11:26 <hanna> instead of the polymorphic stuff
11:26 Sose_ joined
11:26 <hanna> (and also an Unbox instance for Q)
11:26 <ClaudiusMaximus> tobiasBora: but you'll need V.Unbox Q, which is problematic as Integer is variable sized (and Ratio Int is highly unsafe)
11:27 freusque joined
11:27 oisdk joined
11:28 TCZ joined
11:28 RayNbow`TU joined
11:28 <* hackage> plan-b 0.2.1 - Failure-tolerant file and directory editing https://hackage.haskell.org/package/plan-b-0.2.1 (mrkkrp)
11:29 Kreest__ joined
11:31 jerbome_ joined
11:33 wroathe joined
11:37 <* hackage> microstache 1 - Mustache templates for Haskell https://hackage.haskell.org/package/microstache-1 (phadej)
11:37 HoierM joined
11:39 HoierM_ joined
11:40 ricksanchez joined
11:41 saussure joined
11:42 oisdk_ joined
11:43 <hanna> ClaudiusMaximus: I guess if you really, absolutely wanted to support Integer you could store it as an Either Int Pointer, which unboxes the “common” case in exchange for needing an indirection for the uncommon case? no idea how difficult that would be to implement though
11:43 <hanna> or whether it would even be worth it
11:43 <hanna> Either Int Pointer of course being (Bool, Int)
11:44 Gloomy joined
11:47 pavonia joined
11:49 tommd joined
11:50 saussure joined
11:52 mmn80 joined
11:53 cretiq joined
11:53 <ClaudiusMaximus> hanna: i don't know if it's possible, where would you store the Map Int Integer (or similar) for the pointers?
11:53 <hanna> Integer is basically a pointer to a memory region isn't it?
11:53 <hanna> (the bignum variant)
11:54 primal joined
11:54 <ClaudiusMaximus> hanna: Integer is a sum type of a small integer (Int) or a large integer (sign plus ByteArray# iirc0
11:55 <ClaudiusMaximus> the ByteArray# is immutable, and can be moved by GC afaik
11:55 <hanna> ah, things must have changed since I last poked around GHC data types
11:56 <hanna> I recall in the past it was essentially a ForeignPtr + length ?
11:56 <ClaudiusMaximus> i wrote some FFI wrappers for integer-gmp (the hgmp package) so I'm relatively familiar with the current version, but yes integer gmp is different from earlier versions
11:57 coot____ joined
11:57 <ClaudiusMaximus> the earlier version required gmp custom memory allocators, which broke foreign code sometimes (eg making mpfr bindings next-to-impossible)
11:57 arpl joined
11:58 harshbagadia joined
11:58 <hanna> ah neat
11:59 <merijn> I'm always impressed with the speed of GHCs libgmp bindings
12:00 jacereda joined
12:00 odell joined
12:00 <ClaudiusMaximus> probably comes from using the super-fast ghc allocator instead of malloc (possibly?) for every integer operation
12:00 <hanna> Wasn't there a bignum shootout that came to the conclusion ghc-gmp was faster than gmp in C
12:01 <merijn> C wasn't in it, but GHC did beat basically every other language's GMP bindings
12:01 <merijn> http://www.wilfred.me.uk/blog/2014/10/20/the-fastest-bigint-in-the-west/
12:05 Denthir joined
12:08 saussure joined
12:09 im0nde joined
12:11 cschneid_ joined
12:13 posco joined
12:13 SiCC joined
12:13 eL_Bart0 joined
12:14 noplamodo joined
12:14 fiddlerwoaroof joined
12:14 oldsk00l joined
12:14 sns joined
12:14 Aidan[m] joined
12:14 saussure joined
12:14 TonL joined
12:14 aaron7 joined
12:15 wroathe joined
12:16 dunj3 joined
12:17 gregoire joined
12:19 phaji joined
12:21 reactormonk[m] joined
12:21 M-wamaral joined
12:21 closures999[m] joined
12:21 monomon[m] joined
12:21 alaradia[m] joined
12:21 bb010g joined
12:21 NickHu joined
12:21 riaqn joined
12:21 Lex[m] joined
12:21 Naughtmare[m] joined
12:21 sn[m] joined
12:21 davidar joined
12:21 corintho[m] joined
12:21 angelbeats[m] joined
12:21 karroffel joined
12:21 nick2000 joined
12:21 jyp[m] joined
12:21 curry[m] joined
12:21 unclechu joined
12:21 herzmeister[m] joined
12:21 turt2live joined
12:21 unlmtd joined
12:21 roadrunner168[m] joined
12:21 M-BostonEnginerd joined
12:21 elwan7[m] joined
12:21 myfreeweb joined
12:21 tfc[m] joined
12:21 tester668[m] joined
12:21 seequ_ joined
12:21 m4lvin[m] joined
12:21 rdesfo[m] joined
12:21 miviotros[m] joined
12:21 pellegrino joined
12:21 jmnoz[m] joined
12:21 korayal[m] joined
12:21 ollieh joined
12:21 hendrik[m] joined
12:21 sirius[m] joined
12:21 sudoreboot[m] joined
12:21 noraesae joined
12:21 aer[m] joined
12:21 aspiwack[m] joined
12:21 TheWizardTower joined
12:21 davidar_ joined
12:21 M-berdario joined
12:21 M-Illandan joined
12:21 M-schmittlauch joined
12:21 Magnap joined
12:21 M-Quora joined
12:21 srenatus[m] joined
12:21 MatrixTraveler[m joined
12:21 hiq[m] joined
12:21 TylerCecil[m] joined
12:21 hpd_m joined
12:21 unknownln joined
12:21 cbHXBY1D[m] joined
12:21 FederalRick[m] joined
12:21 bobjason[m] joined
12:21 goodboy[m] joined
12:21 Soif[m] joined
12:21 ptek[m] joined
12:21 hakan[m] joined
12:21 jacqueline[m] joined
12:21 zaphar_ps[m] joined
12:21 herre[m] joined
12:21 iffsid[m] joined
12:21 mmmrrr[m] joined
12:21 wr3n[m] joined
12:21 QoMe joined
12:21 colton[m] joined
12:21 rfabbri[m] joined
12:21 moonarch joined
12:21 jascot[m] joined
12:21 jhinkle[m] joined
12:21 M-krsiehl joined
12:21 rakete joined
12:21 gentam[m] joined
12:22 tomkerk[m] joined
12:22 TesX[m] joined
12:22 zar[m] joined
12:22 NopeMarker[m] joined
12:22 drasich[m] joined
12:22 Guest91110[m] joined
12:22 ProofTechnique[m joined
12:22 M-kevinliao joined
12:22 M92854[m] joined
12:22 gkaplan[m] joined
12:22 Yves[m]1 joined
12:22 JCGrant[m] joined
12:22 exarkun left
12:22 spb joined
12:22 eacameron joined
12:23 cschneid_ joined
12:24 primal_ joined
12:24 LKoen joined
12:25 oisdk joined
12:26 koserge joined
12:26 jutaro joined
12:27 ccomb joined
12:27 lukky513 joined
12:27 mizu_no_oto joined
12:28 darlan joined
12:28 hollisb joined
12:29 ErinvanderVeen joined
12:31 saurabhnanda joined
12:32 saussure joined
12:34 eklavya joined
12:34 NickCage joined
12:37 <NickCage> Hello everyone, im trying to write a function that removes all Leafs in an n-ary tree structured like this NTree x = NLeaf x | NNode x [NTree x]. Advice is very appreciated. So far im having a function that removes every child, leaving me with the root of the tree (which is very wrong. :-))
12:38 vgrocha joined
12:38 oisdk joined
12:39 <ongy> NickCage: Have you tried to write something with filter?
12:39 <saurabhnanda> what's the safest way to read a complete file in Haskell? I'm assuming it's not readFile because of laziness -- http://hackage.haskell.org/package/base-4.9.1.0/docs/Prelude.html#v:readFile
12:39 <NickCage> ongy does filter work, when Ntree is set as its own datatype?
12:40 Elhamer_ joined
12:40 acarrico joined
12:40 <ongy> saurabhnanda: do you want to have all of it in memory? And as String, bytestring, Text?
12:40 <ongy> NickCage: no, you will have to use a recursive function that applies filter
12:40 rickygee joined
12:41 <saurabhnanda> ongy: all in memory. Figuring out why flavour of string does my processing function like. Gotta keep it happy.
12:41 jerbome_ joined
12:41 <mauke> @let data NTree x = NLeaf x | NNode x [NTree x] deriving (Eq, Ord, Read, Show)
12:41 <lambdabot> Defined.
12:41 <ClaudiusMaximus> NickCage: i'd use mapMaybe in a recursion
12:42 <mauke> NickCage: what should the function return for NLeaf 42?
12:42 <saurabhnanda> ongy: Text
12:42 <saurabhnanda> ongy: read an entire file as Text
12:43 <mauke> saurabhnanda: http://hackage.haskell.org/package/text-1.2.2.2/docs/Data-Text-IO.html#v:readFile
12:43 jleon joined
12:44 <NickCage> mauke an empty list of the above node
12:44 <ski> what's the desired type of the function ?
12:45 <mauke> NickCage: why a list?
12:45 <mauke> when would it ever return multiple values?
12:45 jacereda joined
12:45 <NickCage> mauke well, the Ntree is defined, so that it either has a Nleaf, or Nnode [Ntree]
12:45 <NickCage> with all children of the node lying in the []
12:46 Maxdamantus joined
12:46 tommd joined
12:46 <NickCage> and my goal is to remove every leaf in that list.
12:46 <mauke> you're repeating yourself without answering my question
12:46 <ski> so do you want `NTree a -> [a]' ? `NTree a -> [NTree a]' ? something else ?
12:47 twomix joined
12:47 cretiq joined
12:47 <NickCage> Ntree a -> Ntree a
12:47 <NickCage> is the signature of the function
12:47 <mauke> that's not what you just said
12:47 <mauke> if it returns a tree, it can't return a list
12:47 <ski> well, you said to return an empty list in one case. the empty list doesn't have that return type
12:48 <mauke> > [] :: NTree a
12:48 <lambdabot> error:
12:48 <lambdabot> • Couldn't match expected type ‘NTree a1’ with actual type ‘[t0]’
12:48 <lambdabot> • In the expression: [] :: NTree a
12:48 <NickCage> sorry, my bad. I couldnt put it into words
12:48 <NickCage> Ntree a -> Ntree a has to be the signature, and my goal is to remove every leaf in the tree and return the "new" one.
12:48 <NickCage> i hope this helps
12:49 <ski> which tree should the function return, when passed `NLeaf 42' as input ?
12:49 <ongy> NickCage: what's: rmLeaves (NLeaf 42)
12:49 <NickCage> that would have to raise an error
12:49 <NickCage> because there wouldnt be anything left
12:49 <ski> ok
12:49 Kreest_ joined
12:49 <ongy> :(
12:49 <ski> how about `NNode 42 []' ?
12:49 <NickCage> this is allowed
12:50 Soft joined
12:50 saussure joined
12:50 <NickCage> so id just convert the NNode 42 [] into NLeaf 42
12:50 <mauke> wait, what?
12:50 <NickCage> or not?
12:50 <mauke> why do you have NLeaf in the first place, then?
12:51 <mauke> what are you using this data structure for?
12:51 <NickCage> thats a good point, maybe thats the tasks's intention
12:52 <NickCage> well its homework. and both, the data type, and the functions signature is given
12:52 <saurabhnanda> mauke: ongy: thanks
12:52 <tobiasBora> ClaudiusMaximus: hanna: Hum... I tried to use Ratio Int, but still not working...
12:52 <tobiasBora> Could not deduce (V.Unbox (Ratio Int))
12:52 <hanna> Yes there's no Unbox Ratio instance
12:52 <hanna> you'd need to write your own as well
12:52 <hanna> based on (Int, Int)
12:52 <tobiasBora> ok ^^
12:52 <mauke> NickCage: is the text of the assignment online somewhere?
12:54 <NickCage> it is, though in german.
12:55 <mauke> link?
12:55 <ongy> you can still post it, at least I can read it :)
12:55 <NickCage> http://www-stud.informatik.uni-frankfurt.de/~prg2/SS2017/aufgaben/teil1/blatt5.pdf
12:56 <NickCage> 1.e)
12:56 <mauke> well, that's vague
12:56 <tobiasBora> hanna: Hum... But how can I construct a Ratio Int? Because I tried "derivingUnbox "Ratio Int"", and I've an error "Ratio Int" is not a valid constructor suffix!
12:56 wroathe joined
12:57 <ongy> "Fehlermeldung ausgeben" -> "output error message" well, tell them their type doesn't allow it, since output is IO :)
12:57 TheFuzzball joined
12:57 <hanna> tobiasBora: there's a Complex example, no?
12:58 <mauke> ok, looks like NNode 42 [] is supposed to stay NNode 42 [] because it's not a leaf (nominally)
12:58 <ski> NickCage : i don't interpret that as saying that `NNode 42 []' should be converted into `NLeaf 42'
12:58 <NickCage> ski you are right, that was me typing before thinking. :-)
12:58 <tobiasBora> hanna: Hum... I may need to use default here. Let me look at that
12:58 <quchen> Woah, manually inferring types. Your lecturer must hate you.
12:59 ccomb joined
12:59 <ski> NickCage : so .. how about `NNode 0 [NNode 1 [],NLeaf 2,NNode 3 [NLeaf 4,NNode 5 [NNode 6 []],NLeaf 7,NNode 8 []]]' ?
12:59 <ongy> compute the type? Is that proper terminology?
13:00 <mauke> > let removeLeaves (NLeaf _) = error "empty tree is empty"; removeLeaves (NNode x children) = NNode x [ removeLeaves t | t@(NNode _) <- children ] in removeLeaves (NNode 0 [NNode 1 [],NLeaf 2,NNode 3 [NLeaf 4,NNode 5 [NNode 6 []],NLeaf 7,NNode 8 []]])
13:00 <lambdabot> error:
13:00 <lambdabot> • The constructor ‘NNode’ should have 2 arguments, but has been given 1
13:00 <lambdabot> • In the pattern: NNode _
13:00 <hexagoxel> ongy: the docs on `error` "error stops execution and displays an error message."
13:00 <mauke> > let removeLeaves (NLeaf _) = error "empty tree is empty"; removeLeaves (NNode x children) = NNode x [ removeLeaves t | t@NNode{} <- children ] in removeLeaves (NNode 0 [NNode 1 [],NLeaf 2,NNode 3 [NLeaf 4,NNode 5 [NNode 6 []],NLeaf 7,NNode 8 []]])
13:00 <lambdabot> NNode 0 [NNode 1 [],NNode 3 [NNode 5 [NNode 6 []],NNode 8 []]]
13:00 <ClaudiusMaximus> tobiasBora: the constructor for Ratio Int is hidden (to allow invariants to be preserved), you must construct them with (%)
13:00 <tobiasBora> hanna: Yes, it seems to work great, thank you
13:00 <ongy> hexagoxel: if we are allowed to do more than requested, entferneBlaetter = error "I removed everything" would be valid :)
13:01 <hexagoxel> ongy: i would not give a student any points if they choose to nitpick over the phrasing in such a way.
13:01 <ongy> since removing the entire tree also removes all leafs :D
13:01 <quchen> ongy: Sure, why not? You get a value and an initial environment, and compute the type of the value given that.
13:01 davr0s joined
13:01 <ongy> hexagoxel: in homework I would nitpick, for exams I wouldn't
13:01 <ongy> quchen: I'm just used to infer/determine, but I guess compute does fit
13:02 <mauke> I'd totally submit that solution
13:02 <tobiasBora> ClaudiusMaximus: yes, I think I got it. For types like "data Color = Red | Blue", I think to remember that there is a function that bind it to a Int, but I can't find it anymore
13:02 <quchen> ongy: »determine« would maybe allow asking GHCi :-)
13:02 <ClaudiusMaximus> tobiasBora: deriving Enum and fromEnum/toEnum
13:02 <hexagoxel> some homework is precondition for admission to finals.
13:02 <mauke> teachers need to learn to write unambiguous specs
13:03 <hexagoxel> ongy: on the other hand i agree that the tasks are worded poorly in general.
13:03 <tobiasBora> ClaudiusMaximus: thank you! And then the good way to proceed is to bind it in a derivingUnbox right?
13:03 <quchen> mauke: That will show him!
13:03 <mauke> particularly when it comes to programming
13:03 <mauke> you can't just handwave your way around a bug in code: "oh, you know what I mean"
13:04 <NickCage> mauke im still trying to grasp your suggestion. Ive never seen the @ and {} parts before.
13:04 <sshine> but handwaving makes regular bugs go away!
13:04 <ongy> quchen: but compute doesn't? I just outsource the computation :)
13:04 <sshine> surely handwaving will make software bugs go away, too.
13:05 <quchen> mauke: I guess the »(polymorphic)« type of »curry fst« is a false statement, since »curry fst« has many polymorphic types. Therefore, »duck in rubber suit« is a correct answer.
13:05 <ongy> NickCage: t@(NNode _) is a pattern match that also names the thing that is matched t
13:05 <quchen> (For exercise 3)
13:06 <ongy> we should create an "improved" version of the assignment and sent it to the TAs :D
13:06 <* hackage> stm-split 0.0.2 - TMVars, TVars and TChans with distinguished input and output side https://hackage.haskell.org/package/stm-split-0.0.2 (HenningThielemann)
13:06 govg joined
13:07 <NickCage> and what does the {} brackets do in this case? ongy
13:07 hurkan left
13:07 beanbagula joined
13:07 rcat joined
13:07 <quchen> :t let isNothing Nothing = True; isNothing Just{} = False in isNothing
13:07 <lambdabot> Maybe t -> Bool
13:07 <quchen> :t let isNothing Nothing = True; isNothing Just whatever = False in isNothing
13:07 <lambdabot> error:
13:07 <lambdabot> • Equations for ‘isNothing’ have different numbers of arguments
13:07 <lambdabot> <interactive>:1:5-28
13:08 saussure joined
13:08 <quchen> NickCage: The {} just omits all fields since we only care about the constructor, not the field values
13:08 <quchen> :t let isNothing Nothing = True; isNothing (Just whatever) = False in isNothing
13:08 <lambdabot> Maybe t -> Bool
13:08 <ongy> NickCage: if you have Constructor{} that matches (Constructor _) (Constructor _ _) and so forth, it makes code more robust against changes
13:08 <quchen> Note the unused »whatever«.
13:08 <quchen> We could write »_« there, sure, but that gets tedious when there are many fields.
13:08 <* ski> would prefer `{_}'
13:09 Puggy joined
13:09 inad922 joined
13:09 <NickCage> ongy mauke quchen hexagoxel ski clever, thank you very much.
13:10 <quchen> NickCage: It’s a bit of abuse of notation, since {…} is usually used for pattern matching on records.
13:10 <* ski> still isn't sure mauke's solution is what NickCage had in mind
13:10 <tobiasBora> ClaudiusMaximus: Ok it works thank you. Now, I've one more step to do: is it possible to have an unbox instance for "V.Unbox (V.Vector Alpha)", when I've an instance for "V.Unbox Alpha" ?
13:10 odell joined
13:10 <ClaudiusMaximus> tobiasBora: no, because things must have a fixed maximum size (constant for the type) to be able to be unboxed
13:11 <tobiasBora> ClaudiusMaximus: Ok too bad. So I'm stuck with boxes
13:12 <ClaudiusMaximus> tobiasBora: either that or (if the vector size is fixed) you could do tricks with statically-sized vectors (size mentioned in the type)
13:12 <tobiasBora> ClaudiusMaximus: Hum interesting...
13:13 <hexagoxel> ski: i think mauke's solution is what was intended by the tutor. not that the task makes any particular sense :/
13:13 <* hackage> tagged-identity 0.1.2 - Trivial monad transformer that allows identical monad stacks have different types https://hackage.haskell.org/package/tagged-identity-0.1.2 (mrkkrp)
13:13 saussure joined
13:13 <ClaudiusMaximus> tobiasBora: then unboxing could map a 0 length vector to (), and length (n+1) to (vector :: length n, item)
13:13 <tobiasBora> ClaudiusMaximus: I see lot's of implementation: fixed-vector, vector-sized, sized-vector... Is one better than the others?
13:13 <ski> hexagoxel : that's not what i remarked on, though
13:13 <ClaudiusMaximus> tobiasBora: i don't know
13:14 reuben364 joined
13:14 <tobiasBora> ClaudiusMaximus: I think I see, but need to write it to be sure. I will let you know, thank you
13:15 theelous3 joined
13:15 jathan joined
13:15 silentcontrib joined
13:15 <ClaudiusMaximus> tobiasBora: is unboxing really necessary? does the boxing overhead cause you trouble?
13:15 <tobiasBora> ClaudiusMaximus: I don't know, I will test that
13:15 jacklo joined
13:15 <merijn> Unboxing a vector doesn't really make sense
13:15 <tobiasBora> The think is that I use way too much memory
13:15 iAmerikan joined
13:15 <merijn> Actually
13:16 <merijn> s/doesn't really/really doesn't
13:16 <tobiasBora> merijn: In fact, I don't really mind to unbox the vector
13:16 <hexagoxel> ski: ah, you mean a different formulation of the same semantics. yeah, that's fair.
13:17 <tobiasBora> but the thing is that I do a map on the vector of vector, and that I would like to unbox the output of this map
13:17 <tobiasBora> so if you have a nice way to do a map from a vector to an unbox vector, I think it would be nice
13:17 <ski> hexagoxel : .. or even a different semantics
13:17 wroathe joined
13:19 mattyw joined
13:19 yogsototh_ joined
13:21 <tobiasBora> Grrr
13:21 <tobiasBora> I don't understand why, but here: https://hackage.haskell.org/package/vector-0.12.0.1/docs/Data-Vector.html
13:21 <tobiasBora> there is a "uniq" function
13:21 neoo joined
13:22 <tobiasBora> but when I use V.uniq, he tolds me "Not in scope: ‘V.uniq’ Perhaps you meant one of these: 'V.init' from Data.Vector
13:22 <bollu> I'd asked this question in the idris forums but no one replied. I was hoping maybe someone here would have an idea? https://groups.google.com/forum/#!topic/idris-lang/qcZNGHJGJQY
13:23 <ClaudiusMaximus> tobiasBora: it's new in 0.12, maybe you are using an earlier version
13:23 wroathe joined
13:23 eacameron joined
13:24 neoo joined
13:24 kmels joined
13:25 <tobiasBora> ClaudiusMaximus: ok thank you
13:26 cdg joined
13:26 neoo joined
13:28 asm_ joined
13:28 yoneda joined
13:29 halogenandtoast joined
13:29 jutaro joined
13:29 neoo joined
13:31 neoo joined
13:31 saussure joined
13:32 neoo joined
13:34 sternmull left
13:34 silentcontrib_ joined
13:34 primal joined
13:34 neoo joined
13:35 tommd joined
13:35 <reuben364> If I have an (a,b), Prism' a c, Prism' b d, can I construct a Prism (a,b) (c,d) easily without using prism' or constructing it directly.
13:35 <reuben364>
13:35 wei2912 joined
13:37 codesoup joined
13:37 cpennington joined
13:37 <reuben364> Context: I want to build a prism from a generic xml-like tree to specific data types.
13:38 <c_wraith> reuben364: I think alongside does what you want
13:38 <quchen> Yeah
13:38 <quchen> Just don’t ask for its type
13:38 <quchen> https://hackage.haskell.org/package/lens-4.15.2/docs/Control-Lens-Lens.html#v:alongside
13:39 moongazer joined
13:39 earldouglas joined
13:40 <reuben364> Scary.
13:40 ccomb joined
13:41 saussure joined
13:41 takle joined
13:43 <quchen> > view (alongside _1 _2) (("hello", "world"), (123,456)) -- reuben364
13:43 <lambdabot> ("hello",456)
13:43 ystael joined
13:44 meba joined
13:44 primal_ joined
13:45 dni joined
13:46 <mauke> lens types: don't ask, don't tell
13:47 entuland joined
13:47 <quchen> Combining the joy of weak typing with the convenience of Agda
13:47 dsh joined
13:47 <quchen> Most things fit together and then do something, except when they don’t
13:48 reuben364 left
13:49 reuben364 joined
13:49 <wilornel> Hey ##haskell! What are some nice functions I could read up on? Any beautiful definitions in the standard lib?
13:49 <merijn> wilornel: Depends, how theoretical do you like to get?
13:50 <quchen> wilornel: the list sorting algorithm.
13:50 <quchen> https://hackage.haskell.org/package/base-4.9.1.0/docs/src/Data.OldList.html#sort
13:50 <wilornel> merijn: I love theory! Our courses this semester don't have much theory
13:50 <merijn> wilornel: In that case: fold!
13:51 <merijn> wilornel: Specifcally: http://eprints.nottingham.ac.uk/224/1/fold.pdf
13:51 <merijn> wilornel: Or "proof that any recursive function can be written as fold + trivial helper"
13:51 fakenerd joined
13:51 <merijn> but yeah, sort is nice too
13:51 <quchen> merijn: surely fix counts as a trivial helper
13:52 <wilornel> Thanks merijn and quchen , checking them out
13:52 <merijn> wilornel: Also, this beauty: https://gist.github.com/merijn/c163cc106fd245d1cf2e
13:52 cloudhead joined
13:53 BlueRavenGT joined
13:53 `^_^v joined
13:53 mohsen_ joined
13:54 primal joined
13:54 <wilornel> the cons operator is not surrounded my spaces on both sides, it seems
13:54 <wilornel> in that sort implementation
13:54 nohTo joined
13:55 odell joined
13:55 <byorgey> wilornel: no, spaces are not required around operators in Haskell
13:55 <ski> wilornel : fwiw, this is not ##haskell :)
13:55 <quchen> The clown operator! (o:)
13:56 <ski> wilornel : perhaps you'd be interested in the book "Pearls of functional algorithm design", btw
13:56 chlong joined
13:56 <merijn> I prefer the snowman operator
13:56 stevenxl joined
13:56 <merijn>
13:56 <quchen> > let o = "hello " in (o:) ["world"]
13:56 <lambdabot> ["hello ","world"]
13:56 <* ski> . o O ( snoyman operator )
13:57 <wilornel> thanks for the resources everyone! It's a little bit unclear, but it's good practice to go over these
13:57 <wilornel> and I'm getting that book now
13:58 saussure joined
13:59 <wilornel> Is that an efficient definition of split or is it specifically a short definition of split?
14:00 mr_sm1th joined
14:00 <merijn> wilornel: It's supposed to showcase DList (for efficient append) and a neat "tortoise & hare" trick. It should be fairly efficient, but the first half isn't lazy, so that's a downside
14:00 <merijn> wilornel: iow, it's efficient, depending on your criteria of efficiency ;)
14:01 sternmull joined
14:01 <wilornel> I think I get the definition of split. You're skipping two elements on the second argument for every one element you concatenate on the first argument.
14:01 <merijn> wilornel: right, and since they're the same list you know you've hit halfway as soon as the right hits the end
14:02 <wilornel> that's the first case
14:02 <wilornel> but then it _looks_ like you're switching them places
14:02 <merijn> wilornel: how so?
14:02 <wilornel> ooooh no I get it!
14:02 <merijn> :)
14:02 <wilornel> in the first case, xs is the second half
14:03 <merijn> Right
14:03 <wilornel> and f [] will allow you to rebuild the first half
14:03 <wilornel> nice
14:03 <hanna> I wonder if T.pack . foo . T.unpack is subject to fusion. Depends on `foo`, I suppose?
14:03 <wilornel> what about the second case?
14:03 <ClaudiusMaximus> merijn: is that splitInHalf in the split package? if not, maybe suggest it?
14:03 <merijn> wilornel: Well, what if you have an uneven number of elements?
14:04 primal_ joined
14:04 <wilornel> does it end up being |(a,b)| = (n + 1, n) or (n, n+1)... let's see
14:04 <merijn> ClaudiusMaximus: Split does something different, probably better
14:04 <merijn> (n, n + 1), since we use "xs" as right half and we have 1 element left on the right
14:04 <wilornel> yeah it ends up being (n, n+1) right?
14:04 <wilornel> yes
14:05 <wilornel> coooool!
14:05 <merijn> ClaudiusMaximus: Split does "[a] -> [[a]]" which lets you build the left side lazily
14:05 <wilornel> on to sort
14:05 <merijn> actually
14:05 <merijn> I don't even know if you can consume the left side lazily, tbh
14:06 <merijn> ClaudiusMaximus: Honestly, I can't really be arsed to do the work to propose a patch to split, but feel free to copy the implementation and do it for me :p
14:06 <wilornel> never seen this @ in as@(a:as') syntax
14:06 <wilornel> found it
14:06 saussure joined
14:06 oisdk joined
14:06 <ClaudiusMaximus> merijn: you might be able to make it lazier if you write it recursively using let ~(as,bs) = ... in (a:as,bs) instead of the dlist?
14:07 <merijn> possibly
14:07 justin2 joined
14:07 <ClaudiusMaximus> if that is even possible..
14:07 <merijn> ClaudiusMaximus: I mostly wrote it to showcase DList + the tortoise&hare trick to people (like wilornel) :)
14:07 <ClaudiusMaximus> the tortoise+hare trick is nice :)
14:07 coltfred_ joined
14:08 <wilornel> ` mergePairs (a:b:xs) = merge a b: mergePairs xs
14:08 <wilornel> `, it looks like there's three arguments given to merge
14:08 <wilornel> which takes two arguments
14:08 govg joined
14:09 <wilornel> ah, no , nvm
14:09 prophile joined
14:09 hydraz joined
14:09 nohTo joined
14:10 bennofs joined
14:10 <shapr> GOOD MORNING!
14:10 twopoint718 joined
14:11 <wilornel> GOOD MORNING!
14:11 <wilornel> midnight and a quarter here
14:11 rickygee joined
14:11 <wilornel> this one is weird: ` mergeAll xs = mergeAll (mergePairs xs)
14:11 <wilornel> `, if we run into the case `mergePairs xs = xs `
14:12 <ClaudiusMaximus> an earlier case of mergeAll should handle that possibility i think
14:12 <wilornel> because then it's just `mergeAll xs = mergeAll xs`
14:12 <wilornel> hmm let's see
14:12 <wilornel> yes!
14:12 thc202 joined
14:12 <wilornel> in (a:b:xs), can xs be [] ?
14:12 <ClaudiusMaximus> figuring out the pre/post conditions and invariants would make a good exercise i guess
14:12 <ClaudiusMaximus> yep
14:13 takle joined
14:13 <shapr> wilornel: sounds like a good time to code!
14:13 jordan35353 joined
14:14 <wilornel> ClaudiusMaximus: what do you mean with pre/post conditions? Pre is unsorted, post is sorted, and invariants is a sorted list inputted that comes back out sorted
14:14 sleffy joined
14:14 <wilornel> shapr: hahah yes I think that's where it's headed tonight
14:14 freusque joined
14:14 <ClaudiusMaximus> wilornel: i mean for each clause of each helper function, not the whole function
14:14 <wilornel> ah yes, if there could be a function type declaration, right?
14:15 <* hackage> hs-multiaddr 0.1.0.0 - Multiaddr Library for LibP2P https://hackage.haskell.org/package/hs-multiaddr-0.1.0.0 (CMCDragonkai)
14:15 <ClaudiusMaximus> wilornel: also properties like "length of output is strictly less than length of input" would be useful to prove termination
14:15 <jordan35353> http://lpaste.net/442024582266748928
14:16 <jordan35353> why doesnt my function work
14:16 <jordan35353> the one at the bottom
14:17 <jordan35353> i want to count how many "Blatt" mbaum has
14:17 <wilornel> hmm do you usually express these pre/post and invariants in comments around functions in haskell?
14:17 Big_G joined
14:17 <ongy> jordan35353: your help function only has clauses for lists with no or exactly 1 element
14:18 <wilornel> it's interesting how `sequences` will do `descending b [a] xs` or `ascending b (a:) xs` depending on if a < b or a > b. Notice the difference between [a] and (a:)
14:18 <ClaudiusMaximus> wilornel: sure, either that or link to a pdf of a paper describing it in more detail
14:18 <wilornel> gotcha!
14:18 quchen joined
14:19 <ClaudiusMaximus> wilornel: for exported functions, the comments can use haddock markup to look pretty in the generated html documentation
14:19 <jordan35353> how do clauses for lists longer than that look like? ongy
14:19 ccomb joined
14:19 ph88 joined
14:19 <ph88> how can i make this function for two inputs? https://hackage.haskell.org/package/conduit-1.2.10/docs/src/Data-Conduit-Internal-Conduit.html#awaitForever
14:20 <saurabhnanda> quick question -- what is the opposite of -fobject-code
14:20 Sh4rPEYE joined
14:20 fragamus joined
14:20 juanpaucar joined
14:21 <wilornel> If we can't match `descending a as (b:bs)`, then we match `descending a as bs`... but this means that bs in the second case is [], right?
14:22 <ongy> jordan35353: you can match a list on (x:xs), then x will be the first element (head) and xs everything else (tail)
14:23 <ph88> is there some smart combinator to turn awaitForever :: Monad m => (i -> ConduitM i o m r) -> ConduitM i o m () into awaitForever :: Monad m => (i -> i -> ConduitM i o m r) -> ConduitM i o m () ?
14:23 eschnett joined
14:23 <jordan35353> yes but the thing inside the list is a Baum not a list
14:24 <jordan35353> i dont know how to handle that ongy
14:24 {emptyset} joined
14:24 davr0s joined
14:24 <wilornel> I think you want to do pattern matching
14:24 <ongy> jordan35353: you call helpfunction on it :)
14:25 <ongy> jordan35353: first you should think about what you want that to return, then we can think about how you tell ghc to do it
14:26 plutoniix joined
14:27 <jordan35353> help_function (Knoten a [(c:cs)]) = help_function c
14:27 <jordan35353> doesnt work : /
14:27 <ongy> jordan35353: (Knoten a (c:cs))
14:28 <ongy> the ':' here is the Cons constructor of [], you don't need the syntax sugar for lists here
14:29 <* hackage> hs-multiaddr 0.1.0.1 - Multiaddr Library for LibP2P https://hackage.haskell.org/package/hs-multiaddr-0.1.0.1 (CMCDragonkai)
14:29 <jordan35353> help_function (Knoten a (c:cs)) = help_function c
14:29 <jordan35353> this compiles but gives me 1
14:29 <jordan35353> now i need to handle the rest of the list
14:30 <jordan35353> help_function (Knoten a (c:cs)) = help_function c + help_function cs
14:30 <jordan35353> doesnt work because cs is not an element but a list
14:30 Nk_ joined
14:30 <Cale> Perhaps you want help_function c + help_function (Knoten a cs) ?
14:30 <Cale> I don't know what is going on though.
14:31 <Cale> That looks like it would at least type check
14:31 <Cale> It's probably worth thinking about what help_function is actually meant to be computing here (it's poorly named)
14:32 <jordan35353> its supposed to count all leafes of the tree
14:32 <Nk_> http://lpaste.net/355769 In this Coq code, what makes O the number 0?
14:32 <Nk_> How are peano numbers defined like this?
14:33 <Cale> jordan35353: Okay, so the number of leaves of the tree Knoten a cs is the sum of the number of leaves of each of the trees cs, right?
14:33 <* ski> supposes jordan35353 is also doing <http://www-stud.informatik.uni-frankfurt.de/~prg2/SS2017/aufgaben/teil1/blatt5.pdf> ..
14:33 <glguy> Nk_: this is #haskell
14:33 sheaf joined
14:34 primal joined
14:34 <Cale> jordan35353: So, you should have leafCount (Knoten a cs) = sum (map leafCount cs)
14:34 <jordan35353> who are you ski : D
14:35 juanpauc_ joined
14:36 <shapr> glguy: sparta reference?
14:36 <jordan35353> Cale now it works :))
14:36 <jordan35353> thanks ^
14:39 nohTo joined
14:39 <* ski> is ski
14:39 <shapr> I met ski once.
14:39 sellout- joined
14:39 cschneid_ joined
14:40 maffh joined
14:40 <ongy> ski: :) I was wondering if I reference the assignment, but I opted not to do that
14:41 <* hackage> fltkhs 0.5.1.7 - FLTK bindings https://hackage.haskell.org/package/fltkhs-0.5.1.7 (deech)
14:41 <* ski> was figuring Cale might find it interesting
14:42 nohTo joined
14:43 Kreest joined
14:44 ChristopherBurg joined
14:44 primal_ joined
14:45 rickygee joined
14:45 bennofs joined
14:45 <* ski> remember seeing Hughes on a unicycle
14:46 arpl left
14:46 <shapr> yeah, that was fun
14:46 chrissound joined
14:47 fotonzade joined
14:47 kritzcreek joined
14:47 tlaxkit joined
14:47 <* hackage> graph-rewriting 0.7.10 - Monadic graph rewriting of hypergraphs with ports and multiedges https://hackage.haskell.org/package/graph-rewriting-0.7.10 (JanRochel)
14:48 <Cale> Haha, I wasn't there for that, but I think I recall a photo of it
14:48 Gloomy joined
14:48 <shapr> There were pix, though I dunno what happened to all of them.
14:49 <shapr> Maybe in July I can post pix of Cale on my unicycle.
14:49 cyborg-one joined
14:49 <Cale> hahahaha
14:50 <* hackage> graph-rewriting-gl 0.7.8 - OpenGL interface for interactive port graph rewriting https://hackage.haskell.org/package/graph-rewriting-gl-0.7.8 (JanRochel)
14:50 <maffh> Hello, I am trying to build an application with Stack. However, when I import a library like Data.Map, it results into the following error: hs:5:1: error:
14:50 <maffh> Failed to load interface for ‘Data.Map’
14:50 <maffh> It is a member of the hidden package ‘containers-0.5.7.1’. Use -v to see a list of the files searched for.
14:50 <jordan35353> i tried removing the help function
14:50 <jordan35353> anzahlStueckeMelodien (Entwuerfe b (Knoten a c) n) = sum (map anzahlStueckeMelodien ([Entwuerfe b c n]))
14:50 <maffh> How do you add the Data.Map library to the stack config?
14:51 <tolt_> maffh: you need to add containers to your dependencies in your cabal file
14:51 <jordan35353> now c at the end gives me the error:
14:51 <jordan35353> Couldn't match expected type ‘Baum’ with actual type ‘[Baum]’
14:51 <jordan35353> In the second argument of ‘Entwuerfe’, namely ‘c’
14:51 <jordan35353> why is that?
14:51 <Cale> shapr: What's in July that I should be coming to? I plan to go to ICFP/FSCD this year, but that's September
14:51 <shapr> HacBoston
14:51 <Cale> ahhh, yeah
14:51 <shapr> Is there something like Pandas for Haskell?
14:52 <ongy> jordan35353: because you are doing things wrong :P. think a moment about what '\x -> map f x' is, that may help you
14:52 <ski> i suppose <ScannedInAvian.com> isn't up anymore ?
14:52 <shapr> or more specifically, if I want to create google maps visualizations from cvs data
14:52 <* hackage> graph-rewriting-lambdascope 0.5.10 - Lambdascope, an optimal evaluator of the lambda calculus, as an interactive graph-rewriting system https://hackage.haskell.org/package/graph-rewriting-lambdascope-0.5.10 (JanRochel)
14:52 <shapr> ski: only for email at the moment
14:53 <* ski> was thinking <archive.org> might have something, but it doesn't look like it
14:53 <* hackage> graph-rewriting-layout 0.5.6 - Force-directed node placement intended for incremental graph drawing https://hackage.haskell.org/package/graph-rewriting-layout-0.5.6 (JanRochel)
14:53 cretiq joined
14:54 primal joined
14:54 <Cale> jordan35353: Well, it says you used a list of Baum where it was expected you would put a single Baum...
14:54 <* hackage> graph-rewriting-ski 0.6.7 - Two evalutors of the SKI combinator calculus as interactive graph rewrite systems https://hackage.haskell.org/package/graph-rewriting-ski-0.6.7 (JanRochel)
14:54 <* ski> blinks
14:55 <quchen> What’s the name for the ⊑ operator? »subtype« sounds like OOP, but »(Int -> Int) ⊑ (b -> b) ⊑ a« looks like subtyping as in »is also a (specialized version of)«.
14:55 pie_ joined
14:55 <Cale> jordan35353: What's the type of Entwuerfe?
14:55 <maffh> @tolt, Thx it works!
14:55 <lambdabot> Unknown command, try @list
14:55 <* hackage> graph-rewriting-strategies 0.2.6 - Evaluation strategies for port-graph rewriting systems https://hackage.haskell.org/package/graph-rewriting-strategies-0.2.6 (JanRochel)
14:55 TheFuzzball joined
14:56 <* ski> rewrites Ramsey numbers into Ramsey types
14:56 <lyxia> quchen: subtyping doesn't necessarily connote OOP
14:57 <ski> quchen : i always found that use of it suspicious .. but i suppose you could say something like "more concrete/specific/monomorphic than"
14:57 <Cale> quchen: It'll have different names wherever it gets used (it's used for a bunch of different orderings), but "is a specialisation of" doesn't seem bad for your use case.
14:57 <ski> (it's not subtyping)
14:57 <quchen> lyxia: Sure, but the term is heavily biased towards OOP.
14:58 juanpaucar joined
14:58 <* hackage> graph-rewriting-trs 0.1.9 - Evaluate first-order applicative term rewrite systems interactively using graph reduction https://hackage.haskell.org/package/graph-rewriting-trs-0.1.9 (JanRochel)
14:58 descender joined
14:58 dfeuer joined
14:58 <* ski> . o O ( "On Understanding Types, Data Abstraction, and Polymorphism" by Luca Cardelli,Peter Wegner in 1985-12 at <http://lucacardelli.name/Papers/OnUnderstanding.A4.pdf> )
14:58 raynold joined
14:59 <lyxia> ski: does that link explain why this isn't subtyping
14:59 Elhamer joined
15:00 <ski> i don't recall. it mentions subtyping, though
15:00 <ski> if you want non-traditional subtyping, you could try
15:00 <ski> @where ErikPoll
15:00 <lambdabot> "Subtyping and Inheritance for Inductive Types" in 1997 at <http://www.cs.ru.nl/E.Poll/papers/durham97.pdf>,"Subtyping and Inheritance for Categorical Datatypes" in 1997 at <http://www.cs.ru.nl/E.
15:00 <lambdabot> Poll/papers/kyoto97.pdf>,"A Coalgebraic Semantics of Subtyping" in 2000 at <http://www.cs.ru.nl/E.Poll/papers/cmcs00.pdf>,later version of that in 2001 at <http://www.cs.ru.nl/E.Poll/papers/ita01.
15:00 <lambdabot> pdf>
15:00 <* hackage> graph-rewriting-ww 0.3.7 - Evaluator of the lambda-calculus in an interactive graph rewriting system with explicit sharing https://hackage.haskell.org/package/graph-rewriting-ww-0.3.7 (JanRochel)
15:01 FreeBirdLjj joined
15:01 <lyxia> Isn't "more monomorphic than" an example of subtyping?
15:01 <quchen> Alright, fair enough. I’ll go with the »specialzation of«, it’s fairly descriptive.
15:02 <quchen> Next, why can’t all polymorphically recursive functions be inferred?
15:02 <quchen> What breaks inference for them?
15:03 <quchen> :t let f [] = (); f (_:xs) = f (zip xs xs) in f
15:03 <lambdabot> error:
15:03 <lambdabot> • Occurs check: cannot construct the infinite type: b1 ~ (b1, b1)
15:03 <lambdabot> Expected type: [(b1, b1)] -> ()
15:03 <quchen> :t let f :: [a] -> (); f [] = (); f (_:xs) = f (zip xs xs) in f
15:03 <lambdabot> [a] -> ()
15:03 vlatkoB joined
15:03 <shapr> I'm giving a talk comparing Haskell and Python implementations of a REST API in three weeks, come on down to Atlanta Functional Programming!
15:03 <quchen> Does it have to do with the way recursive let is typechecked?
15:03 Sh4rPEYE joined
15:04 <ski> lyxia : no. that involves type variables. subtyping doesn't
15:05 <ski> (well, one could mix subtyping with parametric polymorphism. but they're still different)
15:05 <kadoban> shapr: Interesting. Will it be streamed or posted anywhere afterwards?
15:05 <lyxia> Maybe I have a too broad definition of subtyping... T is a subtype of U if every value of type T is a value of type U...
15:06 <shapr> kadoban: er, hadn't thought of that
15:06 augur joined
15:06 justin2 joined
15:07 codygman__ joined
15:07 <lyxia> That doesn't exclude any use of type variables
15:08 romank joined
15:08 flatmap13 joined
15:08 <codygman__> It's not clear to me that Data.Time.Format as it is supports parsing a date like: 2014-03-08T16:57:17.507Z
15:09 <ph88> how can i check if an option has been parsed well and also use a default with optparse-applicative? https://bpaste.net/show/545253c97393
15:09 sighingnow joined
15:09 takle joined
15:09 HarveyPwca joined
15:09 <shapr> kadoban: I'm doing haskell/spock and python/flask, and I'll have the code up on github by tomorrow, I hope.
15:10 <ph88> shapr, can you include examples of a few HTTP methods, serving static content, serving json from database, and serving html template + values ?
15:11 <shapr> hm, sure
15:11 <dolio> quchen: Unification isn't designed to handle polymorphic recursion.
15:11 <shapr> ph88: I was going to start with something that just tracks exercise by name/reps/UTCTime
15:11 <shapr> then yesterday I realized I forgot to put in weight :-P
15:11 <shapr> so the next step is to finish this code, and then add weight and compare the ease of change
15:11 <lyxia> ph88: have you tried seeing what actually happens if the option can't be parsed?
15:11 <ski> presumably in the ordering quchen used, we have both ⌜α → α ⊑ β → β⌝ and ⌜β → β ⊑ α → α⌝, so, by anti-symmetry, ⌜α → α⌝ and ⌜β → β⌝ should be equivalent .. however clearly ⌜(α → α) → (α → α)⌝ isn't equivalent to ⌜(α → α) → (β → β)⌝ ..
15:12 sshine left
15:12 <ph88> shapr, ye nice .. i was trying to use spock myself and it wasn't clear how to do the things i just mentioned
15:12 <ski> .. so it appears something weird/unexpected is going on
15:12 <shapr> ph88: I followed the tutorials on the spock.li site
15:12 <ph88> lyxia, oh ye optparse handles that
15:12 <shapr> they include json and db
15:13 hackebeilchen joined
15:13 <ph88> not static
15:13 <shapr> though I didn't lok for html+template
15:13 <shapr> oh, really?
15:13 <lyxia> ski: Maybe that's what quchen actually meant but I think that's assuming too much from what he wrote earlier.
15:13 <quchen> Sorry, was away for 5 minutes. Back now.
15:13 <ski> lyxia, possibly
15:13 <quchen> Yes, that’s too much.
15:14 <quchen> :-)
15:14 <quchen> dolio: How so?
15:14 <ski> quchen : so, which parts were assuming too much ? :)
15:15 <quchen> dolio: Unification finds the most general sub……………somethingtype, i.e. the most general substitution to unify the types. Is the »most general« something not easily defined with polymorphic recursion?
15:15 <nshepperd> ⌜α → α ⊑ β → β⌝ seems only true if implicitly quantified?
15:15 <dolio> You don't get to unify the same variable with multiple different types. But the definition of polymorphic recursion is that you're instantiating a variable with different types in the recursive call than the function was called with.
15:15 <quchen> ski: The part where you had 50% non-ASCII characters in your line ;-)
15:15 jao joined
15:15 <nshepperd> in which case you can't put these both in one type as if they were free variables
15:15 <ski> *which* part(s) of it ? :)
15:15 fryguybob joined
15:16 <quchen> I understood the line, it’s just not what I was trying to find out. I asked the question very handwavy because I only needed a handwavy answer. :-þ
15:16 <ski> nshepperd : .. but then how can one describe it compositionally ? in other words, does congruence fail ?
15:16 <quchen> Handwavily? Something like that.
15:16 <nshepperd> ⌜(forall α. α → α) → (forall α. α → α)⌝ is indeed equivalent to ⌜(forall α. α → α) → (forall α. β → β)⌝ though
15:17 <nshepperd> er, that's (forall β. β → β) of course
15:17 <quchen> dolio: So is it because type variable instantiation comes too early in the unification algorithm then?
15:17 zcourts joined
15:17 FreeBirdLjj joined
15:17 <quchen> dolio: I’m still not seeing what exactly breaks it, or what exactly would make it possible
15:17 <dolio> It's because generalization is a distinct process from the unification used to infer types.
15:18 Noldorin joined
15:19 <dolio> To infer types, you make up variables for all the things you don't know, unify all the way down, and then generalize all the unification variables that are still unbound variables into quantified variables.
15:19 <quchen> Yup.
15:20 <ClaudiusMaximus> saurabhnanda: you can :m + *Module to force interpreted mode in ghci (note the *). but this only works if source is available, so not for installed packages
15:21 <c_wraith> err, I thought that only worked for :load
15:21 <ClaudiusMaximus> c_wraith: works for both i think
15:21 romank joined
15:21 cschneid_ joined
15:22 <quchen> dolio: And now? :-) This seems sensible.
15:22 juanpaucar joined
15:22 <dolio> Now what?
15:22 <quchen> dolio: Do two unequal type variables have the same name and are generalized to the same type?
15:22 <quchen> Where does it break?
15:22 bvad joined
15:23 <ski> lyxia : btw, note that ⌜σ₀ → τ₀⌝ is a subtype of ⌜σ₁ → τ₁⌝ in case ⌜τ₀⌝ is a subtype of ⌜τ₁⌝ and ⌜σ₀⌝ is a *super*type of ⌜σ₁⌝ (contravariance)
15:23 <quchen> At some point, some definition on the left-hand side and the »same, but differently typed« value on the RHS have to be unified, no? And that’s when type inference reports the failure?
15:23 <dolio> When you infer 'foo x = foo ()', foo is given a type `a -> b`, then `a` gets unified with `()` due to the recursive call, so foo has type `() -> b`.
15:23 <ski> lyxia : otoh ⌜σ₀ → τ₀⌝ would presumably be more specialized than ⌜σ₁ → τ₁⌝ in case ⌜τ₀⌝ is more specialized than ⌜τ₁⌝ and ⌜σ₀⌝ is *more* (not less) specialized than of ⌜σ₁⌝ (that's not precise enough, but should serve to point out that contravariance doesn't enter here)
15:23 jerbome joined
15:24 <dolio> Before we get to generalize, we've unified a with () to concretize it.
15:24 <quchen> Aaah.
15:24 spb left
15:24 <dolio> In this case you get a valid type, but it's not the most general possible type.
15:25 <quchen> So if we generalized every time we created a new type variable, we would solve the problem, but then we’d have to instantiate again everywhere, which would cause a whole lot of problems.
15:25 <dolio> In other cases you might do something that falls afoul of the occurs check or something.
15:25 <quchen> Like too-many-∀s.
15:25 dni joined
15:25 MarioBranco joined
15:26 <dolio> You can't generalize immediately when you create a variable.
15:26 uglyfigurine joined
15:26 <quchen> Yes, that won’t work. I was just playing »what if« :-)
15:27 <dolio> I'm not 100% sure, but I think polymorphic recursion is impossible to infer. Like undecidable.
15:27 <ski> is it the case that polymorphic recursion (in the general) can't be inferred, or only that the algorithms we're using can't do it ?
15:27 <quchen> Undecidable? Like »may take forever«?
15:27 <ski> (cf. rank-`n', for `n >= 3')
15:28 <dolio> If you have a particularly nice type system maybe it's possible.
15:28 <dolio> Like with principal typings maybe.
15:28 cory__ joined
15:28 RyanGlScott joined
15:28 saussure joined
15:28 <quchen> What’s the most general type of »foo x = foo ()« if not »() -> t«?
15:28 <dolio> a -> b
15:28 RyanGlScott left
15:29 <quchen> Ah, right.
15:29 <dolio> The problem seems similar to rank-n inference to me, though.
15:30 <nshepperd> if you can do rank-2 inference, you can do some polymorphic recursion, by translating to an application of a rank-2 fix
15:30 <* hackage> BioHMM 1.1.6 - Libary for Hidden Markov Models in HMMER3 format. https://hackage.haskell.org/package/BioHMM-1.1.6 (FlorianEggenhofer)
15:31 <nshepperd> i think
15:31 <ski> (which rank-`2' fix ?)
15:33 <* hackage> StockholmAlignment 1.1.1 - Libary for Stockholm aligmnent format https://hackage.haskell.org/package/StockholmAlignment-1.1.1 (FlorianEggenhofer)
15:33 <dolio> Perhaps it's more like just rank-2, and so is decidable, just in an unintuitive way.
15:34 <nshepperd> let fix f = f (fix f) in fix (\recurse -> do something polymorphic)
15:34 <dolio> Not in the way we usually implement the checking algorithms.
15:34 <nshepperd> oh, maybe fix needs to be rank-3 there
15:34 <dolio> Yeah, I think that might be the case.
15:34 Gurkenglas joined
15:35 <nshepperd> yes, because the lambda is rank-2
15:36 <ph88> does someone know a more elegant way to write this piece of code? https://bpaste.net/show/b636779ae2ba the idea is that these values have a backup (when they are not set) when "device" is set
15:36 TheInfosphere joined
15:36 _jak joined
15:37 <quchen> :t fromMaybe -- ph88
15:37 <lambdabot> a -> Maybe a -> a
15:37 <quchen> > fromMaybe (Just 4) 10
15:37 <lambdabot> error:
15:37 <lambdabot> • Ambiguous type variable ‘a0’ arising from a use of ‘show_M527627100159...
15:37 <lambdabot> prevents the constraint ‘(Show a0)’ from being solved.
15:37 <quchen> > fromMaybe Nothing 10 :: Int
15:37 <lambdabot> error:
15:37 <lambdabot> • Couldn't match expected type ‘Int’ with actual type ‘Maybe a0’
15:37 <lambdabot> • In the expression: fromMaybe Nothing 10 :: Int
15:37 <quchen> Oo
15:38 <ski> nshepperd : i meant the type of it
15:38 tlaxkit joined
15:38 <quchen> Ah, flipped the arguments. Anyway, that’s the »Just-or-default« function, ph88.
15:38 cloudhead joined
15:39 aarvar joined
15:39 <ph88> oh ok
15:40 <nshepperd> ski: i guess the type is whatever matches the thing you want to apply it to
15:40 <nshepperd> which isn't ery helpful, heh
15:40 great joined
15:40 <ph88> quchen, like this? https://bpaste.net/show/a97548d3f4ff the code is still 4 lines ;/
15:41 codygman__ joined
15:42 ianandrich joined
15:43 Wuzzy joined
15:43 oisdk joined
15:43 <lyxia> ph88: just pattern match on device straight away
15:43 chlong joined
15:44 <ph88> on both st and device ?
15:44 <nshepperd> i guess for 'fix' to have an actual most-general type for this situation, you would have to go impredicative
15:45 silver joined
15:45 steve833 joined
15:45 <ph88> i also try this https://bpaste.net/show/9162468d5f0c not sure why that type error
15:45 <lyxia> ph88: http://lpaste.net/355772
15:46 Catalectic joined
15:46 <ph88> oh you use tuples, smart :P
15:46 <lyxia> ph88: fromMaybe st (changeSt <$> device)
15:47 <ph88> lyxia, it should check st first .. if st is Just 2 it should use that
15:48 <ph88> on your lpaste you prioritize device first
15:48 zcourts joined
15:48 <lyxia> Oh sorry
15:48 <lyxia> I was confused by your second paste
15:48 <lyxia> didn't notice st was a Maybe
15:48 <codygman__> Using wreq can i ignore all ssl errors (i really need to)? Failing wreq, can i do so with http-client-tls?
15:48 <dolio> ski, quchen: So, from what I can find, Milner-Mycroft inference is equivalent to semi-unification. And since there are papers titled 'a decidable instance of semi-unification', presumably the full problem is undecidable.
15:48 <ph88> let st' = fromMaybe (changeSt <$> device) st here st is tried first i think
15:50 Elhamer_ joined
15:50 justin2 joined
15:50 <ski> nshepperd : hm. which would that be, then ?
15:50 sellout- joined
15:50 eklavya joined
15:51 <lyxia> ph88: if you have two Maybes, fromMaybe won't be very useful
15:51 <ph88> if both device and st are Nothing i would like to get Nothing
15:51 <ph88> if both are Just then st has priority over device
15:51 dbmikus joined
15:51 <ph88> if one is Just then take that one
15:52 jmelesky joined
15:53 trism joined
15:53 urodna joined
15:53 seriedivergente joined
15:53 <lyxia> ph88: http://lpaste.net/355773
15:54 systadmin joined
15:54 <lyxia> it would be simpler if tcol/vcol/st are either all Just or all Nothing at the same time
15:54 Elhamer joined
15:55 tommd joined
15:56 rickygee joined
15:56 chrisdotcode joined
15:56 <lyxia> ph88: you described <|>. You would use fromMaybe if there were always a device available.
15:57 sellout- joined
15:57 <ph88> ye i wasn't using fromMaybe initially , just an idea to try
15:57 facu_ joined
15:57 <facu_> Hi!
15:57 <facu_> : (
15:57 <facu_> : )
15:57 <ski> hello facu_
15:58 nickolay joined
15:59 seriedivergente left
15:59 <nshepperd_> ski: well, I guess with impredicative it would be the plain old (a -> a) -> a
15:59 oisdk joined
15:59 juanpaucar joined
16:00 <nshepperd_> With the rank 2 function unified with a
16:00 sepp2k joined
16:00 <ski> then `a -> a' will be rank-3, which can't be inferred
16:01 gestone joined
16:01 phyrex1an joined
16:02 <nshepperd_> However, maybe we can do this with only rank 2 types by writing let f = (\recurse -> do stuff); y = f y in y
16:02 spike` joined
16:02 <nshepperd_> I don't think there's anything rank 3 or impredicative that happens in that one?
16:02 <spike`> /?
16:03 <nshepperd_> Or maybe I'm just kicking the can down the road in the inference of y
16:03 <ski> if `y' is rank-`2', wouldn't `f' then need to be rank-`3' ?
16:03 <* ski> looks at spike`
16:04 afarmer joined
16:04 <nshepperd_> No, y is rank 1.
16:04 primal_ joined
16:04 <ski> perhaps this specific use could still be inferred, though
16:05 <nshepperd_> Y is the original polymorphically recursive function
16:05 <ski> hm, i thought `y' would have the type that you unified with `a' before
16:05 nick2000 left
16:05 spike` joined
16:05 <ski> hello again, spike`
16:06 spike` left
16:07 yqt joined
16:07 <dolio> ski: I do see an algorithm that claims to infer polymorphic recursion and uses principal typings, though.
16:07 Sonolin joined
16:07 <ski> mhm
16:07 toby1851 joined
16:08 <dolio> Which HM and MM don't have, to the best of my knowledge.
16:09 spike` joined
16:10 kmels joined
16:11 Elhamer joined
16:11 <shapr> dolio: I know HM and DM, what's MM?
16:11 <dolio> Milner-Mycroft.
16:12 <shapr> ah, thanks
16:13 FreemanXiong joined
16:13 ziocroc joined
16:14 <tobiasBora> What is the good way to produce mutable vectors from Data.Vector using an input list?
16:14 <tobiasBora> I saw "thaw", but not sure it's the best thing to use
16:14 <codygman__> Answering my question about disabling https validation using http-client: newManager $ mkManagerSettings (def { settingDisableCertificateValidation = True }) Nothing >>= \manager -> withResponse "https://insecure" manager $ \res -> print $ responseStatus res
16:14 mada joined
16:15 <codygman__> ^^^ took forever on mobile
16:15 <lyxia> tobiasBora: unsafeThaw if you care about performance
16:15 <DataComputist> After writing some Haskell code to https://code.world/haskell and clicking 'run', the side window has been showing 'running ...' for more than 10 minutes. It's probably not working. Anyone know why? I'm using macOS and Chrome.
16:15 <tobiasBora> lyxia: thank you
16:15 ragepandemic joined
16:16 <kadoban> DataComputist: Most obvious reasons would be a problem with the website or a problem with your code. Does that site usually work? Never heard of it.
16:16 govg joined
16:17 conal joined
16:18 <lyxia> DataComputist: I also get stuck with "Running..." under firefox
16:18 jutaro joined
16:20 Swizec joined
16:20 Velpoman joined
16:21 <lyxia> DataComputist: Now it seems to actually run, with "Running..." not being updated.
16:21 krazedkat joined
16:21 <lyxia> DataComputist: this one draws a square https://code.world/haskell#PLK0sf9TIOeU0o9TUnrgMMw
16:22 afarmer_ joined
16:23 <EvanR> lyxia: whoa
16:25 <EvanR> DataComputist: that site looks pretty awesome... if it works
16:25 <EvanR> i see the square
16:25 <EvanR> osx chrome
16:26 <DataComputist> Why this doesn't work: https://code.world/haskell#Pv-e2lr-WUT5nc0q4c-1gAw
16:26 <lyxia> EvanR: It is! Check out the recent talk https://www.youtube.com/watch?v=7CGuI9HcfqQ
16:26 <lyxia> DataComputist: it works, it drew a blank picture
16:26 <DataComputist> OK
16:27 <DataComputist> 'running ... ' is confusing
16:27 <EvanR> success, nothing
16:27 <DataComputist> as if it never finished
16:27 {emptyset} joined
16:27 <EvanR> the unix philosophy
16:27 <EvanR> agreed running ... is superfluous ;)
16:27 <lyxia> DataComputist: Yeah it should be fixed.
16:27 refold joined
16:28 rcat_ joined
16:28 oisdk joined
16:28 <Cale> DataComputist: Try replacing blank with something like circle 5
16:29 conal joined
16:29 <EvanR> from the forum... https://code.world/#PSDuykS2GTlVtMYVgZDswfA
16:29 <EvanR> looks like haskell is the only language
16:29 thc202 joined
16:31 <steve833> http://lpaste.net/35577
16:31 psychicist__ joined
16:31 <steve833> im trying to convert a tree to a binary tree (if possible)
16:31 pera_ joined
16:31 <EvanR> i wonder how you infer types here...
16:32 SpinTensor joined
16:32 <Cale> steve833: http://lpaste.net/355774 ?
16:32 <lyxia> steve833: you mean http://lpaste.net/355774 ?
16:33 <steve833> ?? :D
16:33 <lambdabot> :D
16:33 <steve833> wat
16:33 <steve833> why is the bot laughing about me
16:33 <steve833> yes i mean http://lpaste.net/355774
16:33 psychicist__ joined
16:33 <duckqlz> :D
16:34 <Cale> steve833: Note that [b] is always a 1-element list
16:34 primal joined
16:35 <steve833> thats bad news
16:35 <Cale> It can't have 0 or 2 elements, because it clearly has exactly 1, namely b.
16:35 SpinTensor joined
16:35 osa1 joined
16:35 osa1 joined
16:36 dni joined
16:36 <Cale> > length [6]
16:36 <lambdabot> 1
16:36 <Cale> You also probably want to pattern match rather than using the length function at all
16:37 <Cale> i.e. have a case for (NKnotten a []) separate from the case for (NKnotten a [b]) and (NKnotten a [b1,b2])
16:37 <Cale> Er, Knoten
16:37 <Cale> :)
16:38 <mauke> obviously, node = knot
16:38 <steve833> ntreebtree (NKnoten a []) = BBlatt a
16:38 <steve833> this works i thikn
16:38 <Cale> yes
16:38 <steve833> but the problem is here
16:38 <steve833> ntreebtree (NKnoten a [b]) = BKnoten (ntreebtree b) a (ntreebtree b)
16:38 <steve833> i cant know how deep i will have to go into b
16:38 <Cale> steve833: You want the subtrees to be the same in that case?
16:38 <steve833> maybe i need to use map again?
16:39 tzh joined
16:39 <steve833> no but i think my definition of a binary tree needs exactly 2 subtrees to work
16:39 <steve833> because if there is only one it says that an argument is missing
16:39 <Cale> Well, yes.
16:40 pylbrecht joined
16:40 <steve833> well yes i need to use map again?
16:40 <Cale> It's somewhat unusual to have both the branches and the leaves labelled
16:40 juanpaucar joined
16:40 <Cale> I mean yes your definition needs exactly 2 subtrees.
16:40 <steve833> thats ok then
16:40 <Cale> If it allowed for empty leaves, you could make one of the subtrees empty
16:41 <Cale> But as it is, that definition of binary tree doesn't allow for a tree having only 2 elements in it. You can only have 1 or at least 3.
16:42 <steve833> i can live with that
16:42 <mauke> this is exercise 1.d, right?
16:44 primal_ joined
16:45 zero_byte joined
16:46 <steve833> yes mauke
16:47 MohdSKhoeini[m] joined
16:47 jimmyrcom_ joined
16:47 <steve833> http://lpaste.net/355775
16:48 <steve833> this works better, but it still crashes when there are multiple Blatt in the list
16:48 famusmockingbird left
16:48 <mauke> that's still too complicated. you can delete line 12
16:49 <mauke> er, and line 13 isn't quite right
16:49 <steve833> yes theres the problem
16:49 <steve833> someone told me tho to make a pattern for the emptyl ist
16:49 <mauke> it should be ntreebtree (NKnoten a [b1, b2]) = BKnoten (ntreebtree b1) a (ntreebtree b2)
16:50 alexbiehl joined
16:50 <steve833> Non-exhaustive patterns in function ntreebtree mauke
16:50 <mauke> cool
16:50 <mauke> that means it's working
16:50 <steve833> which pattern are we missing?
16:51 TheFuzzball joined
16:51 oisdk joined
16:51 drewbert joined
16:51 bennofs joined
16:51 <mauke> if you followed my suggestions, you have cases for NBlatt _ and NKnoten _ [_, _]
16:52 <mauke> so what's missing is NKnoten _ [], NKnoten _ [_], and NKnoten _ (_ : _ : _ : _)
16:52 <mauke> but those can be covered by adding: nbtreebtree _ = error "entsprechende Fehlermeldung"
16:53 <steve833> you can speak german?
16:54 <mauke> yes :-)
16:54 saussure joined
16:55 aconz2 joined
16:55 <steve833> http://lpaste.net/355776
16:55 <steve833> Multiple declarations of ‘ntreebtree’
16:55 <steve833> urgh
16:56 saussure joined
16:57 buttbutter joined
16:58 <ongy> steve833: that's because of your typo
16:58 joaj joined
16:59 <steve833> typo is fixed now, problem persists : /
16:59 balor joined
17:00 <ongy> the typo with nbtreebtree?
17:01 <steve833> it works now
17:01 <steve833> i changed it to this:
17:01 SpinTensor joined
17:01 <steve833> http://lpaste.net/355778
17:02 meoblast001 joined
17:02 JakePeralta joined
17:03 JakePeralta joined
17:04 juanpaucar joined
17:05 <ongy> steve833: Line 13 looks a bit weird to me, but that could be fro myour assignment
17:05 tromp joined
17:05 <steve833> thanks for everybody that helped me ^
17:06 <bartavelle> steve833: you still should have a warning
17:06 connrs joined
17:06 <steve833> why?
17:06 <bartavelle> steve833: just barging in, but I believe line 15 pattern should be (_ : _ : _ : _)
17:07 <bartavelle> which is very much different from [_,_,_]
17:07 <* hackage> threepenny-editors 0.2.0.9 - Composable algebraic editors https://hackage.haskell.org/package/threepenny-editors-0.2.0.9 (PepeIborra)
17:07 Johan_Meh joined
17:07 uglyfigurine joined
17:07 <steve833> youre right i think
17:08 <steve833> because when pattern is longer than 3 its a nonexhaustive pattern
17:08 zcourts joined
17:08 <ongy> I'd go with _ or (b1:b2:_), but it's up to you
17:08 pie_ joined
17:09 <steve833> look at this:
17:09 <bartavelle> that would work too, except elements from longer would be silently discarded (which might be right)
17:09 uglyfigurine joined
17:09 exbio joined
17:09 acowley_ joined
17:09 <ongy> bartavelle: it schould be "all others", b1 and b2 may be interesting for the error message (but I don't really think so)
17:09 <steve833> http://lpaste.net/355778
17:10 Deide joined
17:10 <steve833> what do we need to change to give the error when there is 3 OR MORE elements in a list=
17:10 <steve833> ?
17:10 unK_ joined
17:10 <bartavelle> steve833: what I or ongy suggested, depending on if you want to raise an error or to silently ignore extra elements
17:10 oisdk joined
17:11 <steve833> i want to raise an erro
17:11 mohsen_ joined
17:11 alhariel joined
17:11 <ongy> steve833: you could either go with _ and just catch "everything else" or if you want to do a pattern, you will have to use (b1:b2:...)
17:11 <bartavelle> then the proper pattern would be (_:_:_:_), that matches lists of length 3 or more
17:11 <ongy> steve833: you can change the pattern in line 14
17:11 <yoneda> exit
17:12 <steve833> do i substitude the list for (_:_:_:_) or everything including a ?
17:12 <ongy> steve833: think about it :P
17:12 <steve833> nvm
17:12 <steve833> only the list of course
17:12 <ongy> do you understand what you can match with ':' ?
17:12 <steve833> yeah we just check the FIRST 3 elements
17:13 <steve833> the rest wont matter then
17:13 Achylles joined
17:13 <ongy> steve833: I meant in a more general way. When I have a pattern let (x:xs) = [1, 2, 3, 4, 5] what will x and xs be?
17:14 <steve833> x is 1
17:14 <steve833> xs is the rest
17:14 <ongy> ok, good :)
17:14 <steve833> i start to understand haskell i thikn
17:14 <steve833> thx for your help so far ^^
17:14 rkazak joined
17:14 baldrick1 joined
17:14 bodisiw joined
17:15 Swizec joined
17:15 <ongy> so: are you actually here? I wonder what kind of person likes highlights enough to use such a common word as nick
17:16 <bartavelle> yeah, and it looks really strange to have all the 'so' words colored in red
17:16 <bartavelle> (with my client)
17:17 Luke joined
17:18 pie__ joined
17:19 exferenceBot joined
17:19 raichoo joined
17:21 yellowj joined
17:22 ErinvanderVeen joined
17:23 oisdk joined
17:24 primal joined
17:24 emile joined
17:25 nahra joined
17:26 <tobiasBora> Hum...
17:27 gestone joined
17:28 <tobiasBora> It's funny, my code using vector + sorting in place instead of lists + sorting via nubOrd is slower (not that much) and uses 3x the memory of the version with lists !
17:29 ph88^ joined
17:29 <Tuplanolla> Is it not an unboxed vector, tobiasBora?
17:29 <tobiasBora> Tuplanolla: No. I tried to make a unboxed vector of it, but it was quite heavy...
17:30 jgertm joined
17:30 <tobiasBora> like I needed to unbox also a vector
17:31 erisco joined
17:32 k0ral joined
17:32 Flechette joined
17:33 <tobiasBora> Wahou
17:33 mstruebing joined
17:33 <tobiasBora> it really depends on the sorting algorithm I use
17:33 joedevivo joined
17:33 <tobiasBora> the Intro sorting is still worse: 140M instead of 8M
17:33 marmalodak joined
17:34 meandi joined
17:34 DrMentats left
17:34 <steve833> https://en.wikipedia.org/wiki/Bogosort
17:34 <steve833> use this sort
17:34 filterfish joined
17:35 <tobiasBora> steve833: it's not here: https://hackage.haskell.org/package/vector-algorithms-0.7.0.1
17:35 armlesshobo joined
17:35 <tobiasBora> how
17:35 <tobiasBora> what a good sort
17:35 Scip joined
17:35 <cocreature> tobiasBora: how’s the performance using tim sort?
17:35 Bassetts joined
17:36 <pie__> you guys know any tools for writing troubleshooting tools or something like that?
17:37 <tobiasBora> cocreature: around the same values than merge sort
17:37 <tobiasBora> But maybe I got why it's slower
17:37 <ph88^> is there a function for a conduit that does nothing ?
17:37 eL_Bart0 joined
17:37 <tobiasBora> What I really want is counting the number of differents elements in a list
17:37 fugyk joined
17:38 <tobiasBora> so I'm using for the list "Extra.nubOrd l"
17:38 swhalen joined
17:38 neoo joined
17:38 <tobiasBora> and for the vector version, I first sort, then use the sort, and then the uniq function
17:38 noxd joined
17:39 <tobiasBora> some of you see a more elegant solution?
17:39 <cocreature> hyperlolog? :)
17:39 Xandaros joined
17:39 dschoepe joined
17:40 snowalpaca joined
17:41 <tobiasBora> cocreature: I'm sorry, I don't want approximation ;)
17:41 jgertm joined
17:41 sedeki joined
17:41 neoo joined
17:41 Gloomy joined
17:41 <cocreature> tobiasBora: who cares about correctness if it’s fast!
17:41 drewbert joined
17:41 <tobiasBora> cocreature: mathematicians
17:41 <tobiasBora> but I don't know why
17:41 <cocreature> show us the code :)
17:42 neoo joined
17:44 <tobiasBora> cocreature: It's not really organised not well written, but here is the idea: http://paste.debian.net/936187
17:44 <tobiasBora> forget about all the stuff commented
17:44 primal_ joined
17:44 <tobiasBora> basiquely, I've a set of angle
17:44 ragepandemic joined
17:44 neoo joined
17:45 <tobiasBora> I can convert one angle into a matrix J(angle)
17:46 <tobiasBora> then for a given list of angles, I compute J(angle1) J(angle2) ... J(anglen)
17:46 <tobiasBora> and I want to see the number of these matrix I can obtain
17:46 <tobiasBora> matrices*
17:46 Itkovian joined
17:47 neoo joined
17:48 mjora7 joined
17:48 <lyxia> ph88^: return ()
17:48 replay joined
17:48 neoo joined
17:49 uglyfigurine joined
17:50 juanpaucar joined
17:50 neoo joined
17:52 Johan_Meh joined
17:52 snowalpaca joined
17:56 afarmer joined
17:56 ContessaTP joined
17:57 rickygee joined
17:58 jhenligne joined
17:58 ErinvanderVeen joined
17:58 drewbert joined
17:59 systadmin joined
18:00 mr_sm1th joined
18:03 latro`a joined
18:07 fakenerd joined
18:08 <actualHuman_462> pie__ : You mean like, Haskell programs as shell scripts?
18:09 <shapr> pie__: yeah, what kind of troubleshooting tools?
18:10 <pie__> so apparently i want to make decision trees
18:10 <actualHuman_462> Ooh, like the classic 'Menu' program
18:11 <Tuplanolla> Do you mean stuff like that Windows XP help system with hundreds of unhelpful stock responses, pie__?
18:11 <pie__> Tuplanolla, probably, except not actually shit
18:11 <actualHuman_462> Error 0x53 - "Error: Program execution failure"
18:12 Itkovian joined
18:12 <actualHuman_462> How much 'pretty' do you want? Does this need a GUI, or are we thinking like an interactive CLI thing?
18:13 bollu joined
18:13 chaosmasttter joined
18:13 <pie__> i dont actually know but for starters ill take what i can get
18:13 chrissound joined
18:13 <pie__> i was hoping maybe something that can render to an interactive html page
18:14 Sh4rPEYE joined
18:14 <Tuplanolla> Who's going to be the victim?
18:14 <pie__> lazy sysadmins
18:14 <pie__> <----
18:14 <pie__> "sysadmins"
18:14 <Tuplanolla> Hey, that's me.
18:14 <pie__> home users trying to use nixos
18:15 <pie__> ok just me trying to use nixos
18:15 <pie__> without actually learning it...because I Have Things To Do(tm)
18:15 <actualHuman_462> Well, I'm not aware of any frameworks specifically for that purpose, but case (getLine) of "1" -> doThingOne works pretty damn smoothly
18:16 <pie__> actualHuman_462, i suppose the "runtime" has no reason to be complicated
18:16 <pie__> more like an authoring tool might be nice
18:16 <actualHuman_462> Ahhhhh
18:16 <pie__> because its zomg _DATA DRIVEN_ (r)(tm)(c)
18:17 geekosaur joined
18:17 <actualHuman_462> The idea, I assume, is to be static collections of markup for documentation that the user navigates using 'choose your own adventure' style input
18:17 rickygee joined
18:17 <actualHuman_462> As opposed to something that goes out and interrogates the world to guide a user to a choice
18:17 <actualHuman_462> ?
18:18 beanbagula joined
18:18 davr0s joined
18:18 <pie__> what do you mean by the latter?
18:18 <pie__> i didnt actually thing of integrating this inside documentation, that might even be a good idea :PP
18:19 <pie__> but yeah choose your own adventure is esentially what i was thinking
18:19 <pie__> basically, tech support flowchart but interactive
18:19 saurabhnanda joined
18:19 <EvanR> who knows how StaticPtr works... you run two of the same GHC programs , same computer or not, and you can send StaticPtrs between them to refer to values in either?
18:20 maffh joined
18:20 conal joined
18:21 fendor joined
18:21 <actualHuman_462> Simplest possible solution I can think of:
18:21 <Tuplanolla> I'm reminded of Inform 7, pie__.
18:22 <pie__> you know
18:22 <pie__> inb4 i should just use textadventure software >.>
18:22 <pie__> oh wow thats what you just sai
18:22 <pie__> *said. lmao
18:22 jud^ joined
18:23 gawen joined
18:24 primal joined
18:24 <pie__> honestly though there has to be a proper tool for this...
18:24 peterbecich joined
18:24 <Tuplanolla> I'm perpetually surprised by how rarely that is true.
18:25 <pie__> Tuplanolla, :C
18:25 <pie__> i also have a harder problem
18:25 <pie__> how do i find common questions in irc logs
18:26 sirreal joined
18:26 <Tuplanolla> You want neural networks even if you don't know it yet.
18:26 <pie__> obviously.
18:27 <Tuplanolla> I'll go be obvious somewhere else.
18:27 <pie__> :C
18:27 <pie__> noooo we like you here
18:27 <pie__> anyway, im just saying that because like ENTERPRISE and DECISION TREES
18:27 <pie__> that just means anything that doesnt suck costs 10k$ a seat
18:28 oisdk joined
18:28 dddddd joined
18:29 pie__ joined
18:30 <EvanR> pie__: mechanical turk
18:30 angryShiva joined
18:30 <geekosaur> they suck too, they just suck differently
18:31 <angryShiva> \nick angryMonk
18:31 angryMonk left
18:31 <actualHuman_462> https://gist.github.com/IronGremlin/237a2a7faa2dfb23a1b73cba32a1f166
18:31 <monochrom> Angry Monk was angry with you :)
18:34 primal_ joined
18:34 mikecaruso joined
18:35 juanpaucar joined
18:36 <actualHuman_462> The idea there is basically just make the minimum possible amount of author effort - Literally anyone could write steps for the thing. You could migrate it to something more complex later with minimal effort because the tree would be insanely easy to scrape programatically.
18:36 drewbert joined
18:37 <* monochrom> picks his nose.
18:37 mikecaruso joined
18:38 preyalone joined
18:38 buglebudabey joined
18:38 gestone joined
18:38 rickygee joined
18:38 falafel joined
18:39 mikecaruso joined
18:39 <* erisco> generalises to a cavity phlegm extractor
18:41 dni joined
18:42 saussure joined
18:42 <mnoonan> "you see, a monad is like a nose, and (>>=) is like a finger.."
18:43 <actualHuman_462> Does that make 'guard' a tissue?
18:43 saussure joined
18:43 marr joined
18:44 primal joined
18:46 acertain joined
18:48 beanbagula joined
18:48 juanpaucar joined
18:49 codebam joined
18:49 juanpaucar joined
18:49 ChaiTRex joined
18:53 <pie__> \it has been pointed out to me that these are usually called expert systems. facepalms were had
18:53 Gloomy joined
18:53 <DataComputist> What's wrong with https://code.world/haskell#PlaW4aJDPTJhZiub1_ZsUEg ?
18:54 <mniip> DataComputist, you forgot |
18:54 <mniip> in guards
18:54 primal_ joined
18:54 <mniip> also you probably want `mod`
18:55 <EvanR> "parse error in" ... whaever happened to "unexpected foo, expecting bar1, bar2, bar3, or bar4..."
18:55 eacameron joined
18:55 <erisco> those errors are dubious
18:55 <monochrom> It happened when GHC switched from parsec to happy. :)
18:56 <pikajude> what an ironically named parser
18:56 <EvanR> DataComputist: haha i fixed your code and now i see a blinking traffic light!
18:57 <monochrom> That's neat.
18:58 <mniip> hmm
18:58 <mniip> is that ghcjs
18:58 <erisco> because it is left-to-right parsing those errors assume that the left is correct and the right is incorrect
18:58 <erisco> and they usually assume left is maximally correct
18:59 rickygee joined
18:59 <erisco> so it works in some cases, maybe most cases depending on the language and likely human errors, but can be entirely unhelpful in others
19:00 <erisco> because the inferred intent is wrong
19:00 <EvanR> parsing is not necessarily left to right
19:00 <EvanR> thats just how the text is displayed
19:00 <EvanR> its from beginning to end
19:00 <erisco> there is no difference in the parlance
19:01 <erisco> front to back, beginning to end, left to right, these are all the same thing
19:01 beanbagula joined
19:01 <erisco> but top to bottom and bottom to top describe something else, heh :P
19:02 Bare joined
19:02 <DataComputist> Are the compiling errors left OK? https://code.world/haskell#P1y7LjiIxUjZWtkRM9Kbi3Q
19:03 caumeslasal joined
19:03 Itkovian joined
19:03 JohanL joined
19:03 <lyxia> these are OK warnings
19:03 coot____ joined
19:03 <lyxia> very nice traffic light
19:04 primal joined
19:04 theelous3 joined
19:05 Luke joined
19:07 tommd joined
19:08 esph joined
19:08 jleon joined
19:09 fakenerd joined
19:09 yamad joined
19:11 bollu joined
19:11 jleon joined
19:12 <greymalkin> Are there many packages like this on hackage: https://hackage.haskell.org/package/elo ? No code.
19:12 drewbert joined
19:13 <EvanR> probably
19:14 <kuribas> that's rather pointless
19:14 <monochrom> That's bizarre.
19:14 oisdk joined
19:14 <buglebudabey> i am using gloss in my stack project but it can't seem to find one particular function. what could be the reason?
19:15 <geekosaur> you're using the haddock from a different version than your project is using?
19:16 jleon joined
19:17 <geekosaur> ...not helping is that the language itself lets the type signature be somewhere other than the definition, but ghci can't do that at all
19:17 joco42 joined
19:19 rickygee joined
19:19 joco42 joined
19:20 merijn joined
19:20 skeuomorf joined
19:20 fnurglewitz joined
19:20 <merijn> ghc-prim is wired into GHC, no? i.e. I can get away without specifying version ranges on it
19:21 jleon joined
19:21 Luke joined
19:22 chaosmasttter joined
19:22 <monochrom> That depends on whether what you use is present in all versions.
19:22 t7 joined
19:23 mjora7 joined
19:23 <monochrom> It is between a rock and a hard place.
19:23 <geekosaur> whoops, I see I managed somehow to put that last message here instead of -beginners
19:24 <geekosaur> also the package itself is not in all versions (although I guess you can hope you don't need to care about versions that don't have it)
19:25 jleon joined
19:25 pandeiro joined
19:26 <monochrom> If you don't put a bound, #haskell will get a question from a user "merijn's package fails to build" and it will take us forever to find out there is a version incompatibility issue.
19:26 <monochrom> If you do put a bound, #haskell will get a question from a user "how do I install a different version of ghc-prim" and it will take us forever to find out they're trying to build your package with a version incompatibility issue.
19:27 <monochrom> By the law of excluded middle, PEBKAC. :)
19:27 cpup- joined
19:28 jeffreybaks joined
19:28 eschnett joined
19:29 <merijn> monochrom: I was asking specifically about ghc-prim, if it's wired into GHC that should already be covered by the bound on base
19:29 saussure joined
19:29 caumeslasal1 joined
19:29 <monochrom> Ah you have a bound on base?
19:29 <merijn> Anyway, it's not my package and I noticed the library already had a way around the issue I saw
19:30 <merijn> Of course it got merged while breaking everything... :p
19:30 connrs joined
19:31 <merijn> ghc-prim is actually only for GHC7.4 anyway, 7.6 and later already reexport GHC.Generics
19:31 cpup joined
19:32 <merijn> Also, does everyone else also just rely on "push to github and wait for Travis" as a method for seeing if your commits work with old versions
19:32 <geekosaur> some people use hvr's repo
19:33 <hexagoxel> ghc-prim is a boot-lib, but in general it is possible to use a version of a bootlib different from the one included with the compiler one currently uses.
19:34 oisdk joined
19:35 <clamchowder> hello
19:35 <hexagoxel> merijn: i run checks locally, the tool is published as `iridium` on hackage. it requires cabal and the relevant ghc versions to be installed.
19:35 bollu joined
19:35 <clamchowder> I have a question about Parsec
19:36 darjeeli1 joined
19:36 <merijn> hexagoxel: I run some checks locally, but not for all ghc's atm
19:37 <clamchowder> is there an "and" analog to the operator <|>?
19:37 <merijn> clamchowder: eh, >> :)
19:37 <monochrom> FSVO analog
19:37 <clamchowder> merijn: I tried that but it didn't work...
19:37 <clamchowder> merijn: let me be more specific
19:37 <monochrom> Difference being "same input" vs "the rest of the input"
19:37 <merijn> clamchowder: You're going to have to have some more specific example code/problems :)
19:37 bennofs joined
19:38 <Cale> clamchowder: You mean that you want to check both parsers match the same portion of the input?
19:38 toby1851 joined
19:38 <clamchowder> Cale: no I want to apply parser1 to consume some string, then parser2 to consume the rest
19:38 CoderPuppy joined
19:38 lifter joined
19:39 <monochrom> Then it's >>
19:39 <merijn> clamchowder: That's what >> does, unless I misunderstand what you want :)
19:39 <hexagoxel> so, typewise, Parser a -> Parser b -> Parser ?
19:39 <monochrom> b'
19:39 <monochrom> err, b
19:39 <monochrom> If you want (a,b) there's liftA2(,)
19:39 jleon joined
19:40 rickygee joined
19:40 saussure joined
19:40 <clamchowder> merijn: let me find an example...
19:40 <* hexagoxel> meant that question for clamchowder, to make sure.
19:41 <monochrom> Oh! Misread. Yeah.
19:41 bendo joined
19:41 <clamchowder> hexagoxel: yes
19:42 cpup joined
19:42 <hexagoxel> (there also is (*>) and (<*) that can make sense in the context of parsing)
19:43 <alanz> I hate RecordWildCArds
19:43 <monochrom> Why?
19:43 <merijn> I love RecordWildCards
19:43 <alanz> They hide information. You see random names and don't know where they come from
19:44 <alanz> until you notice the telltale {..} and have to chase decls
19:44 <hexagoxel> clamchowder: if you only want the value from the second parser, or don't care about their values at all, then (>>) or (*>) is appropriate.
19:44 <monochrom> Are you OK with FieldNamePuns?
19:44 <clamchowder> OK say I want to parse a string ended with a space or a tab followed by a -
19:44 <alanz> yes, they at least bring the name into (human) scope
19:44 <clamchowder> and I want to use manyTill
19:45 <* alanz> rant over, move along
19:45 <merijn> clamchowder: Can you lpaste what you've got right now? And what it fails to parse
19:45 liyang joined
19:45 flatmap13 joined
19:45 <clamchowder> I want to use manyTill to use parser p1 until there's a space or a tab followed by a '-'
19:45 <mjora7> Can someone help me with a question? I'm using this "hello world" app for Scotty: https://hackage.haskell.org/package/scotty and I wanted to know how to add another route, so I looked in the documentation https://hackage.haskell.org/package/scotty-0.11.0/docs/Web-Scotty.html but I cannot figure out how to do it. So I just added another "get" underneath the current one and it worked. My question is... How was I supposed to know that's
19:45 <mjora7> how you do it? When I look at the signature of the scotty function, nowhere is it apparent that it can take multiple arguments. What am I missing?
19:46 <clamchowder> say the parser for space / tab is p2
19:46 <clamchowder> and the one for '-' is p3
19:46 <clamchowder> I do: manyTill p1 (p2 >> p3)
19:46 oisdk joined
19:46 jud joined
19:46 <shapr> jud: howdy
19:47 <jud> shapr, 'lo
19:47 <shapr> mjora7: I thought scotty was no longer active? I've been using Spock
19:47 <clamchowder> If I test it with "2 3 -", I get error saying "unexpected 3 expecting "-""
19:47 Itkovian joined
19:47 <mjora7> shapr: I had no idea about that, which leads me to another question... How am I supposed to know what libraries to use and what to avoid? I picked scotty cause it looked simple.
19:48 <clamchowder> merijn: does that make sense?
19:48 <shapr> mjora7: I don't have a good answer other than asking here :-/
19:48 <merijn> clamchowder: Well, not without code :)
19:48 <shapr> mjora7: I agree, scotty is simple, and spock is almost as simple. Also, docs on spock.li are easy to read and have worked fine for me.
19:48 <mjora7> shapr: Do you have any idea about my original question though? I'm super confused about how to properly read Haskell documentation.
19:48 <mjora7> shapr: And thanks for the suggestion.
19:49 <clamchowder> you can think of p1 as matching anything...
19:49 zachk joined
19:49 <merijn> mjora7: As for how you should know
19:49 barcabuona joined
19:49 <shapr> mjora7: I don't think you're expected to know that kind of thing. Are the tutorials on spock.li easier to read?
19:50 oisdk joined
19:50 <shapr> I usually look for a tutorial with some example code, and follow that.
19:50 <merijn> mjora7: The name as well as the actual documentation of ScottyM tell us that scotty is a monad instance, so that tells us that we can use >> (i.e. new line in do notation) to combine multiple "ScottyM ()" values together
19:50 dni joined
19:50 liyang_ joined
19:50 <merijn> mjora7: Now, what that combination *means* is something that has to be documented somewhere, but for e.g. route configuration you can usually guess it's combining them somehow
19:51 <mjora7> merijn: Ok that went above my head, I think the answer is that I need to study more Haskell... Monads specifically. I'm about half way through my textbook and thought it was enough to start using some libraries to make stuff like with other languages, but I guess Haskell is a different beast as the code is still extremely confusing to me.
19:51 <merijn> mjora7: It's not very obvious from the docs, though.
19:51 <clamchowder> It seems like the problem is the program consumed the 2, and the space following the 2 triggered the (p2 >> p3) part in manyTill, and then look for the -, but encountered 3.
19:52 tromp joined
19:52 <merijn> mjora7: Monad is mostly just a convenient/common interface for "things that can be combined"
19:52 <lyxia> Maybe look for tutorials, this one lines up a get and a put or two https://ocharles.org.uk/blog/posts/2013-12-05-24-days-of-hackage-scotty.html
19:52 <shapr> mjora7: ooh, which textbook?
19:52 <lyxia> uh, a get and a post or two
19:52 <mjora7> shapr: Learn You a Haskell
19:52 <merijn> mjora7: I would say that most of the "production" haskell libraries (especially in the web side of things) tend to be rather complicated and use significant haskell knowledge to actually understand. Additionally, Learn You a Haskell is...not very in-depth in what it covers
19:53 <shapr> mjora7: neat, is this for a class?
19:53 <mjora7> merijn: Yeah I'm starting to realize that.
19:53 tv joined
19:53 <merijn> mjora7: Honestly, I would consider myself rather good at haskell and *I* still find a lot of the web framework's rather intimidating
19:53 saussure joined
19:54 <mjora7> shapr: Nope, just out of personal interest. I'm sick of using imperative languages, I feel like I'm just hitting a brick wall a lot of the times and being forced to write ugly code, which isn't fun.
19:54 <mjora7> merijn: What do you use Haskell for?
19:54 <merijn> mjora7: I've heard good things about the CIS194 haskell course: https://www.seas.upenn.edu/~cis194/fall16/
19:54 <lyxia> clamchowder: manyTill p1 (try (p2 >> p3))
19:55 Levex joined
19:55 <merijn> mjora7: Basically, everything...short throwaway scripts to parsing, task-farming of jobs on cluster, to hobby projects :p
19:55 gestone joined
19:55 <mjora7> merijn: Are you using it professionally though, or just for personal stuff?
19:56 <clamchowder> lyxia: that works! thank you.
19:56 kuribas` joined
19:57 cdg joined
19:58 <merijn> mjora7: I'm writing stuff for my job in it, yes. Although mostly tools/small things, since my main work is CUDA and that's easier from C++.
19:58 <bollu> merijn: do you work on HPC?
19:58 jathan joined
19:59 <Athas> From what I have seen of the Haskell web infrastructure, I would not call it pretty Haskell.
19:59 oisdk joined
19:59 <merijn> mjora7: I would say of all languages I learned, Haskell probably took the longest to be able to productively write code in. But I also think that *once* you start to get productive you can ramp up crazy fast and attempt projects you'd never consider without it
19:59 <merijn> Athas++
19:59 <Athas> But I think I'm decoupled from the community taste-wise. I don't like all the Template Haskell and tons of extensions.
20:00 <merijn> I like Template Haskell and I like a lot of extensions, but I still think a lot of web frameworks are ugly :p
20:00 <Athas> But that's basically all they are!
20:00 <merijn> Athas: Go figure!
20:00 rickygee joined
20:01 <lifter> I read this blog about GHC Generics (https://stackbuilders.com/tutorials/haskell/generics/index.html) but I wasn't able to figure out why or when I'd use them. Can someone explain?
20:01 <mjora7> So what language is even good at web frameworks... I've never seen one that wasn't ugly.
20:01 TheFuzzball joined
20:01 <bollu> I want: (a -> f b) -> (b -> c) -> (a -> f c)
20:02 <Athas> mjora7: Well, the web is inherently ugly. But... Go, maybe? It's a flawed language, but it has good aesthetics.
20:02 <merijn> mjora7: I would say that, where many other language strive to make the first (small/trivial) programs the easiest to write. Haskell strives to make your advanced/big programs easier to write. At the cost of making those initial first programs harder...
20:02 <bollu> @djinn (a -> f b) -> (b -> c) -> (a -> f c)
20:02 <lambdabot> -- f cannot be realized.
20:02 <bollu> wat
20:02 <lyxia> lifter: you can use generics when you want to derive code from a type
20:02 <bollu> @djinn Functor f => (a -> f b) -> (b -> c) -> (a -> f c)
20:02 <lambdabot> Error: Class not found: Functor
20:02 <merijn> bollu: No Functor constraint :)
20:02 <merijn> :t \f g -> fmap g . f
20:02 <lambdabot> Functor f => (a1 -> f a) -> (a -> b) -> a1 -> f b
20:03 <bollu> hmm, I suppose that works
20:03 <bollu> ty
20:03 <EvanR> watch this
20:03 jathan_ joined
20:03 <EvanR> let x = 2 in (+) 0x
20:03 <EvanR> > let x = 2 in (+) 0x
20:03 <lambdabot> 2
20:03 <EvanR> bwahahaa
20:03 <bollu> wtf
20:03 <lifter> lyxia: How might I know when I'd want to do that?
20:04 <bollu> EvanR: how?
20:04 <EvanR> dont ask
20:04 <EvanR> dont tell
20:04 <merijn> zero width space?
20:04 <dolio> No.
20:04 <EvanR> no space
20:04 lgas joined
20:04 <ChaiTRex> > let x = 2 in (+) 5x
20:04 <lambdabot> 7
20:04 <Athas> Oh God.
20:04 Itkovian joined
20:04 aconz2 joined
20:04 <bollu> yeah, what the hell?
20:04 <Athas> Is it because 5x is treated as two lexemes?
20:04 <EvanR> overloaded whitespace before it was cool?
20:04 <bollu> no way
20:04 <shapr> mjora7: I suggest asking questions here in #haskell, you'll learn much.
20:04 <Athas> Jesus.
20:05 <dolio> 0x isn't a valid token, so it parses as two tokens.
20:05 <EvanR> yes 5x is parsed as 5 x
20:05 <bollu> Athas: I refuse to believe that it is the explanation
20:05 <bollu> wtf
20:05 jmelesky joined
20:05 <EvanR> i accidentally mistyped something and was surprised to see it actually work
20:05 <Athas> I _have_ to use this.
20:05 <merijn> quchen: I thought your stgi thing was online somewhere or am I misremembering?
20:05 <bollu> > let x = 2 in (+) x5 # will not work since it parses?
20:05 <lambdabot> <hint>:1:53: error:
20:05 <lambdabot> parse error (possibly incorrect indentation or mismatched brackets)
20:05 <bollu> yeah
20:05 <bollu> what the flying fuck
20:05 <lyxia> lifter: when you have repetitive code that can't be simply factored out as a function
20:05 <bollu> EvanR: ty for coolness
20:06 jgertm joined
20:06 <bollu> > let x = 10 in (*) 5x
20:06 <lambdabot> 50
20:06 <EvanR> who needs space
20:06 <EvanR> APL style haskell
20:06 <Athas> This is the worst thing.
20:06 <bollu> this is amazing
20:06 <Athas> I definitely know what I'll take care to ban in my own language.
20:07 <lyxia> lifter: for example, aeson uses generics to derive conversions to and from JSON. That would be tedious to write by hand otherwise if you have a lot of types.
20:07 <Athas> It's actually trickier to catch this in a lexer than you'd think. Probably it snuck in by mistake.
20:07 <EvanR> would you allow 5+5
20:07 <Athas> I refuse to believe anyone thought this was a good idea.
20:07 <merijn> Athas: I think it was just an accident
20:07 <dolio> It's not a mistake.
20:08 <hexagoxel> meh, that clashes with rust-style non-overloaded literals, like 5int or 1u64. i still want those in haskell.
20:08 <dolio> Unless you think the description of how things are lexed in the Haskell report is accidentally wrong.
20:08 kuribas`` joined
20:08 <bollu> how do I ByteString to String
20:08 <bollu> pretend the world is ASCII with me
20:08 <bollu> please
20:08 <hexagoxel> bollu: haha
20:08 <ChaiTRex> bollu: BS.unpack?
20:08 <bollu> ah, thank you :)
20:08 <EvanR> BSC.unpack
20:09 <merijn> dolio: I meant "no one intentionally wanted this when they wrote the report"
20:09 <shapr> mjora7: how'd you find Haskell the language?
20:09 <merijn> dolio: i.e. it was an accidental interaction of individually sensible rules that wasn't actively strived for
20:10 iAmerikan joined
20:11 akhov joined
20:11 <dolio> 0x isn't even the weirdest case that is implied by the rules, I think.
20:11 <shapr> uh oh
20:11 <EvanR> i meant to type 2x
20:11 <EvanR> but 0x is funny
20:11 <dolio> A long time ago, someone pointed out that e.g. F.where should probably be parsed as F.wher e
20:12 <dolio> Because where is a keyword and not a valid qualified name.
20:12 <dolio> GHC doesn't implement that, though.
20:12 <Tuplanolla> That's funny.
20:12 <merijn> dolio: Wow...I hope someone hit that person
20:13 <Athas> The Haskell grammar is surprisingly complicated.
20:13 <Athas> Glad I don't have to parse it.
20:13 <Tuplanolla> It's beautiful in the same way an everywhere-continuous nowhere-differentiable function is.
20:13 <lifter> > let in ()
20:13 <lambdabot> ()
20:13 <dolio> merijn: For pointing out that the specification of the lexer/parser in the Haskell report should probably be rewritten?
20:14 <merijn> dolio: For suggesting "F.where" should be parsed as "F.whe e"
20:14 <dolio> The Haskell report suggests it.
20:14 <EvanR> i think they pointed out the report as is implies that
20:14 <Athas> GHC has some tricks to permit some keywords as variable names (like "as"). Are those also present in the report?
20:14 <hexagoxel> lifter: needs more random "do"s inserted
20:14 <EvanR> which is stupid
20:14 <bollu> Tuplanolla: you don't think weirstrass is beautiful? :P
20:15 <Tuplanolla> Real analysis is disgusting.
20:15 <bollu> Tuplanolla: agree.
20:15 <EvanR> constructive analysis tho
20:15 <bollu> EvanR: how?
20:15 <bollu> EvanR: I don't care much, I <3 algebra
20:15 <EvanR> infinite algebra has the same issues
20:16 afarmer joined
20:16 <EvanR> off topic
20:16 <dolio> Athas: Unsure. I suspect 'as' is a valid variable name per the report. The keyword can't appear in many places.
20:16 <dolio> Allowing 'where' would probably be considerably worse.
20:17 canta joined
20:17 kmels joined
20:17 <Tuplanolla> > where where where = where -- fix id
20:18 <lambdabot> <hint>:1:1: error: parse error on input ‘where’
20:18 <Athas> dolio: right, looks like the grammar just pulls the "as" terminal out of a hat; it's not in a production for 'reservedid'.
20:18 <quchen> merijn: Sure it’s online
20:18 <quchen> STGi, that is
20:18 <bollu> quchen: have you hosted it someplace?
20:19 <quchen> ?google quchen stgi
20:19 <lambdabot> https://github.com/quchen/stgi
20:19 <dolio> Athas: Yeah.
20:19 <bollu> ah, the repo
20:20 <bollu> wait, does that work for anything?
20:20 <bollu> ?google bollu simplexhc
20:20 <lambdabot> https://github.com/bollu/simplexhc
20:20 <bollu> neat
20:20 <lyxia> What is 'as' a keyword for?
20:20 <hexagoxel> import qualified
20:20 <dolio> qualified isn't a reservedid, either.
20:21 <Athas> I'm not surprised the GHC parser has so many shift/reduce conflicts.
20:21 rickygee joined
20:21 tommd joined
20:21 teqwve joined
20:22 MarioBranco joined
20:22 <lyxia> oh right.
20:22 <[exa]> How would you define the difference between closure and thunk?
20:22 <[exa]> (if there's any)
20:22 baldrick1 joined
20:23 Luke joined
20:24 <lyxia> a thunk is code representing an unevaluated value, a closure is code capturing some environment.
20:24 juanpaucar joined
20:24 bjz joined
20:24 primal_ joined
20:25 <lyxia> it seems "thunk" is actually more general than I thought https://en.wikipedia.org/wiki/Thunk
20:25 juanpauc_ joined
20:25 flatmap13 joined
20:25 Guest10 joined
20:25 <lifter> I don't know if one can say a thunk is code, I think of it more as a representation in memory of an unevaluated expression.
20:26 duckqlz joined
20:27 mbrock joined
20:27 <lyxia> Okay. I would say code and representation are synonymous.
20:28 <Philonous> How do I read a judgment of the form Γ ⊨ a ≡ b : A ? is it Γ ⊨ (a ≡ b) : A or Γ ⊨ a ≡ (b : A) ?
20:29 primal joined
20:29 <lyxia> it depends
20:30 bollu joined
20:30 <dolio> Neither.
20:30 <dolio> The point is that a and b are equal terms of type A.
20:30 flatmap13 joined
20:31 <Philonous> That's really strange, because this paper has a Lemma that states that from Γ ⊨ a ≡ b : A follows a:A and b:A, which would be not even worth stating if what you said is true dolio
20:31 <lyxia> Philonous: what paper
20:32 <Philonous> Weirich "A Specification of Dependently-Types Haskell"
20:32 <lyxia> It could be that Γ ⊨ a ≡ b : A is a different judgement from Γ ⊨ a : A
20:32 oisdk joined
20:32 <dolio> It's not a triviality. There's probably no inference rule from 'G |- a = b : A' to `G |- a : A`.
20:33 <lyxia> Philonous: the notation "Γ ⊨ a ≡ b : A" can't be decomposed
20:33 jordan3533 joined
20:33 <Philonous> Ah, OK
20:33 mmn80 joined
20:34 primal_ joined
20:34 takle_ joined
20:35 <jordan3533> hi
20:35 zcourts_ joined
20:36 hybrid joined
20:36 <jordan3533> i know that you can get the type of an expression in ghci with ":t"
20:36 <jordan3533> is there anyway to define your own type and use it?
20:36 <dolio> Philonous: It's probably kind of like when you see judgements for well formed types 'G |- A type', and then it's proved that when you have 'G |- M : A' it happens that 'G |- A type' also holds. That way you're justified in eliding the latter as a premise for everything.
20:36 <jordan3533> my_type :: (j -> k) -> (l -> j) -> l -> k
20:36 <dolio> So your proof trees are smaller.
20:36 <jordan3533> how can i tell ghci about mytype?
20:37 duckqlz joined
20:37 <lyxia> type MyType j k l = (j -> k) -> (l -> j) -> l -> k
20:37 <lyxia> ghci won't magically refactor types displayed with :t though
20:37 <dolio> Lots of papers probably don't even bother proving it, but if you're being really meticulous, you might.
20:38 cdg joined
20:38 <jordan3533> type test j k l = (j -> k) -> (l -> j) -> l -> k
20:38 <jordan3533> Malformed head of type or class declaration: test j k l
20:38 cpup- joined
20:38 conal joined
20:38 <lyxia> type Test
20:38 <lyxia> with an upper T
20:39 <jordan3533> wow
20:39 <jordan3533> now it works
20:39 <jordan3533> why no lowercase?
20:39 Gurkenglas joined
20:39 kova joined
20:39 <lyxia> lowercase identifiers are for type variables only
20:39 <jordan3533> alright
20:39 <jordan3533> ghci won't magically refactor types displayed with :t though
20:40 <jordan3533> what do you mean by that?
20:40 <Philonous> dolio, I think the real problem is that I don't fully understand what's going on. Dependent type theory seems to be full of notations and terminology that's just assumed to be understood, and I haven't yet found an introduction that properly defines all the them. So I've been reading papers and watching talks and sort-of understand what they are doing, but not in every last detail
20:40 <kadoban> Concrete types are capitalized. It's part of the syntax.
20:40 <jordan3533> :t (foldr const) Test (curry fst)
20:40 <lambdabot> error:
20:40 <lambdabot> • Data constructor not in scope: Test :: b -> c
20:40 <lambdabot> • Perhaps you meant variable ‘nest’ (imported from Text.PrettyPrint.HughesPJ)
20:40 <jordan3533> will this work with my own type?
20:40 Levex joined
20:40 NocnaShada joined
20:40 koserge joined
20:40 <jordan3533> or did u mean it "cant refactor" that it wont work
20:40 <monochrom> @type curry fst
20:40 <lambdabot> c -> b -> c
20:41 <dolio> Philonous: That paper certainly isn't a beginner intro to formal type theory. :)
20:41 <monochrom> it looks like curry fst = const
20:41 <monochrom> but either way it is not a list.
20:41 <Philonous> dolio, I've read TAPL, but it didn't deal in equalities
20:41 <jordan3533> Not in scope: data constructor ‘Test’
20:42 <jordan3533> so it wont be able to help me with my own types?
20:42 yrdz joined
20:42 <monochrom> Right.
20:42 rickygee joined
20:42 <lyxia> jordan3533: (\f g x -> f (g x)) has type MyType j k l, yet if you ask :t (\f g x -> f (g x)) it will not show MyType j k l...
20:42 <jordan3533> ok
20:42 <monochrom> But you know how to run ghci on your own computer who has access to your Test.
20:42 cpup joined
20:42 <jordan3533> it still doesnt work
20:43 <monochrom> But Test is not the problem. curry fst is.
20:43 <monochrom> where foldr wants a list, you give it a function?
20:43 <jordan3533> :t (foldr const) Test (curry fst)
20:43 <lambdabot> error:
20:43 <lambdabot> • Data constructor not in scope: Test :: b -> c
20:43 <lambdabot> • Perhaps you meant variable ‘nest’ (imported from Text.PrettyPrint.HughesPJ)
20:43 <dolio> Philonous: Ah. Well, that notation is pretty common when it's somehow important that types are involved with how equality is defined.
20:43 <jordan3533> after i said type Test j k l = (j -> k) -> (l -> j) -> l -> k
20:43 <monochrom> *shrug*
20:43 <dolio> If you read any OTT, it's even more verbose, because there can be different types on each side.
20:44 Levex joined
20:45 vurt joined
20:45 <lyxia> jordan3533: Test is a type synonym... it's not a value to apply (foldr const) to.
20:48 <* hackage> schematic 0.1.0.0 - JSON-biased spec and validation tool https://hackage.haskell.org/package/schematic-0.1.0.0 (dredozubov)
20:48 vurt joined
20:49 stux|RC-only joined
20:49 <dolio> Actually, maybe the equality judgments aren't heterogeneous. Just the types.
20:50 <Philonous> dolio, Ah, a little later they give the dynamics of the judgement
20:50 <Philonous> dolio, I think the confusion really was how it (didn't) decompose
20:50 <Philonous> Thanks dolio, lyxia
20:50 <kova> Hello, I forgot the name of a certain virtual machine commonly used to implement the execution model of functional languages like Haskell, and I can't find resources on the internet for it.
20:50 <codedmart> I have `exposed-modules: Mappings` in my cabal file, but when I `stack build` I get this `Warning: The following modules should be added to exposed-modules or other-modules`?
20:51 latro`a joined
20:51 <kova> Its name is an acronym of the names of the registers in it
20:51 quchen joined
20:51 sleffy joined
20:52 Levex joined
20:52 <kova> ... you've got to be f****** kidding me. I just found it.
20:52 cpup joined
20:52 <spoonm> kova: what's it called?
20:53 <kova> spoonm The SECD machine.
20:53 CoderPuppy joined
20:53 rblaze joined
20:53 <Philonous> That's how it works, search for hours, finally ask in IRC only to find it immediately after.
20:53 <lyxia> codedmart: do you have more than a library in your cabal file
20:53 <kova> spoonm Stack, Environment, Control, Dump.
20:54 <monochrom> Haskell's is STG not SECD.
20:54 <lyxia> codedmart: and do you see your module being compiled twice
20:54 primal joined
20:54 <monochrom> Not to mention that SECD is call-by-value so very unrelated to Haskell.
20:54 <codedmart> lyxia: I have an executable.
20:54 <kova> monochrom well I read that it's a common target for functional language compilers
20:54 abel-abel joined
20:55 <monochrom> Well I read that SECD is call-by-value.
20:55 rcat joined
20:55 sync___ joined
20:55 <lyxia> codedmart: I guess your executable and your library are at the same directory?
20:55 <lyxia> (they shouldn't)
20:55 <monochrom> I also read that "functional" is very broad, to the point Scala is functional too.
20:55 <codedmart> Yup they are
20:56 <monochrom> And Excel.
20:56 <monochrom> So much for reading.
20:56 <lyxia> codedmart: you should move the executable and the library in different directories
20:56 duckqlz joined
20:57 <lyxia> https://stackoverflow.com/questions/6711151/how-to-avoid-recompiling-in-this-cabal-file for instance
20:57 <kova> monochrom I wouldn't say that either Excel or Scala are functional. They just support the functional style (Excel less)
20:57 <codedmart> lyxia: OK thanks!
20:58 <bollu> is using sequence to convert from Either e (IO a) to IO (Either e a) "semantically true"?
20:58 <lpaste> Abel-Abel pasted “dynamic-cabal” at http://lpaste.net/355787
20:58 <bollu> I mean, it works, but it seems dishonest to use
20:59 <* hackage> threepenny-editors 0.2.0.10 - Composable algebraic editors https://hackage.haskell.org/package/threepenny-editors-0.2.0.10 (PepeIborra)
20:59 fluffypony1 joined
20:59 <quchen> bollu: »yes« and »not really«
20:59 <bollu> quchen: yeah, so what's the "semantically honest" function? :3
20:59 <abel-abel> I got this error when I run `cabal install dynamic-cabal`. How to solve that?
21:00 <quchen> bollu: »yes« it’s »semantically true« (whatever that means), »not really« its’t not dishonest no
21:00 <abel-abel> Do I have to fix the bug in the source code of the library?
21:00 <bollu> ah, I see
21:00 <bollu> quchen: like, in the sense of
21:01 <bollu> quchen: you can replace traverse with forM, but that's asking for too much strength
21:01 <quchen> abel-abel: It could just be a wrong version in the dependency of a package
21:01 <bollu> quchen: so, well, is using traverse in this situation something like that
21:01 <quchen> forM is redundant (because of for_)
21:01 <quchen> s/for_/for
21:01 <quchen> and for is just flipped traverse
21:01 <quchen> and traverse is sequence . fmap f
21:01 <quchen> So there you have your sequence back :-)
21:01 <bollu> :P
21:01 dfeuer joined
21:01 <bollu> OK
21:02 <bollu> but you got the spirit of my question I hope?
21:02 jeffreybaks joined
21:02 <quchen> Not really. »semantic honesty« is not something I’ve heard before.
21:02 nickolay joined
21:02 <quchen> It works. It uses correct functions. It typechecks. It does what it should.
21:02 <bollu> quchen: am I asking for a ring when all I want is the underlying additive structure ?
21:02 drewbert joined
21:02 <bollu> quchen: something like that
21:02 rickygee joined
21:02 <abel-abel> quchen, a wrong version? where to fix that?
21:03 <bollu> quchen: "am I asking for the minimal algebra
21:03 <bollu> "
21:03 <quchen> Oh, you’re wondering whether there is something simpler. Well, explicit pattern matching, but then you’d just be reinventing things.
21:03 drewbert joined
21:03 <bollu> hm, OK
21:03 <quchen> That’s how the traversable instance of Either works after all.
21:03 <quchen> Anyway, I think sequence is fine here.
21:04 beanbagula joined
21:04 <bollu> yeah
21:04 primal_ joined
21:04 tusj joined
21:05 juanpaucar joined
21:05 baldrick1 joined
21:05 eschnett joined
21:06 epsilonhalbe joined
21:06 flatmap13 joined
21:06 sdothum joined
21:06 asthasr_ joined
21:07 ninja_in_neopren joined
21:07 iAmerikan joined
21:08 juanpauc_ joined
21:08 beanbagu1 joined
21:09 <quchen> abel-abel: I’m not familiar (enough) with Cabal anymore :-$
21:09 <quchen> There is a flag --allow-newer I think
21:09 <jordan3533> why do i even have to learn unification step by step
21:09 <jordan3533> my class is so weird
21:09 <quchen> Hah, you’re the second one having to do this today.
21:10 <quchen> Studying in Frankfurt by any chance?
21:10 <jordan3533> yeah
21:10 <jordan3533> who else did it?
21:10 <abel-abel> quchen, thanks.
21:10 <quchen> I don’t remember the name.
21:10 <quchen> It was exercise 3. :-þ
21:10 <monochrom> You don't have to. If you never make type errors, you don't need to do unification yourself.
21:10 <jordan3533> did he get the solution?
21:10 <jordan3533> i should start monitoring this irc ^
21:10 <quchen> We didn’t talk about that exercise.
21:10 <quchen> I just saw the PDF.
21:11 <EvanR> professor: "go to #haskell, im taking the day off"
21:11 <monochrom> But what's wrong with learning unification?
21:11 <Tuplanolla> I'm a bit surprised I've never seen our students here.
21:11 <jordan3533> prof: you dont know what unification is and never saw an example? well 50% of the points for this task gl hf
21:12 <quchen> Unification is fairly simple. Type inference would be worse.
21:12 <abel-abel> which course are you talking about
21:12 <jordan3533> programming 2
21:12 juanpaucar joined
21:13 <abel-abel> programming 2?
21:13 <jordan3533> yes
21:13 <monochrom> Yeah, "programming 2" is a universally known standard. Right? Right?
21:13 <abel-abel> which programming 2?
21:13 <abel-abel> :(
21:13 <jordan3533> its the name of the course
21:13 <jordan3533> we do haskell
21:13 <jordan3533> and later sql i think
21:13 theorbtwo joined
21:14 primal joined
21:14 <quchen> Interesting combination.
21:14 <monochrom> Here in North America we call it "computer science 2.718"
21:14 pera joined
21:15 <jordan3533> lel
21:15 <Tuplanolla> Even your courses have floating-point errors.
21:15 <jordan3533> does anyone do my task lol
21:15 <jordan3533> its 50% and i dont even get it
21:15 <jordan3533> wanna*
21:15 <monochrom> Consider changing career.
21:16 <jordan3533> i wanna learn it
21:16 <jordan3533> but not rn lol
21:16 joaj joined
21:16 <quchen> Rn is the worst, yes.
21:16 <Tuplanolla> Now is the only time for most things.
21:17 <abel-abel> googled 'programming 2' and got this: https://www.monash.edu.au/pubs/handbooks/units/FIT2034.html
21:17 <jordan3533> :t curry fst
21:17 <lambdabot> c -> b -> c
21:17 <jordan3533> thats the task
21:17 <abel-abel> nothing about haskell :(
21:17 <jordan3533> why do i have to do it myself smh
21:17 <quchen> Same reason you calculated 1+1 yourself that one time.
21:18 zacts joined
21:18 <quchen> abel-abel: It’s called »Programmierung 2« and it’s in German.
21:19 systemfault joined
21:20 exarkun joined
21:20 <abel-abel> quchen, thanks. sadly. I don't know German.
21:21 <jordan3533> NOW is the time to learn it
21:21 macalinao joined
21:22 <abel-abel> I guess I'll forget to learn Haskell when I am trying to learn German. :(
21:22 maffh joined
21:22 <quchen> abel-abel: The exercise isn’t really about Haskell, but about its background in Hindley-Milner type inference.
21:22 <jordan3533> there is no such thing as a full brain capacity
21:23 rickygee joined
21:23 <abel-abel> quchen, got it.
21:24 primal_ joined
21:26 sampuka joined
21:27 HoierM_ joined
21:28 jeffreybaks joined
21:30 <monochrom> Do I even want to read the actual assignment? :)
21:30 flatmap13 joined
21:31 rblaze1 joined
21:31 primal joined
21:31 kmels joined
21:33 mada joined
21:33 juanpaucar joined
21:33 <jordan3533> https://imgur.com/a/t6gAP
21:33 <jordan3533> enjoy monochrom
21:34 <monochrom> Oh God, you can't even tell apart "foldr const (curry fst)" from "foldr const . curry fst".
21:35 tomphp joined
21:35 <monochrom> (And what's with that "Test" thing which isn't even in the question?)
21:35 kmt-lnh joined
21:36 <jordan3533> the test thing was another name for "."
21:36 primal joined
21:36 iAmerikan joined
21:36 juanpaucar joined
21:36 lambdaTom joined
21:37 <monochrom> OK, that only adds two more problems.
21:37 moth joined
21:37 <bollu> cocreature: ping
21:37 <jordan3533> the previous task was like "write a list comprehension that filters numbers bigger than 5"
21:37 <jordan3533> and now this
21:37 <jordan3533> wtf
21:37 joco42 joined
21:38 <mauke> welcome to the learning wall :-)
21:38 <monochrom> "problem" in the sense of: When some people are confronted with a problem, they say, "I think ___ is a good idea". Now they have two problems.
21:38 <mauke> it's like a curve, only slightly steeper
21:38 Coldblackice joined
21:38 <eacameron> I have a typeclass Atomable that allows me to turn various types into the "Atom" type. I'd now like to create a Map AttributeName Atom but without requiring anyone to use the "toAtom" method. I'd rather write `Map AttributeName (forall a. Atomable a => a)` but GHC complains about impredicative polymorphism.
21:38 <eacameron> Is there a workaround?
21:39 lambdaTom left
21:39 <mauke> it would have to be 'exists' anyway
21:39 <dmwit> eacameron: `insert :: Atomable a => AttributeName -> a -> Map AttributeName Atom -> Map AttributeName Atom`?
21:39 <bollu> https://github.com/llvm-hs/llvm-hs/blob/llvm-4/llvm-hs/test/LLVM/Test/Global.hs#L28
21:39 <monochrom> But anyway, the two additional, self-inflicted, artificially created problems: 1. Test is a type, "." is not a type. 2. "f x y" and "f . y" are different, even when "x" is defined to be ".".
21:39 <bollu> ^ is that a haskell-ism I am unaware of?
21:40 <bollu> i.e, referring to a global data structure and then editing it with { }
21:40 <dmwit> bollu: It's just record update syntax.
21:40 <mauke> bollu: record update
21:40 <monochrom> This is beyond XY problems. This is XYZ@#$ problems.
21:40 <dmwit> Whether you are aware of it or not, I don't think anybody here can say. =)
21:40 juanpauc_ joined
21:40 im0nde joined
21:40 <eacameron> dmwit: That's not a bad workaround I suppose.
21:40 flatmap13 joined
21:40 lambdaTom joined
21:41 <eacameron> dmwit: I thought there was a way to use existential quantification in cases like this?
21:41 <bollu> dmwit: nice
21:41 <dmwit> eacameron: Sure. But why?
21:41 <bollu> dmwit: that really simplifies life
21:41 <eacameron> dmwit: Why not?
21:41 <bollu> dmwit: how did I not know this exists?
21:41 <bollu> dmwit: I wound up just learning lens when I needed updates >_<
21:41 <dmwit> eacameron: Skip an extension without losing functionality or concision. What's not to love?
21:41 <bollu> dmwit: and I'm consider myself "intermediate" at haskell
21:42 <monochrom> @type const
21:42 <erisco> jordan3533, inadequate teaching is a fault, but relying on the compiler to tell you the type is weak
21:42 <lambdabot> a -> b -> a
21:42 davr0s joined
21:42 <dmwit> eacameron: Bonus points: the library writer gets to do extra work rather than the library user. Usually that's a good tradeoff.
21:43 <eacameron> dmwit: I guess I'd have to use the constructor for the existential quantified type anyway?
21:43 <dmwit> (Even though the extra work is very light: one extra token in each case, usually.)
21:43 <erisco> jordan3533, it is much stronger to be able to do this in your head because it can, and usually does, guide you to the program you want
21:43 juanpaucar joined
21:43 <dmwit> eacameron: Exactly what I'm referring to, yeah. =)
21:43 <monochrom> erisco: True about inadequate teaching, but do not be so quick to assume it, for you haven't really seen what the teacher did.
21:43 a3f joined
21:43 a3f joined
21:43 <* hackage> preamble 0.0.37 - Yet another prelude. https://hackage.haskell.org/package/preamble-0.0.37 (markfine)
21:43 <erisco> and I do not assume it
21:44 rickygee joined
21:44 <dmwit> monochrom: In fact, I am quick to assume the opposite, because there is an SO question with a quite detailed working out of this question in a very clean notation that I doubt a student could invent on their own.
21:44 <eacameron> dmwit: I don't understand why existential quantification is possible but my use case is not. All I'm doing is naming the thing.
21:44 <monochrom> My experience in efnet #math is that most students who claim "the teacher/textbook/whatever didn't tell us" were lying.
21:44 primal_ joined
21:44 <erisco> may more often be explained as the student not listening ;)
21:44 <dmwit> eacameron: What do you mean by "my use case is not possible"?
21:44 <Logio> erisco, monochrom: that's also the kind of problem that is really trivial after you know what to do (and therefore hard to teach to people who don't)
21:44 <jordan3533> ^
21:45 <eacameron> dmwit: I mean I don't know why using the forall directly runs up against impredicative types but putting it inside a data constructor does not.
21:45 <Logio> speaking as a former TA of a Haskell course :P
21:45 baldrick1 joined
21:46 juanpauc_ joined
21:46 <monochrom> "curry fst" and "foldr const" are within reach.
21:46 sellout- joined
21:46 <dmwit> eacameron: Two reasons: 1. you are using a different quantifier (even though it's spelled the same in Haskell) 2. Because adding a constructor to guide the type system makes a lot of things easier. See also: equirecursive vs isorecursive types.
21:46 JBbankss joined
21:46 <dmwit> eacameron: The constructor acts as a "hint" about where exactly the boundary between polymorphic and monomorphic occurs.
21:47 <eacameron> dmwit: Very interesting.
21:47 <eacameron> dmwit: That's helpful. I'll use your workaround then. Thank you for the help!
21:47 juanpaucar joined
21:47 <monochrom> Yes, equirecursive code is pretty confusing to me.
21:48 <monochrom> (Nevermind whether it is confusing to the computer. I'm sure someone can get it to work.)
21:48 rblaze joined
21:48 flux joined
21:48 <bollu> what's the context here with existentials?
21:48 <dmwit> I'm pretty sure the "obvious" equirecursive type system is undecidable for both checking and inference.
21:49 <dmwit> So, confusing to computers, too. =)
21:50 kmt-lnh left
21:51 juanpaucar joined
21:52 leat joined
21:52 <erisco> monochrom, I think saying if we never make type errors then we needn't worry about types is a corollary from the purpose of types is to prevent errors
21:52 <erisco> monochrom, but I think we would both say this is not the only way to make use of types
21:52 hiratara joined
21:53 im0nde_ joined
21:53 tromp joined
21:54 <monochrom> Eh? That's not what I said.
21:54 primal joined
21:54 <monochrom> Exercise for the reader: What did I say?
21:54 <erisco> your message just left my log, darn, but I must have misunderstood then
21:55 kova left
21:55 <monochrom> If you never make type errors, you don't need to do unification (or type inference) yourself.
21:55 <erisco> oh never mind, it is still there, and yes that is it
21:56 ertes joined
21:56 <bollu> @tell cocreature I may need coroutines in LLVM 5. Do you plan on supporting LLVM 5 just yet?
21:56 <lambdabot> Consider it noted.
21:56 takle joined
21:57 <erisco> well now I can't steer myself to any other reading of it :P
21:57 <bollu> @tell cocreature if not, what's my best course of action? write C FFI and then link to it?
21:57 <lambdabot> Consider it noted.
21:57 <bollu> @tell cocreature, my stuff <-> C FFI <-> C++ code that does LLVM work with coro <—> LLVM?
21:57 <lambdabot> Consider it noted.
21:58 zcourts joined
21:59 <erisco> monochrom, can you clarify for me?
21:59 primal_ joined
22:00 <monochrom> How about this. Why do you think that "do unification yourself" and "worry about types" are equivalent?
22:00 halogenandtoast joined
22:01 <erisco> why not just tell me and then I won't have to wander about what you're really meaning
22:02 neoo joined
22:02 Itkovian joined
22:02 <monochrom> Unification means unification. OK? I don't see how that extrapolates to worrying about types which is so much broader and so many extra aspects than unification.
22:03 <bollu> @tell cocreature so, it's part of LLVM 4, but not part of llvm-hs. I left this issue, I'd love pointers - https://github.com/llvm-hs/llvm-hs/issues/110
22:03 <lambdabot> Consider it noted.
22:03 <monochrom> To me you're like "monochrom, you said under some circumstance one doesn't need to do math. So you mean one doesn't need to think?"
22:04 cpup- joined
22:04 mooooooooo joined
22:04 primal joined
22:04 rickygee joined
22:05 <monochrom> Why do people always do this to me? Why do they keep putting words into my mouth?
22:05 neoo joined
22:06 lambda-11235 joined
22:07 <erisco> it isn't a conspiracy, I assure you... but I need to reinterpret the conversation now because I am confused
22:07 cpup joined
22:07 <monochrom> I feel like some people are English Literature majors so that if I say so much as "I saw a dog playing with a cat today" they are going to say "monochrom, what you said is such a beautiful political allegory"
22:07 neoo joined
22:08 augur joined
22:08 <hpc> monochrom: this is why i never say anything that can be misconstrued as factual
22:08 neoo1 joined
22:08 flatmap13 joined
22:09 <c_wraith> hpc, is that so?
22:10 <peterbecich> Hello, I'm trying to build `accelerate-llvm` and encounter an error when compiling the dependency `llvm-hs`. Any ideas what I'm doing wrong? I have LLVM 4.0.0. Thank you: http://lpaste.net/667392219346370560
22:10 neoo joined
22:11 <erisco> monochrom, I am beginning with the picture of a programmer who never makes type errors yet does not know how to do unification
22:11 jedws joined
22:11 <peterbecich> The dependency is llvm-hs version 4.0.1.0. I am compiling llvm-hs 4.1.0.0 to see if it has the same issue.
22:11 <mauke> you can't make type errors <meme here> if your language is untyped
22:11 coot____ joined
22:11 <erisco> monochrom, and also that by saying "never makes type errors" I am assuming this programmer can write any program and not just trivial ones not involving polymorphism
22:12 <bollu> peterbecich: which OS and compileR?
22:12 <erisco> so somehow we're writing perfect programs yet are oblivious to the types. I cannot see how we'd have any picture of the types without knowing unification
22:12 <monochrom> erisco, you accept the fact that people like Ramajuan exist whose intuition is correct 99.9% of the time and they can't even tell you why?
22:13 CoderPuppy joined
22:13 <actualHuman_462> I write quite a bit of Haskell code that seems to work pretty well and have never heard of the concept of unification before today.
22:13 neoo joined
22:13 j2j joined
22:13 <erisco> I don't know this person but if they fit the description of the programmer I am describing then they do not refute my point here
22:13 <peterbecich> bollu: Debian 8.8 and presumably llvm 4.0.0. I have other llvm versions on the path. Maybe I need to remove those.
22:14 <peterbecich> llvm-ar --version gives 4.0.0
22:14 primal_ joined
22:14 <bollu> peterbecich: no, LLVM is the LLVM version. But, which C/C++ compiler is being picked up?
22:14 dfeuer joined
22:14 <bollu> peterbecich: what's your CC / CXX?
22:14 <monochrom> I'm done explaining myself. Not my problem anymore.
22:14 <peterbecich> bollu: oh, thanks. gcc --version gives 4.9.2
22:14 <bollu> peterbecich: hmm.
22:15 <peterbecich> bollu: clang --version gives 3.5.0-10
22:15 <peterbecich> bollu: I'm not sure whether it is using clang or gcc
22:15 <bollu> peterbecich: can you set CC and CXX to clang and then run stack build?
22:15 <bollu> peterbecich: I'd be interested in what happens. (I don't work on llvm-hs, just use it)
22:15 <bollu> peterbecich: so I'm just asking you to try things :)
22:16 ContessaTP joined
22:16 <bollu> peterbecich: but, well
22:16 <bollu> peterbecich: could you try?
22:16 neoo joined
22:16 <erisco> well, I was just going to get around to specification as a purpose of types
22:16 cpup joined
22:17 <peterbecich> bollu: also, is this a problem? "Debian clang version 3.5.0-10 ... (based on LLVM 3.5.0)"
22:18 takle joined
22:18 <bollu> peterbecich: shouldn't be, because it's picking up the right llvm version. shouldn't matter what clang was compiled with
22:18 <peterbecich> I built and installed LLVM 4 manually as I don't have Debian Sid packages. I think 4.0 is only available on Sid.
22:18 <peterbecich> Ah thanks.
22:19 <peterbecich> How do I set CC and CXX? Happy to try this. Sounds interesting. Thanks
22:19 <bollu> export CC=clang
22:19 <bollu> export CXX=clang
22:19 anuxivm joined
22:19 <bollu> $ CC=clang CXX=clang stack build —verbose
22:20 <bollu> ^ that should work out of the box
22:20 <bollu> you'll have to replace — with "- -" because mac OS likes to fuse my — into a single line in a text bos
22:20 <bollu> box*
22:20 alx741 joined
22:20 <peterbecich> bollu: Thanks, building now
22:22 MarcelineVQ joined
22:22 <peterbecich> bollu: no luck http://lpaste.net/355788
22:24 <bollu> peterbecich: can you stack clean --full
22:24 <bollu> peterbecich: and then run "CC=clang CXX=clang stack build —verbose"
22:24 <bollu> in the same line the CC, CXX and the stack build
22:24 <bollu> this is probably superstition
22:25 rickygee joined
22:25 <monochrom> Does stack actually honour CC and CXX?
22:25 greeny joined
22:25 <bollu> I think so
22:25 FransWillem joined
22:25 <bollu> IIRC, I managed to force it to use ccache'd clang
22:25 <bollu> because building took way too long
22:26 <peterbecich> bollu: looks promising! Hasn't crashed yet. I had not set CC and CXX in the same line, before
22:26 scav joined
22:26 <bollu> peterbecich: it shoudln't actually matter
22:26 LeaChim joined
22:26 cstrahan joined
22:27 <peterbecich> so you think the `stack clean --full` made the difference? I built this from source successfully a few weeks ago, with an older commit. The latest commit changed the version of llvm-hs: https://github.com/AccelerateHS/accelerate-llvm/commit/3dd939af03175f28cc79807dd575abede59f7a46
22:28 <peterbecich> bollu: I think it is building successfully. May take a while. I will report back. Thanks!
22:28 <bollu> peterbecich: yeah, possibly. But then again, like I said, "superstition" :)
22:28 <bollu> peterbecich: I don't understand either stack or GHC's build process well / at all
22:28 <peterbecich> :)
22:29 <peterbecich> me neither
22:30 buglebudabey joined
22:31 gugah joined
22:31 hiratara joined
22:33 gestone joined
22:34 jmelesky joined
22:34 hybrid joined
22:34 <peterbecich> bollu: accelerate-llvm built successfully! Thanks very much!
22:35 flatmap13 joined
22:35 buglebudabey joined
22:35 mkurkov_ joined
22:36 cpup joined
22:37 <bollu> peterbecich: yw
22:37 <bollu> peterbecich: glad I could hep
22:37 <bollu> help*
22:38 drewbert joined
22:38 lgas left
22:38 takle joined
22:38 lgas joined
22:40 chu joined
22:42 drewbert joined
22:42 dmj` joined
22:44 netheranthem joined
22:45 rickygee joined
22:46 flatmap13 joined
22:50 sleffy joined
22:54 flatmap13 joined
22:55 dni joined
22:56 <Rotaerk> is there a better hoogle instance than https://www.haskell.org/hoogle?
22:56 <Rotaerk> stackage is better in some ways, but it's missing some stuff
22:57 Jesin joined
22:57 <geekosaur> I think hoogle.haskell.org is preferred now?
22:57 <geekosaur> but each has shortcomings: the one you used has an out of date database, but handles fuzzy types better than the new one
22:58 tromp joined
22:58 <Rotaerk> ah, thanks
22:59 takle joined
23:02 mizu_no_oto joined
23:02 <sm> http://hoogle.haskell.org
23:03 pandeiro joined
23:04 kvda joined
23:05 uglyfigurine joined
23:06 rickygee joined
23:08 fiddlerwoaroof joined
23:09 im0nde joined
23:10 tuborgman joined
23:10 DrMentats joined
23:11 skeuomorf joined
23:11 DrMentats left
23:12 darjeeli1 joined
23:13 zzz joined
23:15 Levex joined
23:16 otulp joined
23:18 tromp joined
23:18 dni joined
23:18 augur joined
23:20 baldrick1 joined
23:20 takle joined
23:21 LHoT10820 joined
23:21 augur joined
23:26 louispan joined
23:26 LHoT10820 joined
23:27 nishiki_ joined
23:27 rickygee joined
23:27 nilof joined
23:27 <nishiki_> Hi, how do I print what an instance of Arbitrary?
23:28 theDon_ joined
23:28 <nishiki_> I've defined an arbitrary for a binary tree and would like to see what it looks like
23:29 gienah joined
23:29 a3Dman joined
23:30 zero_byte joined
23:30 mb013619 joined
23:30 markus1189 joined
23:30 markus1199 joined
23:32 shans_ joined
23:32 connrs joined
23:32 Levex joined
23:33 kvda joined
23:33 NoCreativity joined
23:34 <sm> if you can make it also an instance of Show, use pretty-show ?
23:34 mkoenig_ joined
23:34 <pikajude> nishiki_: looks like `arbitrary` creates one
23:35 <pikajude> or a generator, rather
23:35 <pikajude> i'm assuming there's a function that runs a generator
23:35 vydd joined
23:35 <pikajude> oh, `generate`
23:35 <pikajude> looks like `generate arbitrary` will generate one
23:37 nakal joined
23:38 joco42 joined
23:40 <mb013619> i'm trying write a rest client and following https://haskell-lang.org/library/http-client, but either the httpJSON example is out of date, or something else is wrong since the example isn't working for me
23:40 <mb013619> i'm somewhat new to haskell, here's a gist of the error: https://gist.github.com/brailsmt/792a070d8111ff96aea7905be7a888f4
23:41 <mb013619> i've tried all sorts of things, but i can't seem to get the incantations just right...
23:41 MarioBranco joined
23:41 jmcarthur joined
23:41 takle joined
23:41 <Rembane> mb013619: Try a request <- setRequestHeader ...
23:41 <Rembane> mb013619: Instead of the let request = ...
23:42 <sm> indentation of line 19 looks wrong
23:42 louispan joined
23:43 <sm> the ambiguous type error for resp is because you aren't using resp for anything yet, you can comment out that line or add an explicit type annotation
23:43 <mb013619> yeah, using 'request <- setRequest...' winds up with a couldn't match IO Request with Request
23:44 <mb013619> sm: k, i'll try that
23:45 dihuteno joined
23:46 exferenceBot joined
23:46 hexagoxel joined
23:47 rickygee joined
23:48 uglyfigurine joined
23:50 <sm> also parseRequest is a monadic function. I think you missed a line or two from the example you're following
23:50 tromp joined
23:51 <mb013619> yeah, i just fixed that one, and got Lib.hs to load
23:51 <mb013619> sm, Rembane: thx
23:51 <Rembane> mb013619: No worries. Good luck!
23:52 jedws joined
23:53 YongJoon joined
23:53 bydo joined
23:53 cschneid_ joined
23:54 YongJoon joined
23:54 mb013619_ joined
23:55 oisdk joined
23:56 vaibhavsagar joined
23:59 infinity0_ joined
23:59 infinity0_ joined