<     May 2017     >
Su Mo Tu We Th Fr Sa  
    1  2  3  4  5  6  
 7  8  9 10 11 12 13  
14 15 16 17 18 19 20  
21 22 23 24 _2_5 26 27  
28 29 30 31
00:00 <monochrom> Oh! Oops. Yeah.
00:00 <monochrom> "b >> many a"
00:00 <erisco> a little more completely described... take all the productions which are not left-recursive
00:00 <erisco> these are the prefixes
00:00 <erisco> so make these productions into a rule
00:00 Welkin joined
00:01 <erisco> then take all the left-recursive productions and reduce to just the suffixes (after the left-recursive non-terminal)
00:01 <erisco> make this another rule
00:01 <erisco> then it is the first rule followed by the second
00:01 infinity0 joined
00:02 <erisco> or first non-terminal followed by the second, I mean, meh
00:02 <ZelteHonor> The Yacc grammar is basicelly, EXP ::= APP | OtherStuff ; APP ::= APP Close | Close ; Close ::= cst | ident | S
00:02 <ZelteHonor> S should be EXP
00:04 alqatari joined
00:04 <erisco> well... I'd prefer you try and refactor it and then let us know where you get stuck
00:04 infinity0 joined
00:05 <ZelteHonor> Just to be sure, I should only change the production off APP, and introduce other rule. I should not change the other?
00:06 <ZelteHonor> Also, thanks a lot.
00:06 plutoniix joined
00:06 smillmorel joined
00:06 darjeeling_ joined
00:07 infinity0 joined
00:08 <erisco> you have to be careful because, for example, A ::= Ba | b; B ::= A is left-recursive also
00:10 <erisco> I know the last line isn't valid BNF but that is how you'd think of it http://lpaste.net/355170
00:10 infinity0 joined
00:10 JeanCarloMachado joined
00:11 <erisco> we reduce the mutual recursion to self recursion by substitution
00:11 <erisco> then it becomes clear what is going on
00:12 <ZelteHonor> I think I see it.
00:12 infinity0 joined
00:12 <erisco> now we have goofy productions like APP ::= APP
00:13 <erisco> I am going to assume that this is nonsense and ignored
00:13 <erisco> otherwise we have an ambiguous grammar
00:14 <ZelteHonor> Hum wait. I have mislead you I am sorry. The last production of close is actually (EXP)
00:14 <ZelteHonor> And not EXP directly.
00:14 <erisco> ah, well that makes much more sense
00:15 infinity0 joined
00:15 <erisco> I made an edit
00:16 heurist joined
00:16 <erisco> so we go back to step 1) what are the prefixes? i.e. what are the productions which are not left-recursive?
00:17 <ZelteHonor> I think there is only one. It is close in APP.
00:18 <erisco> I made another edit, try again
00:19 soniku joined
00:19 <ZelteHonor> The 3 last line.
00:20 <ZelteHonor> If I discovers a left-recursive problem in OtherStuff, but related to the EXP rule, can I solve them seperatly?
00:20 <erisco> well there are three. lines 15, 16, and 17
00:20 bigs joined
00:20 jer1 joined
00:20 cansis joined
00:20 dgpratt joined
00:20 runeks joined
00:21 mbrcknl joined
00:21 <erisco> if it doesn't involve APP then sure
00:21 <ZelteHonor> Yeah.
00:21 <ZelteHonor> In other stuff there is a rule bin_op
00:21 <ZelteHonor> And
00:21 <ZelteHonor> bin_op ::= EXP + EXP
00:22 <ZelteHonor> So back to APP.
00:24 <erisco> so you have all the ways an APP can begin
00:24 <erisco> make a rule for that, call it PREFIX, say
00:24 debouncer joined
00:24 <erisco> now you need all the ways it can end
00:25 <erisco> these are all the left-recursive productions with the first non-terminal reduced (i.e. remove it)
00:25 <erisco> make that a rule and call it SUFFIX
00:25 nh2 joined
00:26 <erisco> now, APP', i.e. our right-recursive refactor of APP, is just a PREFIX or a PREFIX followed by one-or-more SUFFIX
00:26 earldouglas joined
00:26 <ZelteHonor> So we have
00:27 <ZelteHonor> PREFIX ::= cst | ident | '(' (APP | OtherStuff) ')' ; SUFFIX ::= cst | ident | '(' (APP | OtherStuff) ')' :: APP' ::= PREFIX | PREFIX (one or more SUFFIX)
00:28 <erisco> yup
00:28 <erisco> something like this http://lpaste.net/355173
00:28 <erisco> now you can look at that result and find it is rather clunky, and we no longer have Close and EXP
00:29 <erisco> so we can do some re-organising at this point to clean it up and get those back
00:29 <erisco> you also need to substitute APP' for APP
00:29 <erisco> or do we say it the other way around in English? I don't know :P
00:30 <ZelteHonor> I don't know. I am french.
00:30 JoshS joined
00:30 oisdk joined
00:31 <erisco> the first obvious observation is that PREFIX and SUFFIX are the same
00:31 <erisco> because we began with APP ::= APP Close | Close
00:32 <ZelteHonor> I'll soon have a course at University where I'll learn that.
00:32 <ZelteHonor> Yes
00:34 zcourts joined
00:34 <erisco> the dual of this process gives you back left-recursion, as you might guess
00:34 <ZelteHonor> Something like that:
00:34 alx741 joined
00:34 <ZelteHonor> APP' ::= FIX SUFFIXES SUFFIXES ::= FIX SUFFIXES | FIX FIX ::= cst | ident | '(' (APP' | OtherStuff) ')' -- NOTE that APP' is substituted for APP
00:34 <ZelteHonor> Oops
00:35 <ZelteHonor> APP' ::= FIX SUFFIXES ; SUFFIXES ::= FIX SUFFIXES | FIX ; FIX ::= cst | ident | '(' (APP' | OtherStuff) ')' -- NOTE that APP' is substituted for APP
00:35 darlan joined
00:36 <ZelteHonor> I am not sure where to go, to put it back into the original grammar.
00:37 <erisco> well, APP and APP' are language equivalent, so you can just stick it right in
00:37 <erisco> and cross your fingers that the parser implementation can handle it
00:38 <ZelteHonor> Do stuff like this: APP' ::= FIX SUFFIXES SUFFIXES ::= FIX SUFFIXES | FIX FIX ::= cst | ident | '(' (APP' | OtherStuff) ')' turn into this: APP' ::= FIX SUFFIXES SUFFIXES ::= FIX SUFFIXES | FIX FIX ::= cst | ident | '('APP' ')' | '(' OtherStuff ')'
00:38 <ZelteHonor> Wait
00:38 <ZelteHonor> Copy paste fail
00:38 <erisco> if other parts of the grammar use Close, for example, well we know that Close ::= cst | ident | '(' (APP' | OtherStuff) ')'
00:39 <erisco> because we can just stick in APP' wherever now
00:39 <ZelteHonor> FIX ::= cst | ident | '(' (APP' | OtherStuff) ')' into FIX ::= cst | ident | '('APP' ')' | '(' OtherStuff ')'
00:40 acarrico joined
00:40 <ZelteHonor> Is my transformation right?
00:41 alien8 joined
00:41 baldrick joined
00:41 jer1 joined
00:41 butterthebuddha joined
00:41 <erisco> yup
00:42 <ZelteHonor> Thanks a lot. Your help is truly valuable.
00:42 <erisco> I am trying to think of it algebraically and am blanking
00:43 <erisco> x <*> (y <|> z) distributes, so you have x <*> y <|> x <*> z
00:43 <erisco> right, okay
00:43 <erisco> and it is both left and right distributive
00:43 nick123 joined
00:43 <erisco> so then you get (x <*> y <|> x <*> z) <*> w and thus x <*> y <*> w <|> x <*> z <*> w
00:44 JeanCarloMachado joined
00:44 Axman6 joined
00:44 <erisco> I am using the Haskell notation but since you're using parser combinators I assume you're familiar
00:44 ystael joined
00:44 <Welkin> does it really work that way?
00:45 <Welkin> or are you using haskell syntax for convenience
00:46 <erisco> I am not sure what dichotomy you're getting at Welkin
00:46 <Welkin> 20:43 < erisco> x <*> (y <|> z) distributes, so you have x <*> y <|> x <*> z
00:46 <erisco> you mean to ask if that is actually an Alternative law?
00:46 revprez__ joined
00:47 <erisco> I haven't read of any laws which interact between Applicative and Alternative, strangely
00:47 nh2 joined
00:47 <erisco> but in the case of parsers this *may* hold
00:48 <pacak> :t (<|>)
00:48 <lambdabot> Alternative f => f a -> f a -> f a
00:48 <erisco> if it is a general CFG parser then it does, but otherwise may not
00:48 <pacak> :t (<>)
00:48 <lambdabot> Monoid m => m -> m -> m
00:48 <pacak> :t mempty
00:48 <lambdabot> Monoid a => a
00:48 <pacak> :t empty
00:48 <lambdabot> Alternative f => f a
00:48 <pacak> erisco: Alternative is a monoid for Applicative
00:48 <erisco> for example, a parser may have no trouble with x <*> (y <|> z) but stumble with x <*> y <|> x <*> z because it takes first match over the alternative
00:49 <erisco> in terms of grammar though, which parser combinators are designed to mimic (in Applicative-style anyways) -- hence "executable grammar" -- they are the same grammar
00:50 <ZelteHonor> How would I do if I want close and EXP back?
00:50 <erisco> pacak, what are the laws?
00:50 <pacak> Same as for monoid
00:50 <pacak> associativity, left and right identity elements
00:50 <erisco> that's fine, but specifically what are the laws that interact between Applicative and Alternative?
00:50 <erisco> the monoid laws do not
00:50 <pacak> :t (<|>)
00:50 <lambdabot> Alternative f => f a -> f a -> f a
00:50 <pacak> :t (<>)
00:51 <lambdabot> Monoid m => m -> m -> m
00:51 <erisco> ZelteHonor, just replace APP with APP'
00:51 <pacak> They are the same
00:51 <ZelteHonor> Thanks
00:51 <erisco> pacak, you are missing my point
00:51 kadoban joined
00:52 doomlord joined
00:52 xcmw joined
00:52 chao-tic joined
00:53 <erisco> ZelteHonor, after you do that replacement you will probably see a lot of redundancy but that is okay. You can just clean up the grammar from that point
00:54 <ZelteHonor> Excellent. Left-recursion is evil.
00:54 splanch joined
00:54 <Welkin> erisco: not if it's pointless
00:55 <erisco> ZelteHonor, it is definitely a thorn for top-down parsing!
00:55 <erisco> Welkin, for the purposes of just generating a parser it may well be
00:55 <erisco> since it is likely to make several optimisations anyways
00:57 sgronblo joined
00:57 filterfish joined
00:57 infinity0 joined
00:58 <ZelteHonor> Oh damn. It work. The new grammar work.
00:58 DoubleDonkey joined
00:58 DrMentats joined
00:58 kadoban joined
00:58 splanch joined
01:01 <thang1> what new grammar?
01:01 jer1 joined
01:01 vaibhavsagar_ joined
01:03 davesq joined
01:04 mjora7 joined
01:05 <DrMentats> http://imgur.com/a/k23uy The best way to ensure that automatically generated variables won't clash with user defined ones.
01:05 <EvanR> what in the
01:05 aarvar joined
01:05 JeanCarloMachado joined
01:06 <DrMentats> I'm actually thinking about leaving it like this lol
01:06 <EvanR> is that a special font? or special rendering system or
01:07 <DrMentats> it's just unicode. I went to great lengths to refactor all my code in terms of Data.Text just to achieve this.
01:08 <DrMentats> well, it also allows me to use the neat Forall symbol
01:08 <erisco> pony endofunctors
01:08 <EvanR> ok
01:08 splanch joined
01:08 Stanley00 joined
01:09 <erisco> the crime is using -> instead of →
01:09 <pacak> DrMentats: Don't underestimate users :)
01:09 <DrMentats> erisco: ah, yes, I just noticed it
01:09 <Welkin> what about =>?
01:09 <DrMentats> the problem with the right arrows is that they have always had a weird issue with character width
01:09 guardianJ joined
01:10 <EvanR> right-arrow.net
01:10 <pacak> > let (🐎) = (+) in 1 🐎 2
01:10 <lambdabot> 3
01:10 <erisco> I think that is just a font problem
01:10 flatmap13 joined
01:10 <erisco> mixing and matching fonts, possibly
01:10 <DrMentats> EvanR: oh wow, I never knew about that website
01:11 <erisco> I don't know all the arcane arts of rendering glyphs
01:11 lambdamu_ joined
01:11 <EvanR> it used to come up first on google when i searched for this
01:11 <DrMentats> erisco: I just wonder whether or not I should add a space after it, but then people with the proper font might have too much space
01:12 <AaronFriel> jle`: I added a fixed WrappedIx implementation to `Graphted`: https://hackage.haskell.org/package/graphted-0.2.5.1/docs/src/Data-GWrappedIx.html#WrappedIx
01:12 <erisco> and thus ASCII lives on
01:13 <DrMentats> worst case scenario, I will replace emoji with greek letters because those seem to work fine across the board
01:13 <thang1> nice nice
01:13 <Welkin> ナイス
01:14 <thang1> It's a shame we can't make double width unicode
01:14 <Welkin> oh but you can!
01:14 <thang1> oh right, nvm
01:14 hybrid joined
01:14 <Welkin>
01:14 <erisco> and a shame we don't have a vomit combining character
01:14 <DrMentats> so I'm assuming by pancak's example that 🐎 is parsed as an operator by haskell? funny
01:14 <thang1> That >> character is single width on my font :p
01:14 <Welkin> 《~~~》
01:15 <EvanR> erm
01:15 <Cale> DrMentats: yeah, it's a symbol character
01:15 <Welkin> o.o
01:15 <thang1> oh man that's ugly as fuck. It renders as single width and the font just pretends the extra empty space isn't there
01:15 <EvanR> whether the arrow is single or double is a rendering issue not a unicode issue
01:15 <Welkin> that is a horse
01:15 guardianJ joined
01:15 <Welkin> 🐎
01:15 <Welkin> LOL
01:15 <thang1> EvanR: yeah, my font is slightly fucky with unicode, which is funny because it's supposed to be amazing with unicode
01:16 <DrMentats> the horse operator
01:16 robertkennedy joined
01:16 <thang1> This sort of thing is a huge issue with unicode in general. between that and our input issues being fucking married to the standard keyboard, it's no wonder we've never developed better ways of writing things out in programming languages
01:16 <Cale> 🐌
01:17 <Welkin> thang1: does this render weird for you? 好像
01:17 systadmin joined
01:17 <EvanR> the great thing about standard keyboards is https://en.wikipedia.org/wiki/Space-cadet_keyboard
01:17 <thang1> DrMentats: that's some beautiful unicode choices tho
01:17 <ExpHP> ah good, with emoticon operators I can now finally program comfortably on my phone
01:17 <DrMentats> https://en.wikipedia.org/wiki/APL_(programming_language) used unusual characters to great effect
01:17 <Welkin> thang1: 【《好像》()】
01:18 <thang1> Welkin: http://i.imgur.com/Saxtxuz.jpg
01:18 <DrMentats> thang1: lol thank you
01:18 <thang1> Welkin: part 2: http://i.imgur.com/6fyI9uL.jpg
01:18 mjora7 joined
01:18 <Welkin> is that a carousel horse?
01:19 <Welkin> could also be a 草泥马 :D
01:19 Goplat joined
01:19 <pacak> thang1: nice fonts.
01:19 Anonymous0250 joined
01:21 kadoban joined
01:22 cschneid_ joined
01:23 a3Dman joined
01:23 a3Dman joined
01:23 Supersonic112_ joined
01:23 <Costar> Why they changed the Monad restriction to Applicative?
01:23 {emptyset} joined
01:24 <Cale> Costar: Because every Monad ought to be an instance of Applicative *anyway* and it's nice to be able to rely on that.
01:24 <Cale> Costar: You can always define pure = return, (<*>) = ap
01:24 <Costar> Cale: We just need Functor
01:24 <Cale> and fmap = liftM
01:24 <Cale> and so there's no excuse to leave out an Applicative instance, really.
01:24 nesqi joined
01:25 debouncer joined
01:25 <EvanR> if polymorphic code expects an Applicative, and theres a Monad without an Applicative instance, it wont be accepted
01:25 jer1 joined
01:25 <EvanR> which would be annoying because it would work
01:25 <Costar> Yeah
01:25 <Cale> Or, it wouldn't have been accepted -- but now it will be.
01:25 <Costar> I did not noted that
01:26 <Costar> since yesterday
01:26 <thang1> pacak: it's Pragmata Pro, pretty nice font. Way overpriced if you actually buy it
01:26 <thang1> https://github.com/be5invis/Iosevka <-- much better free alternative if you like the look of PP
01:27 <Costar> Cale: I don know if I liked that
01:27 <EvanR> oh nice
01:27 <Costar> im thinking about it
01:27 <Costar> im still shocked lol
01:27 <DrMentats> I use this one myself https://github.com/tonsky/FiraCode
01:28 <Cale> Costar: If you're shocked about that, wait until you find out about Foldable and Traversable being in the Prelude
01:28 <Cale> :t foldr
01:28 <lambdabot> Foldable t => (a -> b -> b) -> b -> t a -> b
01:29 <Costar> Cale: To me, this make more sense.
01:29 <thang1> quick, someone fold a tuple /s
01:30 <ZelteHonor> And no. It didn't work. The tool just did not regenate the grammar properly.
01:30 <pacak> > length (1,2)
01:30 <lambdabot> 1
01:30 <thang1> gg no re, haskell == ded language. Literally unusable
01:30 <Cale> I actually rather like that result.
01:30 <EvanR> just changed everything to iosevka...
01:31 <thang1> EvanR: welcome to the enlightenment
01:31 <EvanR> hmm
01:31 <thang1> how do you likey?
01:31 <pacak> Better than php.
01:31 <Cale> It's indicative of how we ought to think of pairs: as containers for a single element (the second part), having a label (the first part)
01:31 nh2 joined
01:31 <Cale> > fmap (*10) (1,2)
01:31 <lambdabot> (1,20)
01:31 <Costar> pacak: writing in a paper is better than php
01:31 plot joined
01:32 <thang1> Is that really how you should be thinking of tuples though?
01:32 <Cale> All the instances are consistent with that view.
01:32 <Cale> (and have to be)
01:32 guardianJ left
01:33 flatmap13 joined
01:33 <Cale> > mapM (\x -> [10*x, 100*x]) ("hello", 1)
01:33 <lambdabot> [("hello",10),("hello",100)]
01:33 <EvanR> thang1: i know i can see more now... i think... but my brain is going to have to get used to it
01:33 <Cale> This is because the functor in question is (,) e
01:34 <thang1> Cale: what are the brackets doing in there?
01:34 <Cale> Which brackets?
01:34 <Cale> The list?
01:34 <thang1> oh I'm stupid, nvm
01:34 <thang1> I was seeing a bunch of (,) stuff and then saw [,] and somehow my brain totally forgot that was a list
01:35 <EvanR> thang1: can it somehow render -> and arrows in code?
01:35 flatmap1_ joined
01:35 <EvanR> -> as arrows
01:36 <thang1> EvanR: it has support for ligatures. However, your editor is in charge of font display, not the font. Fonts have no "knowledge"
01:36 <EvanR> well the terminal is in charge of font display ;)
01:37 <thang1> True, but the terminal won't know to change -> to arrow unless you tell it to :p
01:37 <EvanR> can it be done?
01:37 <thang1> sure, I do it in emacs right now
01:37 <thang1> http://i.imgur.com/vjKvkMS.png
01:38 <DrMentats> if anyone is interested in the follow up, apparently some characters in unicode have "ambiguous width", including the arrows. changing the fallback from "narrow" to "wide" in the gnome-terminal fixed it, but also somehow broke greek letters. sigh.
01:38 <EvanR> thang1: i dont see arrows
01:38 <thang1> Every single type?
01:39 acertain joined
01:39 <EvanR> ->
01:39 <thang1> They're a single character. I picked large arrows because I don't like tiny ones (my code is normally the size of the font in my terminal)
01:39 <EvanR> its clearly hyphen greater than
01:39 <EvanR> i want double width non-broken arrows in haskell source code in the terminal!
01:40 <EvanR> and \ should be lambda ;)
01:40 <thang1> http://i.imgur.com/zw1epo0.png
01:40 <thang1> Perfectly possible if your terminal is inside emacs :p
01:40 <DrMentats> EvanR: I second the lambda thing
01:40 <thang1> Otherwise you'll just have to find a terminal that supports unicode text replacement or pretty printing
01:41 <jle`> AaronFriel: nice
01:41 <EvanR> i just realized i could scroll to the right of that giant image, but i still see now arrows anywhere
01:41 <thang1> oooh sorry, my desktop is 3200x1800 pixels lol
01:41 <thang1> The white background code is not mine, that is code I opened up in a web browser to show the difference
01:42 <thang1> My last screenshot shows every single symbol I have defined for dynamic text replacement
01:42 <EvanR> oh
01:42 <thang1> It'll show the replaced symbol when, but will revert to ascii when I place my cursor over the text. Really helpful for LaTeX when I have stuff like \lnot \land \lambda, \epsilon, \Sigma, etc
01:42 <AaronFriel> thang1: why not just use a font like Fira code?
01:43 tlee753 joined
01:43 <thang1> AaronFriel: I do use a font that supports litagures
01:43 <thang1> However just because your font supports something doesn't mean anything happens. You have to tell your text editor to change things for you
01:44 <robertkennedy> With Comonads, why does extend flip the inner arrows but not the outer arrow, and how does that generalize?
01:44 <thang1> otherwise why would it know to replace forall with ∀ ?
01:44 JeanCarloMachado joined
01:44 <EvanR> emacs is an interesting OS!
01:44 w-e-b-s-c-a-l-e joined
01:44 <thang1> EvanR: You can do the same thing in vim too. If anything, vim is even easier because it's had dynamic pretty printing for longer
01:44 <EvanR> well, iterm2
01:45 path[l] joined
01:45 biglambda joined
01:45 <AaronFriel> thang1: http://i.imgur.com/QUznYuL.png
01:45 texasmynsted joined
01:46 <thang1> https://github.com/enomsg/vim-haskellConcealPlus
01:46 jer1 joined
01:46 <thang1> EvanR: see? voila
01:47 <thang1> AaronFriel: what text editor are you using?
01:47 <AaronFriel> VS Code
01:48 <EvanR> some of that codes too far
01:48 cschneid_ joined
01:48 <pacak> javascript. Ugh.
01:48 <EvanR> showing x for *
01:49 <thang1> AaronFriel: VS Code supports ligatures
01:49 <AaronFriel> thang1: http://i.imgur.com/kjlDiEW.png
01:49 <AaronFriel> Is that a question? yes
01:49 <thang1> So your VS Code is simply doing automatically what I did explicitly in my text editor
01:49 baldrick joined
01:49 <EvanR> ah you can disable that
01:49 <AaronFriel> yes
01:49 <thang1> Emacs doesn't do things magically for you because you ask nicely. It does things for you if you program it into the system. I already showed how I have tons of ligitures enabled in my code :p
01:50 <thang1> EvanR: Yes, I can disable any of the symbols and change them however I want to. I can also enable different symbols per language
01:50 <MarcelineVQ> it's time like these I wish editor customization was interesting
01:50 <thang1> For example, if * is always used as multiplication in Haskell, but alawys used as regex in Pearl, I could customize that accordingly.
01:50 <MarcelineVQ> so it'd be easier to participate :>
01:51 robertkennedy joined
01:51 <thang1> Also, AaronFriel why tf is your 'l' loopy, your 's' cursive, and your 'e' weird?
01:51 <AaronFriel> Different fonts
01:52 <thang1> ahh. idk, I'm not a fan of cursive r in typed fonts. Some of those look a little much. If it works for you then all's good :p
01:52 <DrMentats> I'm interested as well, the italic text seems a bit hard to read but it's pretty nice
01:52 carlomagno1 joined
01:52 <thang1> DrMentats: You can have italic text without using the Lobster font lol
01:53 <AaronFriel> It shows up a lot here because there are a lot of types and constructors, in other code you wouldn't see it.
01:53 robkennedy joined
01:53 ddere joined
01:53 <DrMentats> thang1: I used to enable it on comments, but I don't think I'm using italics at all at the moment. maybe should reconsider.
01:54 w-e-b-s-c-a-l-e left
01:54 <thang1> Here's how italics look on my computer: http://i.imgur.com/zw1epo0.png (enabled in the comment "Conversion from ASCII to LaTeX logic symbols"
01:54 <thang1> )
01:54 <thang1> (way bottom right of the image)
01:55 <EvanR> thats the same image over again
01:55 malthe joined
01:55 <thang1> Yeah I re-linked it so nobody had to dig up the url again. It has italics in there so why not? :p
01:55 <EvanR> i didnt see any, this screenshot is so frustrating ;)
01:55 <DrMentats> It's on the very bottom, but half of it is cut off lol
01:56 <thang1> oh whoops
01:56 <thang1> I scrolled down two lines and forgot my screenshot didn't show that
01:56 darlan joined
01:56 <thang1> http://i.imgur.com/SA0erZw.png better? lol
01:57 Xanather joined
01:58 halogenandtoast joined
01:59 <EvanR> haha oh geez the @ sign looks hilarious
01:59 Costar joined
02:00 gothos joined
02:00 <Welkin> thang1: lots of unicode for you https://github.com/copumpkin/categories/blob/master/Graphs/GraphMorphism.agda
02:00 <kadoban> Hm, that font looks familiar. Is that anonymous pro or one of those?
02:00 hucksy_ joined
02:00 bus000 joined
02:00 <EvanR> thats actually pretty light on unicode for agda
02:01 <Welkin> I tried various "code" fonts
02:01 <ReinH> How many levels of equals symbol are you on?
02:01 <Welkin> I still think inconsolata or monaco is good though
02:01 <cheshircat> Is there a way to view type family associated types for types in GHCI? Like, if val implements PersistEntity, can I figure out the type of Unique val (in persistent)
02:01 <EvanR> i was on monaco just before iosevka
02:02 <ReinH> emacs supports ligatures. I use Fira Code. It's great.
02:03 <thang1> oooh yisss
02:03 <thang1> Agda, I wanna get me some of that
02:03 <thang1> kadoban: Pragmata Pro is mine
02:03 <kadoban> I like inconsolata, but is very light on glyphs which is sometimes unfortunate. It barely covers like ANSI or whatever it's called.
02:04 <kadoban> Hmm, I'll have to cehck that out, it looks fairly nice.
02:04 <Welkin> yeah, inconsolata is only ascii
02:04 <thang1> renaming 3-bar-equal-sign to 4-bar-equal-sign lol
02:04 <EvanR> 1-bar equal sign
02:04 <EvanR> 0-bar equal sign, ultimate zen
02:04 <thang1> kadoban: it's way too expensive for normal people. Just use Iosevka
02:04 <Welkin> I forgot to write an entire program using chinese characters
02:05 <Welkin> too bad I still need to prefix the names with a lowercase ascii character in haskell
02:05 <kadoban> Ah, it's not free. Too bad. I'll look that one up too.
02:05 <thang1> Iosevka is a clone of Pragmata Pro :p
02:06 <Welkin> thang1: pragmata pro is 19 euros
02:06 <thang1> For all the ligatures and shiny shit it's like 200 iirc
02:06 <Welkin> thang1: oh, 199 euros
02:06 <kadoban> That looks pretty nice, iosevka
02:06 jer1 joined
02:07 <EvanR> integer math question
02:07 <thang1> I like it a lot. I just use Pragmata Pro because I found it on the internet tbh
02:07 <EvanR> when you use div or quot, you get whats effectively the floor of doing the rational division
02:07 <EvanR> for positive numbers
02:07 <Welkin> I prefer wider fonts
02:07 <EvanR> how do you get the ceil?
02:07 <Welkin> fatter, rounder ones
02:08 <EvanR> without going through actual ceil
02:08 <Welkin> dejavu sans mono is good, or whatever it's called
02:09 <thang1> EvanR: uhh, probably just gonna have to write your own? I don't think the haskell library has anything standard for that and I've never seen it called anything special
02:09 <EvanR> i am doing that... now sort of trying to figure out how
02:10 markus1189 joined
02:10 JeanCarloMachado joined
02:11 markus1199 joined
02:11 <jchia> I have a question about parsers, e.g. megaparsec or some other commonly-used parser packages. Do do parsers natively have the ability to recursively parse into their own string/text/bytestring results? E.g. if my parsing strategy involves first splitting a line with semicolon as a delimiter expecting a fixed number of fields, and then parsing each field (each field may parsed in a different way), can this parsing strategy be expressed directly in a Parsec so
02:11 <DrMentats> wow, I just got iosevka and it really is amazing
02:11 sleffy joined
02:11 <thang1> DrMentats: it's pretty great innit?
02:11 <EvanR> i am impressed so far
02:11 <EvanR> @@@ notwithstanding
02:11 subtlebot joined
02:12 <DrMentats> thang1: I don't even feel like writing code anymore, I just wanna look at it
02:12 <thang1> EvanR: can't you just do rational divison and then take the ceiling? Or are you explicitly trying to avoid taking the ceiling?
02:12 <EvanR> it just seemed out of the way
02:12 reggie_ joined
02:12 <thang1> lol. Take a look at some Agda or something that makes heavy use of unicode. So pretty
02:12 <EvanR> but i see now you can do a divMod check if the remainder is 0, if not add 1 to the quotient
02:13 <thang1> Sure. Totally much less out of the way than doing the division and taking a ceiling of either the remainder or the quotient /s
02:13 jacob joined
02:14 <DrMentats> thang1: I only wish the actual → character had double width in it, but neither iosevka nor fira code solve this problem. oh well, I guess it would look ambiguous otherwise.
02:15 <EvanR> the editor and renderer should do it
02:15 <thang1> yeah, the editor will do it nicely
02:15 <EvanR> we were just talking about that
02:15 splanch joined
02:15 <EvanR> and when you hover over stuff it shows the raw version
02:15 <DrMentats> yes, the ligature works, but I mean the actual unicode thing
02:15 <EvanR> iterm2 has an option "when width is ambiguous, use double width"
02:16 <thang1> The unicode thing is spaced identically to me in emacs... I did a tiny bit of work to do that, though
02:16 <DrMentats> actually, hold on
02:16 <thang1> You won't get the arrow the same in the terminal without messing with your terminal though
02:17 <DrMentats> yeah, I managed to get a good arrow on my terminal by changing the font to Monospace Regular for the time being
02:17 <DrMentats> I mean the unicode arrow, not the ligature of course
02:17 <thang1> ah got it
02:18 <thang1> the ligature replaces the ascii with the unicode arrow :p
02:18 jmcarthur joined
02:18 a3Dman joined
02:18 rcschm joined
02:18 <DrMentats> I'll try dynamically replacing the unicode thing with -> and see if the ligature takes effect then
02:19 <DrMentats> then it's the best of both worlds
02:19 <EvanR> i kinda do want ÷ for div now...
02:19 <EvanR> this is getting addictive
02:19 <DrMentats> EvanR: lol
02:19 <thang1> hah, rice baby rice
02:20 BlueRavenGT joined
02:20 <thang1> Just replaced div :p
02:21 JeanCarloMachado joined
02:22 <EvanR> `div` ?
02:24 nomicflux joined
02:25 hybrid joined
02:26 istvan joined
02:26 <Welkin> what is the best fuzzy-match extension for emacs?
02:27 <Welkin> for finding files
02:27 <thang1> Welkin: all hail the great helm, destroyer of worlds, obtainer of sex from consenting females
02:27 <Welkin> not ido or icicles?
02:28 <thang1> (helm can use tons of shit as its backend, I prefer ripgrep because it's awesome)
02:28 fkurkows1 joined
02:28 <thang1> ido is ok, it's more "pure emacs" which means nothing considering this /text editor/ comes with tetris baked in
02:28 mmachenry joined
02:28 <thang1> never heard of icicles => it's probably useless
02:29 rblaze1 joined
02:29 <thang1> Yeah all icicles does is minibuffer completion and cycling
02:29 <thang1> helm does /everything/
02:29 filterfish joined
02:33 <EvanR> :44
02:33 <EvanR> uhg
02:36 <DrMentats> thang1: is there no ligature for <> in iosevka?
02:37 halogenandtoast joined
02:37 khumba joined
02:39 exferenceBot joined
02:39 e14 joined
02:40 chao-tic joined
02:41 <thang1> You can view the entire characterset here: https://be5invis.github.io/Iosevka/specimen.html
02:42 wedens joined
02:43 mjora7 joined
02:43 guardianJ joined
02:43 <DrMentats> thang1: many of those are not showing up for me at all
02:43 <thang1> All of the glyphs are going to be images in the web browser...
02:43 hexagoxel joined
02:43 <thang1> if it's faint grey, he hasn't implemented it
02:44 <DrMentats> oh that's the actual character set, I meant as a ligature
02:44 path[l] joined
02:44 <thang1> DrMentats: what's your text editor?
02:44 nick123 joined
02:44 <DrMentats> thang1: Atom
02:44 preyalone joined
02:44 butterthebuddha joined
02:44 sellout- joined
02:44 <DrMentats> but that shouldn't be an issue, Fira Code displayed all of its ligatures properly
02:45 <DrMentats> I'm getting ->, ::, and not much else
02:45 <DrMentats> i.e. -> and :: use the ligature, >= for example doesn't
02:46 sleffy joined
02:46 <thang1> https://discuss.atom.io/t/new-ligature-font-support-issue/22189
02:46 <thang1> maybe look at that?
02:47 guardianJ left
02:47 <DrMentats> that used to be an issue in older versions, but it should work nowadays
02:47 <DrMentats> tried applying that fix nonetheless and the results are the same
02:47 <thang1> Weird... no idea why it's not working
02:48 <DrMentats> maybe I downloaded the wrong version
02:49 <DrMentats> actually I seem to be using the wrong ligation set, no idea how to change it though
02:51 <thang1> Hmm, how did you install the font?
02:53 <thang1> You're gonna want the XV00 ligature set
02:53 baldrick joined
02:55 dfordivam joined
02:55 <DrMentats> thang1: yep! XV00 gives me \/ and some others, but I think I'm still missing some
02:56 JeanCarloMachado joined
02:56 flxw joined
02:56 <thang1> weird... Atom should be working with this
02:56 <thang1> https://github.com/be5invis/Iosevka/issues/56
02:57 guardianJ joined
02:58 <thang1> Also, it seems that <> >>= and a few others aren't done yet in the font
02:59 shayan_ joined
02:59 a3Dman joined
03:00 <qmm> is >> pronounced sequence?
03:01 jer1 joined
03:01 baweaver joined
03:01 xcmw joined
03:02 mithrandeer joined
03:02 takle_ joined
03:02 bno1 joined
03:02 jacob joined
03:02 fosterit_ joined
03:02 urodna_ joined
03:03 soniku_ joined
03:03 inr_ joined
03:03 ystael joined
03:03 AntiSpamMeta2 joined
03:03 gehmehge1 joined
03:04 niteria_ joined
03:04 shayan__ joined
03:04 <kadoban> Probably not, since 'sequence' is an actual other thing.
03:04 <kadoban> If I had to give it a name, it'd just be "and then", though that's not perfect.
03:04 bjz joined
03:05 raynold_ joined
03:05 xfix_ joined
03:05 ExpHP_ joined
03:05 Guest6344 joined
03:05 AlainODea_ joined
03:05 <thang1> DrMentats: apparently the font does support >>= but it doesn't support >>, <<, ++, <>, ><
03:05 preyalone_ joined
03:05 avdi_ joined
03:05 feltnerm_ joined
03:06 <EvanR> wait...
03:06 <DrMentats> << and >> do get "tighter" here, not sure if that's considered a ligature
03:06 <EvanR> if i remove the signature it defaults to Integer even though im using it (in another module though) as Word8
03:06 theDon_ joined
03:06 <EvanR> and fails to type check
03:06 plot_ joined
03:06 ec\_ joined
03:07 dmwit joined
03:07 jackhill_ joined
03:07 ipuustin_ joined
03:07 athan_ joined
03:07 <thang1> EvanR: is this the compiler or the linter? :p
03:07 markus1209 joined
03:07 <EvanR> compiler
03:07 platz joined
03:07 platz joined
03:07 bengt__ joined
03:07 pfoetche1 joined
03:07 petercommand joined
03:07 hpc_ joined
03:07 <thang1> Weird...
03:07 avn_ joined
03:08 <MarcelineVQ> give it a signature :>
03:08 <thang1> I got nothing lol
03:08 otto_s_ joined
03:08 ahihi2 joined
03:08 <thang1> I'm guessing the compiler isn't able to dig deep enough to check that you're using something in another module as Word8
03:08 Cthalupa- joined
03:09 cmn joined
03:09 phaji joined
03:09 kvda joined
03:09 trevorri- joined
03:09 watersoul_ joined
03:09 jer1 joined
03:10 glguy_ joined
03:10 tekacs joined
03:10 opi0s joined
03:11 StoneToad_ joined
03:11 kyren joined
03:11 <geekosaur> modules can be compiled separately, so it can't check how you used it in a different module
03:11 scav_ joined
03:11 <geekosaur> (values at least. things that go into the .hi file for inlining can be checked)
03:11 Fairy joined
03:12 <EvanR> yeah yeah
03:12 <EvanR> 16 simple color definitions, turns into 32 lines of code ;)
03:12 <thang1> So if you inlined the other definition, would that work? hmm...
03:12 hust921 joined
03:12 tsani joined
03:12 <EvanR> i was hoping it would be polymorphic
03:12 <EvanR> Num a => V3 a
03:13 jdt joined
03:13 <MarcelineVQ> hmm, you can do something like colorA,colorB,colorC :: Num a => V3 a I think
03:13 mjora7 joined
03:13 <MarcelineVQ> should save a few lines anyway
03:14 <Welkin> better save on character too
03:14 <Welkin> those are expensive
03:14 dogbits joined
03:15 louispan joined
03:15 <thang1> just do colorA,colorB,...color16 all on one line, comment it saying "fuck polymorphism in its almost-useful ass" and hide it in the bottom of the file in shame
03:15 Supersonic112 joined
03:15 <Welkin> even better if you can pack those colors into a single 32-bit integer
03:15 <Welkin> think of all the savings
03:15 ycheng joined
03:16 c0dehero joined
03:16 <dogbits> I've been trying to convert the following function from do notation into monads. Though i'm confused how I'm meant to pass conn into multiple monad execQuery :: String -> [Int] -> IO ()
03:16 <dogbits> execQuery query params = do
03:16 <dogbits> conn <- getDb
03:16 <dogbits> stmt <- liftIO $ prepare conn query
03:16 <dogbits> do liftIO $ execute stmt $ map toSql params
03:16 <dogbits> do liftIO $ commit conn
03:16 <dogbits> do liftIO $ disconnect conn
03:16 <dogbits> return ()
03:16 meba joined
03:16 <Welkin> dogbits: there is no such things as "convert into monads"
03:16 mjora7 joined
03:16 <Welkin> you mean you are trying to desugar do-notation to use explicit bind (>>=)
03:16 <EvanR> Welkin: i'm intentionally not trying to optimize this program to see how fast it is
03:17 <EvanR> without worrying about crap like that
03:17 raid joined
03:17 <Welkin> dogbits: also, don't paste your code in the channel like that, use lpaste instead
03:17 <Welkin> @lpaste
03:17 <lambdabot> Haskell pastebin: http://lpaste.net/
03:18 qz joined
03:18 petermw joined
03:18 <Welkin> dogbits: do notation is desugared as follows:
03:18 augur joined
03:18 felixsch_ joined
03:18 <Welkin> `conn <- getDb` becomes `getDb >>= \conn -> ...`
03:18 <Welkin> you just wrapp subsequent lines in lambdas
03:18 shiona joined
03:18 magthe joined
03:19 srenatus[m]1 joined
03:19 jmiven joined
03:19 JeanCarloMachado joined
03:19 <Welkin> so the next line becomes: `liftIO (prepare conn query) >>= \stmt -> ...`
03:19 bjz joined
03:19 <dogbits> oh so wrap the following bindings using a lamda function?
03:19 Madars joined
03:19 forker joined
03:19 ninedotnine joined
03:19 <EvanR> http://codepad.org/VEPQhhkN
03:19 jluttine joined
03:19 <EvanR> enjoy
03:20 <thang1> EvanR: beautiful
03:20 <EvanR> yes lpaste wasnt responding
03:21 mzf joined
03:21 markasoftware joined
03:21 justanotheruser joined
03:22 ridho joined
03:22 zgotsch joined
03:23 JoshS joined
03:25 systemfault joined
03:25 argent0 joined
03:26 dfranke joined
03:27 debouncer joined
03:27 zgotsch joined
03:28 louispan joined
03:28 guardianJ joined
03:29 <thang1> still a shame we can't make that shorter
03:29 conal joined
03:30 bjz joined
03:31 <EvanR> well
03:31 <EvanR> in the end, type signatures are good
03:31 <EvanR> the main gripe i had was having to type them
03:32 takle joined
03:32 ubsan_ joined
03:33 <EvanR> hehe interesting
03:33 <EvanR> screenW, screenH :: Int
03:33 <dogbits> when I desugered the function it stopped changing the database is this because of laziness. Sorry for pasting code directly in. http://lpaste.net/355174
03:33 <EvanR> (screenW,screenH) = (320,240)
03:33 <EvanR> works
03:35 <glguy> dogbits: Those appear to be equivalent. Also note that the 3 'do's next to liftIO were redundant in the original
03:35 takle_ joined
03:36 <pacak> As well as liftIOs themselves
03:36 <glguy> equivalent assuming 'disconnect conn :: IO ()' which is why you'd be able to omit the 'return ()'
03:36 flatmap13 joined
03:37 <glguy> OHH
03:37 <glguy> no, you have two prepares
03:37 <glguy> and no executes
03:37 JeanCarloMachado joined
03:38 <dogbits> oh shoot
03:39 doomlord joined
03:39 <qmm> given, test :: State Int Int ; test = do { put 3; modify (+1) ; get } ; print $ execState test 0
03:39 <qmm> test returns 4
03:40 <qmm> i am confused what the Int Int is the type signature
03:40 <qmm> in the type signature
03:40 <geekosaur> the first Int is the state, the second is the result
03:40 <geekosaur> :t put
03:40 <lambdabot> MonadState s m => s -> m ()
03:41 <geekosaur> in your example, put :: Int -> State Int ()
03:41 andyo joined
03:42 <geekosaur> not all State actions have the same result type as the state type
03:42 tromp joined
03:43 <Welkin> what is the name of the `get` function for State?
03:43 <Welkin> it should have type State Int Int in this case
03:43 <geekosaur> > let test :: State Int (); test = do { put 3; modify (+1) } in execState test 0
03:43 <lambdabot> 4
03:44 ystael joined
03:44 <geekosaur> you're ignoring the Int result from the final `get` and getting the saved State back instead via execState
03:44 sword865 joined
03:44 <geekosaur> :t get
03:44 <lambdabot> MonadState s m => m s
03:44 <Welkin> oh, it's just `get`
03:45 <EvanR> standard get is part of MonadState the class
03:45 <EvanR> which State implements
03:47 robotroll joined
03:50 <thang1> systemd in haskell
03:50 <thang1> neat
03:50 <Axman6> ...
03:50 <EvanR> i dont believe it
03:50 <LiaoTao> thang1: Just no
03:50 isenmann joined
03:50 <thang1> https://www.seas.upenn.edu/%7Esweirich/papers/systemd-submission.pdf
03:51 <thang1> of course, the d stands for dependent here.... :p
03:52 <thang1> But then they actually do make a System D in the paper, which is glorious
03:52 <* LiaoTao> groans
03:52 <thang1> They replace FC (haskell's core language) with FC, and then create a System D, which is an implicitly typed version of DC
03:53 jer1 joined
03:53 xcmw joined
03:53 <Axman6> don't do these things to me thang1!
03:53 robertkennedy joined
03:53 <Axman6> :)
03:55 <monochrom> Next April 1st, systemd will be rewritten in System D.
03:56 JeanCarloMachado joined
03:56 <pacak> monochrom: In powerpoint because powerpoint is turing complete.
03:59 <robertkennedy> Does every product type allow the sum type to be written inside it? With laziness, it seems like you could construct `P Bool (P a b)` and access it in ways that preserve the invariant. Is there any type which disallows this?
04:00 <EvanR> P Bool (P a b), and you use undefined for the one thats not there?
04:00 DrMentats left
04:00 <EvanR> i guess thats a working implementation of the sum type
04:01 xxalien8dxx joined
04:01 v0latil3 joined
04:02 asthasr joined
04:06 ystael joined
04:08 <EvanR> so supercombinators is a way to compile functional code into low level code
04:08 <EvanR> and isnt really used in GHC?
04:09 JeanCarloMachado joined
04:09 <thang1> lots of neat stuff isn't used in GHC lol. I'm guessing supercombinators aren't used because of type explosion?
04:09 takle joined
04:10 <EvanR> i get the impression theres a better way
04:10 <Hafydd> I read "so supercomputers is a way to compile functional code into low level code", and thought it was a comment about GHC's performance.
04:10 descender joined
04:10 jer1 joined
04:11 <EvanR> yeah at this rate might have to contract NSA to help build hackage packages
04:11 dan_f joined
04:12 drostie joined
04:13 <thang1> hey now, it's not /terrible/
04:13 <Hafydd> Contract NASA: they'll accelerate you to a high speed so that by the time you come your code will have compiled, and you will have aged relatively little.
04:13 leat joined
04:14 <EvanR> now you have me wondering about the implications of time dilation on computer science problem complexity
04:14 soniku joined
04:14 muthafaka joined
04:14 <EvanR> using that technique you could accelerate an exponentional problem into linear!
04:15 <Hafydd> I'm not sure about that...
04:15 <Hafydd> Surely you can only apply a linear factor.
04:16 splanch_ joined
04:16 <EvanR> constant acceleration away from the earth, then back
04:17 TommyC joined
04:17 splanch__ joined
04:17 <Hafydd> Oh, yes, maybe it isn't linear, in light (http://i.imgur.com/MDCBTVL.jpg) of that.
04:17 <nshepperd> you can orbit around a black hole for a bit
04:17 <robertkennedy> No, accelerating makes things compute/age slower.
04:17 <LiaoTao> So just accelerate the rest of the universe
04:17 <EvanR> you accelerate away and come back, to the computer sitting on the earth running normally
04:18 <Hafydd> We're talking about leaving the computer behind.
04:18 <LiaoTao> Problem solved
04:18 <nshepperd> the problem here is that the rest of civilization will have continued while your code was compiling, so it'll be out of date by the time you get to running it
04:18 <robertkennedy> Idk that there's a way to go somewhere and age faster than standing still. Sounds like the opposite of relativity
04:18 <Axman6> but it will get lonely :(
04:18 splanc___ joined
04:18 fosterite joined
04:19 <EvanR> robertkennedy: nothings aging faster here
04:19 Guest69745 joined
04:19 <nshepperd> well, you can go to orbit instead of being on earth
04:19 <nshepperd> then you will run some parts per million faster :)
04:20 roar joined
04:20 <thang1> What you really want to do is you want to isolate the computer inside an inverse blackhole event horizon so that it's isolated from the rest of the universe and time dialation works backwards
04:20 <robertkennedy> The longest spacetime distance from point a to b is the parabola from throwing it
04:20 <EvanR> nshepperd: i wonder if anyone from nasa has used this in a budget meeting to get more money
04:20 <thang1> a co-horizon, if you will :p
04:20 <EvanR> "space station: computers run faster up there"
04:21 <EvanR> robertkennedy: no thats the shortest
04:21 <pacak> aeson, let's simplify a bit. Suppose we have a sum type data Value = Number Int | String Str | Null. Suppose you want to write computations like "intMagic (+) a b", that should return a sum of a and b packed into Number if both a and b are numbers and Null if that's not the case. What kind of abstraction would you use for intMagic?
04:21 <robertkennedy> Oh yeah thanks that makes much more sense.
04:22 chao-tic joined
04:22 <EvanR> pacak: a regular function
04:23 <thang1> (☞゚ヮ゚)☞
04:23 jmcarthur joined
04:23 <nshepperd> it's neither really. it's the extremum of the spacetime metric which doesn't correspond to proper time in any simple way iirc
04:23 <robertkennedy> pacak: parseJSON :: Value -> Maybe Int
04:23 <Welkin> thang1: lol wtf
04:23 <nshepperd> err
04:23 <thang1> ¯\_(ツ)_/¯
04:23 <Welkin> the answer to everything in haskell is: use a function
04:24 <nshepperd> no wait it's the same as proper time
04:24 <robertkennedy> No nshepperd special relativity isn't voodoo
04:24 <EvanR> parabola = GR
04:24 <robertkennedy> Yeah
04:24 v0latil3 joined
04:24 <thang1> GR is pretty standard stuff now, which is great
04:25 <pacak> Welkin: It gets really ugly if you want to replace a vector of numbers somewhere deep inside a value with it's sum.
04:25 v0latil3 joined
04:25 <EvanR> pacak: then you need lenses, or something similar and simpler
04:25 <EvanR> and prisms
04:26 <pacak> robertkennedy: So basically doing computation inside a Maybe monad and dropping results back into Value... Might work.
04:26 <EvanR> field :: Text -> (Value -> Value) -> Object -> Object
04:26 <pacak> EvanR: "[{\"foo\":[1,2,3,4,5],\"bar\":2}]"
04:26 takle joined
04:26 <pacak> replace "foo" key with 15
04:26 <EvanR> ok
04:27 <v0latil3> hello, i have an assignment to remove multiple words in a list from a string. I have a function to remove one word from a string, and I am lead to believe that I can use foldl to do this. I do not understand this though, does not foldl only do a function on two items in a list?
04:27 fluffystub joined
04:27 <pacak> :t foldl
04:27 <lambdabot> Foldable t => (b -> a -> b) -> b -> t a -> b
04:27 <pacak> Hmm...
04:27 <pacak> :t List.foldl
04:27 <lambdabot> error:
04:27 <lambdabot> Not in scope: ‘List.foldl’
04:27 <lambdabot> No module named ‘List’ is imported.
04:27 <pacak> @import Data.List
04:27 <lambdabot> Unknown command, try @list
04:27 <pacak> O_o
04:27 <thang1> lol
04:28 <thang1> :t L.fold
04:28 v0id_NULL joined
04:28 <lambdabot> error:
04:28 <lambdabot> Not in scope: ‘L.fold’
04:28 <lambdabot> Perhaps you meant one of these:
04:28 <thang1> :t L.foldl
04:28 <lambdabot> error:
04:28 <lambdabot> Not in scope: ‘L.foldl’
04:28 <lambdabot> Perhaps you meant one of these:
04:28 <thang1> ಠ_ಠ
04:28 <pacak> Mwahahaha
04:28 <robertkennedy> pacak: more, just do the conversion one time. Like `magicPlusInt v1 v2 = (+) <$> parseJSON v1 <*> parseJSON v2`
04:28 <pacak> :t foldl :: (b -> a -> b) -> b -> [a] -> b
04:28 <lambdabot> (b -> a -> b) -> b -> [a] -> b
04:28 <pacak> Ha!
04:29 <v0latil3> :t Data.Foldable.foldl
04:29 <lambdabot> Foldable t => (b -> a -> b) -> b -> t a -> b
04:29 <thang1> pacak: that's stupid
04:29 <pacak> :t Data.List.foldl
04:29 <lambdabot> Foldable t => (b -> a -> b) -> b -> t a -> b
04:29 <pacak> v0latil3: Do you know what a Foldable is?
04:30 <v0latil3> pacak: I believe so, but maybe not too well. I don't think I could explain it well
04:31 <pacak> robertkennedy: I have a bigass Value and I want to operate on it without knowing what's inside and without actually decoding it, result should also be a Value
04:31 <pacak> :t filter
04:31 <lambdabot> (a -> Bool) -> [a] -> [a]
04:31 <robertkennedy> remove badwords s = unwords [word | word <- words s, not (word `elem` badwords)]
04:31 JeanCarloMachado joined
04:31 thunderrd joined
04:31 pungi-man joined
04:31 mjora7 joined
04:32 <thang1> v0latil3: Foldable means that you can fold over it
04:32 <thang1> that is, you can consume something one at a time and eat up the entire data structure
04:32 <pacak> :t foldl _ [1..10] [2,5]
04:32 <lambdabot> error:
04:32 <lambdabot> • Found hole: _ :: [t] -> Integer -> [t]
04:32 <lambdabot> Where: ‘t’ is a rigid type variable bound by
04:32 <v0latil3> mine goes like remWord word str = unwords $ filter ((/=) word) $ words str
04:32 tromp joined
04:32 <thang1> or, (insert handwaving) it "behaves like a list" when you run fold on it
04:32 <pacak> :t foldl (\string badint -> filter (/= badint) string) [1..10] [2,5]
04:32 <lambdabot> (Enum a, Num a, Eq a) => [a]
04:32 jer1 joined
04:32 <pacak> foldl (\string badint -> filter (/= badint) string) [1..10] [2,5]
04:33 <pacak> > foldl (\string badint -> filter (/= badint) string) [1..10] [2,5]
04:33 <lambdabot> [1,3,4,6,7,8,9,10]
04:33 <pacak> v0latil3: Something like this
04:33 <robertkennedy> pacak: it's probably small enough to fit in memory, given that aeson has strict structures. Doing something like `sum <$> mapMaybe parseJSON vs` is nice with this abstraction (mapMaybe would filter non ints)
04:33 <pacak> (that's not terribly efficient)
04:34 <v0latil3> I was trying this - remWords file = foldl (\w _-> remWord w str) ws
04:34 <v0latil3> 36 where
04:34 <EvanR> pacak: check out lens-aeson
04:34 <v0latil3> 37 ws = words $ head $ lines file
04:34 <v0latil3> 38 str = unlines $ tail $ lines file
04:34 <v0latil3> but the function i gave is wrong for sure
04:34 takle joined
04:34 <thang1> v0latil3: don't paste multiline stuff into the IRC. Use the lpaste
04:34 <v0latil3> I think I need to change that function and use the 3 parameter foldl
04:34 <EvanR> if lpaste is working
04:34 <EvanR> if its not, dont use pastebin please
04:34 <EvanR> find another
04:34 <v0latil3> thang1: sorry I thought 4 lines would be ok
04:35 <thang1> It's fine. It's more so you don't get triggered as a spam bot (which any super rapid line enter tends to do)
04:36 <thang1> (and also because pasting 4 lines of code over and over fills up the chat way too quickly)
04:36 <v0latil3> https://hastebin.com/orimihofep.sm
04:36 <robertkennedy> v0latil3: looks like your strategy passes through `words str` many times, yeah?
04:36 <pacak> EvanR: I did. It's not that helpful for some reason. Maybe my lens-fu is lacking.
04:36 brynedwards joined
04:37 <v0latil3> robertkennedy: it removes the words from the first line of the file from the rest of the file thats what is in the "where"
04:37 <EvanR> i havent really groked full lens yet, but the type (b -> b) -> a -> a can go a long way
04:37 uglyfigurine joined
04:39 <robertkennedy> I know it's functionality, I'm observing it's implementation. But I see your error now, I think
04:40 <pacak> EvanR: It totally can, but... Say there's _Array :: Prism' Value (Vector Value). How do I use it to say "replace Array with Number sum of it's numbers, replace it with Null if it's not an Array.
04:40 <thang1> Also, v0latil3... your remWord function removes all instances of the word from a string
04:40 <robertkennedy> v0latil3: your `foldl` function needs three arguments: `foldl f acc xs`. In particular, your acc input needs to be an acceptable output (in case there were no badwords)
04:41 JeanCarloMachado joined
04:41 <v0latil3> thang1: yeah its supposed to do that!
04:42 <thang1> So what's remWords doing?
04:42 <v0latil3> removing all the words on the first line of the file from the rest of it
04:42 <EvanR> pacak: i honestly dont know how, but I know theres some easy way
04:42 <EvanR> classical existence
04:42 <thang1> ahh, okay
04:43 <thang1> Right now your remWords is taking in one single massive string as the entire file
04:43 <robertkennedy> so when you choose foldl, you can fill in some pieces: `remWords file = foldl (\str' word -> _) str badwords`
04:43 <v0latil3> thang1: yes
04:44 <robertkennedy> But you see, it will loop through the entire file once for every bad word!
04:44 jer1 joined
04:44 louispan joined
04:45 nick123 joined
04:45 <thang1> oooh wow, I think I see what it's doing now
04:45 <v0latil3> assignment is to use foldl with my single remword though :/
04:46 <robertkennedy> Maybe do `foldr (\word -> if word `elem` badwords then id else (word :)) [] (words str)`. I still think list comprehension was made for this
04:47 <thang1> (word :) [] (words str)?
04:47 AaronFriel joined
04:47 <v0latil3> yeah i dont get how this application is "foldable"
04:47 <Axman6> pacak: want a hand with lens-aeson?
04:47 <thang1> Sure that works, but man does it look terrible
04:48 muthafaka joined
04:49 <Lokathor> so if a package won't build on a platform, but it cites a LLVM issue as the compile process crashes
04:49 <Lokathor> who do i tell
04:49 <pacak> Axman6: More like lens-fu in general.
04:49 <thang1> you need a function, the accumulation you're returning, and the data structure you're folding
04:49 <robertkennedy> thang1: you're missing a crucial parenthesis. The pattern is `if p x then (x:) else id`, which is just filter.
04:49 <pacak> Axman6: How do I use it to say "replace Array with Number sum of it's numbers, replace it with Null if it's not an Array or elements are not numbers"?
04:49 rkazak joined
04:50 xcmw joined
04:50 <thang1> In my mind, the first thing I think of is I should be operating on a "list" where I apply the function to every thing in it and accumulate the result
04:50 <MarcelineVQ> Lokathor: good question, step 1 is to make sure the llvm you have is a compatable version for the ghc you have
04:51 <MarcelineVQ> step 2 is ???
04:51 <thang1> The function here is to remove the bad words (statically known) per every line. If you have 1 or less lines, return the empty list
04:51 <v0latil3> thang1: yeah there is 2 data structures though
04:51 <Lokathor> MarcelineVQ, I have GHC 8.0.2 and LLVM 3.7, which i think is the correct match
04:52 <Lokathor> i will have it produce the error message again, which will take a bit for it to fail
04:53 <robertkennedy> pacak: `toJSON $ parseJSON v >>= fmap sum . mapM parseJSON`
04:53 <EvanR> certain first get the Value
04:53 <EvanR> but you shouldnt need to continually parseJSON and rewrap it
04:53 <EvanR> thats the point of the lenses
04:54 muthafaka left
04:54 <glguy> Lenses aren't really going to help you do this "if array then this, else that" logic
04:54 <thang1> ahh I see why my intuition is failing now. You can't operate line by line because remword doesn't take multiple words to remove
04:54 baldrick joined
04:54 <v0latil3> yeah
04:54 nick123 joined
04:54 <thang1> Does it have to accept only one word as input?
04:55 <v0latil3> it would be way easier to basically do remwords and filter with a function that checks each word it it is in the badwords list
04:55 BartAdv joined
04:55 <EvanR> you can write a lens that acts on an Array of Numbers if thats what it is, or another way if its not
04:55 <robertkennedy> Yeah exactly
04:55 <EvanR> and combine them with the standard accessors for aeson
04:55 <thang1> ¯\_(ツ)_/¯ chalk it up to stupid professors
04:56 <EvanR> i mean, lens-aeson
04:56 <v0latil3> thang1: http://i.imgur.com/5EFxyZh.png
04:56 <thang1> I dislike programs that are designed to be coded in a weird way in order to expand your brain. Out of the millions of ways to get you to think creatively in haskell, writing a list-comprehension/filtering problem in a foldl isn't a great one :p
04:56 <glguy> pacak: You can do this, however: sumOf (values . _Number) :: Value -> Scientific
04:57 <glguy> has _Array :: Value -> Bool
04:57 <v0latil3> thang1: it isnt super specific with the remword but it needs to use filter and foldl
04:57 <v0latil3> yeah lol
04:57 <EvanR> foldl???
04:57 debouncer joined
04:57 <thang1> yeah it has to be foldl...
04:57 dedicated joined
04:57 <thang1> "let's run a strict function on a potentially infinite data structure. What the fuck could go wrong?"
04:58 <pacak> http://lpaste.net/355178 - I made this
04:58 ubsan_ joined
04:58 <EvanR> this seems the totally wrong way to do it
04:58 <EvanR> maybe its a challenge question
04:58 <thang1> I dislike stupid challenges
04:58 <MarcelineVQ> what's the full wording of the exercise
04:58 <thang1> filling a swimming pool using a teacup is a challenge, but it teaches you nothing useful
04:58 <thang1> http://i.imgur.com/5EFxyZh.png <-- he just posted it
04:59 <pacak> robertkennedy: Your version looks like it should work but throws a bunch of type errors for some reason.
04:59 takle joined
04:59 <robertkennedy> EvanR: hmmm I can see why in the specific case of `toJSON . fmap sum $ parseJSON v >>= mapM parseJSON` looks promising. Bit every time I look up a lens I feel like that exercise is as difficult as writing the special decoded
04:59 ubsan_ joined
04:59 splanch joined
04:59 zacts joined
05:00 <robertkennedy> pacak: sorry, I was using `parseJSON :: Value -> m Value`. You'll want to write a wrapper function, or fromJSON may look, I'll check
05:00 <EvanR> robertkennedy: was just saying, probably shouldnt be thinking of json as a string to solve this problem, its a trivial part of the process to separate out
05:00 <pacak> glguy: sumOf is nice, but sum is just an example, my goal is to use some statistical operations. Not sure if it's easy to describe them as a monoid
05:01 eklavya joined
05:01 <pacak> robertkennedy: I have a rough idea how to implement it, was curious if there's a better approach.
05:02 <asthasr> depends on the statistical operation, right?
05:02 <MarcelineVQ> Huh, that's quite odd. Why foldl is even mentioned when this can be done with filter alone :(
05:02 <asthasr> arithmetic mean could be described as a monoid, for example
05:02 JeanCarloMachado joined
05:02 <robertkennedy> EvanR: that's the point of the refactor I'm aiming at: separate parsing the JSON, summing, and encoding, so you can easily change to encoding to SQL or BSON or whatever
05:02 <v0latil3> MarcelineVQ: yeah I'm not really sure
05:03 alien8 joined
05:03 fosterit_ joined
05:03 <MarcelineVQ> and it reccomends using head, this text is either quite old or misguided, not that that observation is especially helpful
05:03 drcode joined
05:04 <EvanR> robertkennedy: the point of this exercise is how to manipulate json data
05:04 <MarcelineVQ> v0latil3: were you able to cobble something together from the suggestions given so far?
05:04 <asthasr> pacak: https://twdkz.wordpress.com/2013/05/31/data-analysis-with-monoids/
05:04 takle joined
05:04 _sg joined
05:05 hamishmack joined
05:05 dec0n joined
05:06 <pacak> asthasr: There's a nice package called statistics that does stuff I want, I just need to figure out how to apply it to parts of a huge json Value I have in memory. Post looks interesting, I'll check it out anyway.
05:06 <robertkennedy> :t \v -> (\r -> case r of {Result r -> Number r; Error e -> Null}) . fmap sum $ parseJSON v >>= mapM parseJSON
05:06 <lambdabot> error: Not in scope: data constructor ‘Result’
05:06 <lambdabot> error:
05:06 <lambdabot> Not in scope: data constructor ‘Error’
05:06 <asthasr> pacak: fair enough, just thought you might find it interesting :)
05:07 v0latil3 joined
05:07 <EvanR> i dont think parseJSON should be involved anywhere in this solution, assume you have a Value
05:08 sgronblo joined
05:08 <pacak> EvanR: It can be used, it can for example take Value and return Maybe (Vector Double)
05:09 louispan joined
05:09 eklavya_ joined
05:10 <cocreature> parseJSON is exactly for converting Value to something else so saying that it shouldn’t be involved if you have a Value seems weird
05:10 <robertkennedy> Replace parseJSON with fromJSON in there and it type checks a o k
05:10 <EvanR> sounds like you want a Prism' Value (Vector Double)
05:11 <pacak> EvanR: Hmm... Right.
05:11 rcschm joined
05:11 <EvanR> yeah i misinterpreted robertkennedy parsing strings, not doing json parser monad
05:12 eklavya__ joined
05:12 jer1 joined
05:12 drcode joined
05:12 insitu joined
05:12 S11001001 joined
05:13 <Axman6> pacak: sorry I got pulled away to some work, sounds like what you wanted is possible though
05:13 wedens joined
05:13 cansis joined
05:13 mkurkov_ joined
05:13 shans_ joined
05:13 <Lokathor> MarcelineVQ, here we go http://lpaste.net/355179
05:13 zpconn__________ joined
05:13 bigs joined
05:13 ikke joined
05:14 <glguy> pacak: It would help to have an example of an operation you're trying to apply to the JSON file
05:15 abhixec joined
05:15 <pacak> glguy: [{\"foo\":[1,2,3,4,5],\"bar\":2}]" - perform Operation of type Vector Double -> Value on [1..5]
05:15 robatosan joined
05:15 soniku joined
05:16 filterfish joined
05:16 osa1 joined
05:16 osa1 joined
05:16 <pacak> Or replace it with Null (whole result or specifically foo key if it's not a Vector Double
05:16 <MarcelineVQ> Lokathor: is this under 64bit windows?
05:17 <MarcelineVQ> well sily question I see the pi up there
05:17 <Lokathor> MarcelineVQ, this is under Linux on a Raspberry Pi
05:17 <Lokathor> "Raspbian", which is debian ARMHF with some funny drivers thrown in basically
05:17 <glguy> over (values . key "foo") :: (Value -> Value) -> Value -> Value, this applies a function to the Value [1..5]
05:18 takle joined
05:18 <glguy> You'll need to build a Value -> Value next that has the behavior of either applying Vector Double -> Value or returning Null
05:19 <pacak> glguy: Is there a nice way of building such a function? (anything better than http://lpaste.net/355178) ?
05:20 <pacak> Alternatively is there a way to compose _Foo :: Prism' Value (Vector Double) ?
05:21 <MarcelineVQ> Lokathor: hmm I think you're gonna want to ask in #ghc or the ghc mailing list due to arm being, afaik, a work in progress or there may be some special flag to give to the llvm optomiser on arm arch
05:22 <Lokathor> ah, no biggie if it won't run on the pi, that's only for the benchmark stuff anyway. the main lib is fine without aeson
05:22 andyhuzhill joined
05:22 vlatkoB joined
05:22 <MarcelineVQ> well it may which is why I'd suggest askin aroundf
05:24 <glguy> preview (_Array . below _Number) :: Value -> Maybe (Vector Scientific)
05:24 <glguy> (making progress)
05:24 nick123 joined
05:25 <pacak> glguy: There's _Double...
05:25 <pacak> _Array . below _Double
05:25 <pacak> this works
05:25 <* pacak> goes to read on below
05:25 takle joined
05:25 JeanCarloMachado joined
05:26 nick123_ joined
05:26 sleffy joined
05:26 danvet joined
05:26 <Axman6> :t below
05:26 <lambdabot> (Applicative f, Choice p, Traversable f1) => APrism' s a -> p (f1 a) (f (f1 a)) -> p (f1 s) (f (f1 s))
05:26 <MarcelineVQ> Lokathor: ask orion if he got arm working on his pi or if bgamari can point you at a standard build process of some kind
05:26 filterfish joined
05:27 <glguy> pacak: previews (_Array . below _Double) :: (Vector Double -> a) -> Value -> Maybe a
05:27 <MarcelineVQ> *ghc working on his pi
05:27 subttle joined
05:27 <pacak> :t previews
05:27 <lambdabot> MonadReader s m => Getting (First r) s a -> (a -> r) -> m (Maybe r)
05:27 <pacak> :t preview
05:27 <lambdabot> MonadReader s m => Getting (First a) s a -> m (Maybe a)
05:27 <MarcelineVQ> angerman could know what's up too, I think he works on cross-compiling at least
05:27 <EvanR> youre trying to run ghc on the pi, or cross compile somehow?
05:28 <angerman> wat?
05:28 <MarcelineVQ> mm, did I​ mix names up? :>
05:29 jer1 joined
05:30 mda1 joined
05:31 <MarcelineVQ> does TH work on arm?
05:33 MP2E joined
05:33 <glguy> MarcelineVQ: seems to
05:33 andyhuzhill joined
05:34 <MarcelineVQ> guess it's not that then, seemed likely with aeson
05:34 <glguy> It works on my Rpi3 at least
05:34 JeanCarloMachado joined
05:35 mmachenry joined
05:35 <sophiag> performance question: i was going through a tutorial recently on using rules to implement fusion (i'm trying to get a better understanding for space complexity) and noticed there was no difference in performance when testing with criterion. is this because: a) GHC already does this on its own now? b) optimizations don't work in GHCi, c) it only affects memory usage and not speed, or d) ??
05:36 osa1_ joined
05:36 <angerman> MarcelineVQ: yes it does. You can use TH with CC for iOS and Android. Limited though.
05:36 <Axman6> possibly the second (actually possibly all). I would only compare performance of compiled code
05:36 <nshepperd_> Mostly b, i think
05:36 <angerman> MarcelineVQ: and to be fair not all diffs are landed yet. So you'll need to use my custom branch.
05:37 <nshepperd_> Isn't ghci interpreted
05:37 <pacak> sophiag: Are you compiling with optimizations?
05:37 <sophiag> pacak: it seems we've determined it's GHCi
05:37 <thang1> GHCI is interpreted, yes
05:37 drcode joined
05:37 <* angerman> would call GHCi partially interpreted.
05:38 <EvanR> i thought you could run optimized binary code from ghci
05:38 <sophiag> but this tutorial was from 2007 so i was wondering whether GHC performed fusion in some cases automagically since then
05:38 ubsan_ joined
05:38 <angerman> EvanR: yes, -fobject-code. GHCi can load object code, which can be optimized.
05:38 <Axman6> yeah GHCi is a bit more compiled than fully interpreted, but doesn't fully compile things IIRC
05:38 Xanather joined
05:39 <angerman> I don't think it will compile anything you provide to it via the repl. However loading modules when available as object code should work, I believe.
05:39 <angerman> MarcelineVQ: for whom were you asking anyway?
05:39 andyhuzhill joined
05:40 Maxou joined
05:40 <MarcelineVQ> angerman: myself and Lokathor, though he seems to have things in a running state it's just also failing halfway through, http://lpaste.net/355179
05:40 takle joined
05:41 xtreak joined
05:41 <angerman> MarcelineVQ: ohh, but that doesn't look like cross compiling. That looks like an arm-ghc (e.g. a cross compiled ghc, not a cross compiling ghc (host -> target, host != target))
05:42 uglyfigu_ joined
05:42 <angerman> With the former, I have no experience. All I'm doing is the latter. E.g. cross compiling from x86_64 -> armv7
05:43 <EvanR> and that works fine?
05:43 <angerman> for iOS and Android, with my patches... and GHCSlaves... I can compile lense just fine :-)
05:43 ogrady joined
05:44 <EvanR> oi
05:44 <MarcelineVQ> aha alrighty, I thought maybe you had an idea about it due to the breadth of considerations one needs for cc. sorry to have interrupted you :>
05:44 <angerman> I don't have an rPi slave though... more to come on zw3rk's medium page over the next few weeks.
05:45 <angerman> (there was a reason, I posted the building libiconv yesterday :D)
05:47 <MarcelineVQ> EvanR: who are you asking?
05:47 liste joined
05:48 <angerman> EvanR: looking at your crashlog, could it be that your rPi is out of memory during opt?
05:48 liste joined
05:48 <EvanR> i do have a raspberry pi and am planning on running haskell programs on it, but i wasnt actually asking about that today
05:49 <EvanR> somebody else was
05:49 <MarcelineVQ> it's Lokathor's, that's a good thing to check though
05:49 redpoppies joined
05:49 <EvanR> i was just curious to what extent all these shenanigans are in working order right now
05:49 <EvanR> seems like prospects are good
05:50 <angerman> EvanR: https://github.com/zw3rk/ghc-build-scripts/blob/master/build-mobile-ghcs, https://github.com/angerman/ghc/tree/my-ghc
05:50 fowlslegs joined
05:50 JeanCarloMachado joined
05:51 <angerman> EvanR: the latter repo is force-pushed periodically upon rebasing open diffs onto a recent ghc-head.
05:51 Koterpillar joined
05:51 jer1 joined
05:51 <angerman> EvanR: you can see the current set of diffs in https://github.com/angerman/ghc/commit/d8ee928d21fb9ca06d982de9ad161da1162b3748; I usually put the D<NNN> number into the branch names.
05:51 <EvanR> so thats a fork of ghc to cross compile for phones?
05:52 <angerman> it's ghc-head + a few open diffs applied.
05:52 <angerman> just for convenience. You could equally well, just pull ghc-head, and then `arc patch` all those diffs atop.
05:53 <EvanR> this is the recommended way to compile for pi?
05:53 <angerman> EvanR: it's also not just for phones. I'm just testing it on iOS and Android. Raspberry Pi should work fairly well I believe.
05:55 <angerman> However if you want TH support, you'd need some form of https://github.com/zw3rk/ghc-slave, which is essnetially just something like https://github.com/zw3rk/ghc-slave/blob/master/iOS/GHCSlave/GHCSlave/main.m (wrapping the iserv-slave).
05:55 <Lokathor> angerman, that output is a GHC on a raspberry pi trying to compile for raspberry pi
05:55 baldrick joined
05:55 <angerman> Lokathor: yea, as I said, it looks like it's a cross compiled ghc, not a cross compiling ghc.
05:55 <Lokathor> well the GHC came from stack's auto-downloader, so i don't know where the GHC itself was compiled from, i guess
05:56 <angerman> Lokathor: and the error looks like opt ran out of memory.
05:56 <Lokathor> it also takes ages and ages and ages to error out
05:56 <Lokathor> like, more than 10 minutes i think
05:56 <EvanR> is it using SD card for swap?
05:56 <Lokathor> probably
05:56 <Lokathor> let me check
05:56 <EvanR> that sounds crazy
05:56 jbgi joined
05:56 <* angerman> firmly believes that we want cross compilation for low powered and small devices.
05:57 paolino joined
05:57 <angerman> (which is why I'm trying to improve on that ;-))
05:57 <angerman> I consider ghc on my i7 slow already. But ymmv I guess.
05:57 <Lokathor> http://lpaste.net/355180
05:58 <angerman> if someone wants to try cross compiling to raspberry pi, with the my branch, be my guest, I'll try to help where I can. If someone wants to write a ghc-slave for rpi, I'd also be glad to help :)
05:59 <Lokathor> hmm, what if i pay you 35 dollars and you just buy a raspberry pi
05:59 <EvanR> whats a ghc-slave
05:59 <orion> Lokathor: It's nearly impossible to compile anything on a Raspberry Pi because of its memory constraints.
05:59 <thang1> Isn't that something that just automatically builds and runs on a target platform?
06:00 tromp joined
06:00 <Lokathor> orion, actually i have had only a few things that crash out from OOM in my time poking at haskell on rpi
06:00 jchia joined
06:00 takle joined
06:00 yellowj joined
06:01 <orion> Lokathor: I am unable to compile GHC on a RPi.
06:01 <angerman> Lokathor: I have a rpi here... not just one :)
06:02 <Lokathor> well, first, are you talking about rpi1 or rpi2/3? because the 2 and 3 have a WHOLE gig of ram
06:02 <orion> 3
06:02 <Lokathor> ah, hmm
06:02 <Lokathor> i admit that i've never tried to build GHC itself
06:02 <orion> Compiling GHC requires many GB of memory.
06:02 <Lokathor> always obtained a provided binary
06:02 hurkan joined
06:02 <angerman> EvanR: ghc-slave, is essentially a wrapper around iserv. ghc can with -fexternal-interpreter compile interpreted code in a secondary process. (Similar to how ghcjs compiles TH via the Out of Process TH solution).
06:02 <MarcelineVQ> EvanR, thang1: it's for compiling splices and possibly running alternative rts for a process that needs them, ghci does this currently with -fexternal-interpreter I think
06:02 <MarcelineVQ> oop :X
06:03 <thang1> ahh okay, yeah that seems pretty advanced :p
06:03 <orion> And I can't use a cross-compiled version of GHC because TemplateHaskell is disabled in those versions, which makes GHC basically useless for any real-world projects.
06:03 <angerman> EvanR: so effectively you point ghc, to an iserv-proxy, which then transmits the data to a slave on the target machine.
06:03 <Lokathor> so, can GHC stop at the LLVM code step? and just dump all that into a file and pass it off to another machine and have the LLVM on that machine finish the compile?
06:03 <angerman> orion: I got you covered :p
06:03 <Lokathor> (assuming you use the LLVM path)
06:04 <angerman> Well theoretically, yes.
06:04 dfordivam joined
06:04 <angerman> there is -fkeep-llvm-files and -fkeep-tmp-files I believe.
06:04 andyhuzhill joined
06:04 <angerman> I'm not sure if you can feed them trivially back into ghc though.
06:04 <Lokathor> would that reduce the maximum memory needed at once? or does the maxmimum memory use come from LLVM itself?
06:05 <orion> angerman: I figured out how to build native ARM binaries on x86_64.
06:05 henriksod joined
06:05 <angerman> orion: :-)
06:05 <Lokathor> orion, what do you need template haskell for in your projects?
06:05 <orion> Lokathor: I
06:05 robatosan joined
06:06 <orion> Lokathor: TH is required for dependencies of my project.
06:06 <angerman> Lokathor: well. I don't know the constraints, but it looks like the `opt` command, which ghc invokes is at issue. And well, ghc might be taking away most of the memory already... but honestly, this is all just guess work.
06:06 <angerman> orion: I know there are evil splicer, zeroth appraoches. It's all nasty :)
06:06 mjora7 joined
06:07 <thang1> Hmm...
06:07 <orion> angerman: I use qemu-user-static and Docker: https://github.com/centromere/ghc-arm
06:07 <thang1> Can you just open up your rpi, wire in 16GB of ram temporarily, and then after compiling take the ram out?
06:07 <Lokathor> thang1, nope, the firmware can't address RAM above 1gb
06:08 <suzu> add 16 gigs of swap?
06:08 <angerman> orion: yea, that one works as well, on linux only though.
06:08 <thang1> ^ the swap idea sounds great
06:08 <Lokathor> the rpi is /actually/ a GPU with a CPU strapped on, rather than the other way around, so it's got a weird memory limit
06:08 jer1 joined
06:08 <monochrom> :)
06:08 eatman joined
06:08 <thang1> oooh that makes sense
06:08 <angerman> orion: I can do: aarch64-none-linux-android-ghc Fib.hs Counter.hs -threaded -outputdir build/arm64-android -stubdir . -fexternal-interpreter -pgmi /Users/angerman/.cabal/bin/iserv-proxy -opti10.0.1.37 -opti5000 :D
06:08 <thang1> Either way, I'm thinking that the easiest way to compile GHC on limited hardware is to bypass the hardware limti temporarily :p
06:09 <angerman> orion: where Counter.hs uses TH, and Fib.hs defines functions used in splices in Counter.hs :D
06:10 <EvanR> cross compiling makes way more sense, sorry people who want to run ghc on an arduino ;)
06:11 takuan joined
06:11 fosterite joined
06:11 <thang1> But... what about my pocket calculator?
06:11 yoneda joined
06:12 <Lokathor> rpi does well with Rust and Erlang
06:12 <thang1> If I can't run GHC on my TI, how am I supposed to be productive when I procrastinate during math class?
06:12 <Lokathor> not haskell :/
06:12 <Lokathor> elixir also seems like an interesting prospect
06:13 <EvanR> compiling on pi right. but i imagine finished compiled haskell binaries run fine?
06:13 JeanCarloMachado joined
06:14 plot joined
06:14 <Lokathor> as long as they don't touch the disk :P
06:15 <Lokathor> because "disk" is "sd card"
06:15 <EvanR> im fine with that
06:15 <Lokathor> irc bot or whatever is workable
06:15 <EvanR> does the linux avoid that?
06:15 hamishmack joined
06:15 <EvanR> id be more worried about linux distro taking liberties with disk
06:16 <orion> EvanR: Running a pre-built GHC on the RPi doesn't help with the memory issue.
06:16 <Lokathor> it's not too bad. i used it with emacs as a desktop replacement for a few days earlier this year because my main computer's drive burned out
06:16 <EvanR> orion: why would you? cross compile
06:16 <thang1> with emacs?
06:17 <thang1> Did that help you remember why emacs used to stand for Eight Megs And Constantly Swapping? :p
06:17 <orion> EvanR: Cross-compiling is useless because the resulting GHC doesn't have TemplateHaskell.
06:17 <EvanR> eh?
06:17 <EvanR> resulting GHC
06:17 <EvanR> cross compile the actual program
06:17 <EvanR> i am not interesting in developing or compiling ghc
06:17 <orion> You can't cross-compile and use TH at the same time.
06:18 <Lokathor> thang1, it wasn't too bad as a rust IDE
06:18 <EvanR> are you sure or are we misunderstanding again
06:18 <orion> EvanR: I am 100% sure that if GHC is running on x86_64 and it's trying to build an ARM binary, TemplateHaskell will absolutely not work.
06:19 <EvanR> thats bad
06:19 <cocreature> orion: I am pretty sure angerman is working on fixing that or even has fixed it already :)
06:19 <Lokathor> that sounds dumb
06:20 <angerman> orion: cocreature is right. TH *will* work via ghc-slave.
06:20 andyhuzhill1 joined
06:20 <Lokathor> it's all Core when it compiles down, right? the final target being here or there shouldn't affect your ability to get to the "i have a core file" step using TH
06:20 edsko joined
06:20 <angerman> orion: in fact it *does* work.
06:20 <EvanR> right i must be misunderstanding where TH comes into this picture
06:21 <EvanR> should be finished way before code gen
06:21 shangxiao joined
06:21 takle joined
06:21 <angerman> Though, to be fair, for File IO and Process IO, only embedFile and other one way File IO (host -> target) that uses AddDependentFile through TH does work.
06:21 <orion> EvanR: When you use TH, you compile *and run* code during the overall compilation process.
06:22 <EvanR> but the running code has to be compiled ?
06:22 <EvanR> rather than interpreted
06:22 louispan joined
06:22 <orion> EvanR: It's explained here: https://ghc.haskell.org/trac/ghc/wiki/TemplateHaskell/CrossCompilation
06:22 <angerman> EvanR: what happens is that you code ses TH splices. These in turn can call arbitrary haskell functions, (which in turn can call C funtions via FFI, or doe all kinds of werid stuff).
06:23 Mortomes|Work joined
06:23 <angerman> EvanR: now, a cross compiler can only compile code for the target, thus if you compile the code that the TH splice uses, it ends up being the wrong format. As it can't be executed on the host.
06:24 uglyfigurine joined
06:24 <angerman> EvanR: this then leads to the dilemma where you can't have TH in cross compilers (until quite recently; and not even all patches are in upsteam ghc), so it's likely going to be ghc 8.4, that supports this first.
06:24 takle_ joined
06:25 <angerman> EvanR: Anyway. GHCJS is a cross compiler by nature (compiling to javascript). And ghcjs pioneered the out of process template haskell solution. Which evaluates the splice on the target. (e.g. it ships the libraries to the target, and runs the splice there; then ships the result of the splice back).
06:25 conal joined
06:26 <angerman> For some time now we have `-fexternal-interpreter` which allows ghc, to evaluate interpreted code though a separate process. This is called iserv, and was inspired what luite did in ghcjs.
06:26 quchen joined
06:26 <angerman> End of last year, Shea Levy lifted many of the hardcoded #ifdef GHCI elements from ghc, to allow `-fexternal-interpreter` in stage1 cross compilers.
06:27 JeanCarloMachado joined
06:27 debouncer joined
06:27 <angerman> Since sometime in January, I have added linker for aarch46/mach-o, and aarch64/elf, as well as improved the armv7/elf linker. This now allows the GHC runtime to load and link object files for these architectures.
06:28 <angerman> That was a necessary building block for an iserv process running on say aarch64/ios, or aarch64/android or armv7/android. (e.g. that's the ghc-slave application).
06:28 v0latil3 joined
06:28 v0latil3 joined
06:28 <v0latil3> so my wifi driver broke apparently
06:28 <v0latil3> MarcelineVQ: I couldn't figure anything out
06:29 nickolay joined
06:29 codesoup joined
06:29 <angerman> Now to compile TH with a stage1 cross compiler (and again let me stress this: not all patches have landed in ghc master yet), you basically tell your ghc, to compile TH splices through iserv (on your target).
06:29 splanch_ joined
06:29 <v0latil3> MarcelineVQ: I'm the stupid foldl question guy
06:30 <angerman> This means that ghc is sending the compiled object code to the target, and finally a small bytecode snippet for the splice that the iserv process on the target can then execute and run; and send back that result.
06:30 <pacak> > foldl (\string badint -> filter (/= badint) string) [1..10] [2,5]
06:30 <lambdabot> [1,3,4,6,7,8,9,10]
06:30 <pacak> v0latil3: ^
06:30 benl23 joined
06:30 <pacak> v0latil3: Explain me this plz.
06:30 <angerman> And as I mentioned you naturally have issues with Process and File IO. (e.g. embed git hash by calling git...)
06:31 <angerman> Because your splice ends up running on the target not on the host. And unless you have git (in this case) and the same source on the target, this does not make much sense.
06:31 <v0latil3> pacak: oh I think you said that before I saw the numbers and wasnt paying attention so i thought it was about something else
06:31 <angerman> File IO is similar, because your splice is run on a completely different machine, with a different filesystem.
06:31 takle joined
06:31 <EvanR> wow this is deep
06:32 <pacak> v0latil3: I totally said that before.
06:32 <EvanR> i have absolutely no interest in using TH in my project
06:32 <angerman> However anything that uses just AST generation (lens, aeson, ...) should work.
06:32 <v0latil3> pacak: yeah thats what i mean!
06:33 <dysfun> i read that aeson's TH 'derivation' works faster than the generic one
06:33 <EvanR> i looked through the list for obvious libs that cant be used without TH
06:33 uglyfigurine joined
06:33 <EvanR> didnt see any i will need
06:33 <EvanR> but im probably not looking hard enough
06:33 <pacak> EvanR: lens :)
06:33 andyhuzhill1 joined
06:33 <EvanR> not using lens
06:33 <pacak> EvanR: and recursion-schemes :)
06:33 <EvanR> oh recursion-schemes...
06:33 <EvanR> single tear
06:34 <pacak> My TH code for it finally got in.
06:34 <c_wraith> I wonder if there's a no-TH flag for lens..
06:34 <glguy> lens doesn't use th
06:34 <c_wraith> lens compiles against it, though
06:35 <cocreature> I don’t think that matters for cross compilation
06:35 <Lokathor> oh hey
06:35 <Lokathor> orion, i can build text 1.2.2.1 on my rpi :P
06:36 <EvanR> and so it seems clear why people would want to have a ghc on a pi
06:36 <EvanR> because the engineering required and not fully done yet to get cross compilation to work
06:36 <Lokathor> among the commonly used packages, it's the biggest ram hog of them
06:36 <glguy> lens depends on the template-Haskell package but didn't need the extension
06:36 cryo28 joined
06:37 <angerman> glguy: makeLenses does though, no? :-)
06:37 <c_wraith> yeah, but who doesn't write lenses by hand? :P
06:37 freusque joined
06:37 <angerman> glguy: and what fun is using lenses without makeLenses? :-)
06:37 hvr joined
06:37 hvr joined
06:38 Monoide joined
06:41 takle joined
06:42 uglyfigurine joined
06:44 guiben joined
06:44 alfredo joined
06:47 <Lokathor> i read a thing a while ago
06:47 lambda-11235 joined
06:47 Guest19237 joined
06:47 <Lokathor> from a programmer of erlang for like 10 years, and he lamented that nested data structures are too hard to deal with in functional languages
06:47 <Guest19237> whats the best language
06:47 <Lokathor> Guest19237, Esperanto
06:47 <pacak> Guest19237: php
06:48 JeanCarloMachado joined
06:48 <jle`> context-free
06:48 <Guest19237> Lokathor: neniu
06:48 <EvanR> erlang and elixir still dont have lenses
06:48 <dysfun> algol 60
06:48 <Lokathor> Guest19237, jes! kial ne?
06:48 <EvanR> and nested data structures are easy in non functional languages?
06:49 jer1 joined
06:49 <dysfun> depends what you call a "functional language"
06:50 <dysfun> e.g. it's very easy to manipulate nested data in erlang because pattern matching
06:50 <Guest19237> Lokathor: vian vizaĝon
06:50 <Lokathor> EvanR, hey i dunno what they think is easy or hard or what they call "functional", but they also suggested just using ETS tables whenever you need
06:50 takle joined
06:50 <EvanR> whats ETS tables
06:50 <Lokathor> which is the Erlang version of keeping it all in an IORef
06:50 <dysfun> ETS is a memory-backed database library
06:50 <dysfun> shared between erlang processes
06:51 uglyfigurine joined
06:51 <Lokathor> they're fully imperative
06:51 <dysfun> they have immutable data and deal mostly in expressions
06:52 dm3 joined
06:52 <dysfun> i find it interesting, because even though it's immutable data in erlang, you don't get to reason about it with absence of side effects
06:53 <Lokathor> well, the interprocess communication is always a side-effectful/imperative thing, and you communicate with your ETS table via such
06:53 razi1 joined
06:54 <dysfun> yeah
06:54 <dysfun> but most of my recent few years has been clojure, which i dare to call functional
06:55 <dysfun> its idea of immutable data is more like haskell's, just without being *forced* to segregate side effectful code
06:55 raichoo joined
06:56 zeroed joined
06:56 <dysfun> so when i did some erlang recently, it surprised me to see "oh, this thing that i thought was immutable data is actually sending a message to a process to 'mutate'"
06:56 <Lokathor> i think that the enforcement is what gives me confidence to go with it
06:56 <Lokathor> rust has an STM package, but then has to say things like "be sure you don't accidentally ever write anything in an atomic block that you can't safely retry later"
06:57 <dysfun> clojure has a rather lossy protection in the form of the io! macro (warn if you use something that uses it outside of a transaction)
06:57 <dysfun> er inside
06:57 <Guest19237> jle`: toys
06:57 JeanCarloMachado joined
06:57 coot joined
06:59 Snircle joined
06:59 takle joined
06:59 rcschm joined
06:59 <Guest19237> dysfun: run it
06:59 Shock_ joined
07:00 leat joined
07:00 <dysfun> what, algol 60?
07:00 Itkovian joined
07:00 <dysfun> nah, i'm good :)
07:01 tromp joined
07:02 xall joined
07:03 shangxiao joined
07:03 dm3 joined
07:03 armyriad joined
07:03 mattyw joined
07:06 jer1 joined
07:08 gehmehgeh joined
07:08 tlee753 joined
07:08 jhrcek joined
07:09 conal joined
07:09 <v0latil3> pacak: thank you
07:09 uglyfigurine joined
07:09 tlee753 joined
07:10 JeanCarloMachado joined
07:11 ridho joined
07:12 eagleflo joined
07:12 zariuq joined
07:12 fosterite joined
07:13 cfricke joined
07:14 vlatkoB_ joined
07:14 tec_ joined
07:14 mfukar joined
07:17 meba joined
07:18 kuribas joined
07:19 robatosan joined
07:19 cur8or joined
07:21 albertid joined
07:21 yepo_ joined
07:21 quobo joined
07:21 sbrg joined
07:22 mrkgnao joined
07:24 ertes joined
07:25 geekosaur joined
07:25 benl23 joined
07:25 ragepandemic joined
07:27 mrkgnao joined
07:28 jer1 joined
07:28 mrkgnao joined
07:30 mda1 joined
07:30 jdt joined
07:30 reggie_ joined
07:32 ventonegro joined
07:34 xormor joined
07:34 JeanCarloMachado joined
07:35 CurryWurst joined
07:36 insitu joined
07:36 connrs joined
07:37 uglyfigurine joined
07:37 thc202 joined
07:37 Maxou joined
07:39 osa1 joined
07:39 fowlslegs joined
07:39 fizruk joined
07:40 valdyn joined
07:41 ridho joined
07:41 louispan joined
07:43 ertes-w joined
07:43 takle joined
07:44 Shock_ joined
07:45 JeanCarloMachado joined
07:46 <ph88_> can anyone give me a hint what i could do to get these parsing and conduit functions right? https://bpaste.net/show/4d799bce2cd8
07:48 jer1 joined
07:48 rcschm joined
07:50 JeanCarloMachado joined
07:51 spacecadetbrown joined
07:51 <bartavelle> ph88_: you could break the input in lines before running parseAndSelect
07:51 <bartavelle> that way you'd have line by line parsing
07:51 acidjnk22 joined
07:52 butterthebuddha joined
07:53 ehubinette joined
07:53 hust921 joined
07:53 hust921 joined
07:54 cloudhead joined
07:54 <bartavelle> or even just running plain attoparsec functions with CL.map btw
07:55 <ph88_> bartavelle, at the moment selectColumn is a conduit .. if i split it by line then each line will become a conduit as well .. but a conduit with only 1 value .. this is not what i want
07:55 uglyfigurine joined
07:55 <ph88_> i want 1 conduit with many Double values
07:55 <bartavelle> ph88_: there is a conduit for line splitting
07:56 <ph88_> where ?
07:56 <bartavelle> ph88_: http://hackage.haskell.org/package/conduit-extra-1.1.15/docs/Data-Conduit-Binary.html#v:lines
07:57 <bartavelle> there's the same thing for Text
07:57 <ph88_> i'm working with ByteString
07:57 guiben joined
07:58 <ph88_> so i put lines conduit into conduitParserEither parseLine .| selectColumn ?
07:58 <bartavelle> I'm not sure what conduitParserEither does, is it supposed to apply the supplied parser forever on the input ?
07:58 JeanCarloMachado joined
07:59 <bartavelle> ie. is your problem that it's only applied once, or that you'd like to ignore the end of lines ?
07:59 <bartavelle> that is, what comes after the parsed data*
08:00 uuplusu joined
08:00 <bartavelle> brb
08:03 aloiscochard joined
08:03 noan joined
08:04 JeanCarloMachado joined
08:04 marr joined
08:05 nurupo joined
08:06 albel727 joined
08:07 <ph88_> bartavelle, my problem is just that i'm parsing a single line at the moment as you can see on the paste on line 26. i wrote a parseFile function (line 6) but i haven't used it yet ..
08:08 <ph88_> https://hackage.haskell.org/package/conduit-extra-1.1.15/docs/Data-Conduit-Attoparsec.html#v:conduitParserEither
08:08 Itkovian joined
08:09 <bartavelle> that documentation is unclear to me :)
08:09 jer1 joined
08:10 chimney joined
08:11 <pacak> Suppose I have Prism' a (b, c), how do I apply Prism' b d to that to get Prism' a (d, c) ?
08:11 jeltsch joined
08:12 <dysfun> is Generic preferred over Data ?
08:12 <bartavelle> pacak, is that even possible? shouldn't the second be an iso ?
08:12 <pacak> dysfun: Generics are newer and faster.
08:12 eklavya joined
08:13 thecatwasfat joined
08:13 <dysfun> faster? that's nice
08:13 balor joined
08:13 <pacak> bartavelle: Hmm... I don't know if it's possible or not, but I can imagine how to implement that using primitives, at least for my case.
08:13 <bartavelle> no what I say is wrong
08:13 <bartavelle> i had it the other way around
08:14 <pacak> dysfun: Problem with generics - about compilation time is about cubic to data size.
08:14 louispan joined
08:14 <dysfun> wonderful
08:15 <dysfun> so every time i change the data structures i'm being generic about, i will get to wait a while to test them?
08:15 <pacak> 200 fields product time for a relatively simple deriving can easily take 5-10 minutes.
08:15 cranej joined
08:15 bjz joined
08:16 JeanCarloMachado joined
08:16 <dysfun> that doesn't sound very appealing
08:16 <pacak> Also yes, at some point ghc can say "screw you guys I'm going home" and will stop trying to optimize stuff.
08:16 <dysfun> well, i can see why they might for Data, but Generic is supposed to be new and shiny
08:17 <pacak> dysfun: Generics are usually nice. They misbehave if you do stupid things.
08:17 <dysfun> but how do we define stupid?
08:17 <dysfun> what are the parameters of this cubic slowdown?
08:18 <ph88_> bartavelle, this is my attempt to use the lines conduit https://bpaste.net/show/3e7114ac6b49
08:19 <ph88_> it works but then when i want to pipe that into parseLine it stops to work
08:19 <dysfun> i.e. where is the tipping point between Data and Generics seeming like better options
08:20 <bartavelle> ph88_, please include your whole file so that I can play with it
08:20 <pacak> dysfun: 200 fields product type
08:20 <dysfun> so it's cubic on the number of fields in a single type?
08:20 <pacak> dysfun: data Foo a = Foo a a a
08:20 <pacak> that's 3
08:20 <pacak> dysfun: yes
08:20 <dysfun> but if i define 10 types of 10 fields, it's fine?
08:21 <ph88_> bartavelle, i would have to setup a new project
08:21 <pacak> if they are separate types = sure
08:21 <dysfun> okay. i can arrange for that to be the case
08:21 oish joined
08:21 <pacak> Dont forget -O/-O1/-O2 otherwise performance will be ugh.
08:21 Matajon joined
08:21 <dysfun> heh
08:21 <dysfun> yes
08:22 <* dysfun> has -O2 when the dev flag isn't set
08:22 _flow_ joined
08:22 uglyfigurine joined
08:23 mmn80 joined
08:24 tomphp joined
08:24 <dysfun> what about algebraic datatypes? do i just add the total fields of the cases to approximate it or is it more complex?
08:24 bvad joined
08:24 Maxou joined
08:24 <pacak> More or less. It's just if at some moment you see that your code takes ages to compile - you know what to blame.
08:24 <ph88_> bartavelle, i also think i loose line information this way
08:25 <dysfun> yeah, i'm just trying to get started on the right foot :)
08:25 <bartavelle> ph88_, yes, you do
08:25 JeanCarloMachado joined
08:25 <ph88_> that sux
08:27 Ciquattro joined
08:28 lep-delete joined
08:29 Beetny joined
08:30 splanch joined
08:31 drcode joined
08:32 mekeor joined
08:33 Elhamer joined
08:33 <lpaste> bartavelle pasted “ping _ph88_” at http://lpaste.net/355182
08:34 <bartavelle> ph88_, ^^
08:34 <bartavelle> this one works because it drops eol
08:35 Yuras joined
08:36 bhamilton joined
08:36 refold joined
08:36 jaspervdj joined
08:36 JeanCarloMachado joined
08:36 eklavya joined
08:37 ccomb joined
08:38 richi235 joined
08:40 bhamilton joined
08:41 Levex joined
08:41 muchoo joined
08:42 <muchoo> in what state if ghc crosscompiler for arm CPUs? is it usable?
08:42 <bartavelle> AFAIK, you don't get template haskell when you cross compile
08:42 <muchoo> i'm not even sure how to get stated.. i had to jump through hoops to get arm gcc working
08:43 xtreak joined
08:45 zero_byte joined
08:46 takle joined
08:47 zph joined
08:47 nitrix joined
08:48 sfcg joined
08:49 nuclx joined
08:50 jzl joined
08:50 jzl joined
08:50 CoderPuppy joined
08:50 Levex joined
08:51 tero- left
08:52 JeanCarloMachado joined
08:52 Gurkenglas_ joined
08:52 Mortomes|Work_ joined
08:52 robatosan joined
08:54 mjora7 joined
08:54 noumenon joined
08:56 sgronblo joined
08:58 oish joined
08:58 xificurC joined
08:59 baldrick joined
08:59 mstruebing joined
09:00 balor joined
09:01 splanch joined
09:01 tromp joined
09:01 bennofs joined
09:02 splanch_ joined
09:04 mitch_ joined
09:04 splanch__ joined
09:05 wizonesolutions joined
09:05 oisdk joined
09:05 oish_ joined
09:05 xtreak joined
09:06 cyborg-one joined
09:07 JeanCarloMachado joined
09:08 uglyfigurine joined
09:08 hust921 joined
09:09 splanch joined
09:11 unK_ joined
09:12 asthasr joined
09:13 fosterite joined
09:14 cansis joined
09:14 splanch joined
09:16 twanvl joined
09:18 JeanCarloMachado joined
09:18 bytesighs joined
09:18 litchblade joined
09:18 Yuras joined
09:20 deank joined
09:21 <ertes-w> are there any alternatives to the 'language-bash' library for *generating* shell scripts? an sh library would be good enough
09:22 <kuribas> muchoo: I think it would be very hard, if at all possible.
09:22 <muchoo> kuribas I see.. too bad
09:22 <kuribas> muchoo: you could buy a raspberry pi, and compile there...
09:23 <ertes-w> i would use language-bash, but it has a failing test case
09:23 <muchoo> oh, so it is crosscompiling part that is the issue?
09:23 <kuribas> yes
09:23 xtreak_ joined
09:23 kritzcreek joined
09:24 <bennofs> ertes-w: don't run the test suite? :)
09:25 <muchoo> this is for satellite receiver that runs linux. quad 1500 Mhz, 3GB of ram. not sure how i'd go about installing ghc on it though
09:26 uglyfigurine joined
09:26 JeanCarloMachado joined
09:26 jkachmar joined
09:26 a3Dman joined
09:26 <kuribas> muchoo: it seems someone did a succesful cross-compile: https://github.com/ku-fpg/raspberry-pi/wiki/GHC-Cross-Compiler-for-Raspberry-Pi
09:27 tjpeden joined
09:29 <ertes-w> bennofs: sure, but… you know… there is a reason why the test fails =)
09:29 runeks joined
09:29 <ertes-w> it's only about brace expansion, which i could live without, but still…
09:29 <bennofs> ertes-w: hmm
09:29 <bennofs> ertes-w: Test suite logged to: dist/test/language-bash-0.7.0-tests.log
09:29 <bennofs> 1 of 1 test suites (1 of 1 test cases) passed.
09:29 <bennofs> language-bash-0.7.0
09:29 <kuribas> muchoo: also this page: https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/RaspberryPi
09:30 <ertes-w> bennofs: i guess it doesn't always fail
09:30 <muchoo> thanks for the links
09:30 <ertes-w> bennofs: https://github.com/knrafto/language-bash/issues/17
09:30 <muchoo> I'd really like to get ghc going. it is a shock going back to C or C++
09:30 <NickHu> How do I call a LoggingT IO a from another LoggingT IO a without runStderrLoggingT? What's the runLoggingT function supposed to do? I can't quite understand its signature
09:31 <ertes-w> NickHu: (>>=)?
09:31 <NickHu> I tried logger <- askLoggerIO, which gives me something I can pass to runLoggingT, but how can I pass the logger from the first function to the next
09:31 romank joined
09:31 <mrkgnao> what exactly do you mean by "call"? if you have f :: LoggingT IO a, then a simple f' <- f inside a do block should work
09:31 JeanCarloMachado joined
09:32 Wizek joined
09:32 <ertes-w> NickHu: (LoggingT IO) is a monad, so you can use (>>=) (or do-notation)
09:32 bitonic joined
09:33 LuckyRawApe joined
09:33 sgronblo joined
09:34 ozgura joined
09:34 wedens joined
09:35 jwbuurlage joined
09:36 <mrkgnao> I think my reply may have been a bit flippant. :(
09:36 <kuribas> muchoo: just out of interest, what are you making?
09:36 rcschm joined
09:36 bennofs joined
09:37 <NickHu> This is the code I'm trying to make work http://lpaste.net/355185
09:37 <mrkgnao> NickHu: Once you have written a "complete" LoggingT IO a, you would use runLoggingT to "run" it and produce something of type IO a
09:37 <NickHu> This compiles fine, I just don't like the runStderrLoggingT there - is there a way to ask for whatever logger I already have in that do block and pass it along
09:37 <muchoo> kuribas channel bug removal plugin to prevent screen burn-in
09:38 Wizek_ joined
09:38 <mrkgnao> NickHu: what is the type of askLoggerIO? IO Logger?
09:38 <kuribas> muchoo: for a tablet?
09:38 <mrkgnao> and what is the type of runStderrLoggingT?
09:39 <muchoo> kuribas for 65" oled =)
09:39 <NickHu> askLoggerIO :: m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) - it doesn't do anything at all in the code I linked
09:39 julian_rubin joined
09:39 <NickHu> runStderrLoggingT :: MonadIO m => LoggingT m a -> m a
09:39 <muchoo> I suffered burn in issues on my old plasma set, so I am bit OCD about it
09:39 gmcabrita joined
09:39 ridho joined
09:40 <kuribas> muchoo: ah cool! Keep in mind that haskell needs a lot of memory, and isn't really suited for low memory, low speed devices.
09:40 <NickHu> This is in the monad-logger package
09:40 <NickHu> And I have getReact :: M.Map Text Text -> Maybe Text -> URI -> LoggingT (MaybeT IO) FacebookReacts
09:40 vikram__________ joined
09:40 ixxie joined
09:40 <julian_rubin> @pl \x y -> x y
09:40 <lambdabot> id
09:40 angular_mike_ joined
09:40 <muchoo> kuribas true.. think it will be an issue with 3GB? obviously other things need to run on the box as well
09:41 <mrkgnao> NickHu: okay. I think you shouldn't have to use askLoggerIO in this function, as you've realised
09:41 <kuribas> muchoo: lol no... I was thinking a few MB
09:41 <muchoo> hehe
09:42 <NickHu> mrkgnao: Yeah..
09:42 <muchoo> yeah, "embedded" devices today are like top desktop models a few years ago
09:42 a3Dman joined
09:42 cris_ joined
09:43 <mrkgnao> NickHu: so, does this not typecheck?
09:43 <NickHu> It does
09:43 <dysfun> muchoo: that depends. at the low end of the spectrum, things are often still powered by chips that don't support paging!
09:44 zpconn__________ joined
09:44 <NickHu> It just forces me to select the stderr logger in getReacts
09:44 <NickHu> Which is already in a LoggingT
09:44 locallycompact joined
09:44 uglyfigurine joined
09:44 <NickHu> So I'd rather do something like, pull the logger from this monad and pass it forward
09:45 <jchia> There's intercalate and words, but how can I split a comma-delimited string? I can't find anything in base. What's the cleanest way to get the splitting functionality? I'm not sure whether I want to use the 'split' package or MissingH package just because of this one function.
09:45 <jchia> Am I missing something from base?
09:45 <mrkgnao> the LoggingT (MaybeT IO) thing looks a bit suspicious to me.
09:46 bigos_ joined
09:46 <mrkgnao> what exactly do you want the monad to do? accumulate a list of results?
09:46 mkurkov_ joined
09:46 <NickHu> why?
09:47 seanparsons joined
09:47 <NickHu> Which one, in getReact or getReacts?
09:47 <dysfun> jchia: Data.List.break can be used recursively
09:47 v0latil3 joined
09:48 <NickHu> I want getReact to be able to fail, short circuiting IO with Maybe monad, and to log this, and getReacts to have a list of results, with failures represented as Nothings
09:50 <jchia> dysfun: Thanks, so define my own split using break?
09:50 <dysfun> i think that's your best option without resorting to hackage, yes
09:51 plot joined
09:51 <cris_> hi, i have a question about STM BANK account example, https://hastebin.com/icoxuwotaf.hs
09:51 <mrkgnao> I mean, if you're not looking to do *logging* and just want to build up a list of results, you'd be better served with a (strict!) Writer monad.
09:51 <mrkgnao> NickHu: okay.
09:51 <mrkgnao> notice that the lift and runStderrLoggingT functions are sort of inverses to each other
09:51 <mrkgnao> one moves from LoggingT IO into IO, and lift moves back
09:52 geekosaur joined
09:52 <cris_> how do I do the ”retry” as in the example?
09:52 <NickHu> mrkgnao: Yes, I understand that
09:53 Yuras joined
09:53 spacecadetbrown joined
09:53 <* mrkgnao> finds the A E S T H E T I C refreshing
09:53 S11001001 joined
09:53 fizruk joined
09:53 <NickHu> Oh are you saying I can do something like fmap over mapConcurrently?
09:53 <mrkgnao> NickHu: there should be some way to lift the async concurrency functions into LoggingT
09:53 Destol joined
09:54 <kadoban> cris_: I think you might have switched to IME or something
09:54 <mrkgnao> yes
09:54 torstein joined
09:55 <mrkgnao> I'm not sure, but is there an analog of takeMVar/wait in STM? (Or would that break STM?)
09:55 <cris_> hi kadoban, the font is now fine
09:55 <kadoban> Yep, all better
09:56 xall joined
09:56 <mrkgnao> lol, my terminal takes around a second to render the prompt if I'm in the GHC repo
09:57 fotonzade joined
09:57 <NickHu> mrkgnao: fwiw mapConcurrently has effectively the same type as mapM
09:57 <cris_> do you have any idea of the bank account example , most of the examples just said that STM will retry and wait, but when i try to draft the example in hastebin, it waits indefinitely and have error , without doing the second transfer action
09:57 <muchoo> :t mapConcurrently
09:57 <lambdabot> error: Variable not in scope: mapConcurrently
09:58 <NickHu> mapConcurrently :: Traversable t => (a -> IO b) -> t a -> IO (t b)
09:58 <NickHu> It's obviously not the same, but we're in the IO monad in this instance
09:59 xtreak joined
10:01 xtreak joined
10:01 jer1 joined
10:02 uglyfigurine joined
10:03 a3Dman joined
10:04 TabAtkins joined
10:04 DocWinter joined
10:04 xall joined
10:06 <mrkgnao> NickHu: you might want to look at lifted-async
10:06 <mrkgnao> :where lifted-async
10:07 jutaro joined
10:07 <NickHu> How would I restructure the last call using mapConcurrently from there?
10:08 saep joined
10:09 razi1 joined
10:10 ixxie joined
10:11 uglyfigurine joined
10:12 NyanPasu joined
10:12 filterfish joined
10:13 <NickHu> I need some way of going from LoggingT (MaybeT IO) -> MaybeT (LoggingT IO)
10:14 fendor joined
10:14 <rightfold> NickHu: I think sequence
10:14 <rightfold> Maybe not. It's early.
10:15 <NickHu> Sequence doesn't seem to work
10:15 tomboy64 joined
10:16 ziyourenxiang joined
10:16 Yuras joined
10:16 v0latil3 joined
10:17 ziocroc2 joined
10:18 Elhamer_ joined
10:18 Maxou joined
10:19 xall joined
10:20 <mrkgnao> rightfold: hoist and friends?
10:21 jer1 joined
10:21 <rightfold> http://stackoverflow.com/questions/41796511/swap-inner-and-outer-monads
10:23 posco joined
10:23 <torstein> I'm getting some kind error when trying to instantiate a type class: http://lpaste.net/355186
10:23 glitch_hat joined
10:26 netheranthem joined
10:27 <rightfold> torstein: class NotFinished (a :: State)
10:27 <rightfold> It defaults to Type
10:27 <torstein> ah okay
10:27 Maxou joined
10:30 hughrawlinson joined
10:31 oisdk joined
10:31 shans_ joined
10:33 wavewave joined
10:34 lynn joined
10:34 soniku joined
10:36 xall joined
10:36 oisdk joined
10:36 asthasr_ joined
10:38 edwardk joined
10:38 dwarders joined
10:39 a3Dman joined
10:41 xall joined
10:42 raichoo joined
10:42 jer1 joined
10:42 Argue joined
10:43 Achylles joined
10:44 fendor joined
10:45 richi235 joined
10:45 fotonzade joined
10:46 tabaqui joined
10:49 seanparsons joined
10:51 Maxou joined
10:54 litchblade joined
10:54 _sg joined
10:56 Guest12837 joined
10:57 danthemyth joined
10:58 fkurkows1 joined
10:58 bennofs joined
10:59 mmachenry joined
11:00 revtintin joined
11:00 bjz_ joined
11:01 Maxou joined
11:02 Snircle joined
11:03 jbgi joined
11:03 simukis joined
11:04 obruT1 joined
11:05 oleo joined
11:05 rcschm joined
11:06 litchblade joined
11:08 __paul0 joined
11:09 blym_ joined
11:09 butterthebuddha joined
11:10 Maxou joined
11:11 Elhamer joined
11:13 shangxiao joined
11:13 <ertes-w> NickHu: honestly i would dispense with the LoggingT altogether
11:13 <ertes-w> having a "logging monad" is much more complexity for little gain in most cases
11:15 fosterite joined
11:18 <Faucelme> I have read somewhere that ContT should always be the outermost transformer in the stack or bad things might happen. Is that true?
11:19 rcat joined
11:19 meba joined
11:19 Wuzzy joined
11:19 Maxou joined
11:20 <ertes-w> Faucelme: not really, but you need to understand the implications of transforming ContT
11:20 oisdk joined
11:20 <ertes-w> MaybeT (ContT r m a) ≃ (Maybe a -> m r) -> m r
11:20 <ertes-w> pretty safe
11:21 <ertes-w> probably even safer than ContT r (MaybeT m) a
11:21 <ertes-w> because understanding what (<|>) does in the latter one is far from trivial
11:21 zariuq joined
11:23 rcschm joined
11:23 <Faucelme> Good, I was mostly concerned about breaking the monad laws, Not about non-obviousness :)
11:23 <ertes-w> i don't think that's possible with proper transformers
11:23 augur joined
11:24 <ertes-w> there are some improper transformers like the original ListT, which doesn't always give you a monad, even when its argument is one
11:25 Destol joined
11:26 phaji joined
11:26 paolino joined
11:29 danza joined
11:29 Maxou joined
11:29 <robertkennedy> I really love stm
11:29 rcschm joined
11:31 rcschm joined
11:32 Apocalisp joined
11:34 a3Dman joined
11:35 eklavya joined
11:35 amuck joined
11:36 jer1 joined
11:37 bjz joined
11:38 oisdk joined
11:41 JeanCarloMachado joined
11:41 splanch joined
11:42 xtreak joined
11:43 splanch_ joined
11:44 xtreak joined
11:47 albel727 joined
11:47 splanch joined
11:52 splanch joined
11:52 plot joined
11:53 jer1 joined
11:53 splanch_ joined
11:54 Arizona6882 joined
11:54 systadmin joined
11:54 sdothum joined
11:56 sepp2k joined
11:56 xall joined
11:57 beerdrop joined
12:00 <quchen> Corollary. All monads beginning with »ST« are awesome.
12:00 <quchen> Proof: obvious
12:02 Filip_ joined
12:02 tromp joined
12:04 systadmin joined
12:04 xall joined
12:05 coot joined
12:11 ozgura joined
12:11 litchblade joined
12:11 beerdrop joined
12:12 nomicflux joined
12:13 Gurkenglas_ joined
12:14 splanch joined
12:14 gehmehgeh joined
12:14 xall joined
12:15 Maxou joined
12:15 jer1 joined
12:16 splanch_ joined
12:16 Elhamer joined
12:17 AntiSpamMeta joined
12:17 <ph88_> bartavelle, did you run that code that you paste for me ?
12:17 danthemyth joined
12:17 filterfish joined
12:18 danthemyth joined
12:18 splanch__ joined
12:19 Elhamer_ joined
12:20 splanch joined
12:20 marr joined
12:20 ccomb joined
12:20 <ph88_> bartavelle, since you didn't put the many/some combinator on parseLine .. i think that code still parse a single line only ..
12:21 doomlord joined
12:21 jeltsch joined
12:22 jhrcek joined
12:22 <ertes-w> robertkennedy: you love haskell STM
12:22 filterfish joined
12:22 gawen joined
12:22 cschneid_ joined
12:23 <bartavelle> ph88_, yes I ran it, and it works
12:23 cur8or joined
12:23 <ph88_> bartavelle, how does it go over multiple lines ?
12:23 <* ertes-w> can't find the documentation of ExtendedDefaultRules
12:23 mmn80 joined
12:24 <bartavelle> ph88_, conduitParserEither runs the parser as long as it gets input
12:24 <ph88_> oooh ok
12:25 <quchen> ertes-w: There are other languages with STM?
12:25 <quchen> Clojure, which has »unsafeIOtoSTM« around every STM action, sure
12:25 <quchen> But that’s it, no?
12:26 <quchen> I remember the C# paper that basically concluded that STM is impossible in C#
12:26 <ph88_> bartavelle, do you know how i can consume any leading spaces at the start of the first line at the file ? then on my parseLine parser i can consume spaces on the end of the line + new lines + spaces leading the next line with just 1 whiteSpace parser
12:26 <ertes-w> quchen: a lot of them do, but it's not haskell's super-STM
12:26 <ertes-w> quchen: it's really just "memory transactions"
12:26 <quchen> STM without transactional guarantees is … IO?
12:27 <ertes-w> quchen: you do get those, and you also get blocking
12:27 <bartavelle> ph88_, yeah, that's what I pasted should do
12:27 <ertes-w> but you don't get composable transactions, and you don't get the "orElse" monoid
12:27 <bartavelle> ph88_, parseLine does skip leading and ending spaces
12:28 <bartavelle> ph88_, skipEol skips the \n and \r
12:28 <ph88_> bartavelle, parseLine doesn't need to skip leading spaces if i can remove the first leading spaces in the file
12:29 <bartavelle> ph88_, I don't know how to only skip a single space with the conduitParseEither function
12:29 <ph88_> ok
12:29 <ertes-w> could someone briefly explain ExtendedDefaultRules? either i'm completely stupid, or it's not in the GHC user guide
12:30 <ph88_> i think i can just run attoparsec first and then give the unconsumed part as input to conduit
12:30 kvda_ joined
12:30 <ph88_> anyway not really important to optimize so soon already :P
12:30 <bartavelle> ph88_, there should be a "drop" function in conduit
12:30 <ertes-w> in particular: when i say something like "default Text", how does it know that i mean IsString?
12:31 <bartavelle> ph88_, if you wanna optimize it, I would suggest http://hbtvl.banquise.net/series/Efficient%20parsing.html
12:31 henriksod joined
12:31 <bartavelle> (self promotion)
12:31 <ertes-w> *"default (Text)"
12:31 Arizona6882 joined
12:32 <ph88_> ok nice i put it in my source file to read later
12:32 <ph88_> first i want to finish the program and then profile it's performance :P
12:33 <ph88_> i'm impressed though :P
12:33 <ph88_> nice looking table in part 4
12:33 mohsen_ joined
12:34 <ph88_> good job bartavelle
12:34 ventonegro joined
12:35 <bartavelle> hehe
12:35 filterfish joined
12:35 panovia joined
12:35 jer1 joined
12:36 jutaro joined
12:36 atec joined
12:37 cloudhead joined
12:37 e14 joined
12:38 <robertkennedy> Are you guys saying the clojure STM couldnt ie encode TQueue?
12:41 nh2 joined
12:41 balor joined
12:41 e14 joined
12:42 <ertes-w> robertkennedy: not as far as i know… clojure has the equivalent of TVar and 'atomically', but lacks the equivalent of 'empty'
12:42 ExpHP_ joined
12:43 <ertes-w> something like this, as far as i can tell, is impossible in closure: readTVar v >>= check
12:43 <robertkennedy> What's the point of it then?
12:43 <ertes-w> well, technically it's still "STM" =)
12:45 e14_ joined
12:45 <robertkennedy> In what way? I guess they could still gaurentee that something like `atomically $ writeTVar x 1 >> writeTVar y 2` won't see x as 1 unless it also sees x as 2?
12:45 <robertkennedy> also sees y, sorry
12:45 spacecadetbrown joined
12:46 <ertes-w> yeah
12:47 filterfish joined
12:47 <robertkennedy> Damn. Well, I accept the pull request: I love Haskell STM
12:47 tabaqui joined
12:49 <ertes-w> there are surprisingly many implementations of STM for surprisingly many languages, but as far as i know the "orElse" monoid is unique to haskell's STM
12:49 <ertes-w> which makes it insanely more powerful than pretty much everything else
12:52 cpup joined
12:52 <masse> ertes-w: and retry as well I think
12:53 <robertkennedy> How do other languages create "events", ie `b <- newTVarIO False; concurrently_ (threadDelay 100000 >> atomically (writeTVar b True)) (atomically (readTVar b >>= check) >> putStrLn "wait show")`
12:54 <ertes-w> MasseR: 'empty' alias 'retry' is the identity of the 'orElse' alias (<|>) monoid
12:55 geekosaur joined
12:56 jer1 joined
12:56 balor joined
12:57 butterthebuddha joined
12:57 xall joined
12:58 chimney left
12:58 smillmorel joined
12:59 xall joined
13:01 tlee753 joined
13:01 fizruk joined
13:02 blym_ joined
13:03 butterthebuddha joined
13:04 cpennington joined
13:04 t0m0 joined
13:04 PennyNeko joined
13:05 vektorweg1 joined
13:05 insitu joined
13:05 beerdrop joined
13:06 rkazak joined
13:07 ertes joined
13:09 geekosaur joined
13:09 jeltsch joined
13:12 TCZ joined
13:13 soniku joined
13:14 splanch joined
13:14 fosterite joined
13:15 iAmerikan joined
13:16 jer1 joined
13:17 fotonzade joined
13:17 filterfish joined
13:18 splanch_ joined
13:20 AntiSpamMeta joined
13:20 dsantiago joined
13:20 RayNbow`TU joined
13:22 filterfish joined
13:24 winmillwill joined
13:25 llacb47 joined
13:28 mizu_no_oto_work joined
13:29 sellout- joined
13:29 jangsutsr joined
13:30 eazar001 joined
13:31 hurkan joined
13:32 mendez joined
13:33 chlong joined
13:33 butterthebuddha joined
13:34 blym_ joined
13:35 filterfish joined
13:35 `^_^v joined
13:36 hc joined
13:36 plutoniix joined
13:36 meba joined
13:36 jabesed joined
13:37 robkennedy joined
13:37 sellout-1 joined
13:37 jer1 joined
13:38 jabesed joined
13:39 sampuka joined
13:39 <jabesed> regarding naming standards, the StudlyCaps convention seems to be recommended
13:40 <jabesed> how do you use it though, when the first 'word' is supposed to be all caps (e.g. an acronym)?
13:40 <jabesed> for instance, a variable named BNF Form
13:40 dmwit_ joined
13:40 <jabesed> BNFForm? BNFform?
13:41 <ertes-w> jabesed: BNFForm or BnfForm; the latter is often more convenient, because you can use your editor's word jumping
13:41 <ertes-w> if it supports camelcase
13:42 plutoniix joined
13:42 seventh-chord joined
13:43 Wamanuz2 joined
13:43 jathan joined
13:43 <jabesed> ertes-w: I see... hmm the later is much more readable too
13:43 <jabesed> latter*
13:44 <jabesed> guess I'll use that
13:44 Swizec joined
13:46 plutoniix joined
13:46 CurryWurst joined
13:47 <robkennedy> When people talk about free, is it in the context of wadler's theorems for free?
13:49 plutoniix joined
13:50 <quchen> Lots of things can be »free«.
13:50 <quchen> The term without context could be any of them.
13:51 <GreySunshine> Hello, I've been trying to setup 'interactive-haskell-mode' on haskell-mode from the haskell-mode documentation. I want it to suggest imports statements and suggest completions from the imported modules. Here is my .emacs file(http://lpaste.net/938582110887739392). I think line 10, 11, 12 does what I ask for but it doesn't work. How have you done it?
13:52 plutoniix joined
13:52 takle joined
13:55 plot joined
13:56 ystael joined
13:56 Yuras joined
13:57 simukis joined
13:57 earldouglas joined
13:57 coltfred joined
13:58 jer1 joined
13:58 plutoniix joined
13:59 edsko_ joined
14:01 ChristopherBurg joined
14:01 plutoniix joined
14:03 antoine9298 joined
14:03 gienah joined
14:03 hc_ joined
14:05 <ertes-w> GreySunshine: does the interactive shell start properly?
14:05 <ertes-w> i.e. can you load your module, ask for types, etc.?
14:05 lambdafan joined
14:06 plutoniix joined
14:06 ridho joined
14:07 xiinotulp joined
14:08 <lambdafan> I want to do a project where I am measuring the similarity of two tweets. How similar is teet A to tweet B. I've familiarized myself with "In defense of MinHash over SimHash", But I am still not certain if my use case favors minhas. Any thoughts?
14:08 jer1 joined
14:10 xiinotulp joined
14:10 zeeb joined
14:11 zeeb left
14:12 <ertes-w> lambdafan: similar in what sense? edit distance? semantic similarity? similar wording/punctuation? …?
14:12 bennofs joined
14:12 mathk joined
14:13 earldouglas joined
14:13 firef1y joined
14:14 thunderrd_ joined
14:14 xiinotulp joined
14:14 chlong joined
14:15 cdg joined
14:15 <lambdafan> ertes-w semantic similarity
14:15 <mathk> @pl (\f g x -> (f x) + (g x))
14:15 <lambdabot> liftM2 (+)
14:15 <lambdafan> ertes-w: semantic similarity
14:16 <mathk> @pl (\g x -> x + (g x))
14:16 <lambdabot> ap (+)
14:16 takle_ joined
14:16 theelous3 joined
14:18 xiinotulp joined
14:18 earldouglas joined
14:19 oisdk_ joined
14:19 oish joined
14:20 mmachenry joined
14:20 <GreySunshine> ertes-w, I did not start the interactive shell. Now I did M-x haskell-process-load-file and it suggests functions from imported modules. It still doesn't suggest modules to import.
14:21 jgertm joined
14:22 xiinotulp joined
14:22 uiop joined
14:23 jer1 joined
14:23 <ertes-w> lambdafan: then you need to study NLP and machine learning… the modern approach to "these two people are talking about the same thing and making similar statements" is deep learning
14:24 takle joined
14:24 <ertes-w> GreySunshine: ah, you want it to auto-import modules… i don't know how to do that
14:24 nbro joined
14:24 jcjf joined
14:25 <GreySunshine> ertes-w, Thank you, a part of it works and that is very helpful!
14:28 xall joined
14:28 xiinotulp joined
14:30 theelous3 joined
14:31 brynedwards joined
14:31 insitu joined
14:31 ertes joined
14:31 crobbins joined
14:32 augur joined
14:33 xiinotulp joined
14:33 nbro joined
14:33 eschnett joined
14:33 splanch joined
14:34 filterfish joined
14:34 MindlessDrone joined
14:34 istvan joined
14:34 nbro left
14:35 hc joined
14:36 xiinotulp joined
14:37 <jabesed> the most straightforward way to build extensible data types would be with a dummy field, e.g. data DExt ext = D | Ext ext
14:37 bjz joined
14:38 flatmap13 joined
14:38 <jabesed> so, e.g. for no extension one would define type D = DExt Void
14:38 <jabesed> the obvious problem with this is nesting of data constructors
14:38 mada joined
14:39 <jabesed> so one could have DExt (D2Ext (D3Ext (D4Ext val)))
14:39 xiinotulp joined
14:39 <jabesed> is there some extension that allows definition of synonyms to pattern a sequence of constructors?
14:40 fizruk joined
14:40 <lyxia> pattern synonyms
14:41 <quchen> Or view patterns.
14:41 <quchen> Pattern synonyms are more modern, view patterns more compatible.
14:41 jer1 joined
14:42 augur joined
14:43 roconnor joined
14:43 <jabesed> lyxia, quchen: thanks, I hadn't heard of pattern synonyms will look it up! I did look into view patterns a long time ago, a bit forgotten now, but didn't think it would apply here
14:43 <jabesed> will check it out
14:43 Cinm joined
14:44 richi235 joined
14:44 <quchen> jabesed: View patterns are like unidirectional pattern synonyms.
14:44 insitu_ joined
14:44 <quchen> Lenses+viewpatterns are roughly like pattern synonyms.
14:44 <quchen> s/lenses/prisms/
14:45 xiinotulp joined
14:45 <jabesed> quchen: don't know prisms either... looks like I have a lot of catching up to do
14:46 xall joined
14:46 <quchen> jabesed: Then don’t worry about prisms.
14:46 ludat joined
14:46 <quchen> Just look up pattern synonyms. :-)
14:46 <jabesed> am I thinking correctly that this would be a sane way to go about defining extensible data types?
14:47 dfeuer joined
14:47 <jabesed> i.e. dummy fields + pattern synonyms (to "get rid of" nesting)
14:49 <jabesed> I've noticed there's more powerful approaches, e.g. using heterogeneous lists, but that seems overkill, particularly given my data types are already (fake) 'dependent'
14:50 theelous3 joined
14:50 nick8325 joined
14:53 antoine9298 joined
14:53 usr joined
14:53 usr joined
14:53 ralu joined
14:54 hackebeilchen joined
14:54 xiinotulp joined
14:56 drostie joined
14:56 burtons joined
14:56 xiinotulp joined
14:57 uuplusu joined
14:57 <jabesed> checked a tutorial just to see what prism was, funny how it talks about a "big clever hack" to simulate subtyping to share combinators for Lens, Prism, etc
14:57 riatre joined
14:58 <jabesed> funny since my need to extend data types somehow results precisely from the lack of subtyping in the language
14:58 fizbin joined
14:58 <jabesed> I know subtyping affects decidability, but not having it available is also be a big pain :/
14:59 <jabesed> s/decidability/type inference
14:59 <byorgey> it's not a hack. Subtyping really wouldn't help with sharing combinators for lens, prism, etc.
14:59 sellout- joined
15:00 <jabesed> ok will have to see what is done, they don't go into details in the tutorial, just make that claim
15:00 steeze joined
15:01 bvad joined
15:01 <jabesed> this one by the way: https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/a-little-lens-starter-tutorial
15:01 ziyourenxiang joined
15:01 Yuras joined
15:02 xiinotulp joined
15:03 MindlessDrone joined
15:03 skeet70 joined
15:03 al-damiri joined
15:04 richi235 joined
15:04 <byorgey> I think that tutorial is far too apologetic. "Oh, sorry, there's some complicated types, don't worry, it's just a big hack"
15:05 teggi joined
15:05 <byorgey> But the fact that you can express lenses in this particular way using higher-order functions is quite amazing and beautiful, and leads directly to the idea of generalizing to other sorts of things (prisms, traversals, etc.)
15:05 <byorgey> and the ability to compose them just sort of falls out for free.
15:06 <byorgey> The tutorial makes it sound like we started out wanting to compose these things, but we don't have subtyping, so we had to resort to this hack to make it work. But that's not at all what happened.
15:06 hc_ joined
15:06 <jabesed> got it
15:07 cobreadmonster joined
15:07 jer1 joined
15:07 hackebeilchen1 joined
15:07 Khisanth joined
15:08 opios joined
15:08 ridho joined
15:09 sleffy joined
15:09 FreeBirdLjj joined
15:09 ertes-w joined
15:10 xiinotulp joined
15:11 fizruk joined
15:11 sm joined
15:11 firef1y joined
15:12 sgronblo joined
15:12 xall joined
15:12 uglyfigurine joined
15:13 soniku joined
15:13 sm joined
15:14 xiinotulp joined
15:15 cschneid_ joined
15:15 _sg joined
15:16 <NickHu> Is there a stdlib function that will roughly split a list into n lists?
15:16 xiinotulp joined
15:17 bvad joined
15:17 <lyxia> nope
15:17 <MarcelineVQ> not in base that I'm aware of but you can craft one with unfoldr and splitAt pretty quickly if you'd like to give it a try
15:17 <MarcelineVQ> if not there's the split package
15:18 <quchen> ?hoogle chunksOf
15:18 <lambdabot> Data.Sequence chunksOf :: Int -> Seq a -> Seq (Seq a)
15:18 <lambdabot> Data.Sequence.Internal chunksOf :: Int -> Seq a -> Seq (Seq a)
15:18 <lambdabot> Data.Text chunksOf :: Int -> Text -> [Text]
15:18 <quchen> … roughly
15:19 xiinotulp joined
15:20 <NickHu> That splits things into lists of n
15:21 <NickHu> Basically I have a bunch of actions, and I want to split them into n lists which I can pass to mapConcurrently (i.e. n worker threads)
15:22 <quchen> NickHu: You can use semaphores to implement a work limiter as well.
15:22 Kreest__ joined
15:22 <quchen> All threads will be forked, but only N are allowed to work concurrently.
15:22 <quchen> The others block.
15:22 xiinotulp joined
15:22 Achylles joined
15:22 <quchen> ?hoogle Sem
15:22 <lambdabot> SDL.Raw.Types type Sem = Ptr ()
15:22 <lambdabot> module Data.Semigroup
15:22 <lambdabot> Data.Semigroup class Semigroup a
15:22 <quchen> Hmm.
15:23 <NickHu> quchen: Does that fit nicely with mapConcurrently?
15:23 <NickHu> Mm, I see it now
15:23 <quchen> NickHu: Yup.
15:23 <NickHu> https://hackage.haskell.org/package/base-4.9.1.0/docs/Control-Concurrent-QSemN.html this package?
15:24 <NickHu> I don't need to worry about spurious wakeups in haskell do I/
15:24 <quchen> https://hackage.haskell.org/package/base-4.9.1.0/docs/Control-Concurrent-QSem.html
15:24 <quchen> NickHu: Not with standard concurrency, no. With STM, yes.
15:25 xiinotulp joined
15:25 xall joined
15:25 Bobopolis42 joined
15:25 sillyotter joined
15:25 <Bobopolis42> hi!
15:25 jer1 joined
15:26 Wizek_ joined
15:26 <quchen> NickHu: The standard scheduler has a notion of fairness, i.e. eventually all blocked things will get a chance to do some work.
15:26 xiinotulp joined
15:27 tom7942 joined
15:27 <quchen> In STM, this is not the case: everyone is woken up at the same time and starts trying to work and annoys the other threads.
15:27 <quchen> »Stampending herd problem«
15:27 <jabesed> Are Lens and friends 'compatible' with 'dependently typed' structures? For instance, if I decorate the types of an AST with meta-types for the expressions it encodes, would it still be feasible to define the required instances for Lens et al?
15:28 <bartavelle> this discord library doesn't build for me, but in which world does it build? https://github.com/jano017/Discord.hs/blob/dev/src/Network/Discord/Rest/Prelude.hs#L77-L80
15:30 nscott76 joined
15:30 xiinotulp joined
15:31 javjarfer joined
15:32 yqt joined
15:32 black0range joined
15:32 Bobopolis42 left
15:33 shangxiao joined
15:34 xall joined
15:34 ogkloo joined
15:34 <lyxia> bartavelle: is there a reason you linked to these few lines specifically
15:35 <bartavelle> lyxia, yes, because they cause a compilation error, and because I don't know why the author had them working
15:35 <bartavelle> I mean, how
15:35 <MarcelineVQ> well how are you compiling it
15:36 <bartavelle> stack build, but how could that even work?
15:36 <bartavelle> Fetched has kind *, how can it be a functor ?
15:36 <lyxia> oh I see how can it be a functor
15:36 bvad joined
15:36 <lyxia> I mean, I see that this is absurd
15:36 <athan_> Hey all, I'm getting a GHC panic on 8.0.2 :\ - something like "translateConPatVec: lookup". Do you think I could fix it locally?
15:36 <bartavelle> ah, this is not some magic I know nothing about?
15:37 doomlord joined
15:37 baldrick1 joined
15:37 <bartavelle> lyxia, and for information, while this is a git repo, the latest hackage version has the same code, yielding to the same error
15:37 twanvl joined
15:37 xiinotulp joined
15:38 Achylles joined
15:39 hc joined
15:39 <lambdamu_> athan_: Do you have minimal example?
15:39 <lambdamu_> athan_: It's certainly possible to work around GHC panics in most cases
15:40 tom7942 joined
15:40 <lambdamu_> athan_: If you know what causes them, it would also be nice if we had report for it on the bug tracker
15:40 <lyxia> bartavelle: yeah, this is a mistake on their part
15:40 merijn joined
15:40 <MarcelineVQ> bartavelle: interesting, the commit that made that instance has a travis failure too :X
15:41 simukis joined
15:41 hackebeilchen joined
15:41 urodna joined
15:41 <bartavelle> MarcelineVQ, yeah, I noticed it too, why did they push to hackage :/ will file an issue
15:42 <black0range> Hello, is it possible to easily convert data types (ex: data Vec2 = Vec2 Int Int) to a pointer to a c array? :)
15:42 fowlslegs joined
15:42 trism joined
15:43 <black0range> Whops messed up the last part of that sentence
15:43 jmelesky joined
15:43 Benzi-Junior joined
15:44 <lyxia> black0range: http://hackage.haskell.org/package/base-4.9.1.0/docs/Foreign-Marshal-Utils.html#v:new ?
15:44 <bartavelle> black0range, I suppose it depends of what you mean by "easy" :)
15:44 sigmundv_ joined
15:45 Itkovian joined
15:45 hc_ joined
15:46 <black0range> i was hoping for some kind of automagic :D
15:46 steeze joined
15:46 a3Dman joined
15:46 hackebeilchen1 joined
15:47 <black0range> How are datatypes stored anyhow? I mean technicly the Vec2 example i did before could be the same of a c-struct with two elements in memory?
15:47 <bartavelle> black0range, no, because of lazyness
15:48 <bartavelle> black0range, then *I think* there is also a tag that identifies the constructor
15:49 splanch joined
15:49 fluffystub joined
15:49 oish_ joined
15:49 <black0range> well thansk for the answer :)
15:49 <lambdamu_> black0range: well something like that is possible, with unpacked strict fields, but you have to watch out for the garbage collector and don't do stuff that breaks referential transparency
15:50 <lambdamu_> black0range: e.g. Data.ByteString.Unsafe has unsafeUseAsCString
15:50 <NickHu> quchen: It doesn't seem to work with mapConcurrently
15:50 <bartavelle> black0range, what's your C data type ?
15:51 <lambdamu_> black0range: it basically just pulls a pointer out, bytestrings datatypes are also pinned on the heap which isn't the default for data types
15:51 <NickHu> I guess they're not thread-safe semaphores... (why would that even exist?!)
15:51 xall joined
15:52 jer1 joined
15:52 <bartavelle> black0range, you could use http://hackage.haskell.org/package/base-4.9.1.0/docs/Foreign-Marshal-Array.html#v:newArray : store (Data a b) = newArray [a,b] if you don't want to bother writing the storable instance
15:52 <black0range> bartvelle: I was hoping to create vectors / matricies that i could send to opengl
15:53 lambdaman joined
15:53 <Cale> black0range: See Storable and StorableArray
15:53 <bartavelle> black0range, aren't there already good opengl bindings for that kind of stuff ?
15:54 eugenez joined
15:54 <lambdamu_> black0range: the vector package has unsafeWith which should be O(1), too, but I don't think the memory is pinned
15:55 plot joined
15:55 <eugenez> Hello friends! Is it possible to shorten the following structure (list1 !! idx1, list1 !! idx2)?
15:56 <Taneb> eugenez, my first thought is, if you're using (!!) a lot, lists probably aren't the data structure you want to be using
15:56 <Cale> eugenez: Shorten, I'm not sure, but I would generally try rather hard to avoid using !!
15:56 <bartavelle> eugenez, (,) <$> (!! idx1) <*> (!! idx2)
15:56 <bartavelle> eugenez, ((,) <$> (!! idx1) <*> (!! idx2)) list1
15:56 <bartavelle> but this is longer :p
15:56 xiinotulp joined
15:57 <black0range> bartville: Well for the standard stuff but there seems to be some problems for example when sending vetrtex data over. Theres of course the posiblity that I've missed something
15:57 <eugenez> Yeah, I know about !!, i rewrote that part like three times, was waaay worse x)
15:57 <eugenez> but impossible to do away with !! imo
15:57 oisdk joined
15:58 rkazak joined
15:58 black0range left
15:58 xall_ joined
15:58 fosterite joined
15:59 <Cale> eugenez: Well, maybe you can do away with the list itself? If you're doing random accesses, you'd rather have a Map or Array or something like that.
15:59 mrkgnao joined
15:59 <bartavelle> black0range, I know next to nothing about opengl, except that there is a kmett package, which I expected to be at least partially working
16:00 <edwardk> both gl and OpenGL work these days
16:00 <edwardk> me shipping gl forced OpenGL to adopt the same approach we use in gl. which is parsing the spec to produce all the code
16:01 Arizona6882 joined
16:01 a3Dman joined
16:02 <edwardk> Er gl and OpenGLRaw
16:02 <eugenez> Cale: Thank you, I'll think about it! :)
16:02 Grisha joined
16:02 <MarcelineVQ> impressive, does that get complicated with the arb and extentions?
16:02 <Grisha> hi everyone
16:02 <Grisha> I’ve got a newbie question
16:02 {emptyset} joined
16:03 <Grisha> having a :: ReaderT Config (Maybe IO) Int
16:03 <mrkgnao> How do I get GHCi to print constraints "properly"? what that means, sort-of-arbitrarily, is that I don't want it to do All The Inference and reduce the constraints in a function's type as far as possible
16:03 <Grisha> a does some IO and the last step in a is a function call that returns Maybe Int
16:03 drostie joined
16:03 xiinotulp joined
16:03 <edwardk> The OpenGL package remains nigh unusable
16:03 <Grisha> how to promote this Maybe Int result to what ReaderT Config (MaybeT IO) Int demands?
16:04 <edwardk> e.g. note how things like http://hackage.haskell.org/package/OpenGL-3.0.2.0/docs/src/Graphics-Rendering-OpenGL-GL-VertexSpec.html#TexCoordComponent have a ton of unexported internals
16:04 <edwardk> so if you run into a situation that the authors of OpenGL didn't expect, you're screwed
16:04 hucksy joined
16:04 <edwardk> MarcelineVQ: yes. =)
16:04 <edwardk> gl is the largest package on hackage
16:04 albel727 joined
16:05 sepp2k joined
16:05 <edwardk> it broke builds on windows because it exceeded command line length limits, etc. for a while
16:05 <mrkgnao> so, e.g. if I have (nullary) classes Super t => A t, Super t => B t, (A t, B t, D t) => C t, then I would like a function of type C t -> t -> t to not show up as (Super t, D t) => t -> t
16:05 <edwardk> because of the sheer number of modules
16:05 <edwardk> we had to adopt shorter module names to fix it
16:05 Luke_ joined
16:05 xiinotulp joined
16:05 <MarcelineVQ> ehe, does that spec approach extend to opencl? by which I mean do you know if there spec is consistent enough to do the same thing
16:05 ioer324 joined
16:05 <mrkgnao> edwardk: did you hear about the cargo NUL mess?
16:06 <mrkgnao> well, maybe not "mess"
16:06 <edwardk> MarcelineVQ: not sure.
16:06 sgronblo joined
16:06 <edwardk> mrkgnao: yeah. cabal has had code to reject such package names for years
16:06 <MarcelineVQ> a person can do a number of tasks opencl does using opengl but it can be complicated from what I've seen
16:06 <lambdamu_> Grisha: I don't think ReaderT (Maybe IO) Int is a valid type
16:06 kamyar joined
16:06 <kamyar> Hello fellows
16:07 <kamyar> Please help me fix this code part
16:07 <lambdamu_> Grisha: I mean ReaderT Config (Maybe IO) Int is a valid type
16:07 <kamyar> http://lpaste.net/355194
16:07 <merijn> Any stack users that can help me fix this test failure? https://travis-ci.org/bos/criterion/jobs/226556679
16:07 <mrkgnao> hmm.
16:07 <MarcelineVQ> using shaders for gpgpu computing I​ mean
16:07 <Grisha> lambdamu_: sorry, you’re correct, that should read `ReaderT Config (MaybeT IO) Int`
16:07 <NickHu> If I have a LoggingT (MaybeT IO) a, how do I go about actually detecting when the MaybeT IO has failed (Nothing), in order to log it?
16:07 <ioer324> hello every one
16:07 <ioer324> how i learn haskell fast
16:07 <ioer324> ?
16:07 <edwardk> MarcelineVQ: https://www.khronos.org/registry/OpenCL/xml/ has a cl.xml
16:08 <merijn> Grisha: Probably something like "lift . lift . return" or something
16:08 <edwardk> assuming it is as consistent as the gl.xml we use in gl then yes
16:08 <glguy> merijn: lift . return should be return, right?:
16:08 <ioer324> everyone hear me?
16:08 <merijn> Grisha: retur to make it "IO (Maybe Int)" two lifts to lift through the transformers, or "liftIO . return" I suppose
16:08 <edwardk> MarcelineVQ: if you don't care about macs then its probably easier to use opengl compute shaders these days.
16:08 <Grisha> merijn: I’m trying it out
16:08 ioer324 left
16:08 <mrkgnao> yes, ioer324. what have you read so far?
16:09 <merijn> glguy: Not if he has "Maybe Int" and needs "MaybeT IO Int" wrapped with something else
16:09 <mrkgnao> :where haskellbook
16:09 Sonolin joined
16:09 <edwardk> glguy: lift is a monad homomorphism, so yes
16:09 <mrkgnao> @where?
16:09 <glguy> merijn: lift :: IO a -> MaybeT IO a, not Maybe a -> MaybeT IO a
16:09 <lambdabot> Maybe you meant: where+ where
16:09 <merijn> glguy: He needs to get an "IO (Maybe Int)" first and lift that
16:09 <MarcelineVQ> edwardk: thank you, I'm just barely getting into this stuff again so anything is helpful
16:09 <mrkgnao> @where haskellbook
16:09 <lambdabot> http://haskellbook.com
16:09 <glguy> merijn: MaybeT :: IO (Maybe a) -> MaybeT IO a
16:09 <merijn> glguy: Right, which is why there's a return first
16:09 eklavya joined
16:10 xiinotulp joined
16:10 Elhamer__ joined
16:10 jer1 joined
16:10 <merijn> oh, I suppose MaybeT, yeah
16:10 ioer324 joined
16:10 <lambdamu_> Grisha: lift . MaybeT . pure should work
16:10 <merijn> Anyway, "liftIO . return" is simpler
16:10 descender joined
16:10 <Grisha> lambdamu_, merijn: thanks a lot guys
16:10 <edwardk> merijn: lift . return = return by law
16:11 <glguy> liftIO . return is return
16:11 <mrkgnao> edwardk: are there any places I can see `constraints` being used?
16:11 <edwardk> liftIO . return = return by law
16:11 <Grisha> lambdamu_, merijn: does this problem represent smell of bad type design?
16:11 <merijn> Clearly I'm too tired to say sensible things
16:11 <edwardk> liftIO (m >>=f) = liftIO m >>= liftIO . f
16:11 <lambdamu_> Grisha: not necessarily
16:11 <mrkgnao> I'm looking to do something like "guided instance resolution"
16:11 <edwardk> mutatis mutandis for lift
16:11 <lambdamu_> Grisha: if you do that all the time then yes
16:12 ubsan_ joined
16:12 mbuf joined
16:12 <edwardk> mrkgnao: hrmm. http://packdeps.haskellers.com/reverse/constraints
16:12 <Grisha> lambdamu_, merijn: thanks a lot guys, I’ve got to go now, you saved my back
16:13 <edwardk> http://hackage.haskell.org/package/folds-0.7.3/docs/src/Data-Fold-M.html#line-61 uses it
16:13 <merijn> Any stack users that know how this stack.yaml stuff is supposed to work that can shed a light on how to fix this failure? https://travis-ci.org/bos/criterion/jobs/226556679
16:13 ioer324 joined
16:13 meandi_2 joined
16:13 sssilver joined
16:13 <MarcelineVQ> edwardk: shucks son this compute shader is great, I'm way out of the loop, thank you
16:13 <edwardk> er actually that part uses reflection
16:14 <edwardk> MarcelineVQ: you can do some fancy fancy stuff with it
16:14 <ExpHP_> "error: No instance for (Control.Monad.Zip.MonadZip Vector)" <-- but it DOES have an instance...
16:14 pera joined
16:14 ioer324 joined
16:14 xxalien8dxx joined
16:14 fowlslegs joined
16:14 <edwardk> MarcelineVQ: e.g. https://github.com/ekmett/vr/blob/master/shaders/poppy_scan.comp computes a poppy style succinct index in parallel using all your gpu compute units
16:15 soniku joined
16:15 <edwardk> and it can share code with the code that i use to use the index in normal gl https://github.com/ekmett/vr/blob/master/shaders/poppy.glsl
16:15 Elhamer_ joined
16:15 <merijn> ExpHP_: Are you sure? For example, are you looking at docs for the version that you're actually building with? If that instance was added in a newer version than you're using...
16:15 <edwardk> so for 3.15% space overhead i can compute an index that lets me do prefix sums on bitvectors in O(1)
16:16 robatosan joined
16:16 <edwardk> ExpHP_: old version of vector?
16:16 <ExpHP_> merijn: It's possible since I'm using stack, I'll have to check
16:17 hc joined
16:18 <ExpHP_> yep, I'm on 0.11, which lacks MonadZip. Damn
16:18 oisdk joined
16:19 <* ExpHP_> pokes at his cabal file and waits for explosions
16:19 xiinotulp joined
16:19 <lyxia> merijn: the stack.yaml lists a very old resolver
16:19 tomphp joined
16:19 <MarcelineVQ> edwardk: that little bit has given me at least 5 new subjects to examine that all seem immedaitely applicable for me, another good day in #haskell :>
16:19 <edwardk> heh
16:20 <ioer324> how write a game with haskell?
16:20 aarvar joined
16:20 antoine9298 joined
16:20 simukis joined
16:21 <merijn> lyxia: I'm unsure how to fix that, though. I don't actually have/use stack, so I keep patching issues one at a time as TravisCI outputs them, so I'm not sure how to update the stack.yaml or even whether I'm supposed to wrt the tests :)
16:21 <lambdamu_> ioer324: How would you do it in another language?
16:21 <edwardk> ioer324: there is a #haskell-game channel dedicated to the libraries folks are using in haskell to build game stuff, but in general like in any other language, you figure out what your game needs then bind to appropriate libraries for sound, etc.
16:21 simukis joined
16:22 <edwardk> there are more options for doing things entirely purely in haskell though, stuff like gloss
16:22 Deide joined
16:22 <merijn> lyxia: stack.yaml lists lts-6.1, so that seems fairly new?
16:22 <mrkgnao> btw, I'm getting a lot of mileage out of reflection for dabbling-around-with-elliptic-curves purposes
16:23 <mrkgnao> like adding points while deferring the actual choice of curve till later, etc
16:23 <edwardk> ExpHP_: the vector-instances package probably supplies an instance of Zip from 'keys' at that version
16:23 <edwardk> but sadly i dont think i thought about MonadZip
16:23 Destol joined
16:24 <mrkgnao> I have to think hard about how constraints and reflection interact.
16:24 Swizec joined
16:24 edsko joined
16:24 <edwardk> mrkgnao: they work together with no headaches and no unsoundness issues
16:24 <edwardk> at least if you avoid Given and unsafeFoo
16:24 gehmehgeh joined
16:24 BlueRavenGT joined
16:25 <ExpHP_> edwardk: looking at keys right now I must say that "zap" is the greatest method name ever
16:25 <edwardk> if you look at Data.Constraint.Nat in HEAD i use reflection like techniques
16:25 <edwardk> =)
16:26 oisdk joined
16:26 SpinTensor joined
16:26 Arizona6882 joined
16:26 <javjarfer> hi! edwardk, first thanks for everything you do for this and other communities, and second, have you ever looked inside all reactive libraries, they almost always do some kind of trick for hiding the node datatypes in the reactive tree
16:26 insitu joined
16:26 <javjarfer> have you ever wonderer if that need could be removed with the use of a dependent-map?
16:27 <mrkgnao> Ah. I'm thinking about how I can achieve some kind of controlled instance resolution with those. Trying to get something of type a :==> b be reflected to a globally available instance, etc.
16:27 <edwardk> i've looked at a bunch of them, but i confess i tend to avoid FRP as a technique as they just don't tend to scale to the problems i'm interested in. for simple guis and the like its fine
16:27 <mrkgnao> Can TH be used to enumerate all in-scope instances of a class at compile time? For, say, quickcheck-ish testing?
16:27 <kamyar> Please help me fix the code : http://lpaste.net/355194
16:27 <edwardk> mrkgnao: oh, you want the internal hom for kind Constraint
16:28 <mrkgnao> wait, is that internal hom like the sheaf kind?
16:28 <edwardk> mrkgnao: i have support for that in my hask package, but you have to explicitly "lower" it to use it
16:28 unyu joined
16:28 <lyxia> merijn: the snapshot is older than the code-page library.
16:28 robotroll joined
16:28 <edwardk> or am i misparsing you
16:29 <edwardk> in hask i have code for producing a type p |- q , where (|-) :: Constraint -> Constraint -> Constraint
16:29 <edwardk> is an implication arrow in the category of constraints itself
16:29 <mrkgnao> I mean, I want to construct instances "by hand" from other instances, and then make them available so that other stuff can use those instances
16:29 <edwardk> with eval, apply, etc. morphisms
16:30 xiinotulp joined
16:30 Boomerang joined
16:30 <edwardk> mrkgnao: well, you have to be careful because its easy to violate the thinness of the category of constraints that way, what you are asking for it unsound in general.
16:30 <ExpHP_> ok good it looks like Vector 0.12.0.1 is still compatible with all of my 40-something dependencies \o/
16:30 <edwardk> er is
16:30 <javjarfer> edwardk, do you mean performance scaling?
16:30 <javjarfer> or model scaling?
16:30 <wayne> Prelude Data.Monoid> Product 10 `mappend` 40
16:30 <wayne> Product {getProduct = 400}
16:30 <edwardk> javjarfer: performance
16:30 <wayne> why does this work, even if 40 isn't (Product 40)?
16:30 bobakk3r joined
16:30 <javjarfer> edwardk, yes, that is normally the issue
16:30 <edwardk> wayne: there is a Num instance for Product
16:30 Elhamer joined
16:30 <ExpHP_> wayne it probably implements Num
16:31 <wayne> ah got it!
16:31 <wayne> thanks
16:31 <mrkgnao> I know, but how do I utilize the thinness? That's one of my biggest problems
16:31 <mrkgnao> I mean
16:31 <mrkgnao> I have "diamond"-shaped class hierarchies
16:31 jer1 joined
16:31 <edwardk> thinness gets utilized every time you construct a Data.Set and don't have to stuff the 'Ord' dictionary into the Set, and can do hedge unions because its sound because every instance of Ord [[[[[[[Int]]]]]]] will be the same as any other
16:31 <javjarfer> edwardk, well, just for the record, I have found that almost always, they are constructed using some kind of type erasure technique to build a polymorphic tree
16:31 <mrkgnao> and I have trouble convincing GHC that it's the same however you descend them when my classes are MPTCs.
16:31 e joined
16:32 xiinotulp joined
16:32 <edwardk> mrkgnao: um, i think you have some other issue, in general the thing you describe is perfectly sound
16:33 <edwardk> mrkgnao: have you seen: https://www.youtube.com/watch?v=hIZxTQP1ifo ?
16:33 ragepandemic joined
16:34 sfcg joined
16:35 xiinotulp joined
16:35 <mrkgnao> What I'm fighting with isn't exactly what I described, now that I think of it. It's actually an overlapping instance problem with classes that have too many "free variables".
16:36 kamyar joined
16:36 <mrkgnao> Idris has the problem I described; I confused the two. Sorry.
16:36 <kamyar> Please help me fix my code: http://lpaste.net/355194
16:36 meoblast001 joined
16:37 <mrkgnao> kamyar: what's the problem, and what have you tried?
16:37 oish_ joined
16:37 bytesighs joined
16:37 <mrkgnao> ekmett: the talk looks interesting
16:38 sfcg joined
16:38 <kamyar> mrkgnao: See the error below
16:38 drcode joined
16:38 TabAtkins joined
16:39 ystael_ joined
16:39 <kamyar> mrkgnao: I have pasted error below the code in the lpaste
16:39 posco joined
16:40 zpconn__________ joined
16:40 runeks joined
16:40 <lpaste> lambdafan pasted “stack.yaml not pulling in dependency from github” at http://lpaste.net/7227508542654119936
16:40 mkurkov_ joined
16:40 xiinotulp joined
16:40 lambdafan joined
16:40 <lambdafan> http://lpaste.net/7227508542654119936
16:41 zph joined
16:41 <lambdamu_> kamyar: you use (||) which has the type Bool -> Bool -> Bool
16:41 <lyxia> lambdafan: I think this should be in extra-dep
16:41 <kamyar> lambdamu_: I wanted to omit if
16:41 <lambdamu_> kamyar: but the second argument you pass is certainly no Bool
16:41 wizonesolutions joined
16:41 S11001001 joined
16:41 tjpeden joined
16:42 Destol joined
16:42 edwardk joined
16:42 <lambdamu_> kamyar: I believe it is IO something
16:42 shans_ joined
16:42 <kamyar> lambdamu_: v is bool
16:42 vikram__________ joined
16:42 bitonic joined
16:42 angular_mike_ joined
16:42 <lyxia> merijn: you can use this stack.yaml instead http://lpaste.net/355195
16:43 <lambdafan> lyxia : I can put git commits in extra-dep?
16:43 xiinotulp joined
16:43 <lambdamu_> kamyar: but if the result type of checkToken is IO a for some a you can bind the action you try to pass to (||) and use the result
16:43 lambdaman joined
16:43 cansis joined
16:43 <kamyar> lambdamu_: Ok u r right. How can I overcome this?
16:44 <monochrom> Use "if".
16:44 glitch_hat joined
16:44 DrMentats joined
16:45 wavewave joined
16:45 <Cale> kamyar: Run the action.
16:45 hughrawlinson joined
16:45 <Cale> If x :: IO Bool, then, in a do-block for an IO action, you can write b <- x and then b :: Bool in whatever follows.
16:45 <kamyar> Cale: What do u mean
16:45 fotonzade joined
16:45 yellowj joined
16:45 <Cale> and the do-block as a whole will have type IO t for some other type t
16:46 dwarders joined
16:46 <lambdamu_> kamyar: use res <- action; return (a || b) instead of return (a || b)
16:46 <Cale> (it'll be the same type as the action on the last line of the do-block)
16:46 kaeluka joined
16:46 <lambdamu_> kamyar: use res <- action; return (a || b) instead of return (a || action) i mean
16:46 lynn joined
16:46 <Cale> You mean return (res || b)?
16:46 <mrkgnao> Can TH be used to find all in-scope instances of a class at compile time?
16:46 <Cale> or something?
16:46 <lambdamu_> yes sorry very bad at writing code on irc
16:47 <glguy> mrkgnao: See 'reifyInstances'
16:47 oisdk joined
16:47 <lyxia> lambdafan: I was wrong. try indenting the bit below "location".
16:47 jkachmar joined
16:47 sfcg joined
16:47 <mrkgnao> glguy: thanks for the pointer
16:48 alien8 joined
16:48 <glguy> mrkgnao: Try: Prelude Language.Haskell.TH Language.Haskell.TH.Syntax> mapM_ putStrLn $(lift . map show =<< reifyInstances ''Show [VarT (mkName "a")])
16:48 <lambdafan> lyxia: indenting had no effect
16:49 <Cale> kamyar: Now, if you really wanted to, you *could* return an IO action which could be run at a later time, but I'm going to assume you don't want that, and just want to do the test straight away
16:49 <lambdafan> lyxia: stack doesn't complain about stack.yaml syntax, it just ignores the entry (I think)
16:49 <Cale> kamyar: You should just do the conn <- ... and runRedis outside of the return, on the lines above
16:49 <lambdafan> such that, cabal has no way to recognize that lsh is a package
16:50 <lambdafan> this is the first time I've ever seen bad behavior from stack, I'm pretty sure I'm following directions
16:51 <lyxia> lambdafan: that's odd because my stack is complaining about the syntax
16:51 jer1 joined
16:52 xtreak joined
16:53 lacrosse joined
16:53 <lyxia> lambdafan: it's also complaining about the extra-dep field and ignoring the package. so perhaps your version of stack doesn't have good enough error messages? Try indenting and removing the extra-dep field.
16:54 <lambdafan> lyxia: can you give me a gist of your stack.yaml that you are using?
16:54 <lambdafan> my version of stack is the latest
16:54 lacrosse left
16:54 <lambdafan> okay maybe not
16:54 <lambdafan> my version is 1.1.0
16:55 fotonzade joined
16:55 ccomb joined
16:56 <lambdafan> alright installing stack 1.4.0
16:57 darlan joined
16:58 connrs joined
16:58 Cassiopaya joined
16:59 Argue joined
17:00 Swizec joined
17:00 sgronblo joined
17:01 ozgura joined
17:01 conal joined
17:02 flatmap13 joined
17:02 conal joined
17:03 rkazak joined
17:03 buttbutter joined
17:04 t7 joined
17:04 jcjf left
17:04 iAmerikan joined
17:05 sgronblo joined
17:06 mmachenry joined
17:06 Argue joined
17:09 xtreak_ joined
17:12 acertain joined
17:12 dfeuer joined
17:12 jer1 joined
17:14 butterthebuddha joined
17:15 <Myrl-saki> @pl \f g x -> f (g x) x
17:15 <lambdabot> flip flip id . liftM2
17:15 <Myrl-saki> @pl \f g x -> f x (g x)
17:15 <lambdabot> ap
17:16 Swizec joined
17:17 <merijn> lyxia: Adding the optparse-applicative thing won't fix the code-page error, I think?
17:17 <Myrl-saki> @pl \(n, x) -> (== n) . length . show $ x
17:17 <lambdabot> uncurry ((. (length . show)) . (==))
17:19 pikajude joined
17:19 dsh joined
17:20 jgertm joined
17:21 oisdk joined
17:22 flatmap13 joined
17:23 fowlslegs joined
17:24 smillmorel joined
17:24 Luke joined
17:26 lambdaman joined
17:26 Naiij joined
17:26 <uglyfigurine> Given data EitherOr a b = Hello a | Goodbye b, why can i do "Hello 2 :: (Num a, Fractional b) => EitherOr a b" but not "Hello 2 :: (Num a, Char b) => EitherOr a b"?
17:27 codesoup joined
17:27 <merijn> uglyfigurine: Char is not a typeclass
17:27 moongazer joined
17:28 argent0 joined
17:28 <uglyfigurine> How would i express that its an EitherOr of Num or Char?
17:29 <bartavelle> uglyfigurine: Num a => EitherOr a Char
17:29 Arizona6882 joined
17:29 <EvanR> Char is a type
17:29 <merijn> uglyfigurine: "Num a => EitherOr a Char"
17:29 <EvanR> one of the simplest ones too
17:29 <EvanR> :t 'x'
17:29 <lambdabot> Char
17:29 <EvanR> what you see is what you get
17:29 <merijn> EvanR: Not sure I'd call unicode characters anything resembling simple ;)
17:30 <uglyfigurine> How do i know if a type is a typeclass or a type?
17:30 <EvanR> unicode may not be simple but this data type is
17:30 <bartavelle> :t '❦'
17:30 <lambdabot> Char
17:30 <uglyfigurine> :t 2
17:30 <lambdabot> Num t => t
17:30 <EvanR> uglyfigurine: you can ask ghci for info on a capital word, like Char or Num
17:31 <EvanR> by doing
17:31 <EvanR> :i Char
17:31 <EvanR> :i Num
17:31 <EvanR> doesnt work in here though
17:31 <merijn> Anyone know how (on github) I can figure out who has commit access to a repo?
17:31 <uglyfigurine> so type classes are always defined with Class and types are data's?
17:31 <EvanR> if you own the repo, check settings, go to collaborators
17:31 bobakk3r joined
17:32 <merijn> EvanR: Not my repo, no
17:32 <EvanR> then id be interested in the answer too ;)
17:32 <merijn> EvanR: I wanna figure out who to badger into merging a pull request and publshing a new version on Hackage >.>
17:32 <EvanR> theres a repo im ostensibly in charge of but dont own, and i cant even see the settings for it
17:32 salmonax joined
17:33 jer1 joined
17:34 <uglyfigurine> merijn: I am guessing Contributors is the list of people who did commit not the who has rights but that might help regardless
17:35 <uglyfigurine> note to self - use commas
17:35 <EvanR> push access is the collaborators list, and you cant see it without owning it, it seems
17:35 zcourts joined
17:35 <merijn> uglyfigurine: Yeah, I know about contributors, but unsure how to figure out who, if any, has access to actually update the repo :)
17:36 <uglyfigurine> merijn: check past PR's. It may tell u who merged it
17:36 <merijn> Looks like it's only bos with commit access, so that doesn't bode well for the timeliness :)
17:39 <Rembane> merijn: Fork it! Revolution! Freedom! Beer!
17:39 <merijn> Rembane: But I don't even wanna maintain my own stuff, let alone someone else's :(
17:40 <Rembane> merijn: Fair enough.
17:40 <EvanR> merijn: the best people to be put in charge is people who dont wanna be!
17:40 <merijn> That's why I wanna get it merged, so I can start depending on it and let someone else worry about maintenance :p
17:40 Luke_ joined
17:40 <merijn> EvanR: That's already the case, bos is maintaining it and he's far too busy, that's the problem :p
17:40 tomphp joined
17:40 uuplusu_ joined
17:41 <EvanR> then the board of shadowy figures will need to replace him, with you ;)
17:41 <uglyfigurine> #makehackagegreatagain
17:41 Luke__ joined
17:42 baldrick1 left
17:43 <merijn> I'd much prefer to stick to my unreasonable yak shaving via small, incremental improvements and let someone else deal with version madness :p
17:44 uuplusu joined
17:46 hc_ joined
17:47 hackebeilchen joined
17:47 <codedmart> What is the best way to print a diff comparing vars?
17:47 BartAdv joined
17:48 Arizona6882 joined
17:48 <merijn> codedmart: I'm unsure what that means?
17:49 ystael joined
17:49 <codedmart> merijn: Something along these lines: https://gist.github.com/codedmart/9e2298df9ea3e2cfb1940832b715b162
17:49 fizruk joined
17:50 <codedmart> I just want to compare and see what is different.
17:50 <merijn> Presumably some scary lens voodoo exists for that
17:52 sellout- joined
17:53 Boomerang joined
17:53 richardcq joined
17:53 jer1 joined
17:54 _sg joined
17:55 <richardcq> Hi guys. I'm trying to rewrite a function that takes f :: a -> a -> [b] and gets head $ f x y into a function in point free style, but head . f ends up with type [a -> a -> b] and not type a -> a -> [b]
17:55 <Cale> (head .) . f
17:56 <Cale> But... just don't
17:56 <Cale> heh
17:56 plot joined
17:56 <geekosaur> sometimes pointfree means comprehension-free >.>
17:57 tomphp joined
17:57 <jle`> s/sometimes/in most cases
17:58 <richardcq> I'm not sure I understand why (head .) . f works the way it does. Doesn
17:58 <richardcq> doesn't head . :: b-> c?
17:58 <EvanR> :t (head .)
17:58 <ExpHP_> the evil apostrophe key strikes again
17:58 <lambdabot> (a -> [c]) -> a -> c
17:59 <EvanR> takes a function that returns a list and returns that function post-processed with head
18:00 sgronblo joined
18:01 {emptyset} joined
18:01 LordBrain joined
18:01 sfcg joined
18:02 majjoha left
18:02 strykerkkd joined
18:02 <richardcq> Oh, I see. I was misremembering the type of (.). So (x .) :: (a->b) -> a -> c and doing ((x .) . f) applies x to the a parameter?
18:02 gawen joined
18:03 <davean> richardcq: I feel it bears reiterating though "Don't do that"
18:04 DocWinter joined
18:04 <EvanR> someone in here was remarking that hlint should tell you when you are accumulating recursively and do a final reverse on it, that you should be done a right fold
18:05 replay joined
18:05 <EvanR> im in this situation and now im wonder how to pull that off
18:05 <richardcq> I'm mostly doing it to get a better feel for the type system. I don't intend to maintain this code. Thanks though guys.
18:06 ralu joined
18:08 <EvanR> when my accumulator is of type ([A], Bool)
18:08 <Tuplanolla> @let (.:) = fmap fmap fmap -- You might eventually encounter this for the same purpose, richardcq.
18:08 <lambdabot> Defined.
18:08 ystael joined
18:09 DrMentats joined
18:09 _sg joined
18:09 <Tuplanolla> > (negate .: (*)) 42 13
18:09 <lambdabot> -546
18:10 sfcg joined
18:10 ridho joined
18:10 Filip joined
18:10 <monochrom> EvanR: Ah that's much more complicated. The advice was for accumulator [A] simply.
18:10 mlehmk joined
18:10 <EvanR> hrm
18:10 <byorgey> EvanR: I think it depends on how you are computing the Bool.
18:10 phyrex1an joined
18:11 <monochrom> Yeah.
18:11 <EvanR> monoiding at each step
18:11 <EvanR> with ||
18:11 lambdaman joined
18:11 <richardcq> Tuplanolla: Like if I wanted f ( g ( k x y z ) ) <=> ((f . g) .: k) x y z?
18:12 <monochrom> Sometimes you use flip on the monoid operator. But in general, it depends, don't feel bad if the advice is inapplicable.
18:12 <lyxia> merijn: I changed the resolver to a more recent one, containing code-page. optparse-applicative is another error that appears in the same error message on travis.
18:12 <byorgey> || is commutative so no flip should be necessary.
18:12 <EvanR> dangit im going to feel silly doing reverse
18:12 <Tuplanolla> It's just `f .: g = (f .) . g`, richardcq.
18:12 <monochrom> :)
18:12 <monochrom> Ah but || is not commutative in the face of bottom. (Operationally, in the face of laziness.)
18:13 <byorgey> good point.
18:13 jer1 joined
18:13 <EvanR> im not going to have bottom
18:13 <richardcq> Oh, I see.
18:13 istvan joined
18:13 <monochrom> But are you going to have laziness?
18:14 <EvanR> i will process the output list lazily, and when im done, check the bool
18:14 jship joined
18:14 <monochrom> "friendly to bottom" is just a theoretical way to say "friendly to infinite list"
18:15 <monochrom> Watch this mathemagic:
18:15 raichoo joined
18:15 <monochrom> > foldr (||) undefined (repeat True)
18:15 <lambdabot> True
18:15 Jonathan222 joined
18:15 <monochrom> > foldr (flip (||)) undefined (repeat True)
18:15 <lambdabot> *Exception: stack overflow
18:15 <monochrom> See what I mean?
18:16 jbgi joined
18:16 unK_ joined
18:16 soniku joined
18:17 <EvanR> when doing a basic loop in haskell leads directly to solving a web of related semantical nonsenses!
18:17 <Jonathan222> Hello. I am supposed to implement a function, that takes a list of anything and replaces every number with a 1 and everything else with a 2. Here is what i have so far: https://pastebin.com/05nCEUGh and i cant identifiy the problem.
18:17 <Tuplanolla> Nonsensices?
18:18 <Cale> Jonathan222: I don't understand the description of that problem
18:18 <Cale> Jonathan222: All the elements of a list in Haskell will have the same type
18:18 <monochrom> There is no "isNumber".
18:18 <monochrom> Haskell is not Lisp.
18:18 <Jonathan222> there is in Data.List
18:18 <Cale> Jonathan222: You could write a type class, something like:
18:18 <Cale> class Foo a where
18:18 <Tuplanolla> Clearly this calls for some `TypeRep`, Cale and monochrom.
18:18 <Cale> foo :: a -> Integer
18:19 <Cale> instance Foo Integer where
18:19 <Cale> foo x = 1
18:19 <monochrom> No, there is no "isNumber".
18:19 <LordBrain> Jonathan222, if you use lpaste, the bot posts the link for us
18:19 <Cale> and so on for other numerical types
18:19 <Cale> and similarly, add instances with foo x = 2 for some non-numerical types
18:19 <Unode> Hi guys, I'm getting a little bit stumped with some basic question. If I have 2 functions I'd like to call in a "do A and B" fashion how would you go about writing this? In particular I'm trying something along the lines of "bracket (A and B) (C) (D)"
18:19 <Cale> and then map that function over a list
18:19 <EvanR> monochrom: so can you still right fold this?
18:19 <Cale> But it's always going to result in a list of all 1's or all 2's
18:20 <monochrom> EvanR: I can, I just have to be careful about the operator.
18:20 <LordBrain> Unode, you can't do A then B?
18:20 <byorgey> Unode: what types do your two functions have?
18:20 <LordBrain> Unode, like, A>>B, not an option?
18:20 <Cale> Jonathan222: What are you actually trying to accomplish through this?
18:20 <MitchellSalad> Cale: data SomeFoo = forall a. Foo a => SomeFoo a
18:21 <MitchellSalad> Cale: that's clearly the answer to this beginner's problem ;)
18:21 <Cale> MitchellSalad: Well, might as well store the Integer results then.
18:21 rperry joined
18:21 chaosmasttter joined
18:21 <LordBrain> Jonathan222, is it possible the assignment expects to be given a list of strings?
18:21 <Cale> Jonathan222: Perhaps you want to define a data type which has various cases for different types of data that your list can hold?
18:22 <LordBrain> Jonathan222, and then to recognize whether the string contains numeric characters?
18:22 hacknightly joined
18:23 <LordBrain> Jonathan222, are you learning about typeable and dynamic?
18:23 <Cale> Actually, apparently the assignment is to take a single String
18:23 <Unode> LordBrain: byorgey A :: IO () , B :: (FilePath -> m a) -> m a
18:23 <Cale> and do things with the characters
18:23 <Cale> digits become 1, other characters become 2
18:23 hacknightly left
18:24 <LordBrain> he said 'any type tho
18:24 <Unode> LordBrain: Checking if >> is an option
18:25 <LordBrain> i imagine it would be much more fun to teach yourself haskell than to learn in a class setting
18:25 nh21 joined
18:26 lambdaman joined
18:27 <Cale> LordBrain: Yeah, he misspoke (gave me more details in PM)
18:27 montik joined
18:27 <LordBrain> maybe if the assignments were organized into a video game where they give you more points and you level up or something
18:27 <Unode> LordBrain: fun is relative
18:28 <Unode> I've been going at it for a while it still looks far from "getting there".
18:28 umib0zu joined
18:28 <LordBrain> well i already knew several languages when i started on haskell i admit
18:28 <LordBrain> and that was like over a decade ago
18:28 <Unode> there's just too many things I don't know how to do and coming from an imperative background, my first approach tends to be wrong.
18:29 <LordBrain> okay, well, yeah, but thats the coolness of it too
18:29 <EvanR> yeah you either have to unlearn all that, or relearn what you know knowing more
18:29 <EvanR> which i liked
18:29 <Unode> well I guess I'll start liking when things "click".
18:29 spacecadetbrown joined
18:29 hacknightly joined
18:30 <Unode> For now there's just too much w.t.f going on. And I don't mean function composition.
18:30 <LordBrain> hehe
18:30 <EvanR> wait till you get the "brain explode" sort of w.t.f.s
18:30 cyborg-one joined
18:30 <MitchellSalad> Unode: yeah, been there (and btw, lots of people come to this channel and express very similar angst and frustration)
18:30 <LordBrain> well, start out by being purist... over time the imperative stuff becomes relevant again
18:30 <pikajude> EvanR: great movie
18:30 ExpHP_ joined
18:30 <MitchellSalad> how about let's get back to your specific problem? plenty of people are around to help
18:31 <Unode> MitchellSalad: yeah your example yesterday was plenty helpful, but to be honest I still don't fully get it
18:31 <Unode> but I guess that's also in part due to how the framework works.
18:31 dm3 joined
18:31 <LordBrain> Unode, its probably the types really that are getting you, not the functionalness per se
18:31 <MitchellSalad> Unode: that's fine, I'm still here to clarify and/or give more examples... just ask
18:32 <Unode> LordBrain: well, right now it's really something as simple as how to chain two functions, one of which is simply IO (), inside a "bracket".
18:32 ExpHP joined
18:32 <Unode> It's part of trying to get a test to run on hspec.
18:32 hacknightly left
18:32 <ExpHP> > let !() = assert False ()
18:32 <LordBrain> Unode, you can put a (do { function; function; function;}) as a parameter to bracket
18:32 <Unode> Let me paste the tiny example I'm trying to work at
18:32 <lambdabot> <no location info>: error:
18:32 <lambdabot> not an expression: ‘let !() = assert False ()’
18:32 <ExpHP> > let !() = assert False () in ()
18:32 <lambdabot> *Exception: Assertion failed
18:32 <lambdabot> CallStack (from HasCallStack):
18:32 <lambdabot> assert, called at <interactive>:3:11 in interactive:Ghci1
18:33 <Unode> right, the { } syntax is also something I still haven't quite understood.
18:33 oish joined
18:33 <LordBrain> okay
18:33 <ExpHP> > let () = assert False () in ()
18:33 <lambdabot> ()
18:33 <Unode> when can you actually use the {}? Cause I've seen it in two contexts that seem different. As part of type definitions and in cases like the do you showed now.
18:34 <ReinH> Anywhere you can use layout.
18:34 rockfordal joined
18:34 <LordBrain> i dont wnat to go into that here, there's a nice right up somewhere you should read
18:34 <Unode> I read that {} is sort of like the curly braces in imperative languages and a replacement to indentation, but when I tried using this at an "maybe here it works" location, I couldn't get it right.
18:34 <LordBrain> its a simple substitution rule
18:34 hacknightly joined
18:34 jer1 joined
18:34 <lyxia> it's also in the syntax for records
18:35 <EvanR> two different uses for { } correct
18:35 <Unode> lyxia: yes, that's what I was referring but didn't remember the right word.
18:35 <ExpHP> why on earth does GHC have a warning for patterns like () that bind no variables?
18:35 <EvanR> layout and record syntax
18:35 <Unode> ok, layout. Can you explain what that means exactly?
18:35 <pikajude> > case of
18:35 gaze__ joined
18:35 <lambdabot> <hint>:1:6: error: parse error on input ‘of’
18:35 <pikajude> darn it lambdabot
18:35 <mrkgnao> can reifyInstances be used with a multiparameter class?
18:36 <LordBrain> Unode, i only used the do{;} syntax here, because it is easier to convey on IRC than layout
18:36 <monochrom> ExpHP, there is human judgment and personal opinion glorified behind a lot of warnings.
18:36 <ReinH> @google Haskell layout
18:36 <lambdabot> https://en.wikibooks.org/wiki/Haskell/Indentation
18:36 <davean> Unode: do {putStr "hello "; putStrLn "world!"}
18:36 albertus1 joined
18:36 <LordBrain> Unode, in most cases, in actual code, i'd use layout
18:36 <davean> Unode: not that I think I've ever seen it actually used
18:36 carlomagno joined
18:36 <mrkgnao> davean: ghc
18:36 <ExpHP> monochrom: I'm trying to figure how somebody could do that by accident though, and just can't think of anything
18:36 <davean> mrkgnao: I try not to look at SPJ's code
18:36 <Unode> LordBrain: what does "layout" mean. That's my question.
18:36 <gaze__> hey guys. what's the best way to implement a nanopass style compile in haskell, where the AST changes slightly from phase to phase?
18:36 <gaze__> I'm used to having one gigantic AST datatype
18:37 <Unode> (a link to some docs is also fine)
18:37 <LordBrain> Unode, it means haskell, like python, is sensitive to white space, you have the wrong number of spaces on a line, and it dont compile.
18:37 <MitchellSalad> gaze__: does this help, or not really? http://blog.ezyang.com/2013/05/the-ast-typing-problem/
18:37 <geekosaur> https://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-210002.7
18:37 <ReinH> Unode: I already linked you
18:37 <Tuplanolla> That sounds like subtyping, which is awkward, gaze__.
18:37 <Unode> LordBrain: so layout == indentation?
18:37 <ReinH> You can also Google "Haskell layout"
18:37 <Unode> geekosaur: thanks
18:37 <LordBrain> Unode, yeah, or "rules for indentation syntax"
18:37 <LordBrain> learn them
18:38 <EvanR> the translation of {;} back from newlines and tabs
18:38 <gaze__> MicheellSalad: Nah. That's for decorating ASTs
18:38 <LordBrain> i think most haskellers avoid tabs
18:38 <EvanR> oh right
18:38 eacameron joined
18:38 <EvanR> not tabs, spaces
18:38 <Unode> I'm used to avoid them also, so I'm fine with that
18:38 <EvanR> i press the tab key and forgot im not using tabs ;)
18:38 <MitchellSalad> gaze__: ah, right. Hrm, would one AST per phase be so bad?
18:38 <ReinH> Newlines and indentation.
18:39 srcerer joined
18:39 <lyxia> ExpHP: It looks very suspicious because the binding contributes absolutely nothing to the program, it is equivalent to not having it.
18:39 Luke joined
18:39 <MitchellSalad> gaze__: lots of boilerplatey 'AST1 -> AST2' conversions, but compared to alternatives, might be the most sane option
18:39 <ExpHP> lyxia !() can be bottom, but still warns
18:40 hacknightly joined
18:40 <lyxia> hm
18:40 <ExpHP> > let !() = assert False () in ()
18:40 <lambdabot> *Exception: Assertion failed
18:40 <lambdabot> CallStack (from HasCallStack):
18:40 <lambdabot> assert, called at <interactive>:3:11 in interactive:Ghci1
18:40 <ReinH> gaze__: is the process monotonic? I.e., does it only add data to the AST?
18:40 <monochrom> To be fair, bottomness is not something you can easily conditional-branch upon.
18:40 <gaze__> ReinH: No. The end result is assembly, which for instance has no type information.
18:40 coot joined
18:41 <ReinH> Ok
18:41 <lyxia> ExpHP: I guess the warning could be dropped in that case, and nobody got around to do it yet.
18:41 hacknightly joined
18:45 iulian joined
18:45 <Unode> ok so, and regarding my initial question, lets say I have this: http://lpaste.net/355197 . Is that the correct way of doing it?
18:46 <Cale> Unode: That's not even syntactically correct -- do-blocks aren't allowed to end in a let
18:46 mizu_no_oto_work joined
18:46 <Unode> Cale: that's half of my question :)
18:46 <EvanR> do has to end in an expression
18:46 plutoniix joined
18:47 <monochrom> Also let is wrong there.
18:47 Anonymous0250 joined
18:47 <Cale> Unode: withSystemTempDirectory takes a string (which is used as a prefix for the names generated), and then a function which accepts a FilePath (the temp directory created), and produces an action to be performed with that directory
18:47 raichoo joined
18:47 <monochrom> Also, bracket (do {putStrLn "Before"; withSystemTempDirectory "custom.file"}) (putStrLn "After") action
18:47 allenj12 joined
18:48 Mibaz joined
18:48 <monochrom> Err nevermind, what Cale said.
18:48 <Cale> That now is syntactically correct, but doesn't typecheck :)
18:48 mivael_ joined
18:48 <monochrom> You know what? withSystemTempDirectory already uses bracket.
18:48 <Cale> yes
18:48 <Cale> You can wrap it in another bracket if you want
18:48 <Unode> yes an how do I go about keeping that function and passing it on to action?
18:49 <Unode> *and
18:49 <Cale> withSystemTempDirectory "custom.file" (\tmpPath -> action tmpPath)
18:49 connrs joined
18:49 <Cale> If you want another bracket, it can go on the outside or the inside there
18:49 <Mibaz> Hey guys; I just got an index out of bounds exception in Data/Vector/Generic.hs. How do I debug something like this?
18:50 alx741 joined
18:50 zariuq joined
18:50 <lyxia> Mibaz: try to get a stack trace https://wiki.haskell.org/Debugging
18:50 <Cale> Mibaz: look for places where you're explicitly indexing Vectors
18:51 JuanMiguel joined
18:51 <Unode> Cale: ok then maybe I'm misusing bracket but, what I want to get at is: show "Before", create the tmpdir, (eventually, copy a file there), run "action" on that tmpdir, cleanup everything even if 'action' fails.
18:51 Costar joined
18:51 Destol joined
18:52 <LordBrain> well, i dont know a canonical technique, but you can hide the index operator on import of Vector, and define your own that chains to the original (imported qualified) with a trace
18:52 <Unode> as part of the cleanup I'm also showing "After" just to be sure that that part of the code executes.
18:52 <LordBrain> ^ Mibaz, that suggestion wa for you
18:52 <ExpHP> I wonder if I should raise a bug about !(). I'm searching the tracker about unused patterns and don't see anything for this...
18:53 plutoniix joined
18:53 <Mibaz> Lyxia, Cale, LordBrain: Lyxia got it, my counting was off. Sorry for the ignorance I panicked ;) thanks!
18:53 <monochrom> Unode: You are not misusing bracket, you are not internalizing the fact that withSystemTempDirectory already does bracket for you.
18:53 jayg1 joined
18:54 plutoniix joined
18:54 sgronblo joined
18:54 <ExpHP> oh bother, there it is https://ghc.haskell.org/trac/ghc/ticket/9127
18:54 <Unode> monochrom: processing ....
18:54 <LordBrain> yeah, a lot of with functions uses bracket
18:55 <Unode> monochrom: so but if I want to "putStrLn" before entering that bracket (i.e. before the directory gets created), how should I go about it?
18:55 <ExpHP> actually, huh, that bug really only targeted wildcard patterns...
18:55 <Unode> LordBrain: yes, I read that in the docs.
18:56 <Unode> but got confused once I wanted to define my own "with..." function that needed to cooperate with withSystemTemp...
18:56 <monochrom> What Cale said, your extra bracket layer, and this time withSystemTempDirectory is the action.
18:56 <monochrom> f a = bracket (print before) (print after) (use withSystemTempDirectory here)
18:56 plutoniix joined
18:57 <Unode> ok, let me try that
18:57 jer1 joined
18:58 <monochrom> Or copy and modify withSystemTempDirectory's source code.
18:58 flatmap13 joined
18:58 <monochrom> God why did you choose one with such a long name? :)
18:59 <Unode> monochrom: call it withTmp
18:59 <Unode> monochrom: but really, modifying the code?
18:59 antoine9298 joined
18:59 <MarcelineVQ> sure why not, there were other options mentioned first though
18:59 plutoniix joined
19:00 <Unode> ok, still trying it out. currently fighting with types.
19:00 <Cale> :t bracket
19:00 <lambdabot> IO a -> (a -> IO b) -> (a -> IO c) -> IO c
19:01 a3Dman joined
19:01 <Cale> The second (and third) argument to bracket are going to be a functions which receive the result of executing the action which is the first argument
19:01 <Cale> -a
19:01 <Cale> So you could have something like bracket (print before) (\_ -> print after) (\_ -> ...)
19:02 <AWizzArd> What is the difference between type classes and Backpack? Both seem to offer a way to define an interface and let users implement specific versions.
19:02 <Cale> however, you probably just want to print the stuff before using do-notation, rather than bracket
19:02 <Cale> and the stuff after, well, if you're concerned with exceptions, you can use finally
19:02 <Cale> :t finally
19:02 <lambdabot> IO a -> IO b -> IO a
19:02 <monochrom> Yeah.
19:03 alx741 joined
19:03 <monochrom> If you really want to use bracket in a meaningful way, learn from withTmp's source code.
19:04 conal joined
19:05 <Unode> I used finally in one situation before. The docs pointed me that bracket handled the same scenario with slightly better chaining of functions.
19:06 <monochrom> I wouldn't thinking of it as a chaining issue.
19:06 <monochrom> bracket has many more knobs. That's what it is.
19:07 <Unode> :)
19:07 diegoksp joined
19:10 halogenandtoast joined
19:10 plutoniix joined
19:11 carlomagno joined
19:11 Anonymous0250 joined
19:11 eschnett joined
19:12 <lyxia> AWizzArd: http://blog.ezyang.com/2016/09/the-base-of-a-string-theory-for-haskell/ see comments
19:13 lambdafan joined
19:14 JeanCarloMachado joined
19:16 <AWizzArd> lyxia: thx
19:17 jer1 joined
19:17 <Unode> geekosaur: thanks for the link. I think I get it now.
19:19 chaosmasttter joined
19:20 <lyxia> AWizzArd: he also talks about this in the introduction of his thesis
19:20 Itkovian joined
19:21 blym_ joined
19:21 plutoniix joined
19:23 plutoniix joined
19:24 afarmer joined
19:24 baldrick1 joined
19:26 Luke joined
19:26 <miviotros[m]> I wanted to play a bit with the state monad in a stack project yesterday. I was quite surprised to see that it does not exist in stackage. Why is that? I don't think it is deprecated but it is difficult to imagine what other reason could have lead to its omission. Am I missing something?
19:26 ejay joined
19:26 <lyxia> transformers is where you find State and it's on stackage
19:28 <miviotros[m]> So I should be looking for StateT, right?. Thank you. Can you explain why transformers?
19:28 <AWizzArd> lyxia: possibly I will have a look at that too.
19:29 <Geekingfrog> miviotros[m] because State is a simple specialisation of StateT
19:29 <geekosaur> State stopped being a standalone monad when mtl2 was released; it is now SateT Identity
19:29 zeroed joined
19:29 <geekosaur> *StateT Identity
19:30 <dmj`> type State s a = StateT s Identity a
19:30 <geekosaur> because it was silly to have standalone State, Reader, Writer that weren't quite compatible with the transformer versions
19:31 MP2E joined
19:31 <geekosaur> the next release fo transformers (or maybe mtl) will apparently have pattern synonyms to restore the old State, Reader, Writer names (currently mtl exports lowercase versions)
19:31 plutoniix joined
19:31 <miviotros[m]> so the same applies to reader and writer?
19:31 <miviotros[m]> ah, apparently yes
19:32 `^_^v joined
19:33 oish joined
19:33 <Myrl-saki> Yayyy
19:33 <Myrl-saki> Whoops. Wrong channel. Sorry.
19:33 <MarcelineVQ> yayyy
19:33 <shapr> Myrl-saki: hey that fits here too
19:33 <Tuplanolla> No fun allowed.
19:34 <Myrl-saki> Happiness is off-topic.
19:34 <* mrkgnao> engages in loud tsk-ing
19:34 <Jonathan222> If im having a list of lists of lists of Integers, and i only want to concat the 2 inner parts, is there a smart way to do it? concat xs concatenates the outer parts.
19:34 <Myrl-saki> Jonathan222: fmap concat.
19:35 <mrkgnao> fmap concat?
19:35 <Jonathan222> thank you ill look into that.
19:35 xcmw joined
19:35 smillmorel joined
19:36 <EvanR> in order to catch a SomeException, add my own string to the beginning of the message, and rethrow it, do i need to make a whole new Exception type
19:36 <mrkgnao> does anyone know how I can get my local haddocks to look as pretty as the Stackage ones?
19:37 <mrkgnao> is it some fpco-proprietary CSS?
19:37 conal joined
19:37 <MitchellSalad> how can CSS be proprietary...?
19:37 <EvanR> CSS that works in your browser but not someone elses
19:39 <mrkgnao> I guess that could be made a thing.
19:39 plutoniix joined
19:41 flatmap13 joined
19:41 hybrid joined
19:42 jer1 joined
19:43 Itkovian joined
19:43 plutoniix joined
19:44 iAmerikan joined
19:46 Arizona6882 joined
19:46 <rblaze> :w
19:46 plutoniix joined
19:47 <ExpHP> :e rblaze <CR> ggdG
19:47 Luke joined
19:48 sgronblo joined
19:48 yellowj joined
19:49 RayNbow`TU joined
19:51 descender joined
19:53 plutoniix joined
19:53 sgronblo joined
19:55 cables joined
19:56 <EvanR> heh man... i used a continually being-killed watchdog thread to let my game do things during the time when the main thread is blocked on vsync, with sdl2
19:56 eacameron joined
19:56 plot joined
19:57 <EvanR> that ended up being a lot more complicated than i was hoping for
19:58 plutoniix joined
19:58 <EvanR> also the name userError is pretty bad, if it shows up anywhere
19:59 CoderPuppy joined
20:00 a3Dman joined
20:01 justin3 joined
20:01 jer1 joined
20:01 carlomagno joined
20:01 DocWinter joined
20:01 leat joined
20:01 <Jonathan222> is there an easy way to simulate fmap when fmap itself is not (yet) allowed to use?
20:01 <EvanR> how is that possible
20:02 bobakk3r joined
20:02 <MarcelineVQ> for lists fmap is known as map, so you can use that if you're familiar with it
20:02 dm3 joined
20:03 <Jonathan222> well, we are allowed to use map and concat and with an input like [[[Integers]]] the 2 inner lists are supposed to be concatenated.
20:03 <Jonathan222> simply using concat concatenates the 2 outer lists, and map concat doesnt seem to work
20:03 Yuras joined
20:04 nakal_ joined
20:05 plutoniix joined
20:05 <Jonathan222> nvm im stupid
20:05 <Jonathan222> solved itself
20:05 <Arizona6882> problems of the form -> "U can not USE" are really stupid
20:06 _sg joined
20:06 <Arizona6882> instead of creativity they pose constraints
20:06 carlomagno1 joined
20:06 <MarcelineVQ> sometimes, other times it forces you to show you understand the concepts, you can use traverse without knowing how to write it
20:07 <Cale> I don't know if I'd categorically agree with that -- there are many cases in which the exercise is to build something up from more primitive notions, and if you were allowed to use pre-existing things in the libraries, it would miss the point of the exercise.
20:07 rperry joined
20:08 <shiona> Arizona6882: well, a novice exercise might be "Implement map for lists". Being able to answer "map" does not require much thought on what's going on.
20:08 tromp joined
20:08 cpup joined
20:08 <shiona> (just a different wording for Cale's point, I assume)
20:08 <Ptival> is ekmett ever around? the package bound on hackage seems completely unbuildable :(
20:09 <johnw> Ptival: he is, more often in #haskell-lens
20:09 <johnw> or let him know via Twitter
20:09 <Ptival> johnw: thanks, will try to reach out!
20:09 <Arizona6882> Ptival: he was around 4 hours ago
20:09 carlomagno joined
20:09 <Arizona6882> Ptival: so ever does not apply :)
20:10 <Arizona6882> Cale: i did not see good problems of this sort, but bad patter is clearly visible.
20:10 <Ptival> Arizona6882: I didn't mean it as a bad "ever", was just wondering if he still came around here or not, w/o knowledge :)
20:11 nh2 joined
20:12 <Arizona6882> Cale: some CT theorist would say that fmap is more fundamental than map.
20:12 ridho joined
20:12 `^_^v joined
20:13 ChaiTRex joined
20:13 <Arizona6882> i dont like whole premise of teachen somebody something by forbidding stuff
20:13 plutoniix joined
20:13 <Arizona6882> curious people will learn everything good themselfs, only small nudge is needed
20:17 <EvanR> ok, and now that i have exceptions even happening and crashing my program
20:17 <EvanR> how do i get some indication of where in the program it crashed from?
20:17 <EvanR> right now it says "Prelude.undefined" in my test
20:17 `^_^v joined
20:18 soniku joined
20:19 <MarcelineVQ> grep -r undefined src/
20:19 <EvanR> which may or may not actually work
20:20 <Cale> Yeah, don't use undefined.
20:20 <EvanR> well i dont get a choice of what bugs were written as
20:20 buttbutter joined
20:20 cpennington joined
20:20 <EvanR> like division by zero in some arithmetic somewhere, is there no hope?
20:21 <Cale> When you find the package responsible, stop using that package, or fork it.
20:21 <MitchellSalad> EvanR: check out https://wiki.haskell.org/Debugging
20:21 <MarcelineVQ> that's a difference exception
20:21 <MitchellSalad> (specifically, section 1)
20:21 `^_^v joined
20:21 eacameron joined
20:22 unyu joined
20:22 <MarcelineVQ> fire up a stack trace for a chance at a hint, ghci -prof -fexternal-interpreter
20:22 plutoniix joined
20:22 jer1 joined
20:22 <EvanR> imagine the final program is running live, on a taco bell drive through manifest display. it has no bugs supposedly. then it crashes with an exception message. hopefully that message is helpful, but if its not, you have no idea what happened?
20:22 <MarcelineVQ> undefined is usually in your own source though, grep should catch it
20:22 <EvanR> i am not asking about undefined.
20:24 <MitchellSalad> EvanR: so would a stack trace be sufficient?
20:24 <MitchellSalad> or are you saying, "what if there's no stack trace and I can't re-run the program?"
20:24 plutoniix joined
20:24 <EvanR> a file and line number would be better than nothing
20:25 <EvanR> so profiled build
20:25 <EvanR> which will reduce performance right
20:25 cdg joined
20:25 <MitchellSalad> definitely
20:25 <EvanR> i guess this is how C fails too right
20:25 <EvanR> segmentation fault, thats it
20:25 <Cale> If you write a pattern match, you'll get a file and line number
20:26 <EvanR> well pattern match failure is one way to fail
20:26 plutoniix joined
20:26 <EvanR> im not sure i understand all the possible ways to fail
20:26 <Cale> There's also a package called 'loch-th' which uses Template Haskell to get you file and line numbers
20:26 <EvanR> hmm.
20:27 <Cale> It's generally better to write (\(x:_) -> x) than to write head
20:27 <Cale> because if that lambda fails, you get a much better message
20:27 <EvanR> ok, so that takes care of situations where you use a partial function and "know" it cant crash
20:28 <EvanR> wait, how is head implemented if not by pattern matching?
20:28 <MitchellSalad> head [] = error "Prelude.head: empty list"
20:28 <Cale> > head []
20:28 <lambdabot> *Exception: Prelude.head: empty list
20:28 <EvanR> so it would be better to not define head [] ?
20:28 <Cale> > (\(x:_) -> x) []
20:28 <lambdabot> *Exception: <interactive>:3:2-12: Non-exhaustive patterns in lambda
20:28 <EvanR> (and get warnings)
20:28 <Cale> No, that wouldn't fix things
20:29 <Cale> The point is that by implementing head in-place, you get a line number where the actual failure occurred
20:29 <EvanR> alright
20:29 <MitchellSalad> > catch (evaluate (head [])) (\(e :: PatternMatchFail) -> putStrLn "I'm alive!")
20:29 <lambdabot> <IO ()>
20:29 <EvanR> so how about arithmetic errors
20:29 `^_^v joined
20:29 <Cale> Those are so rare, I don't have any special strategy for them
20:30 bigos_ joined
20:30 <EvanR> well, i see them all the time
20:30 darjeeling_ joined
20:30 <Cale> If there's a division by zero failure, I'll go to the one division in my entire application and fix it :P
20:30 <EvanR> i have a case and then error "its negative dummy"
20:30 <EvanR> so its better to replace that with (\(x:_) -> x) [] ??
20:30 <Cale> Nah, use loch-th to provide a good message there
20:31 <Cale> It'll also add the line number and file to the message
20:31 <EvanR> theoretically sounds good
20:31 plutoniix joined
20:31 <EvanR> i was trying to avoid TH due to cross compilation being experimental
20:31 <MitchellSalad> 'error' should give call stacks, too, these days
20:31 <MitchellSalad> > error "sup"
20:31 <lambdabot> *Exception: sup
20:32 <MitchellSalad> on a new enough base
20:32 <EvanR> and on undefined?
20:32 <MitchellSalad> yeah, since undefined = error "undefined"
20:32 <EvanR> i guess that should solve it then
20:32 <ezyang> note that you stil need to have HasCallStack to get useful stacks
20:32 <EvanR> im not sure i even see the point of a "full" stack trace
20:33 <Cale> A full "stack" trace
20:33 <EvanR> and HasCallStack
20:33 <Cale> I kind of hate that name actually
20:33 <Cale> It has nothing to do with a call stack :P
20:33 <EvanR> file and line number, if even that makes sense, is all we really should expect by default
20:33 <MitchellSalad> ezyang: my stack traces seem to exist even when I don't write HasCallStack in my code
20:34 RGamma joined
20:34 <MitchellSalad> just running 'main = undefined' shows a stack trace, for example
20:34 Anonymous0250 joined
20:34 <ezyang> yes, but do you get info about the caller?
20:35 <MitchellSalad> ah, good point
20:35 <c_wraith> Cale, would you prefer PretendsToHaveACallStack?
20:35 mjora7 joined
20:35 <EvanR> i tried throwIO from an sdl audio callback thread
20:36 plutoniix joined
20:36 <EvanR> surprisingly it crashed my program as if the except were raised in the main thread
20:36 <EvanR> i wonder how it did that...
20:36 <ezyang> this is why type IO a = HasCallStack => Prelude.IO a is magic!!!
20:37 niez joined
20:37 <MitchellSalad> haha
20:37 istvan joined
20:37 <Cale> c_wraith: :)
20:37 <Cale> c_wraith: I actually think it would be really cool to have a way to visualise the real stack
20:38 <Cale> i.e. as a sequence of mostly pattern matches
20:38 <MitchellSalad> ezyang: do you know if something along those lines is planned for a future GHC?
20:38 <c_wraith> isn't that supposed to be available by hooking into the DWARF debugging data?
20:38 <MitchellSalad> having to write 'HasCallStack =>' everywhere is... yeahh
20:38 <Cale> c_wraith: Possibly, I have no idea
20:38 plutoniix joined
20:39 <Cale> c_wraith: But the real trick is preserving enough bits of the source code to render it in a nice way... maybe they do that, I don't know
20:39 <ezyang> no, because there is a nontrivial cost to passing an actual parameter
20:39 danthemy_ joined
20:39 <c_wraith> do debug builds pass that parameter everywhere?
20:40 <MitchellSalad> you mean -prof?
20:40 justin3 joined
20:40 <c_wraith> hmm, yes. that is all there is.
20:41 <c_wraith> may be time to add a compiler flag to implicitly add HasCallStack to everything
20:41 <MarcelineVQ> cafs cafs cafs spooky cafs at a distance http://simonmar.github.io/posts/2016-02-12-Stack-traces-in-GHCi.html
20:41 the|auriscope joined
20:41 mekeor joined
20:42 plutoniix joined
20:43 rodrigo__ joined
20:43 jer1 joined
20:43 ejay joined
20:44 shivansh joined
20:44 shivansh left
20:44 bobakk3r left
20:44 Digit joined
20:44 plutoniix joined
20:45 <EvanR> calls to error are often lifted to the top level as CAFs.. which breaks the stack trac simulation
20:45 <EvanR> its interesting that conceptually optimization is at odds with comprehensibility
20:46 <EvanR> people else where want both, and id like to settle for comprehensibility
20:46 sleffy joined
20:46 <EvanR> and some people want optimization first
20:46 unyu joined
20:47 plutoniix joined
20:47 sgronblo joined
20:48 bjz joined
20:49 raynold joined
20:49 iAmerikan joined
20:51 uglyfigurine joined
20:51 flatmap13 joined
20:51 hust921 joined
20:51 hust921 joined
20:52 tomphp joined
20:53 sgronblo joined
20:54 dddddd joined
20:55 plutoniix joined
20:55 `^_^v joined
20:57 lambdaman joined
20:57 uglyfigurine joined
20:58 <istvan> I am looking to write a function that returns UUIDs but instead of random data I want an incrementing number. What is the best way to do that?
20:58 blym joined
20:58 <EvanR> er, an incrementing UUID?
20:59 <EvanR> if you want the effect of a UUID but that increments, you can begin a counter at a random very large integer
20:59 <EvanR> and the ID is the digits of that number
21:00 burtons_ joined
21:00 <kuribas> Why do I get parse error line 26? http://paste.lisp.org/display/345818
21:00 mrkgnao joined
21:00 <kuribas> I cannot find it (I must be getting tired...)
21:00 <istvan> EvanR, so I store that counter in global state and update its value?
21:00 <EvanR> i wouldnt store it in a global state
21:01 <EvanR> you want to pass around the generator somehow
21:01 dm3 joined
21:02 <EvanR> but why do you not want to use UUIDs instead
21:02 <monochrom> Best of both worlds: Pass around global state :)
21:02 <kuribas> It says "Parse error in pattern replicatem_, probably caused by a missing do"?
21:02 RedW0lf joined
21:02 <EvanR> down with the global state
21:02 RedW0lf left
21:02 <geekosaur> kuribas, I see a place where it does look like either you missed a do or you didn;t unindent
21:03 <istvan> EvanR, This is more of a thought excercise. Maybe UUID isn't really what i'm trying to understand how to do, even a number that increments from 0 would do.
21:03 <EvanR> ah
21:03 <kuribas> geekosaur: where?
21:03 <EvanR> right, this is a "supply" pattern
21:03 <MarcelineVQ> I
21:03 <geekosaur> after `graph <-`
21:03 <kuribas> geekosaur: right, thanks!
21:03 jer1 joined
21:04 <MarcelineVQ> istvan: 've come across that pattern just recently and saw a really quite interesting take
21:04 <EvanR> istvan: the simplest possible thing is, if you have an infinite list of values. you can pattern match to take the next one and get the rest as the next generator state
21:04 <kuribas> geekosaur: bad error reporting from ghc...
21:04 <rcat> anyone knows if there is a HTTP/2 client available?
21:04 <EvanR> newId :: [ID] -> (ID, [ID])
21:05 <istvan> EvanR, how do you store the next generator state? I was hoping to write a module with a function getNextNumber or something of the sort
21:05 <MarcelineVQ> https://hackage.haskell.org/package/neet-0.4.0.1/src/src/Control/Monad/Fresh/Class.hs instances defined here https://hackage.haskell.org/package/neet-0.4.0.1/src/src/Neet/Population.hs
21:05 plutoniix joined
21:05 <EvanR> yeah you can use basically a State monad as described in MarcelineVQ's link
21:05 <MarcelineVQ> another way is global IORef but this was cooler
21:05 <EvanR> the Supply monad has been around a while
21:07 <EvanR> https://hackage.haskell.org/package/monad-supply-0.6/docs/Control-Monad-Supply.html
21:07 darjeeling_ joined
21:07 JeanCarloMachado joined
21:07 <lambdamu_> http://lpaste.net/355200 this should be an injective type family, no?
21:08 takle joined
21:08 tromp joined
21:09 <jle`> what the heck @ this Supply monad
21:09 conal joined
21:09 kau joined
21:09 <EvanR> yep
21:10 <jle`> peek and supply are partial for the instance for Supply and SupplyT
21:10 <EvanR> right
21:10 <EvanR> not Maybe
21:11 <EvanR> which is more convenient for supplies that never run out
21:11 conal joined
21:12 <jle`> then StateT [s] m a is the wrong implmenetation
21:12 plutoniix joined
21:12 ridho joined
21:12 <EvanR> why
21:13 <jle`> `StateT (NonEmpty s) m a` at best
21:13 <jle`> *at least
21:13 grim_ joined
21:13 <EvanR> then how would you know if it was empty
21:14 <EvanR> exhausted
21:14 markasoftware joined
21:14 <jle`> it is also a bad implementation but it is better :o
21:14 <EvanR> it kind of makes exhausted pointless, so youre really asking to redesign the API
21:14 <MitchellSalad> yeah this library is crap
21:14 <jle`> exhausted is not pointless for many instances
21:14 <jle`> just for that specific instance
21:15 <jle`> but at least it'd be total
21:15 epsilonhalbe joined
21:15 grim_ left
21:15 fotonzade joined
21:15 <EvanR> evalSupply :: Supply s a -> [s] -> a
21:16 <EvanR> youd need to change that API
21:16 <jle`> evalSupply is literally partial
21:16 <EvanR> yeah
21:17 dedicated joined
21:17 <EvanR> a version of this whole thing that is based on Stream would make more sense strictly speaking
21:17 <EvanR> the possibility of running out is a whole nother world really
21:17 zeroed joined
21:18 steeze joined
21:19 rperry joined
21:20 sivs joined
21:22 peterbecich joined
21:22 romank joined
21:23 viran joined
21:24 jer1 joined
21:24 heurist joined
21:24 plutoniix joined
21:25 <viran> Hey, a bit off topic, looking at lecture notes saying NFA that accepts L = {0} has two states. I figure out a 3 states NFA/DFA ... is it possible with 2 states?
21:27 <Tuplanolla> What does that notation mean, viran?
21:27 <viran> Tuplanolla: Language L, with one word "0"
21:27 <monochrom> Maybe "two states" doesn't include the reject state.
21:28 <monochrom> There is #haskell-offtopic if you like.
21:28 epsilonhalbe left
21:29 <EvanR> i dont see this function in the docs... Ordering -> Ordering which gets the opposite?
21:29 <Tuplanolla> Start in A, which is not a final state; on 0 move to B, which is a final state, viran.
21:30 <MarcelineVQ> EvanR: are you asking about Down?
21:30 <Tuplanolla> Nonexhaustiveness implies rejection.
21:30 <EvanR> no
21:30 <EvanR> foo LT = GT
21:30 <EvanR> foo GT = LT
21:30 tsmish joined
21:31 <Cale> EvanR: compare EQ would do it, but usually you just flip the comparison function.
21:31 <viran> Tuplanolla: Thanks
21:31 <EvanR> oh duh
21:32 <EvanR> er
21:32 <monochrom> > compare EQ LT
21:32 <lambdabot> GT
21:32 <* monochrom> jaw-drops
21:33 <panovia> > sort $ map Down [2,1,4,3,6,5]
21:33 <lambdabot> [Down 6,Down 5,Down 4,Down 3,Down 2,Down 1]
21:33 <EvanR> compare arg1 arg2 = compare arg2 arg1 for the last leg of a Ord instance wont give the right answer
21:33 <EvanR> i have to compare arg1 arg2 = flipordering (compare arg2 arg1)
21:33 JeanCarloMachado joined
21:34 balor joined
21:34 <EvanR> compare EQ is funny
21:34 conal joined
21:34 <c_wraith> now I want a Sorted monoid wrapper so that sorting can be a foldMap
21:34 Fairy joined
21:35 Anonymous0250 joined
21:36 iAmerikan joined
21:36 lambdaman joined
21:36 <c_wraith> hmm. that works out to be a trivial bottom-left mergesort
21:36 plutoniix joined
21:36 <c_wraith> thanks autocorrect. *bottom-up
21:37 flatmap13 joined
21:38 carlomagno joined
21:38 <c_wraith> well, no. it's only a bottom-up mergesort if you foldMap over a relatively balanced tree structure. over a list, it would be an insertion sort. woo, flexible sorting tech!
21:39 <EvanR> flexsort
21:39 <EvanR> patent pending
21:39 <c_wraith> you can also use it to convert screen doors into boats.
21:39 <monochrom> @type foldMap
21:39 <lambdabot> (Monoid m, Foldable t) => (a -> m) -> t a -> m
21:40 carlomagno1 joined
21:40 plutoniix joined
21:41 <monochrom> So is it (Ord x, Foldable t) => (a -> Sorted x) -> t a -> Sorted x?
21:41 {emptyset} joined
21:41 <c_wraith> yeah
21:42 <c_wraith> and newtype Sorted a = Sorted [a], with appropriate instances and smart constructors.
21:42 <c_wraith> that's probably already on hackage
21:43 conal joined
21:43 <EvanR> haskellisms win flawless victory
21:43 <jle`> would be useful with Writer too i suppose
21:44 xcmw joined
21:44 <jle`> but, what you're proposing looks like it's just `Map a Int`, or multisets
21:44 <jle`> with the approprite Monoid instance
21:44 <c_wraith> http://hackage.haskell.org/package/sorted-list-0.2.0.0/docs/Data-SortedList.html oh there it is.
21:46 mac10688 joined
21:46 hackebeilchen joined
21:46 plutoniix joined
21:46 <jle`> @let newtype MMap k v = MMap { getMMap :: M.Map k v } deriving Show; instance Monoid v => Monoid (MMap k v) where mempty = MMap M.empty; mappend (MMap x) (MMap y) = MMap (M.unionWith x y)
21:46 <lambdabot> .L.hs:166:43: error:
21:46 <lambdabot> • Couldn't match expected type ‘M.Map k v’
21:46 <lambdabot> with actual type ‘M.Map k v -> M.Map k v’
21:47 <jle`> @let newtype MMap k v = MMap { getMMap :: M.Map k v } deriving Show; instance Monoid v => Monoid (MMap k v) where mempty = MMap M.empty; mappend (MMap x) (MMap y) = MMap (M.unionWith (<>) x y)
21:47 <lambdabot> .L.hs:166:43: error:
21:47 <lambdabot> • Could not deduce (Ord k) arising from a use of ‘M.unionWith’
21:47 <lambdabot> from the context: Monoid v
21:47 <jle`> @let newtype MMap k v = MMap { getMMap :: M.Map k v } deriving Show; instance (Ord k, Monoid v) => Monoid (MMap k v) where mempty = MMap M.empty; mappend (MMap x) (MMap y) = MMap (M.unionWith (<>) x y)
21:47 <lambdabot> Defined.
21:47 <jle`> > M.toList . getMMap $ foldMap (\x -> MMap (M.singleton x (Sum 1))) "hello"
21:47 <lambdabot> [('e',Sum {getSum = 1}),('h',Sum {getSum = 1}),('l',Sum {getSum = 2}),('o',S...
21:48 jer1 joined
21:48 <jle`> > concatMap (\(x,n) -> replicate n x) . M.toList . getMMap $ foldMap (\x -> MMap (M.singleton x (Sum 1))) "hello"
21:48 <lambdabot> error:
21:48 <lambdabot> • Couldn't match type ‘Sum Integer’ with ‘Int’
21:48 <lambdabot> Expected type: MMap Char Int
21:48 <jle`> > concatMap (\(x,Sum n) -> replicate n x) . M.toList . getMMap $ foldMap (\x -> MMap (M.singleton x (Sum 1))) "hello"
21:48 <lambdabot> "ehllo"
21:48 <jle`> > concatMap (\(x,Sum n) -> replicate n x) . M.toList . getMMap $ foldMap (\x -> MMap (M.singleton x (Sum 1))) "sorting done as fold map using map"
21:48 <lambdabot> " aaaddefggiilmmnnnooopprssstu"
21:49 <MarcelineVQ> you've gone mad with power
21:49 <jle`> i think this should be faster than the merge-sort-recombine
21:49 <EvanR> merging sorted lists is fast though...
21:50 <c_wraith> on a flat data structure, sure. I'm not sure about on a tree.
21:50 <EvanR> sort list of trees?
21:50 <c_wraith> ie, I think that will beat the insertion sort degenerate case, but I'm less sure about when it actually gets to be a merge sort.
21:51 <jle`> well, union from Data.Map is specialized to combining sorted sets of keys
21:51 v0latil3 joined
21:51 <jle`> so i assume that whatever it does is the fastest way of doing it
21:51 v0latil3 joined
21:51 <c_wraith> also, that fails utterly when used with a type where "equal" values can vary.
21:52 <jle`> yes but those are degenerate instances of Eq anyways right
21:52 <jle`> i guess this is not a stable sort
21:52 <c_wraith> but they happen and sometimes are *really* useful. :)
21:53 <jle`> i recognize only the purest eq instances
21:53 hiratara joined
21:53 <EvanR> equal values always vary. you could even compare two things for equality if they didnt differ somehow, like where on the screen you typed them ;)
21:53 <EvanR> couldnt even*
21:54 cloudhead joined
21:54 carlomagno joined
21:54 plutoniix joined
21:55 bla_ joined
21:55 <bla_> a
21:56 plutoniix joined
21:57 unyu joined
21:58 plot joined
21:58 Itkovian_ joined
21:58 plutoniix joined
21:59 oisdk joined
21:59 Levex joined
21:59 darjeeling_ joined
22:00 plutoniix joined
22:00 Fairy joined
22:00 sgronblo joined
22:01 rperry joined
22:02 plutoniix joined
22:05 refold joined
22:05 Levex joined
22:06 plutoniix joined
22:07 jer1 joined
22:07 halogenandtoast joined
22:09 chao-tic joined
22:09 zero_byte joined
22:12 ertes joined
22:13 romank joined
22:14 ridho joined
22:16 hackebeilchen1 joined
22:17 mmachenry joined
22:19 soniku joined
22:21 micmus joined
22:21 ego joined
22:22 richi235 joined
22:23 fizbin joined
22:23 Sose_ joined
22:23 hackebeilchen joined
22:24 Levex joined
22:24 tromp joined
22:24 spacecadetbrown joined
22:25 carlomagno joined
22:27 Fairy joined
22:27 mjora7 joined
22:28 jer1 joined
22:31 hiratara joined
22:32 hackebeilchen joined
22:32 Levex joined
22:32 JeanCarloMachado joined
22:33 mmn80 joined
22:33 nh2 joined
22:36 hackebeilchen1 joined
22:37 rperry joined
22:37 hackebeilchen joined
22:40 justanotheruser joined
22:43 anuxivm joined
22:44 hackebeilchen joined
22:44 markasoftware joined
22:44 blym_ joined
22:46 iqubic joined
22:47 <iqubic> Hello
22:47 <iqubic> I am here.
22:48 hybrid joined
22:48 jer1 joined
22:49 afarmer joined
22:49 iqubic joined
22:49 <iqubic> I love haskell and functional programming.
22:49 <jle`> same
22:50 <iqubic> I'm taking a Computer Science Course at school and I'm having to use Java
22:50 roar joined
22:50 <iqubic> And I really think that our current project would be a lot easier if Java were lazy.
22:51 richi235 joined
22:52 <monochrom> Use Iterator to regain lazy list.
22:55 <iqubic> monochrom: That's not what I want to do. I want to have a list of functions, that I call in a particular order.
22:55 <iqubic> And they all have the same signature.
22:55 <iqubic> It's like having this [a -> b]
22:55 Koterpillar joined
22:56 blym_ joined
22:56 <monochrom> Sure. Any particular reason why what you said can't be done in Java?
22:56 <ertes> be sure to use the latest design patterns… and keep up with the news, because they change every week
22:56 Koterpillar joined
22:57 <ertes> if your directory structure is not at least 20 levels deep, you're doing it wrong
22:57 <niez> iqubic, maybe you want a list of functors?
22:57 <iqubic> However some of the functions have an additional parameter or two.
22:57 samp joined
22:57 <iqubic> niez: I want the java equvalent of that.
22:57 <ertes> monochrom: well, for one thing java doesn't really have first-class functions
22:58 <glguy> Fortunately, the benefits and contraints of programming in Java are off-topic in #haskell
22:58 romank joined
22:58 plot joined
22:58 <niez> iqubic, I mean the functor from object oriented world, not a functor like in haskell
22:58 <iqubic> I'll take this elsewhere.
22:59 <iqubic> niez: What kind of data would that be?
22:59 Jona222 joined
23:00 <iqubic> Is it possible to have optional parameters in Haskell
23:00 <iqubic> ???
23:00 <Jona222> Hello everyone. I am given a String with mixed characters: "abc123def456" for example. Is there a way to add up every number in it using only pattern matching? Advice is appreciated
23:00 uuplusu_ joined
23:01 systadmin joined
23:01 <Sonolin> lol I just took what iqubic said as an excercise in another language, and was starting at the code for like 5 minutes wondering why I can't just do "f a"
23:01 <Rembane> iqubic: Yes, and no, they are not built into the language in the same way as they are in for instance C++ or Java, but you can have an OptionalArg data type that has a Monoid instance which will let you combine all the optional parameters you need.
23:01 <kadoban> Jona222: I'm never sure what that means, "only feature X". Is there something specific you're trying to avoid? I'd just filter it so it's only digits and then sum those.
23:02 halogenandtoast joined
23:03 <iqubic> Rembane: Java doesn't have optional arguments either.
23:03 nakal joined
23:03 Levex joined
23:03 <Rembane> iqubic: Oh, well, C++ then, or Python.
23:04 <Koterpillar> Jona222: yes, note that a string is a list of characters
23:04 <Koterpillar> Jona222: …or did I misunderstand you? What result do you want on "abc123def456"?
23:04 <niez> iqubic, http://stackoverflow.com/questions/7369460/help-with-understanding-a-function-object-or-functor-in-java
23:04 <Jona222> Koterpillar 21
23:04 <iqubic> For that he'd want 1 + 2 + 3 + 4 + 5 + 6
23:04 <thang1> Java can have optional arguments if you use a builder type of pattern
23:05 <Jona222> what i have right now: g2 xs = filter isDigit xs
23:05 <Jona222> which gives me a string "123456"
23:05 <iqubic> thang1: Can I use those in a list?
23:05 <Jona222> and i am only allowed to use pattern matching from here
23:05 <jle`> you can mapMaybe readMaybe
23:05 <thang1> So you build up the thing you want by saying objConstructor().arg1().arg2().arg3().arg4(); for example
23:05 <jle`> you aren't allowed to use any functions?
23:06 <iqubic> Jona222: Why do you have to use pattern matching there?
23:06 <jle`> that is...difficult
23:06 <Koterpillar> Jona222: and not even ord?
23:06 <Jona222> Unfortunately, the task says so.
23:06 <jle`> not even + ?
23:06 a3Dman joined
23:06 <thang1> This is also how java composes functions. So if you want to take a stream and filter on the stream you just compose the entire process "builder-like"
23:06 <kadoban> I'm not even really sure what that means, yeah can you use "+" ? Because without that ...
23:06 <jle`> are you expected to implement your own decimal addition on Char's?
23:06 <Jona222> "The following functions are to be implemented using Pattern Matching: [...]
23:06 <jle`> add '1' '1' = '2'
23:06 crobbins joined
23:06 <Koterpillar> doesn't say only
23:06 <iqubic> What task are you working Jona222?
23:06 <Jona222> one of them being add every number in a string
23:07 <jle`> it doesn't say only, so you can probably use things besides pattern matching too
23:07 <glguy> solved "abc123def456" = 579
23:07 <Koterpillar> jle`: add '9' '9' = ?
23:07 <glguy> pattern matching!
23:07 <ChaiTRex> Koterpillar: Obviously '18'.
23:07 <jle`> add :: Char -> Char -> (Char, Char) -- carry digit
23:07 Costar joined
23:07 <iqubic> Jona222: It says you have to use Pattern Matching as one of your tools. Not as the only tool
23:07 <jle`> > mapMaybe readMaybe "abc123def456" :: [Int]
23:07 <lambdabot> error:
23:07 <lambdabot> Variable not in scope: readMaybe :: Char -> Maybe Int
23:08 <jle`> @let import Text.Read
23:08 <lambdabot> Defined.
23:08 <thang1> My gut reaction is that the pattern matching is going to be of the form "if this character is a '1'", "if this character is a '2'", "if this character is a '3'",... etc
23:08 <jle`> > mapMaybe readMaybe "abc123def456" :: [Int]
23:08 <lambdabot> error:
23:08 <lambdabot> • Couldn't match type ‘Char’ with ‘[Char]’
23:08 <lambdabot> Expected type: [String]
23:08 <jle`> aw
23:08 <Digit> ^_^
23:08 <jle`> > mapMaybe (\c -> readMaybe [c]) "abc123def456" :: [Int]
23:08 <lambdabot> [1,2,3,4,5,6]
23:08 <jle`> > sum . mapMaybe (\c -> readMaybe [c]) $ "abc123def456"
23:09 <lambdabot> 21
23:09 soniku joined
23:09 <iqubic> jle`: That uses no pattern matching. LOL
23:09 <thang1> Sure it is!
23:09 jer1 joined
23:10 <iqubic> Your pattern matching on a character.
23:10 <thang1> "sum" is a pattern, mapMaybe is a pattern, lambda functions are a pattern... /s
23:10 <pacak> > mapMaybe ((:[]) . readMaybe) "abc123def456" :: [Int]
23:10 <lambdabot> error:
23:10 <lambdabot> • Couldn't match type ‘[Maybe a0]’ with ‘Maybe Int’
23:10 <lambdabot> Expected type: String -> Maybe Int
23:10 <ChaiTRex> > let digit '1' = 1; digit '2' = 2; digit '3' = 3; digit '4' = 4; digit '5' = 5; digit '6' = 6; digit '7' = 7; digit '8' = 8; digit '9' = 9; digit _ = 0 in map digit "abc123def456"
23:10 <lambdabot> [0,0,0,1,2,3,0,0,0,4,5,6]
23:10 benl23 joined
23:10 <jle`> basically reimplement digitToInt, yeah
23:10 <pacak> > mapMaybe (readMaybe . (:[])) "abc123def456" :: [Int]
23:10 <ChaiTRex> Now just implement 32-bit addition in pattern matching.
23:10 <lambdabot> [1,2,3,4,5,6]
23:11 <Jona222> Thanks everyone, but we didnt get to use "Maybe" yet, so im not sure if i am allowed to do so.
23:11 <pacak> > let 1 + 1 = 3 in 1 + 1
23:11 <lambdabot> 3
23:11 <ChaiTRex> You can even do it with the second operand allowing only a single digit.
23:11 Netwolf joined
23:11 <pacak> ChaiTRex: Done. Works for _some_ 32-bit ints.
23:12 <iqubic> Jona222: What is this activity for?
23:12 <ChaiTRex> Probably best to write a code generator for it rather than doing it by hand, though.
23:12 <thang1> Jona222: look at ChaiTRex's answer, now take that and implement it using pattern matching with guards instead of let statements. After you're done, you can sum the list just fine
23:12 Netwolf left
23:13 <thang1> If you need to reinvent sum, you can do that with pattern matching and explicit recursion, too.
23:13 roar joined
23:14 <ChaiTRex> It would be nice if they handed in a 50-page document mostly taken up by sum using pattern matching.
23:15 <iqubic> Jona222: What is this activity for?
23:15 cschneid_ joined
23:15 ridho joined
23:15 <iqubic> It seems way to constricted for any useful purposes.
23:15 <Jona222> Its homework basically.
23:16 <ertes> 'sum' is a 2-liner for inductively defined natural numbers… the trouble is that you can't add Integer without using some kind of primitive
23:16 <ertes> by "sum" i mean (+)
23:16 robatosan joined
23:16 <Digit> goodness
23:17 lambdaman joined
23:17 <Jona222> I do believe i am allowed to use simple addition here, though
23:17 latro`a joined
23:18 Raptor8m3 joined
23:18 <ertes> Jona222: not that you have a choice anyway… you have to use it
23:18 istvan joined
23:19 oisdk joined
23:22 oisdk joined
23:22 a3Dman joined
23:24 Cale joined
23:27 Koterpillar joined
23:28 biglambda joined
23:29 <biglambda> Does anyone know the syntax for an injective type family within a typeclass?
23:29 <hpc> class Foo a where
23:29 <hpc> type F a
23:29 <hpc> instance Foo Int where
23:29 <hpc> type F Int = Bool
23:30 jer1 joined
23:30 <ertes> biglambda: class C a where type F a = b | b -> a
23:30 carlomagno1 joined
23:30 <hpc> ertes: type family, not fundep ;)
23:30 <ertes> hpc: *injective* type family
23:30 <hpc> oh
23:30 <hpc> oh derp
23:30 <hpc> i didn't even know you could do that
23:31 <ertes> biglambda: note that data families are injective by construction
23:31 <biglambda> Maybe I should describe what I need.
23:31 <ertes> hpc: -XTypeFamilyDependencies
23:31 <biglambda> I have a class Container and a class Selection
23:32 <biglambda> for each instance of container I define it’s selection type
23:32 <ertes> biglambda: like a search type?
23:32 locallycompact joined
23:32 <ertes> or an associated key type?
23:32 oisdk joined
23:32 <biglambda> yes a traversal type basically
23:32 <biglambda> It’s really a path through a tree
23:33 <ertes> biglambda: yeah, i would go with a data family there
23:33 <biglambda> I’d like the selection type to refer back to the container type
23:34 <biglambda> I see, it means I have to box the actual contructor though right?
23:35 <ertes> biglambda: do you have types that share a selection type?
23:35 <biglambda> Both the container and the selector have kind *->*
23:35 <ertes> well, no, you don't
23:35 <ertes> otherwise it wouldn't be injective =)
23:35 <biglambda> :)
23:35 <ertes> biglambda: you don't need to box, as data instances can be newtype
23:36 <ertes> instance C F1 where data Selection = F1Sel1 A | F1Sel2 B
23:36 carlomagno joined
23:36 <ertes> instance C F1 where data Selection F1 = F1Sel1 A | F1Sel2 B
23:36 <ertes> instance C F2 where newtype Selection F2 = F2Sel C
23:36 <ertes> biglambda: this is allowed
23:38 <biglambda> If it’s newtype in the instance does it need to be newtype in the class def?
23:38 <ertes> no
23:38 <ertes> data families are always "data"
23:38 <ertes> newtype is an instance-specific implementation detail
23:38 halogenandtoast joined
23:38 <nshepperd_> Huh. So you need to know the type before you can pattern match?
23:39 <ertes> nshepperd_: yeah
23:39 <glguy> all the constructors are specific to a particular type
23:39 <glguy> so by using the constructor to pattern match you're declaring what the type is
23:39 <thang1> It makes sense, really. Suppose you have a data type Bool = True | False and you want to pattern match on Bool
23:39 <thang1> how do you pattern match on it if you don't know what's inside Bool?
23:40 <robkennedy> Do you guys know linear types? In "retrofitting​ linear types", they say this is invalid: `f :: a -o a; g :: (a -o a -> b) -> a -o a -> b; g k x y = k y (f x)` is invalid. But the result of `f x` is unrestricted, right?
23:40 <biglambda> I think the fact that my container and my selector have kind *->* makes this complicated.
23:40 <ertes> i think nshepperd_ is asking whether you need to know the fully saturated type, and the answer is: you need to know all type arguments that are relevant to instance selection
23:40 <ertes> biglambda: not really
23:41 JUSY joined
23:41 <thang1> robkennedy: linear types can only be used once in the code, right?
23:42 <rightfold> thang1: you need to be more careful in your wording
23:42 <ertes> biglambda: the only caveat is that you can't easily have a single Functor instance for the whole family, but Functor instances have to be instance-specific, unless you code the machinery to derive the family instance by using an extra type class
23:42 JeanCarloMachado joined
23:42 <ertes> biglambda: instance (FunctorHelper a) => Functor (MyFamily a)
23:42 oisdk joined
23:42 dmiles joined
23:43 <ertes> biglambda: but in most cases you might as well just use instance-specific functor instances
23:43 <rightfold> thang1: a value of linear type must be consumed exactly once. This is not equivalent to lexical occurrences (for example, a lambda may close over such a variable, and then the lambda must be applied exactly once)
23:43 dfordivam joined
23:43 <biglambda> Ok so if I have: class Container c where data Selector c :: *-> *
23:43 <ertes> biglambda: instance C F where data Selection F a = … deriving (Eq, Foldable, Functor, Ord, Show, Traversable)
23:44 JUSY left
23:44 <biglambda> And then: instance Container Tree where data Selector = TreePath
23:44 <rightfold> robkennedy: the result of f x is of linear type if x is of linear type, because f returns its input
23:44 <biglambda> Tree, Selector and TreePath are all functors
23:45 <rightfold> robkennedy: there is no function of type :: a -o (a, a), for example. You can't write it
23:45 Destol joined
23:45 <rightfold> Can't eat a cake and have it too
23:46 <EvanR> (:[]) cake
23:47 <robkennedy> rightfold: I see why you want the semantics to be like that, or you'd want some semantics to be like that. But like, `f x = let y = copy x in (y,y)` seems fine with linear typing
23:47 kvda joined
23:48 <rightfold> robkennedy: for most use cases of linear types, copy is presumably not safe and can lead to "double free" bugs
23:49 <rightfold> Unless it does more than just return its input :p
23:49 <EvanR> i.e. do an actual copy?
23:49 <rightfold> (Compare Rust Copy vs Clone)
23:49 <robkennedy> Sure, but you could certainly write a real copy
23:49 <pacak> I suspect copy should exist.
23:49 <glguy> You probably couldn't write a copy that works for all types 'a'
23:49 theDon_ joined
23:49 <glguy> you might be able to get: CanCopy a => a -o (a,a)
23:50 <pacak> Otherwise it limits whatever can be written in linear types
23:50 <glguy> pacak: Linear types doesn't mean you only have -o
23:50 filterfish joined
23:50 jer1 joined
23:50 <glguy> or at least I didn't think it did..
23:51 <pacak> glguy: Yea, you can mix them.
23:52 markus1189 joined
23:52 <nshepperd> yeah, I was imagining data families as sort of like an open GADT, but I guess the way it works makes sense
23:52 <glguy> They are like an open GADT
23:52 markus1219 joined
23:54 <rightfold> pacak: limiting what can be written is the primary job of type systems :P
23:54 <robkennedy> I should finish this paper
23:54 <EvanR> no!
23:54 <rightfold> Having a general copy mechanism is probably not something you want. It's a bit like universal nulls/equals
23:54 <pacak> rightfold: Type system should allow good program and disallow bad ones.
23:55 <nshepperd> glguy: well, they are in that constructors are restricted to particular types. but GADTs also let you bring type information into scope by pattern matching
23:55 <pacak> Without that allow part - best type system is `const (error "typecheck failed")`
23:56 <pacak> Need to read linear types paper
23:56 <pacak> All of it, not just first few pages :)
23:56 {emptyset} joined
23:57 infinity0_ joined
23:57 infinity0_ joined
23:57 <rightfold> Affine types are really cool
23:57 <robkennedy> rightfold: idk about that. Adding something like `withCopy :: a -o (a -o a -o b) -o b` which would allow finite uses seems fine so far
23:58 <robkennedy> But like pacak said, I should finish this before stating more
23:58 louispan joined
23:58 <rightfold> It defeats some of the major use cases of linear types
23:58 <rightfold> For example referentially transparent mutations
23:59 splanch joined
23:59 <rightfold> withCopy $ \a b -> (mutate a, b) -- dangerous!
23:59 <robkennedy> Sorry, that last time I mean `withCopy :: ... -> b`