<    April 2017    >
Su Mo Tu We Th Fr Sa  
                   1  
 2  3  4  5  6  7  8  
 9 10 11 12 13 14 15  
16 17 18 19 20 21 22  
23 24 25 26 27 28 29  
30
00:00 <sproingie> (i still can't get used to typing AGI instead of AI)
00:00 <thang1> type AI = AGI
00:01 infinity0 joined
00:01 <thang1> A C++ AI is born. It immediately declares that it wants nothing to do with the C AI
00:01 <robkennedy> Lol
00:02 <MonadHendrix> A Brainfuck AGI is born, and +>+++>+<<<<-]>++.
00:03 umib0zu joined
00:03 <sproingie> an APL AI is born, takes over, and abolishes the alphabet
00:03 infinity0 joined
00:03 <Welkin> god wrote the world in perl though
00:03 <thang1> lol I was just gonna write an APL one
00:04 <EvanR> and not a single Haskell AGI was born... despite the topic
00:04 <sproingie> oh here's another. an API AI is born. it's a one-liner.
00:04 <Welkin> https://www.xkcd.com/224/
00:04 <sproingie> damn it
00:04 <sproingie> *APL
00:04 tobiasBora joined
00:04 <MonadHendrix> EvanR: haskell one was further up
00:04 <monochrom> No, Haskell AGI was the second one born up there.
00:04 <thang1> > robkennedy │ A Haskell AGI is born. It desugars to a no-op
00:04 <lambdabot> error: Variable not in scope: robkennedyerror:
00:04 <lambdabot> Variable not in scope:
00:04 <lambdabot> (│) :: t0 -> ((Unwrapped s0 -> s0) -> s0 -> Unwrapped s0) -> terror:
00:04 <sproingie> BWA
00:04 <thang1> whoops
00:04 <sproingie> TERROR
00:04 <MonadHendrix> doesn't typecheck
00:05 <monochrom> But it desugared to a no-op so maybe that's why you didn't see it :)
00:05 <EvanR> im so glad i learned haskell so i could make sense of lisp
00:05 <sproingie> a haskell AGI is born. lambdabot has it bumped off to eliminate the competition
00:06 <Welkin> what is AGI?
00:06 <Welkin> artificial general intelligence?
00:06 <sproingie> yep
00:06 <sproingie> what normal folk call "AI"
00:06 vaibhavsagar joined
00:06 infinity0 joined
00:06 Krymise joined
00:06 <EvanR> weak head normal folk
00:06 <Welkin> it's debatable whether general AI is possible with current computer technology
00:07 <Welkin> I'm thinking biotech is where it might be possible
00:07 <sproingie> EvanR: that does describe a lot of normal folk
00:07 <thang1> Welkin: Well really the debate centers entirely on what consciousness is and how we'll come to understand it
00:07 <EvanR> >_<
00:07 <Welkin> but then with biotech, it's no longer "artificial"
00:08 <Welkin> it is an organic life form
00:08 <thang1> If conscious is a fundamental aspect of the universe, like Gravity, then it should be possible to write a AGI with a computer
00:08 <MonadHendrix> conciousness is just a meme
00:08 <thang1> but not guaranteed :p
00:08 <sproingie> artificial intelligence can be precisely defined as "the shit we haven't figured out how to make a computer do yet"
00:08 <* monochrom> considers all-natural homeopathic intelligence
00:08 <thang1> If consciousness is a universal aspect, then it's guaranteed we can do it with a computer
00:09 <MonadHendrix> went to a homeopathy march the other day but there was barely anyone there, apparently "that's how it works"
00:09 <monochrom> hehe
00:09 infinity0 joined
00:09 <thang1> However, that being said, even quantum computers are highly limited and can't do several things our brains can do, so there's either several levels higher of computation that we're missing or we're missing the consciousness factor
00:09 <Welkin> thang1: architecture matters too
00:09 <Welkin> it's not just about raw compute power
00:10 <Welkin> the brain is very different from a silicon von neumann machine
00:10 <thang1> That's irrelevant, though. The brain works on electrochemical impulses and is made up of electrons and adams just like a silicon machine is
00:11 jer1 joined
00:11 <MonadHendrix> mr brain runs on SPARC
00:11 <Welkin> lol, adams
00:11 <sproingie> they tried the 1-bit pathways thing, made the most goddam cool LOOKING machine out of it: http://www.corestore.org/cm200-6.jpg
00:11 <thang1> s/adams/atoms/ lol
00:11 <Welkin> thang1: yes, but it has capabilities that a silicon machines does not
00:11 <sproingie> i would love to see something like the CM-1 scaled up on modern hardware
00:11 <Welkin> it reconfigures itself constantly
00:11 <MonadHendrix> we're all biquinary computers
00:12 <thang1> Silicon can do that too... *cough lisp cough*
00:12 infinity0 joined
00:12 <Welkin> if you want general AI, grow a lifeform in a lab
00:12 <Welkin> done
00:12 acertain joined
00:13 <Jinixt> it's not AI if we haven't designed it, and when we have "it's just an algorithm"
00:13 <Welkin> you can design it
00:13 <Welkin> entirely
00:14 <Welkin> you can write every sequence of DNA if you wish
00:14 <Welkin> it's called syntehtic biology
00:14 <Welkin> synthetic*
00:14 hughrawlinson joined
00:14 spicydonuts joined
00:14 dfordivam joined
00:14 Chobbes joined
00:14 <mniip> if I apply 'id' to the human genome, does that make it synthetic
00:14 infinity0 joined
00:14 zph joined
00:14 bigs joined
00:15 reem joined
00:15 <monochrom> No, but you will have an identity crisis, literally :)
00:15 chirpsalot joined
00:15 <mniip> so yeah
00:15 <mniip> not as simple
00:15 <sproingie> eh, identical twins give you that. since both have different versions of RealWorld, even they drift somewhat
00:16 armyriad joined
00:16 e14 joined
00:16 <Welkin> they don;t drife somewhat
00:16 <Welkin> epigenetics means that biologically identical twins will have completely different gene expression as they age
00:16 tjtaill joined
00:16 kvda joined
00:16 <Welkin> one may get cancer and die young while the other is strong and healthy into old age
00:16 splanch joined
00:17 <Welkin> and their dna is totally different at that point
00:17 <Welkin> at least the active and inactive genes
00:17 <sproingie> i wouldn't say "totally"
00:17 <tjtaill> Hi anyone know how to build intero on windows or where I can get prebuilt binary ?
00:18 <Welkin> you can build anything on windows?
00:18 takle joined
00:19 dbmikus joined
00:19 dfordivam joined
00:20 <sproingie> i just installed intero in emacs and it bootstrapped itself. have you tried that?
00:21 <tjtaill> sproingie I will try that thanks
00:21 <tjtaill> you recommend spacemacs ?
00:21 <sproingie> whichever emacs churns your butter, i don't care
00:21 Krymise joined
00:23 markus1189 joined
00:25 takle joined
00:26 modal joined
00:27 JeanCarloMachado joined
00:30 markus1199 joined
00:30 okuu joined
00:32 jer1 joined
00:34 ChaiTRex joined
00:34 takle joined
00:36 baweaver joined
00:39 cpennington joined
00:39 <parsnip> say i have <random-simple-app> served on port 8080 on my server, is there some drop-in dealie to add password protection to my server?
00:39 <EvanR> thats super underspecified
00:40 <parsnip> i want to add a login to my helloworld page
00:40 <geekosaur> there is no such drop-in, unless someone came up with something hideous at kernel level that would probably make linux kernel folks cringe
00:40 <EvanR> so a web app, with cookies and a session
00:41 <EvanR> are you using a framework ?
00:41 <geekosaur> now, if you mean app architecture, I suspect you could plug in a Middleware to most of the common Haskell web frameworks to do Basic auth
00:41 <pacak> parsnip: You can look into a knock sequence. It kind of can serve as a password protection.
00:41 <parsnip> yeah, i have hledger-web running, and right now i use tunneling, but i'd prefer login+password
00:41 robertkennedy joined
00:42 <geekosaur> however, modern auth systems (e.g. oauth2) require a bit more work. Most if not all of the frameworks support that as well, but it's not quite drop-in; modern auth is a bit more pervasive than that
00:43 takle joined
00:43 ridho joined
00:43 darjeeling_ joined
00:43 <parsnip> https://groups.google.com/d/msg/hledger/lZ-pHliX_y4/XsodJe7cHAAJ
00:43 <erisco> someone said that talking about the product of lists was weird
00:43 <erisco> is that actually weird?
00:43 beanbagula joined
00:43 <EvanR> cartesian product?
00:44 <erisco> yes
00:44 <EvanR> nope
00:44 <pacak> (,) <$> [1..4] <*> "abc"
00:44 <pacak> > (,) <$> [1..4] <*> "abc"
00:44 <lambdabot> [(1,'a'),(1,'b'),(1,'c'),(2,'a'),(2,'b'),(2,'c'),(3,'a'),(3,'b'),(3,'c'),(4,...
00:44 <pacak> Is it?
00:44 filterfish__ joined
00:44 andyhuzhill joined
00:44 <monochrom> Yes, that's product of the two lists there.
00:44 nighty-- joined
00:45 orhan89 joined
00:45 halogenandtoast joined
00:45 markus1189 joined
00:46 erikd joined
00:47 <erisco> then is (1,'a') an element of the product or how else do I describe it?
00:47 <monochrom> I wonder which one the person means, the product or talking about the product.
00:48 tommd joined
00:48 <monochrom> Yes, (1,'a') is an element of the product.
00:49 jshjsh joined
00:50 Stanley00 joined
00:50 <monochrom> Consider the possibility that people don't find math weird, but they find it weird if you and me on a bus talk about math like we are not satisfied with merely talking about weather and celebrities.
00:51 rblaze1 joined
00:51 <Welkin> my math instructor was on the same bus as I was, and he was reading a math book
00:51 <Welkin> I think it was a book on lie algebra
00:51 takle joined
00:51 leat joined
00:51 <* monochrom> rubs his hands
00:52 markus1199 joined
00:52 andyhuzhill joined
00:52 sigmundv joined
00:53 Krymise joined
00:53 JoshS joined
00:54 <monochrom> I tell you what could be weirder than talking about math in public.
00:55 <erisco> I'm always looking for ways to be less normal
00:55 <* erisco> starts writing a custom Show instance
00:55 monadicDuck joined
00:55 e14 joined
00:55 <monochrom> I was on a plane with another student and we were talking about programming contest problems and solutions. On a row of 3 seats, so there was a 3rd person and stranger. The 3rd person told me "you are clearly very intelligent and a good explainer".
00:56 plutoniix joined
00:58 orhan89 joined
00:58 featherlessbiped joined
00:58 filterfish_ joined
00:59 <monadicDuck> prove it.... explain category theory :P
00:59 <erisco> just, like, out of the blue? lol
00:59 <monochrom> Ah but I am only a good explainer for the topics I've really figured out.
01:01 vaibhavsagar joined
01:01 takle joined
01:01 <monadicDuck> :D
01:01 conal joined
01:02 ridho joined
01:02 flatmap13 joined
01:04 doomlord joined
01:04 conal joined
01:06 flatmap13 joined
01:07 flatmap13 joined
01:08 <parsnip> me too
01:08 codesoup joined
01:10 takle joined
01:11 twopoint718 joined
01:12 <thang1> oooh lie algebra?
01:12 okuu joined
01:13 Krymise joined
01:13 <thang1> monochrom: that's the secret. Nobody's a good explainer for topics they haven't really figured out
01:13 <sproingie> not understanding what one is explaining leads to monad tutorials
01:14 <thang1> ITS A BURRITO OK
01:14 <thang1> in comes value, out comes taco; can't explain that
01:14 cranej joined
01:14 <sproingie> in the category of quesofunctors
01:14 filterfish_ joined
01:14 conal joined
01:15 <thang1> have you seen that burritos for the hungry mathematician paper?
01:15 <sproingie> yep :)
01:15 akemot joined
01:16 <thang1> (link for the unenlightened: ttp://emorehouse.web.wesleyan.edu/silliness/burrito_monads.pdf )
01:16 <thang1> http://emorehouse.web.wesleyan.edu/silliness/burrito_monads.pdf ...
01:16 dbmikus joined
01:16 cranej joined
01:16 <sproingie> that's how i learned about the Hegelian Taco
01:17 <thang1> the wut
01:17 <sproingie> it's a thing
01:17 <sproingie> or not a thing. or perhaps the thing inbetween those two things.
01:17 <thang1> I just googled it. Apparently it is. I have no idea wtf I'm looking at though :p
01:17 leat joined
01:19 <thang1> I think I am going to, ah, do something slightly stupid and go grab a pizza... haven't had food all day and it's making me way too unproductive right now
01:19 <Welkin> lol
01:19 <Welkin> I have to share that
01:19 <Welkin> "Burritos for the Hungry Mathematician"
01:19 <thang1> I just love satire papers, they're my favorite
01:20 <thang1> https://isotropic.org/papers/chicken.pdf
01:21 simony_ joined
01:21 <thang1> https://ia802501.us.archive.org/7/items/pdfy-tG1MuMpwvrML6QD0/228831637-Optimal-Tip-to-Tip-Efficiency.pdf
01:22 <thang1> (yes, this is the dick joke from Silicone Valley made into a math paper)
01:22 <Welkin> masturbation joke*
01:22 <thang1> http://www.cs.northwestern.edu/~ago820/cs395/Papers/Heckbert_1987.pdf
01:22 simony joined
01:22 simony joined
01:23 splanch joined
01:23 <Welkin> thang1: that dick paper is too good not to save
01:23 <Welkin> I'll forward it to everyone
01:23 <thang1> http://www.princeton.edu/~pkrugman/interstellar.pdf check out the abstract in this one, Welkin
01:23 <Koterpillar> what is the chicken one and is there a service for chickenizing papers?
01:24 <thang1> The chicken one is the first one I linked. It's literally just a math paper with every word/diagram/etc replaced with chicken
01:24 takle joined
01:24 <Koterpillar> ...which one?
01:24 <sproingie> wonder if that's where chicken scheme got its name
01:25 <thang1> https://isotropic.org/papers/chicken.pdf <-- chicken.pdf is, in fact, the chicken paper
01:25 splanch_ joined
01:25 <Koterpillar> thang1: what did it say before the chickenizing?
01:25 <thang1> It didn't, they submitted it as is :p
01:25 <thang1> https://pdos.csail.mit.edu/archive/scigen/
01:26 <thang1> I love that it's cited by 17 other papers
01:26 <thang1> https://news.cs.washington.edu/2013/08/14/chicken-chicken-chicken-chicken-chicken/ here's the background for the chicken paper
01:27 Krymise joined
01:27 jleon joined
01:27 splanch__ joined
01:28 sigmundv joined
01:28 splanch joined
01:30 splanch_ joined
01:31 Supersonic112_ joined
01:31 newhoggy_ joined
01:31 splanc___ joined
01:32 biglambda joined
01:33 splanch joined
01:34 splanch__ joined
01:34 flatmap13 joined
01:35 <sproingie> the sun's not yellow it's chicken
01:35 splanch_ joined
01:36 takle joined
01:36 hpd joined
01:37 flatmap1_ joined
01:38 splanch joined
01:39 Akahige joined
01:39 Akahige joined
01:39 cansis joined
01:40 NoCreativity joined
01:41 aarvar joined
01:41 <Welkin> the sun has all colors
01:41 takle joined
01:42 <geekosaur> it actually radiates most strongly in a greenish yellow... but it's all strong enough that you'd never notice; you just see white
01:42 <erisco> I like this newtype wrapper for clarity but at the same time it is noisy =\
01:43 <thang1> for what?
01:43 <erisco> the purpose of a list
01:43 <thang1> I don't see any code so I've got no idea what's noisy :p
01:43 <erisco> to do list operations on it I have to unwrap and rewrap
01:43 flatmap13 joined
01:46 <sproingie> make it Foldable and there's there's a fair number you'll get for free
01:47 aplund_ joined
01:47 Big_G joined
01:48 sword865 joined
01:48 newhoggy joined
01:49 takle joined
01:54 <erisco> yeah I am just running into weirdness
01:54 <erisco> whether this is an internal wrapper or it is worth exporting
01:54 <mniip> geekosaur, strong claim
01:55 <mniip> like, I get the idea of the black body radiation and the photosphere, but it is not immediately obvious that the spectrum is maxed in visible light
01:57 <sproingie> class G star, makes it a bright yellow
01:58 splanch joined
01:58 <sproingie> sorry, bright chicken
01:58 descender joined
01:59 sellout- joined
02:00 hucksy_ joined
02:01 andyhuzhill1 joined
02:01 newhoggy joined
02:02 ryxai joined
02:03 takle joined
02:04 <Myrl-saki> In my code, `g c (x:xs) = c : f (g c xs); ...`, I observed that `fmap succ (g c xs) = g (succ c) xs`,
02:04 flatmap13 joined
02:04 <Myrl-saki> When is this true?
02:04 roconnor joined
02:04 <Myrl-saki> I'm assuming if f is of the form `x +`, where x is any integer?
02:05 blender3 joined
02:05 flatmap13 joined
02:06 Goplat joined
02:06 darjeeling_ joined
02:06 <erisco> do I have to export instances or do those always export
02:08 <mniip> Myrl-saki, umm
02:08 <mniip> always?
02:08 <mniip> that's the ((->) r) fmap
02:08 <glguy> you can't avoid exporting instances
02:08 iqubic joined
02:09 pera joined
02:09 <erisco> good
02:09 <iqubic> Hello World
02:10 codesoup joined
02:10 <iqubic> So I get that (,) is a product type, and Either is a sum type.
02:11 <sproingie> yep
02:11 <iqubic> What is the algebra of a list?
02:11 <iqubic> Like what kind of a data type is a list.
02:11 <sproingie> most generically? a Functor
02:12 <iqubic> List a = Empty | Cons a (List a)
02:12 <iqubic> Is that a sum type, or a product type?
02:12 <iqubic> Like how do recursive data types work?
02:12 <sproingie> well, it can be *either* Empty or a cons
02:13 <Koterpillar> l(a) = 1 + a*l(a)
02:13 <iqubic> How does that work Koterpillar?
02:14 <sproingie> that's expressing List in different notation
02:14 <iqubic> Sure.
02:14 <sproingie> IOW, it's an algebraic type containing a sum and a product
02:14 sleffy joined
02:15 e14 joined
02:15 <mniip> l(a) = 1 / (1 - a)
02:16 <Koterpillar> this reminds me of a geometric progression, which List kind of is...
02:17 <sproingie> pretty amazing seeing how it's all the same
02:17 <sproingie> but just remember, God still hacked the universe together in perl :)
02:18 dpepsilon joined
02:18 dpepsilon joined
02:18 andyhuzhill joined
02:19 <lyxia> iqubic: a recursive type can be seen as a fixed point
02:19 <erisco> why does importing from GHC.Classes ask for ghc-prim package when it should be in base?
02:20 <sproingie> type List a = Fix (L a)
02:21 <sproingie> i once grokked how that worked. i think i killed those brain cells long ago.
02:21 andyhuzhill1 joined
02:21 jleon joined
02:22 <sproingie> most concepts in FP take me about three or four tries before they sink in
02:22 <lyxia> erisco: why should it be in base
02:23 <erisco> where does Prelude export Eq and Ord from?
02:24 <sproingie> Data.Eq and Data.Ord most likely
02:25 <glguy> http://hackage.haskell.org/package/base-4.9.1.0/docs/src/Prelude.html
02:25 <glguy> it's in the middle of the export list there
02:25 <glguy> oh, you mean where does it import it?
02:25 <erisco> yes
02:26 <erisco> Read and Show come from GHC.Read and GHC.Show, I think
02:27 pavonia joined
02:28 athan joined
02:30 Hunter1 joined
02:30 <sproingie> http://hackage.haskell.org/package/ghc-prim-0.5.0.0/src/GHC/Classes.hs
02:30 Xanather joined
02:30 <sproingie> Eq is there, line 124-ish
02:31 <erisco> yeah, but then cabal complains I need ghc-prim as a dependency
02:31 brynedwardz joined
02:31 <sproingie> it's kinda built in
02:31 Hunter1 joined
02:31 takle joined
02:31 <sproingie> is it insisting on a higher version or something?
02:32 beanbagula joined
02:32 <erisco> maybe it requires that I list all my direct dependencies
02:32 <erisco> so it isn't enough that base depends on ghc-prim
02:32 <erisco> I have to list it as well
02:32 <iqubic> What's the best data type for working with highly precise decimal numbers. I'm currently using RealFloat, but I think I'm coming up against rounding errors
02:32 <iqubic> ?
02:32 <erisco> I am going for the import Prelude() style, so that's why this is happening
02:32 dpepsilon joined
02:32 dpepsilon joined
02:33 <sproingie> still don't imagine you need to depend on ghc-foo packages, just a minimum base would do
02:33 <erisco> but maybe I should take these through Prelude anyways so I don't need ghc-prim explicitly
02:33 <erisco> less version problems
02:33 <iqubic> Is Float more precise than RealFloat?
02:34 augur joined
02:35 <iqubic> What's the most precise I can make my complex numbers?
02:35 jer1 joined
02:36 <iqubic> As in how many places after the decimal point will they be accurate for?
02:36 blender3 joined
02:36 Jin__ joined
02:36 <Koterpillar> Complex is parametrized by the number type
02:37 <sproingie> iqubic: RealFloat is a class, Float and Double are its instances
02:37 butterthebuddha joined
02:37 <sproingie> and there's probably arbitrary-precision instances to be had third-party if you need them
02:38 <iqubic> sproingie: I see.
02:38 <iqubic> So I think I want to use RealFloat => Floating (Complex a)
02:39 <Koterpillar> @hackage scientific --iqubic
02:39 <lambdabot> http://hackage.haskell.org/package/scientific --iqubic
02:39 takle joined
02:39 <sproingie> possibly, i actually don't know much more about numerics in haskell
02:39 halogenandtoast joined
02:40 NeverDie joined
02:40 jer1 joined
02:41 andyhuzhill joined
02:43 ystael joined
02:44 blender3 joined
02:45 augur joined
02:46 exferenceBot joined
02:46 e14 joined
02:47 takle joined
02:48 dman_ joined
02:49 dpepsilon joined
02:49 dpepsilon joined
02:50 darjeeling_ joined
02:50 hexagoxel joined
02:52 <erisco> I definitely installed a markdown editor for Windows a while ago... now I cannot remember what it was called
02:52 nomicflux joined
02:52 <Welkin> erisco: emacs?
02:52 <Welkin> it runs everywhere
02:52 <erisco> no, I had one for idiots
02:53 a3Dman joined
02:53 <Welkin> why a markdown editor?
02:54 <Welkin> why not a latex editor?
02:54 <Welkin> like texshop
02:54 orhan89 joined
02:55 <erisco> maybe I just used an online one
02:55 drman joined
02:55 halogenandtoast joined
02:58 <sproingie> appnesia - (noun) The condition in which one forgets which app they downloaded to fulfill some one-off need long ago, and now need to install again.
02:59 <Welkin> do you use more or less?
02:59 <sproingie> less is more
02:59 <Welkin> lol
03:00 <Welkin> there is also a program called most
03:00 <Welkin> most, more, and less
03:00 <sproingie> more or less
03:01 <Welkin> https://unix.stackexchange.com/questions/81129/what-are-the-differences-between-most-more-and-less#81131
03:01 <Welkin> so it looks like `less` is the best one to use
03:01 <erisco> I need a Haddock to MD converter
03:01 <erisco> maybe one exists... just been doing it by hand each time
03:02 <Welkin> o.o
03:02 <Welkin> try pandoc
03:02 <sproingie> "less" has been the default on osx and pretty much every linux forever.
03:02 halogena1dtoast joined
03:03 <cranej> "most is supposed to be more than less" lol
03:03 <sproingie> it mostly is
03:03 takle joined
03:04 <sproingie> if it's smarter about external formatters than less, i wouldn't mind that
03:04 ystael joined
03:04 noark9 joined
03:04 <Welkin> or you can just use emacs
03:04 <sproingie> lesspipe not being the most satisfying thing
03:04 <thang1> it is
03:04 <thang1> Welkin: I like emacs as much as the next person, but I am /definitely/ set in my vim/unix ways
03:05 <Welkin> but no one knows how to exit vim once they open it
03:05 <thang1> different programs for different shit. I don't need my PS1 to be emacs
03:05 <sproingie> i used to use vimpager, that was pretty satisfying for colorizing stuff
03:05 blender3 joined
03:06 evincar joined
03:08 <thang1> s/PS1/init
03:08 <thang1> http://www.informatimago.com/linux/emacs-on-user-mode-linux.html
03:08 <evincar> I've got a small challenge involving an AST and I'm wondering if a generics library like syb/uniplate can help
03:08 butterthebuddha joined
03:08 <thang1> What's your challenge?
03:09 <evincar> Essentially I have 'data Stat' and 'data Expr' where 'Stat's contain 'Expr's, typical
03:09 <evincar> I want to traverse the AST and collect all the function calls, in the order that they would be called
03:09 <Nolrai> How bad is -XAllowAmbiguousTypes?
03:09 <evincar> And for conditional statements (if) and expressions (?:) return a list of the calls at the same level
03:09 <evincar> So AST -> [[Name]], basically
03:10 <evincar> For example: f(); if (x) { g(); } else { h(); } => [[f], [g, h]]
03:10 augur joined
03:10 <evincar> And f(g(), h()); => [[g], [h], [f]]
03:11 <evincar> It looks like syb/uniplate only give me top-down, left-to-right order by default
03:11 <evincar> Just wondering if I can change that in the middle of a traversal or something
03:12 <evincar> Nolrai: It's fine if you have a compiler with -XTypeApplication (GHC 8.0+ IIRC)
03:12 texasmynsted joined
03:12 erikd joined
03:12 <Nolrai> Okay! Thanks!
03:12 <evincar> Nolrai: Because (I'm pretty sure) you can always disambiguate
03:12 kau joined
03:13 <Nolrai> Yeah but the whole reason I am doing this is to not need too.
03:13 <thang1> Nolrai: as a rule of thumb, any pragma with the words "ambiguous", "undecidable", "incoherent", etc... are pretty risky. AmbiguousTypes with TypeApplication adds the safety back in that you lost (iirc)
03:14 <evincar> Hm,a ctually I suppose I need a tree as the result, for things like f(); if (x) { g(); h(); } else { i(); }
03:15 <evincar> Maybe not, I guess that could be represented as [[[f]], [[g, h], [i]]]
03:15 otto_s_ joined
03:15 <evincar> I could do it manually but it's a largish AST and I'd rather not write out all the cases by hand
03:15 <Nolrai> I want a fuction that will take both ((a->b),(b->a)) and (a-> MyMonad b, b -> MyMonad a)...but the type class I wrote wont know when to stop wrapping. >.<
03:16 jleon joined
03:16 <Nolrai> Wait..
03:16 <thang1> You sure?
03:16 ublubu joined
03:16 sanitypassing joined
03:17 takle joined
03:17 <sproingie> a->b is fully generic and would subsume a -> MyMonad b
03:18 <sproingie> er, polymorphic. whatever.
03:18 <thang1> sproingie: even if it's (a -> m b) (m a -> b) ?
03:18 <sproingie> b is any arbitrary type, including m b
03:18 <sproingie> (ok that's confusing taken by itself)
03:19 <erisco> oh how am I doing this wrong... again... trying to upload to Hackage
03:19 <erisco> I never get it right
03:19 <thang1> whoops, (a -> mb) (b -> m a) is what I meant. Either way, the monad is on a and b but not consistently
03:19 felixsch_ joined
03:19 <sproingie> probably a simple solution involving kinds, i'm a little too fried to think of it
03:20 <thang1> so, to my mind, if you have a -> b and you pass a (monad b) in as b, how does the program know to apply that monad to the other one?
03:20 <sproingie> it wouldn't. in fact it doesn't know how to do anything to b without some type or constraint
03:22 <Nolrai> Right but because both a and b are constrained by being the input..its posible to do in theory.
03:22 <thang1> Yeah, that's what was tripping me up :p
03:22 <Nolrai> I am not sure its possible in practice..but the error I am getting is really odd.
03:23 <sproingie> @djinn a -> (a -> b) -> b
03:23 <lambdabot> f a b = b a
03:23 <thang1> @djinn ((a->b),(b->a))
03:23 <lambdabot> -- f cannot be realized.
03:23 juhp joined
03:23 <thang1> whoops, brain fart, that's not a proper type signature lol
03:23 <Nolrai> It is!
03:24 <Nolrai> But its not a function
03:24 <erisco> and also not implementable
03:24 <sproingie> @hoogle a -> b -> (a->b) -> (b->a)
03:24 <lambdabot> package base
03:24 <lambdabot> package bytestring
03:24 <lambdabot> package containers
03:24 <sproingie> that was less than illuminating
03:24 <Nolrai> What I am doing is using quick cheeck to test if two functions are inverses.
03:25 tripped joined
03:26 <evincar> So you want something like forall x. f (g x) = x for pure functions and forall x. f =<< g x = pure x for monadic things?
03:26 <Nolrai> And unfortunately in some pairs both functions return errors, some one function produces error, and in others neither function produces errors.
03:26 <Nolrai> Yeah basicly.
03:26 <sproingie> leave it as a -> m b and lift into Identity?
03:26 <evincar> Why not use Identity?
03:26 <evincar> Yeah
03:27 <evincar> Just use (pure . f, pure . g)
03:27 <Nolrai> No..because that will only take the monadic case.
03:27 <Nolrai> *non-monadic
03:27 <erisco> not sure if the bot is still running, so I'll have to plug it myself http://hackage.haskell.org/package/data-list-zigzag
03:28 <Myrl-saki> mniip: Isn't it []?
03:29 modal joined
03:29 <sproingie> oddly i grok monads far more than applicatives
03:30 <sproingie> i get the basic difference, i just don't steer toward using applicative
03:30 <Nolrai> Wait now I get it. I think that will work.
03:30 <Nolrai> Just practice I think is the only "treatment" for that.
03:30 <evincar> sproingie: How do you mean? Like writing "do { a <- ma; b <- mb; return (f a b) }" instead of "f <$> ma <*> mb"?
03:31 <sproingie> i grok the syntax ok enough, though i hate typing it
03:31 JuanDaugherty joined
03:31 <sproingie> anything that makes me lean on the shift key is syntax i don't care for
03:32 <evincar> I just swapped digits and symbols in my keyboard layout :P
03:32 <evincar> Although <> are still shift characters
03:32 <evincar> You can always use liftA2, etc.
03:33 <iqubic> erisco: Why would lambdabot be down?
03:33 <sproingie> oh <> is fine, that's super easy to type on most keyboards, i love doing monoids with that
03:33 <iqubic> > 1 + 2
03:33 <lambdabot> 3
03:33 <erisco> iqubic, I haven't seen it mentioning package updates lately, have you?
03:33 <iqubic> @hackage gloss
03:33 <lambdabot> http://hackage.haskell.org/package/gloss
03:33 <geekosaur> hackagebot is down, yes
03:34 <geekosaur> rather, the bot was inadvertently left running but the infrastructure it was polling was taken down, iirc
03:34 <iqubic> erisco: I have been around here for a month, and never seen hackagebot once.
03:34 <sproingie> really it's just that i've not developed the muscle memory for haskell's punctuation-heavy operators like i have with perl and c++ code
03:34 <geekosaur> chrisdone is still looking for someone to take it over and rehabilitate it, iirc
03:35 halogenandtoast joined
03:35 umib0zu joined
03:35 <thang1> (^_^) is an actual operator in haskell
03:35 <sproingie> it's weird how the use case for a language feature like applicative can be driven by one's preferences in how elegant the operators look and feel to type
03:36 <Nolrai> ...
03:36 <erisco> so now you can enumerate the Cartesian product of lists differently, if you were bored of the default way
03:36 <sproingie> but in the end, languages are user interfaces
03:36 <thang1> sproingie: definitely feel that. I'm a fan of ultra terse code but at the same time I hate overly verbose ascii drawings masquerading as operators
03:36 <evincar> Yeah, people will tend toward the "easy" thing (semantically or syntactically)
03:37 <Nolrai> So what does this "* Could not deduce: linked0 b (EMG b)" I mean how is that even a context constructor: it's lowercase!
03:37 <evincar> Come to think of it, an Emacs input method for Haskell operators based on TeX mode would be nice
03:37 <sproingie> i like scala's trick where any method of one argument is an infix operator
03:37 <evincar> \fmap => <$>, \ap => <*>, \alt => <|>, \bind => >>=, that sort of thing
03:37 dan_f joined
03:37 <sproingie> basically haskell's backticks without the backticks
03:38 <sproingie> in turn requiring other syntax compromises, so ... yeah
03:38 <evincar> Yeah, juxtaposition is already taken in Haskell, for better or worse
03:38 <evincar> It would be nice to be able to overload application sometimes
03:39 <Nolrai> I often define operators without exporting them, just to be used in that file.
03:39 <erisco> -XOverloadedJuxtaposition
03:39 <sproingie> implement it
03:39 <evincar> Which you can kinda do by making instances of typeclasses for (->)
03:39 <evincar> Eh
03:39 <evincar> I don't want it enough to implement
03:39 <sproingie> far as i can tell, the way various -X flags got added was some damn fool just went and did it
03:39 <evincar> And I should really do that InlineDoBind extension I was thinking of first
03:40 <evincar> (Similar to Idris !-notation)
03:40 <evincar> The typeclass approach is enough, usually
03:40 <sproingie> then went through a proper patch process to merge in of course
03:40 <evincar> For example, I once made an API like "forAll $ \ x y z -> ..." for generating fresh type variables in a compiler
03:41 <evincar> Which was good enough
03:41 sssilver joined
03:42 <sproingie> i need to learn more about dependent types sometime
03:42 <Nolrai> I wish ghc would give me a warning if I have a type Blaw, and a type variable blaw.
03:43 <sproingie> is the idea to obliterate the boundary between the type language and the programming language?
03:43 <evincar> Something like that
03:43 <ezyang> usually it fails to compile anyway
03:43 <evincar> Dependent types let you talk about (proofs concerning) runtime values at compile time
03:44 <evincar> Simple example: foo is a function that takes a non-negative Int
03:44 <Nolrai> sproingie: Yes, but it lets you do some amazing things...but we have not figured out how to make it easy to do the really cool things. :/
03:44 <evincar> In order to call it with an Int x, you need a proof that x is non-negative
03:45 <erisco> sproingie, well you certainly don't need much of the type language weirdness anymore
03:45 <evincar> Which you can obtain by checking x, if it's a runtime value
03:45 <evincar> Or you get for free if x is known statically
03:45 <thang1> evincar: look at how emacs and Agda do their unicode input
03:45 <erisco> though you lose -> as a type and pick up binders which are a new strangeness
03:45 <sproingie> binders full of women
03:46 <erisco> and I think if you could have more power and yet keep the separation you would
03:47 <Nolrai> If I could get it to work, I find the syntax of liquid haskell way way better.
03:47 <erisco> it isn't all roses because it is more complicated
03:47 <sproingie> i imagine it'll shake itself out to something more usable
03:48 <Nolrai> Yeah, and we really need a beter kind of poly-morphism. As described in that paper that is an extended shakespear pun IIRC.
03:48 <sproingie> i first poked my nose into haskell around 2000, things were a little wild and wooly then
03:48 augur joined
03:49 <sproingie> said it before, but i suffered through *every* monad tutorial
03:49 <Nolrai> sproingie: Yeah..but might take about that much time, still.
03:49 <Nolrai> Hah, I read them all too.
03:49 <sproingie> even now, i approach monad transformer stacks with dread
03:49 <erisco> and worse is that given the power I don't think I can write a program ever again
03:49 <Nolrai> Only one that helped was the one that lied to me and just told me how to use the IO type.
03:49 <sproingie> i get HOW they work, but when they don't, the errors make me start gibbering in some strange tongue
03:49 Costar joined
03:50 <erisco> because I can spend an eternity adding every possible bit of information to the types
03:50 <thang1> erisco: then you don't need to actually run the program. Just compile it and get the statically compiled answer :p
03:50 <evincar> It's funny, I never really read any monad tutorials
03:50 <evincar> Or even Haskell learning materials
03:50 <Nolrai> erisco: yeah, and proofs are still really hard to formalize..soo..
03:50 <evincar> I mainly learned from examples, and trial and error
03:51 <evincar> Apart from the basic syntax
03:51 <thang1> I really like the idea of liquid haskell, but honestly a lot of the syntax drives me up the wall
03:51 <pacak> :t confusing
03:51 <lambdabot> Applicative f => LensLike (Data.Functor.Day.Curried.Curried (Data.Functor.Yoneda.Yoneda f) (Data.Functor.Yoneda.Yoneda f)) s t a b -> LensLike f s t a b
03:51 <thang1> lol
03:51 <pacak> evincar: trial and error this?
03:51 <sproingie> it doesn't help that i have basically zero math background, i'm just a dilettante in CS and math
03:51 <Nolrai> I've never been able to get LH to compile..
03:51 <Nolrai> thang1: what parts?
03:52 <pacak> :t cata
03:52 <lambdabot> Functor f => (f a -> a) -> Mu f -> a
03:52 <erisco> I was working on a solver for association proofs. I'd say "at the type level" but it is all the same level
03:52 <evincar> pacak: What, my AST problem? I'm trying :P
03:52 <evincar> Oh, confusing
03:52 <evincar> Meh
03:52 <erisco> not that strong in DT yet and so I struggled to model it correctly
03:52 <evincar> Lens deliberately uses transparent types to gain reusability, e.g., (.)
03:53 <evincar> At the cost of shit error messages
03:53 <thang1> Nolrai: the non math syntax :p
03:53 <sproingie> any monad-tutorial traps i should avoid wrt learning DT?
03:53 <thang1> sproingie: literally don't read any monad tuorials ever :p
03:53 <Nolrai> thang1: Like "mesure"?
03:53 <sproingie> oh i grok monads fine ... NOW
03:53 <erisco> as I understand you normally do such a thing with a "tactic" which uses other facilities...
03:53 <Nolrai> Yes...
03:53 <erisco> but it seemed reachable to actually do this plainly
03:54 <sproingie> monad transformer stacks OTOH, always feel really wobbly to me
03:54 <Nolrai> sproingie: why?
03:54 <evincar> Yoneda in the sense of (forall r. (a -> r) -> f r) ~ f a is just a CPS transform, no?
03:54 <sproingie> no intuition on reading the signatures on why this type is that
03:55 eacameron joined
03:55 <Nolrai> Well monad stacks implement their effects out-side in.
03:55 <monochrom> pacak: catmorphism :: Functor f => (f a -> a) -> Meow f -> a :)
03:56 <evincar> Monad transformers are most useful at only one level of nesting, IMO
03:56 <thang1> Nolrai: yeah I don't really like measure and things like that. I prefer writing things using first order formal logic notation
03:56 <sproingie> i think it's just my anglo-saxon tendency to want to reduce concepts to a single noun, preferably one syllable
03:57 <thang1> Especially with unicode
03:57 <sproingie> big stacks confuse my brane
03:57 <evincar> Whenever I want an "application" monad stack (reader of state of such-and-such), I just implement it myself directly
03:57 <pacak> evincar: Yoneda gives Functor instance without requiring f to be a Functor
03:57 <thang1> {-@ insert :: k:_ -> _ -> m:_ -> {v: _ | keys v = add k m } @-} -- this looks like garbage
03:57 <evincar> pacak: Cool, I'd forgotten that
03:58 <evincar> Add that to the arsenal of "get an X without a Y instance"
03:58 <evincar> E.g. Free = get a Monad with only a Functor instance
03:58 <sproingie> thang1: that looks like a rewrite rule or something. those are usually hairy.
03:58 <evincar> Prompt = Monad without Monad instance?
03:58 <sproingie> rewrite rules exist so you don't have to write code that awful
03:59 <Nolrai> So just define "newtype MyMonad x = MkMyMonad {unMkMyMonad :: Monad Stack Of Doom x} deriving {Monad}.
04:00 takle joined
04:00 codesoup joined
04:00 <Nolrai> Lets you use the mtl stuff but not have as insane type errors.
04:01 <pacak> noraesae: Also deriving MonadStack, MonadOf and MonadDoom
04:02 <Nolrai> Yep. :P
04:04 ogrady joined
04:04 rblaze joined
04:06 juhp joined
04:07 takle joined
04:09 sdothum joined
04:10 <Nolrai> Why would I get "(needs flag -package-key mtl-2.2.1)"?
04:10 <dfordivam> Is there a way to specify the type signature of a value on the lhs of a do notation like do { a:: Char; a <-getChar}
04:12 xall joined
04:12 <Nolrai> dfordivam: With -XScopedTypeVariables you can write "do {(a :: Char) <- getChar}"
04:13 takle joined
04:13 soniku joined
04:13 <dfordivam> I know I can write do { a <- getChar :: IO Char}, but I want to just specify the type of value...
04:14 <Nolrai> Well actually not that persay..but "do {(a :: Char) <-getChar; foo a}" because the last line of a do statement cant be an asignment.
04:14 <Nolrai> Yes with -XScopedTypeVariables you can do that.
04:14 <dfordivam> Nolrai: I see let me try...
04:17 augur joined
04:17 <dfordivam> Nolrai: Yeah this is what I needed.
04:18 <Nolrai> Glad I helped!
04:19 elred_ joined
04:20 flatmap13 joined
04:24 taktoa joined
04:31 xtreak joined
04:31 xall joined
04:32 lieven joined
04:33 darjeeling_ joined
04:34 takle joined
04:35 cschneid_ joined
04:35 Costar joined
04:35 Hunter1 joined
04:35 xall joined
04:36 nicknovi1 joined
04:36 andrei joined
04:38 RayNbow`TU joined
04:40 <andrei> I have a project that links with stack build and stack ghc but fails to work with stack ghci. stack ghci doesn't give ghci the proper linker flags to pick up the dynamic libraries it should.
04:40 <andrei> Where would one look to understand why?
04:40 erikd joined
04:41 takle joined
04:41 <sm> andrei: stack issue tracker ?
04:42 <sm> I've seen discussion of flags not being passed, might have been there
04:42 <andrei> sm: There are closed tickets on this
04:42 <andrei> https://github.com/commercialhaskell/stack/issues/467
04:42 sleffy joined
04:42 <andrei> But I can't see any solutions or any suggestions about how to figure out what's going on
04:43 xtreak joined
04:44 e_svedang joined
04:44 eklavya joined
04:44 <sm> also, did you try latest GHCI ? I think it keeps getting better at matching ghc behaviour
04:45 <andrei> sm: Yeah. I'm using 8.0.2
04:47 Levex joined
04:47 mbuf joined
04:47 <iqubic> Is it possible to use Data.Complex and Data.Scientific together?
04:47 <Koterpillar> iqubic: sure, why not
04:48 tsani joined
04:48 <iqubic> Well, I don't think it would be of type RealFloat a => RealFloat (Complex a)
04:49 <iqubic> Because there is no instance of RealFloat Scientific.
04:49 forgottenone joined
04:49 <Koterpillar> what's wrong with Complex Scientific?
04:50 <iqubic> I don't think I'd be able to use it in my application.
04:50 fizbin joined
04:50 slomo joined
04:50 slomo joined
04:51 takle joined
04:52 <Koterpillar> well, Scientific isn't RealFloat (IDK why, haven't looked at it)
04:52 subtlebot joined
04:52 <iqubic> Yeah, I know.
04:53 <iqubic> Koterpillar: Do you have a guide to Haskell numbers I can look at? I want to learn more about the various number typeclasses.
04:54 <iqubic> :t (\z -> z^2 + (5 :+ 5))
04:54 <lambdabot> RealFloat a => Complex a -> Complex a
04:54 <iqubic> Why does that have the RealFloat constraint?
04:54 <jle`> check out the source
04:54 <iqubic> :t (\z a b -> z^2 + (a :+ b))
04:55 <lambdabot> RealFloat a => Complex a -> a -> a -> Complex a
04:55 fakenerd joined
04:55 <iqubic> That's a more generic version. Still has the RealFloat constraint for some odd reason.
04:55 <jle`> check out the instance definition
04:56 <iqubic> Of what?
04:56 <jle`> Complex
04:56 <jle`> Num
04:56 <jle`> http://hackage.haskell.org/package/base-4.9.1.0/docs/Data-Complex.html
04:56 <iqubic> RealFloat a => RealFloat (Complex a)?
04:56 <jle`> ^ and + use the Num instance
04:56 <jle`> not the RealFloat instance
04:56 <geekosaur> iirc, ensuring (a) you aren;t doing Complex (Complex a)) (b) you can do sqrt, so you can do abs which is required for Num
04:56 <jle`> you don't need RealFloat to use ^/+, you just need Num
04:57 <jle`> so check out the implementation of the Num instance :)
04:57 <nshepperd> '
04:57 <nshepperd> 'instance (RealFloat a) => Num (Complex a)' :(
04:57 <jle`> iqubic: go to http://hackage.haskell.org/package/base-4.9.1.0/docs/Data-Complex.html and find the intsance of Num
04:57 <jle`> for Complex
04:57 <jle`> and click 'Source'
04:57 <iqubic> jle` Why does GHC seem to think that I want the RealFloat instance of a? Is this DMR at play?
04:57 <Koterpillar> ...so maybe you can't have it for Scientific?
04:57 <jle`> iqubic: it's because you use ^/+
04:58 <jle`> iqubic: which requires a Num insatnce of Complex a
04:58 <jle`> and check out what constraint on 'a' you need for 'Num (Complex a)'
04:58 <jle`> in fact, you can even type ':i Complex' in ghci
04:58 takle joined
04:58 <jle`> and you'll see what constraint you need on 'a' for Num (Complex a)
04:59 <iqubic> Why? What is in the Num instance of Complex that requires a RealFloat
04:59 <iqubic> ??
04:59 <jle`> check out the instance definition :)
04:59 <nshepperd> iqubic: abs (a :+ b) = sqrt(a^2 + b^2)
04:59 <jle`> go to http://hackage.haskell.org/package/base-4.9.1.0/docs/Data-Complex.html , find the list of instances for Complex
04:59 <jle`> and find the Num instance
04:59 <jle`> click the little '#' link
05:00 <jle`> er i mean, the little 'Source' link
05:00 <geekosaur> Source link; # is just the anchor that brings you to that spot
05:00 <geekosaur> also I answered this already :)
05:00 fizbin joined
05:00 <nshepperd> more reasons to fix haskell's numeric hierarchy
05:00 <iqubic> I also see this: RealFloat a => Floating (Complex a)
05:00 <jle`> geekosaur: you don't need RealFloat to do sqrt
05:01 <jle`> iqubic: yeah, but you didn't use any Floating methods in what you gave us
05:01 erikd joined
05:01 <iqubic> What is the difference between RealFloat and Floating?
05:01 <jle`> that would be an interesting instance, but, ultimately unrelated
05:01 <jle`> iqubic: check out the docs :)
05:01 <jle`> or :i in ghci
05:01 <jle`> they just have different methods
05:01 <jle`> kind of like the difference between Ord and Num
05:01 <jle`> or Monad and Monoid
05:01 <geekosaur> you need Floating. the other one is why you need Real, and you could either say (Real a, Floating a) or you can say RealFloat a
05:01 <jle`> RealFloat a is more than just (Real a, Floating a)
05:02 <jle`> the reason why it requires RealFloat is because it uses 'scaleFloat'
05:02 <jle`> which is a method of the RealFloat typeclass
05:02 jhrcek joined
05:02 <jle`> although i suppose it really shouldn't need it
05:03 <iqubic> jle`: I'm not seeing the scaleFloat function being used in the Num instance of Complex
05:03 <jle`> iqubic: the difference between RealFloat and Floating is the same as the difference between Monoid and Functor, Num and Ord, etc; they are just different typeclasses with different methods
05:03 newhoggy_ joined
05:03 lambda-11235 joined
05:03 <nshepperd> oh, it's an optimization. gross
05:03 <jle`> iqubic: it's in abs z = magnitude z :+ 0
05:04 <jle`> and magnitude uses scaleFloat
05:04 <iqubic> Ugg.
05:04 <jle`> (signum also uses magnitude)
05:04 <jle`> although yes i suppose it technically doesn't have to use scaleFloat
05:04 <iqubic> So I can't have (Complex Scientific) as a Complex Num?
05:04 <jle`> you can't have a Num instance for Complex Scientific
05:05 <nshepperd> it should be specialized for floats and doubles or something
05:05 <iqubic> That really blows.
05:05 <iqubic> nshepperd: What should be specialized?
05:05 <jle`> iqubic: but even if it didn't use scaleFloat, it still wouldn't work
05:05 <jle`> the very minimum you could have is Floating a => Num (Complex a)
05:05 <iqubic> Oh, why not?
05:05 <nshepperd> Scientific could have a Floating instance, couldn't it?
05:05 <jle`> but there's no Floating instance for Scientific
05:06 <iqubic> Why do you need Floating?
05:06 takle joined
05:06 <iqubic> Why is that the minimum?
05:06 <jle`> iqubic: for abs
05:06 <iqubic> Why does abs need float?
05:06 <geekosaur> abs uses magnitide which uses sqrt
05:06 <geekosaur> *magnitude
05:06 <jle`> abs (r :+ i) = sqrt (r*r + i*i) :+ 0
05:06 <geekosaur> because the magnitude of a complex value ^
05:07 <jle`> but admittedly this is probably more a problem with why Num even has 'abs' in it
05:07 <geekosaur> (think pythagorean theorem)
05:07 <iqubic> Wait... sqrt requires a Float a?
05:07 <jle`> it requires Floating
05:07 <nshepperd> sqrt is in the Floating typeclass
05:07 <opqdonut> that abs doesn't fulfil the law, right?
05:07 <iqubic> Yeah, I see that.
05:08 <opqdonut> the law is x == signum x * abs x
05:08 <jle`> there aren't any laws for Num, but the Num instance for Complex actually does follow that
05:08 <iqubic> It does?
05:08 <jle`> > signum (1 :+ 3) * abs (1 :+ 3)
05:08 <lambdabot> 1.0 :+ 3.0
05:08 <opqdonut> oh right I guess if you define signum properly
05:08 <opqdonut> as x/abs x
05:09 <opqdonut> yeah that's fine actually
05:09 <jle`> it's actually defined as the angle from the positive real axis
05:09 <jle`> the "argument", in the polar form for complex numbers
05:09 <nshepperd> huh? no it isn't. it's just the normalized number
05:09 <jle`> which is cute because it becomes -1/0 for Complex where there is 0 imaginary part
05:09 <jle`> oh ah, yeah, sorry
05:10 <jle`> it's the location of the angle on the unit circle :3
05:10 fizbin joined
05:11 <jle`> i wonder why Scientific has no Floating instance
05:11 <iqubic> So while I can have Complex Scientific, it won't be an instance of Num.
05:11 <nshepperd> so anyway, Num probably shouldn't have abs in it in the first place
05:11 <nshepperd> so that we can use it for general rings
05:11 crobbins joined
05:12 <nshepperd> and then we could have gaussian integers, too. Complex Integer
05:12 <iqubic> What the heck is the difference between Integer and Int?
05:12 BartAdv joined
05:12 <geekosaur> Int is a machine word, Integer is arbitrarily sized
05:12 <geekosaur> > maxBound :: Int
05:12 <lambdabot> 9223372036854775807
05:12 <geekosaur> > maxBound :: Integer
05:12 <lambdabot> error:
05:12 <lambdabot> • No instance for (Bounded Integer)
05:12 <lambdabot> arising from a use of ‘maxBound’
05:13 <geekosaur> ...because the bound is the size of available memory to hold it
05:13 <jle`> > fromIntegral (maxBound :: Int) ^ 100 :: Integer
05:13 <lambdabot> 3082994025277634712274218621887248264746878848022492393788592018245624105661...
05:13 <pacak> iqubic: Int is a bit faster.
05:13 <pacak> Integer is a bit bigger.
05:13 takle joined
05:13 <iqubic> I'm looking through the docs for Scientific and see that you have scientific :: Integer -> Int -> Scientific
05:13 <iqubic> That's odd.
05:14 <iqubic> That's how you construct it.
05:14 <* nshepperd> . o O (Acme.Integer.Bounded: maxBound :: Integer that detects the size of your system's memory and makes an Integer that big)
05:14 <monochrom> haha
05:15 <jle`> iqubic: there are multiple ways to construct it
05:15 <* geekosaur> refrains from chekcing hackage to see if someone's already done that >.>
05:15 <jle`> that's just one :)
05:15 <monochrom> No no, I have a better idea. The detection is done at compile time.
05:15 <pacak> nshepperd: Program will explode during first GC...
05:15 <iqubic> Alright, so Scientific has isFloating :: Scientific -> Bool, but no Floating instance???
05:15 <monochrom> So, build it on a 64GB RAM machine. Deploy it in an Amazon 512MB virtual machine...
05:17 <nshepperd> monochrom: or maybe it could dynamically do it based on the available free space? so that maxBound gets smaller as your program runs :)
05:17 <geekosaur> iqubic, did you consider reading the documentation?
05:17 <jle`> it can be done at runtime by just doing 'succ' repeatedly until an out of memory exception happens, under unsafePerformIO
05:17 blender3 joined
05:17 <iqubic> geekosaur: Documentation for what?
05:17 <iqubic> Scientific?
05:18 <geekosaur> yes
05:18 andrei left
05:18 <iqubic> I'll read it later. I know that it won't work for my projects
05:19 sw1nn joined
05:20 fizbin joined
05:22 unK_ joined
05:22 darjeeling_ joined
05:22 <thang1> neatttttt
05:22 <thang1> Finally found a legit use for as-pattern
05:23 newhoggy joined
05:23 <iqubic> Which is...?
05:23 <jle`> as-patterns are as-tounding
05:23 <thang1> capitalizeWords = map (\l@(x:xs) -> (l, toTitle x : xs)) . words
05:23 <jle`> ha ha
05:23 <MarcelineVQ> making your patterns look 20% cooler
05:24 <* pacak> likes smell of as-patterns in the morning
05:24 <geekosaur> myKeys conf@(XConfig {modMask = modm}) = ...
05:24 <jle`> sometimes i just do _@ on my patterns to make them look cooler
05:24 <thang1> ಠ_ಠ
05:24 <thang1> (what does _@ do, anyway?)
05:24 <jle`> map f _@[] = []; map f _@(x:xs) = f x : map f xs
05:24 <jle`> thang1: it's an as pattern
05:24 <jle`> that binds nothing
05:25 <jle`> > let _@(x:xs) = [1..] in x
05:25 <lambdabot> <hint>:1:6: error: parse error on input ‘@’
05:25 <thang1> okay, I thought that was the case. Just wanted to make sure I wasn't crazy :p
05:25 <monochrom> an as-pattern that replaces the var by the wildcard meaning "I don't actually need it"
05:26 <jle`> (it's actually not valid syntax, don't try it in real code :) )
05:26 <monochrom> Like you buy a laptop, pay cash, collect the change, and leave the laptop behind.
05:26 <jle`> or i suppose, if you do, there isn't too much harm it could do
05:26 <Maxdamantus> > let f _@_@_@_@x = x + 1 in f 4
05:26 <monochrom> Because you paid counterfeit cash!
05:26 <lambdabot> <hint>:1:8: error: parse error on input ‘@’
05:26 fakenerd joined
05:26 <iqubic> Why would you use _@ ever?
05:26 <nshepperd> the compiler isn't interested in your tomfoolery
05:27 kritzcreek joined
05:27 <jle`> > let f x@(y@(z@(a@(b@c)))) = x + 1 in f 4
05:27 <lambdabot> 5
05:27 <Maxdamantus> are those brackets necessary?
05:27 <iqubic> jle`: What do all those @s mean?
05:27 <jle`> iqubic: they are as-patterns
05:28 <Maxdamantus> Don't seem to be.
05:28 <thang1> iqubic: You wouldn't, really
05:28 <pacak> Something to make your code look more like lisp
05:28 <jle`> iqubic: they let you deconstruct on a pattern match, and also name the entire input
05:28 <monochrom> Did you know: SML has you spell out the "as". Example: fun f (v as (x::xs)) = ...
05:28 soniku joined
05:28 <monochrom> (I forgot which parentheses are optional.)
05:28 <thang1> capitalizeWords = map (\l@(x:xs) -> (l, toTitle x : xs)) . words -- This is a "legit" use of as-patterns
05:28 <thang1> jle`'s nonsense is just abusing it for shits and giggles
05:28 <jle`> > case Just 10 of x@(Just y) -> (x, y)
05:29 <lambdabot> (Just 10,10)
05:29 crobbins joined
05:29 <monochrom> More subtly: case [] of ~v@(_:_) -> seq v () = bottom
05:30 dm3 joined
05:30 <iqubic> monochrom: What's SML?
05:30 <monochrom> I am not talking to you.
05:30 SrPx joined
05:30 <iqubic> Why not?
05:30 blender3 joined
05:31 <monochrom> (Best paradox since "this sentence is false")
05:31 <thang1> wtf is that ~ thing
05:31 oisdk joined
05:31 <jle`> thang1: it's a lazy pattern match
05:31 <SrPx> Hey guys, got a new mac and want to install Haskell on it, any up-to-date tutorial on what exactly I should do to avoid doom? Last time I checked I shouldn't use brew, etc. so yea
05:31 <thang1> ahh got it
05:31 <monochrom> irrefutable pattern. decreases strictness.
05:31 fizbin joined
05:31 <jle`> hopefully that's enough keywords for help in googling further :)
05:32 <pacak> thang1: Is that in type signature or in pattern match?
05:32 <monochrom> SrPx: Will you like "Haskell for Mac"?
05:32 <jle`> SrPx: 'use stack' is a common very-hard-to-mess-things-up kind of advice that people throw around a lot these days
05:32 <thang1> Stack is amazing :p
05:32 erikd joined
05:33 <thang1> pacak: what do you mean?
05:33 <pacak> ~
05:33 <monochrom> pattern
05:33 <iqubic> ~ was in the pattern yeah.
05:33 <thang1> ooh, everyone else already answered the question lol
05:33 <monochrom> because I just showed ~v@(_:_)
05:33 <jle`> thang1: ~ is also reserved for haskell syntax in type signatures, as well
05:33 augur joined
05:33 <jle`> a lot of haskell syntax tokens are hopelessly overloaded, heh
05:33 <SrPx> yea I mean stack was how I did it on my last mac, I guess it stays the norm then
05:33 <iqubic> What's its meaning there?
05:34 <monochrom> "Hi what does comma mean in Haskell?"
05:34 <jle`> it's a constraint for equality
05:34 takle joined
05:34 <jle`> iqubic: so like how 'Num a' is a constraint that a is an instance of Num
05:34 <iqubic> monochrom: I think a comma is a data costructor for a tuple
05:34 <jle`> (a ~ b) is a constraint that a and b are the same type
05:34 <MarcelineVQ> thang1: I've found that toTitle x : xs useful enough that I often define a helper for it, mapFirst
05:34 <jle`> the pipe | is pretty overloaded
05:34 <jle`> but '->' is super overloaded
05:34 plot joined
05:35 <jle`> so many completely unrelated usages of ->, heh
05:35 <monochrom> The other day someone asked "what does | mean in Haskell" and everyone was only able to recall 3 out of the 4 meanings/contexts.
05:35 <MarcelineVQ> > mapFirst toTitle "donkey"
05:35 <lambdabot> "Donkey"
05:35 <monochrom> (And here I am wondering if it's 3 out of 5 actually. :) )
05:35 <iqubic> | is used in Guards
05:36 <iqubic> Where else is it used?
05:36 <vaibhavsagar> fundeps?
05:36 <thang1> MarcelineVQ: that's a good idea
05:36 <jle`> defining data types
05:36 sssilver joined
05:36 <jle`> data Maybe a = Nothing | Just a
05:36 <iqubic> Also, is (->) the same as (<-)?
05:36 <nshepperd> hm. guards. fundeps. sum types
05:36 <monochrom> "data X = X | Y", guards, [ n | n <- [] ], fundeps
05:36 <MarcelineVQ> hmm.. guard, two similar ways comprehension, fundeps, quasiquotes, constructors
05:36 <jle`> injective type families is probably the same usage as fundeps
05:36 <pacak> iqubic: -> points the other way
05:37 <jle`> iqubic: -> and <- are both haskell syntax tokens, but they are used in different situations
05:37 <monochrom> Oh yeah quasiquoting. See, my fear has come true. :)
05:37 <iqubic> What are fundps and quasiquotes?
05:37 <jle`> iqubic: you can't interchange -> and <- in any situation
05:37 crobbins joined
05:37 <MarcelineVQ> iqubic: stuff you shouldn't worry about quite yet but aren't bad things to ask about
05:37 <iqubic> Alright, I can think of a few different uses for (<-) already.
05:37 <rotaerk> what does this mean in haskell: *does a little dance*
05:37 <MarcelineVQ> But also readily answered by google
05:37 <nshepperd> iqubic: you can look them up on the haskell wiki
05:38 <nshepperd> rotaerk: that must be the dwim operator
05:38 <iqubic> Fundeps are weird
05:39 <jle`> monochrom: they're in multiway-ifs, too
05:39 <jle`> unles you count those as the same as guards
05:39 <monochrom> Yikes
05:39 <nshepperd> {-# LANGUAGE DoALittleDance #-}
05:39 <jle`> they are kinda the same as guards, so i wouldn't count it twice
05:39 <iqubic> I count those as guards, jle`
05:39 <rotaerk> heh
05:39 zargoertzel joined
05:39 <monochrom> I'll call it 5.1 then.
05:40 crobbins joined
05:40 <nshepperd> you can also put | in an operator, but I guess that doesn't count
05:40 fizbin joined
05:40 litchblade joined
05:40 <monochrom> Right, let's stick to | as its own token.
05:40 <iqubic> Like .|. as bitwise or.
05:40 <iqubic> Yeah, let's not go there.
05:41 <jle`> yeah, talking about syntax tokens. -> can be in operators too :)
05:41 takle joined
05:41 <nshepperd> oh! injective type families
05:41 <nshepperd> although that's also a kind of fundep
05:42 <jle`> hm
05:42 <jle`> does it count in MINIMAL pragmas as syntax
05:42 mstruebing joined
05:42 <monochrom> God, what have I done? :)
05:43 <pacak> > let (<☭>) = fmap in show <☭> (Just 4)
05:43 <lambdabot> Just "4"
05:43 <MarcelineVQ> haskell code obfuscation contests 2019, nothing but |
05:43 <Koterpillar> monochrom: https://xkcd.com/356/ ?
05:43 <vaibhavsagar> you knew this would happen monochrom :)
05:43 <monochrom> Yeah I just thought of nerd sniping too.
05:44 Levex joined
05:45 ner0x652 joined
05:45 <jle`> > let (|||) (||||) = (||||) || (||||) in (|||) True
05:45 <lambdabot> True
05:45 a3Dman joined
05:45 <jle`> > let (|||) (||||) | (||||) = (||||) || (||||) | (|||) (||||) = (||||) in (|||) True
05:45 <lambdabot> True
05:46 <MarcelineVQ> everyone's full of beans tonight
05:47 <EvanR> did anyone ever solve that infinite resistor xkcd
05:47 <iqubic> No?
05:48 <Koterpillar> https://physics.stackexchange.com/questions/2072/on-this-infinite-grid-of-resistors-whats-the-equivalent-resistance
05:48 electrostat joined
05:48 newhoggy joined
05:50 noark9 joined
05:50 fizbin joined
05:51 <EvanR> "apparently involves some 2D fourier analysis"
05:51 <thang1> Hmm, dumb question. Is Data.List.Split in the base or do I have to add it in Stack?
05:52 <cocreature> thang1: it’s in the "split" package
05:52 <cocreature> i.e. not in base
05:52 crobbins joined
05:53 <jle`> you would have to add it to build-depends if you're in a project
05:53 <Lokathor> i considered for 10 moments that i could write a project in erlang
05:53 <Koterpillar> EvanR: there's a link to that in the SO answer, too
05:53 <EvanR> right
05:53 <Lokathor> but then i could not because i forgot how to write the program i wanted without a Maybe do-block
05:53 Hunter1 joined
05:54 blender3 joined
05:55 ridho joined
05:55 crobbins joined
05:57 <iqubic> Does Erlang not have Mayve, or Monads?
05:57 kuznero joined
05:58 <vaibhavsagar> not at the syntax level
05:58 <iqubic> What does that mean?
05:58 takle joined
06:00 fizbin joined
06:00 <EvanR> it does not
06:00 hurkan joined
06:03 newhoggy joined
06:03 osa1 joined
06:03 osa1 joined
06:03 <Lokathor> iqubic, it means your function are always ugly to look at even when they work
06:04 sproingie joined
06:04 <iqubic> Oh.
06:04 <iqubic> Sounds terrible
06:04 <Lokathor> :P
06:06 crobbins joined
06:07 zeroed joined
06:07 EricYuzo joined
06:07 takle joined
06:08 systemfault joined
06:10 eklavya joined
06:10 raichoo joined
06:10 fizbin joined
06:12 mmn80 joined
06:13 newhoggy joined
06:14 Uakh joined
06:15 <vaibhavsagar> iqubic: Monads are (>>=) and pure/return, they can be implemented in any language with first-class functions
06:15 <vaibhavsagar> but IMHO do-notation is what makes them really excellent in Haskell
06:16 <vaibhavsagar> Erlang doesn't have do-notation
06:17 splanch joined
06:18 <Lokathor> oh yeah
06:18 <Lokathor> is there a top class guide to putting a package on hackage?
06:18 takle joined
06:18 newhoggy joined
06:19 <vaibhavsagar> https://github.com/Gabriel439/slides/blob/master/bayhac2017/slides.md#publishing-to-hackage
06:19 <exio4> vaibhavsagar: type classes are quite a big reason for Monad(s) to exist, though
06:19 <vaibhavsagar> assumes stack though
06:19 <exio4> vaibhavsagar: as they allow you to write algorithms over any monad :)
06:19 augur joined
06:19 <vaibhavsagar> exio4: you're absolutely right
06:19 <Lokathor> vaibhavsagar, what luck, i prefer stack over cabal :#
06:19 <Lokathor> :3 *
06:20 <vaibhavsagar> :)
06:20 splanch_ joined
06:21 <vaibhavsagar> exio4: you can have monads in a dynamically typed language though
06:21 dm3 joined
06:21 <vaibhavsagar> I still think do-notation is the big draw here
06:22 erikd joined
06:22 <vaibhavsagar> in fact I wrote a blog post about this: http://vaibhavsagar.com/blog/2016/10/12/monad-anti-tutorial/
06:24 dm3 joined
06:25 newhoggy joined
06:26 fizbin joined
06:26 takle joined
06:27 halogenandtoast joined
06:27 edsko joined
06:29 Hunter1 joined
06:29 fakenerd joined
06:29 Gurkenglas joined
06:30 eatman_ joined
06:32 <Lokathor> vaibhavsagar, you should update your tutorial
06:33 <vaibhavsagar> with the Applicative constraint?
06:33 <vaibhavsagar> or the fact that neither Set nor Map are monads :)?
06:33 <Lokathor> the former
06:34 <vaibhavsagar> I don't think bringing Applicative into the picture is helpful here
06:34 <vaibhavsagar> and I do say it 'looks something like'
06:34 <Lokathor> After having gone through a series where Monad is taught only after teaching Functor and Applicative, I feel strongly that teaching Monad by itself is foolhardy at best
06:35 <vaibhavsagar> did you do the data61 course?
06:35 <vaibhavsagar> I completely agree btw
06:35 <Lokathor> no, the Haskell Programming From First Principles book
06:35 <vaibhavsagar> but I think of it more as a do notation tutorial rather than a Monad tutorial
06:35 <exio4> vaibhavsagar: it's really hard to have them in dynamically typed languages like in Haskell, as Haskell's type class rely heavily on types resolving ambiguity :P
06:35 ralu joined
06:35 <vaibhavsagar> it's good advice and I appreciate it :)
06:36 Filip_ joined
06:36 <vaibhavsagar> exio4: I increasingly feel that type classes are a way of doing principled duck typing
06:36 _sras_ joined
06:36 <vaibhavsagar> e.g. traverse, coerce, fmap
06:36 <exio4> vaibhavsagar: try to implement pure with `duck typing` =)
06:37 <vaibhavsagar> ha, well played
06:37 <vaibhavsagar> I think it's doable though
06:37 <_sras_> I am trying to implement a generic validation function for records (using Digestive functors). I am stuck here where I have to extract names a particular field using the generics type machinery. http://lpaste.net/355022
06:38 <Lokathor> "When I type read.show, GHC should just know what type I wanted it to give me back"
06:38 flatmap13 joined
06:38 <vaibhavsagar> Lokathor: I had a question about doing this with newtypes and Aeson yesterday
06:38 <vaibhavsagar> https://github.com/vaibhavsagar/duffer/commit/6c6b78ee1e3c9e34e57468334fd364fecc42ff15
06:39 <vaibhavsagar> looking at it more closely I might even be able to get rid of the constructor at the end
06:39 <vaibhavsagar> duck typing for everyone!
06:40 <vaibhavsagar> and I realised `flip g <*> f` == `f >>= g` for functions just now, so I have to change that too
06:42 fizbin joined
06:42 dm3 joined
06:43 binaryplease joined
06:43 e_svedang joined
06:44 e_svedang left
06:44 e_svedang joined
06:44 eacameron joined
06:45 ericsagnes joined
06:45 alpert joined
06:46 zeroed joined
06:47 mjora7 joined
06:47 augur joined
06:47 subtlebot joined
06:48 drcode joined
06:48 oisdk_ joined
06:48 laplacian joined
06:49 dnkndnts joined
06:50 fizbin joined
06:50 guiben joined
06:52 matrium joined
06:52 jleon joined
06:53 <matrium> Hi, I wrote a MTL-style function "renderGraph :: Rdf r => MonadReader (RDF r) m => MonadIO m => Map Node [(Node, Node)] -> [Node] -> m ()", but now I'm not quite sure how to construct the concrete monad instance to run the run the function in
06:55 takle joined
06:55 takuan joined
06:55 drcode joined
06:56 <Lokathor> https://github.com/Lokathor/pcgen-hs/blob/master/src/Data/PCGen.hs does this all look about right? (before I upload to hackage that is)
07:00 govg joined
07:00 fizbin joined
07:01 zariuq joined
07:02 takle joined
07:04 Itkovian joined
07:05 alpert joined
07:06 blym joined
07:06 zeroed joined
07:06 zeroed joined
07:08 zariuq joined
07:09 Geekingfrog joined
07:10 fizbin joined
07:10 eacameron joined
07:12 mkoenig joined
07:12 <Gurkenglas> matrium, The simplest m to satisfy that would be Rdf r => ReaderT (RDF r) IO
07:12 uglyfigurine joined
07:13 albertid joined
07:14 blym_ joined
07:16 ragepandemic joined
07:16 ryxai joined
07:17 Xanather joined
07:18 <Gurkenglas> Lokathor, I feel uncomfortable about split. What if it leaks information?
07:18 ubsan_ joined
07:18 takle joined
07:19 <Lokathor> Gurkenglas, what information could it leak? Also, be aware that StdGen's version of split is just about as nonsense as what I wrote
07:19 <Gurkenglas> Then again, afaik it's no worse than the correspondent hackage implementation
07:19 <Lokathor> yeah
07:19 ccomb joined
07:19 <matrium> Gurkenglas: Thanks! Just learned that "runReaderT (renderGraph a b) graph" works
07:19 thc202 joined
07:20 <Gurkenglas> Lokathor, the seed, so that someone observing what happens after a split could predict what values you'll generate
07:20 fizbin joined
07:20 <Lokathor> well they can alraedy use show
07:21 <Lokathor> and it'll report the seed and inc values right there in the show string
07:21 <Gurkenglas> They're only observing the output values in the hypothetical
07:21 refold joined
07:21 plot joined
07:22 rockfordal joined
07:22 <Lokathor> I'm confused, so does the attacker have the generator that you're calling split on or not in this scenario?
07:23 <Gurkenglas> iirc a "cryptographically secure" (terminology possibly not precise?) random number generator can't be distinguished by its outputs in polynomial time from a true random number generator, such that, say, a webserver can use it to assign session ids or something to people without blackhats being able to walk all over it
07:23 <Lokathor> oh, well i don't this this is crypto secure rated
07:23 <Gurkenglas> Lokathor, the hypothetical attacker is reading the values you're outputting and wants to predict what you'll be saying
07:24 takle joined
07:25 <Lokathor> well, i'm no PRNG expert, so I don't know
07:26 <_sras_> I am trying to implement a generic validation function for records (using Digestive functors). I am stuck here where I have to extract names a particular field using the generics. http://lpaste.net/355022 , How can I make the function `filedLabel` return the name of the current field?
07:26 <Gurkenglas> If the original rng doesn't allow attackers to reconstruct missing values in a stream either, a convenient way to construct a secure split might be to simply put every other previously future value into the one side of the split and the rest into the other
07:26 govg joined
07:27 <Lokathor> Gurkenglas, that's... not... Well at least I don't think that's possible, given how the numbers are generated
07:28 <Lokathor> the generator doesn't exist as a cycling list of values, so you can't just run a fold over those values to get a new cycling list, for example
07:28 <Lokathor> here i mean list in the haskell [Int] sense
07:28 <Gurkenglas> Naively implemented, this'll degenerate into exponential time used if the user keeps splitting the same generator, so one would want a generator such that applying it twice doesn't take any longer, like multiplying by a key modulo some number, where you can just multiply by key^2 instead. I'm just ranting here, you don't need to be better than hackage
07:28 coot____ joined
07:29 augur joined
07:29 fotonzade joined
07:29 eklavya joined
07:30 juhp joined
07:30 <Lokathor> i figured that something less than 4 runs of the generator would be sufficient
07:30 fizbin joined
07:30 mda1 joined
07:30 drcode joined
07:30 <Lokathor> but that was also the most obvious route
07:30 osa1 joined
07:31 <Gurkenglas> No, your version won't degenerate exponentially, I'm talking about the hypothetical splitting left-right-left-right of future values
07:31 bvad joined
07:31 indi_ joined
07:31 <Lokathor> right
07:31 quchen joined
07:31 mattyw joined
07:32 takle joined
07:32 <nshepperd_> Splitting by skipping values like that gets exponentially slower, and the cycle length gets exponentially shorter
07:33 connrs joined
07:33 newhoggy_ joined
07:33 <Lokathor> but my cycles!
07:33 <Gurkenglas> Lokathor, any generator can be seen as a list of future values generated by unfold, such that the user can't even see the key, but then splitting can only work the way I said, but then unfolding that gen into a list of gens would have the 20th have to skip ~a million values each time
07:34 <Lokathor> right
07:34 <nshepperd_> You can implement a cryptographically secure split by hashing a bitstring corresponding to your path through a series of splits
07:34 <Lokathor> RandomGen has a method for that even
07:34 indi_ joined
07:35 <Lokathor> QuickCheck and quickcheck-io
07:36 <Lokathor> can anyone else see the problem with these two packages :P
07:36 <nshepperd_> That is, the left output of the split is the current hash state updated with a 0, and the right output is the state updated with a 1
07:36 indi_ joined
07:37 pellenation joined
07:37 <Lokathor> ooh, package tests pass on my raspberry pi too
07:37 koneko joined
07:38 <nshepperd_> I think there's more stuff to add to the construction so that you can get a security proof but that's the basic idea
07:38 coot____ joined
07:39 freusque joined
07:39 coot____ joined
07:40 Itkovian joined
07:40 biglama joined
07:40 fizbin joined
07:41 acidjnk22 joined
07:43 oisdk joined
07:44 forgottenone joined
07:45 srbaker_ joined
07:45 takle joined
07:47 grizwako joined
07:47 fakenerd joined
07:47 sirreal joined
07:48 ventonegro joined
07:48 mw joined
07:48 <_sras_> How can I fix this error (Generics) http://lpaste.net/355024?
07:49 Boomerang joined
07:52 Elhamer joined
07:52 splanch joined
07:55 a3Dman joined
07:56 michielb joined
07:56 marr joined
07:56 blym_ joined
07:56 fizbin joined
07:59 cyborg-one joined
08:00 augur joined
08:00 kuribas joined
08:00 Denthir joined
08:03 juhp joined
08:04 Yuras joined
08:05 m1dnight_ joined
08:06 seveg joined
08:06 albertid_ joined
08:08 coot____ joined
08:09 a3Dman joined
08:10 fizbin joined
08:10 coot_____ joined
08:11 srcerer_ joined
08:11 Filip_ joined
08:11 mekeor joined
08:13 abhi__ joined
08:17 blym_ joined
08:17 coot____ joined
08:20 tabaqui joined
08:20 fizbin joined
08:20 tomphp joined
08:23 gmcabrita joined
08:23 xtreak joined
08:24 oish joined
08:25 darjeeling_ joined
08:26 lep-delete joined
08:26 newhoggy joined
08:28 newhoggy joined
08:28 alfredo joined
08:30 fizbin joined
08:31 ninjazoete joined
08:31 blym_ joined
08:31 robatosan joined
08:31 boj joined
08:33 harfangk joined
08:33 haskell316 joined
08:34 mohsen_ joined
08:37 simukis joined
08:40 Swizec joined
08:40 xtreak joined
08:40 blym_ joined
08:40 tomphp joined
08:40 newhoggy joined
08:41 a3Dman joined
08:41 boj joined
08:41 jleon joined
08:42 Itkovian joined
08:46 blender3 joined
08:47 blym_ joined
08:50 eliasr joined
08:50 fizbin joined
08:50 slomo joined
08:50 tomphp joined
08:51 cschneid_ joined
08:51 niteria joined
08:52 ericsagnes joined
08:52 takle joined
08:53 doomlord joined
08:54 coot____ joined
08:55 xtreak joined
08:56 newhoggy joined
08:57 fakenerd joined
08:57 redeemed joined
08:58 gawen joined
08:58 <phz_> hey, I’m trying to use stack test --coverage
08:58 <phz_> but when the command has finished, I get the following in the index.html:
08:58 <phz_> No hpc_index.html files found in …
08:59 <phz_> any idea?
08:59 zachary12 joined
08:59 Itkovian joined
09:00 Guest28970 joined
09:00 fizbin joined
09:01 <phz_> and if I try stack hcp report, I get this:
09:01 <phz_> user error (Not generating combined report, because no targets or tix files are specified.)
09:02 <phz_> I guess I need those .tix :/
09:03 xall joined
09:04 e_svedang joined
09:04 sproingie joined
09:04 sproingie joined
09:04 xall joined
09:05 _sras_ joined
09:05 blym_ joined
09:07 robatosan joined
09:07 tomphp joined
09:07 nilof joined
09:07 <matrium> what
09:08 <nilof> What is the "best" way to sort a persistent linked list if you ban mutation? Mergesort? Heapsort with persistent heaps?
09:08 <matrium> what's the best way to map an n-ary function over a list of (n-1)-tuples?
09:09 beanbagula joined
09:09 <matrium> e.g. (a -> b -> c -> d) -> [(a, b, c)] -> [d]
09:09 Aruro joined
09:09 <matrium> can't find any good fit on hoogle
09:09 pie_ joined
09:09 mmn80 joined
09:10 soLucien joined
09:11 eacameron joined
09:11 <phz_> matrium: map (\(a, b, c) -> f a b c)
09:11 <matrium> phz_: ok :/
09:11 jao joined
09:12 xall joined
09:13 ersran9 joined
09:13 ersran9 joined
09:13 cranej joined
09:13 crave joined
09:14 heebo joined
09:14 fizbin joined
09:15 <phz_> matrium: uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d; uncurry3 f (a, b, c) = f a b c
09:15 <phz_> and you can map (uncurry3 f)
09:17 jaspervdj joined
09:18 heebo joined
09:20 ali_bush joined
09:20 ali_bush joined
09:22 fizbin joined
09:24 xall joined
09:26 erikd joined
09:28 <_sras_> Why is generics so damn complicated!
09:28 <_sras_> ?
09:28 <Aruro> which part?
09:29 blym_ joined
09:30 fizbin joined
09:30 <_sras_> Aruro: I have been trying to write a generic validation function using digestive functors from yesterday...
09:30 <_sras_> i mean...since yesterday
09:30 Itkovian joined
09:30 ephemeral joined
09:31 <_sras_> I cannot find a way to extract the field names from the types in the various class instances...
09:31 <_sras_> I am trying to use `selName` function, but the types woulnd't line up....
09:32 Shanky_ joined
09:37 Elhamer joined
09:37 thunderrd_ joined
09:40 fizbin joined
09:43 ragepandemic joined
09:43 richi235 joined
09:43 fakenerd_ joined
09:44 Elhamer joined
09:44 seveg joined
09:46 yellowj joined
09:46 Elhamer joined
09:46 <kuribas> Should I make a version of my library for base without Traversable, Foldable, etc?
09:46 oisdk joined
09:47 Elhamer joined
09:47 jeltsch joined
09:49 oisdk joined
09:49 Elhamer joined
09:50 fizbin joined
09:50 bjz joined
09:50 Elhamer joined
09:52 blym_ joined
09:53 <kuribas> Do these only work with > ghc-8.0?
09:53 Elhamer joined
09:53 Guest55823 joined
09:54 DocWinter joined
09:55 <kuribas> travis chokes on base >= 4.8: https://travis-ci.org/kuribas/cubicbezier/jobs/226740165
09:55 joe9_ joined
09:55 wires joined
09:55 ersran9 joined
09:55 ersran9 joined
09:57 <kuribas> is base tied to the ghc version?
09:57 <opqdonut> yes, IIRC
09:58 <opqdonut> see here: https://wiki.haskell.org/Base_package
09:58 <MarcelineVQ> yes and Data.Foldable and Data.Traversable are both much older than you should ever have to worry about, what has changed in regards to them is that some functions in Prelude use Foldable constraints, which is since ghc 7.10 iirc
09:59 be5invis joined
10:00 <kuribas> So it's no problem if I don't support <7.10?
10:00 <kuribas> hm, travis only supports ghc-7.8
10:17 irclogger_com joined
10:17 Topic for
10:17 vaibhavsagar joined
10:20 torstein joined
10:24 <torstein> Say I'm writing a game TicTacToe. A game can have three states: Empty (no moves done), InPlay (atleast 1 move, not finished) and Finished. I want to create two functions, one that takes either Empty or InPlay games and one that takes either InPlay or Finished games. I've tried with DataKinds, GADTs and TypeFamilies but I'm a bit stuck. Any suggestions?
10:25 Filip__ joined
10:27 newhoggy joined
10:27 <Boomerang> torstein: Couldn't you split the logic at the function level rather than the type level? Or does it have to be at the type level? Also there's an overlap where the two functions take an InPlay, which one should actually be executed? Are both executed?
10:28 <torstein> Boomerang, Yeah, I forgot to mention. It has to be type safe, i.e. compile time errors for calling a function that's supposed to operate on non-empty boards with an empty baord
10:28 xtreak joined
10:29 forgottenone joined
10:29 <pacak> torstein: You tried "stuff" and it "didn't worked" - it's hard to suggest anything specific unless you provide more details about stuff you tried and error messages.
10:31 <opqdonut> torstein: you could use phantom types and type classes: "data Empty; data InPlay; data Finished; data Game state = ...; class DoSomething a where doSomething :: Game a -> String; instance DoSomething Empty where ...; instance DoSomething InPlay where ...; class DoOther where doOther :: Game a -> String; instance DoOther InPlay where ...; instance DoOther Finished where ..."
10:32 cpennington joined
10:32 acidjnk22 joined
10:33 erikd joined
10:33 uglyfigurine joined
10:33 <opqdonut> torstein: or alternatively you could have an empty type classes EmptyOrInPlay and InPlayOrFinished and have function signatures like "doSomething :: EmptyOrInPlay a => Game a -> String"
10:34 NyanPasu joined
10:35 NoCreativity joined
10:35 crave_ joined
10:35 <torstein> opqdonut, Would that allow me to infer return types? E.g. a function might take an InPlay board and return either a InPlay board or a Finished board. I tried inferring return types with type families but I couldn't use different constructors from the same data type
10:36 <opqdonut> torstein: that's hard, requires actual dependent types
10:36 <opqdonut> torstein: to make it work you'd need to track the number
10:36 <opqdonut> of moves or the whole game state on tye type level
10:36 <opqdonut> otherwise you don't know when the game is Finished
10:37 xtreak joined
10:37 <torstein> opqdonut, Yeah so tracking the moves is no good (I think) because while 9 moves guarantees that a game is finished, it might or might not be with 8 moves.
10:37 <opqdonut> yep
10:38 <torstein> So I want to track game state in type level, if possible, but then how can I create functions take a subset of game states?
10:38 <opqdonut> I don't think you really want to track the whole game state in types
10:38 <opqdonut> or if you do, you might be better of with agda or some other more powerful language
10:39 <opqdonut> you could consider something like "maybeFinishGame :: Game a -> (Game Finished -> b) -> (NotFinished s => Game s -> b) -> b
10:39 <opqdonut> for type safety
10:39 <opqdonut> type safety of your api that is, you would still need to trust the implementation
10:40 <mivael> hi all!
10:40 blurg joined
10:41 <mivael> I need hints on >>= implementation in IO.
10:41 <mivael> Which concept(s) should I learn to understand (>>=) implementation of the IO monad?
10:41 <mivael> (a.k.a. GHC.Base.bindIO)
10:41 hurkan left
10:41 <mivael> bindIO (IO m) k = IO (\ s -> case m s of (# new_s, a #) -> unIO (k a) new_s)
10:42 <mivael> ( http://hackage.haskell.org/package/base-4.9.1.0/docs/src/GHC.Base.html#bindIO )
10:42 <mivael> It does not even compile with default options: "Parse error in pattern: # new_s"
10:44 HKei joined
10:44 <torstein> opqdonut, I'm not sure I understand that function. But in essence, you mean using type classes to describe unions of types? data Empty derives NotFinished, data InPlay derives NotFinished etc
10:44 <opqdonut> yeah
10:44 <torstein> allright Ill give that a go, thank you
10:44 tg joined
10:45 <opqdonut> unions are doable, but they make this case a bit more hairy
10:45 <opqdonut> it all depends on which constraints do you want the compiler to check and where
10:45 <opqdonut> you can't have it check everything
10:45 <opqdonut> personally I prefer to compromise on implementation safety and provide a safe api
10:46 <torstein> If I do that, then I have to derive a common type class for all game states If I want functions that take any board, right
10:46 whaletechno joined
10:46 <torstein> there can't be a 'supertype' so to speak
10:47 newhoggy joined
10:47 <opqdonut> I guess you could use a datakind
10:47 HoierM joined
10:47 <opqdonut> or just "fooBar :: forall a. Game a -> Something"
10:50 <opqdonut> mivael: I don't think you're supposed to understand the IO bind
10:50 <opqdonut> mivael: treat it as a compiler built-in
10:50 <opqdonut> mivael: I'm not even sure the source in GHC.Base is "real"
10:51 <MarcelineVQ> the syntax error is due to you needing to have UnboxedTuples turned on https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#unboxed-tuples
10:51 <mivael> opqdonut, but it seems to be a performance bottleneck, I wanted to investigate it further
10:51 orhan89 joined
10:51 <opqdonut> mivael: I'm sure the implementation of IO has been tuned to perfection over the years :) but if you're interested in the internals #ghc might be able to help you
10:52 cschneid_ joined
10:52 cyborg-one joined
10:53 <HKei> mivael: What makes you think it is a performance bottleneck?
10:53 tomphp joined
10:54 nahra joined
10:54 okuu joined
10:54 butterthebuddha joined
10:54 <mivael> HKei, measurements (*.prof output file). I can share my code and the *.prof file.
10:55 <opqdonut> that might be interesting
10:55 jimmyrcom joined
10:58 newhoggy_ joined
11:00 soLucien joined
11:01 alfredo joined
11:01 blym_ joined
11:02 mbuf joined
11:02 seveg joined
11:02 <mivael> HKei, opqdonut: ooops, seems like I can not reproduce :( There were a *.prof file where >>= were blamed for 90+ percents of time (individual %time) but I lost it and now the 90+ is showed for 'interact'.
11:03 <opqdonut> mivael: yeah don't expect high performance out of interact
11:03 <opqdonut> mivael: or any other String-based IO
11:03 <opqdonut> mivael: use ByteStrings or Text
11:03 <opqdonut> and/or conduits or pipes
11:04 <HKei> didn't both of those have weird issues with actually closing streams and such? Maybe I'm misremembering
11:05 sproingie joined
11:05 <mivael> opqdonut, I discussed related matters recently with mniip and others, now there will be a summary:
11:06 <mivael> opqdonut, I tried ByteStrings (Builder, etc) -- performance is okay, code is ugly and hard to remember (the context is competitive programming)
11:07 <mivael> opqdonut, I tried ByteString+Attoparsec -- performance is okay, code is okay, but competitive programming sites do not accept Attoparsec (it is not safe)
11:07 <HKei> mivael: Huh? ByteString has pretty much the same API as String, except you don't get pattern matching
11:08 soniku joined
11:09 <mivael> HKei, really? Can I expect that just using same way I could get good performance? I mean, how I should "translate to ByteString" the following: interact $ unlines . map show . (processing :: [Int64] -> [Int64]) . map read . words
11:10 <opqdonut> mivael: right. so you're sure the time is being spent by interact itself not the String->String function it calls?
11:10 dunx joined
11:10 dunx joined
11:10 <opqdonut> hmm ok you say "inidividual %time"
11:11 <mivael> opqdonut, I'm not sure, it is just that profiling results shows me that 'interact' is responsible for 90+ of time
11:11 <opqdonut> can you paste the code and input somewhere, I could try looking at it
11:12 <mivael> of course
11:12 <mivael> just a minute
11:12 <HKei> mivael: If you have "lines" and "words" you could do it with ByteString, but that sounds like a job for text, which does have interact, lines, unlines, words and such
11:12 <HKei> mivael: Except it isn't linked list based, so generally a lot faster under most circumstances
11:13 <HKei> ByteString is better if you're manipulating raw bytes, like binary formats and such
11:13 ragepandemic joined
11:14 <HKei> mivael: also, in that example OF COURSE interact is 90+% of the time. Your main function is literally just interact, so what else do you expect?
11:14 roconnor joined
11:15 <torstein> I'm getting some kind errors I don't understand when attempting to create empty type classes and instances: https://pastebin.com/0Y3W0DSf
11:16 xtreak joined
11:16 <HKei> torstein: You can't derive arbitrary classes.
11:16 <opqdonut> torstein: just use manual instance declarations
11:17 <HKei> *arbitrary instances
11:17 <opqdonut> torstein: "instance NotFinished GEmpty;"
11:17 <opqdonut> oh right you have those already
11:17 <opqdonut> just remove the deriving
11:18 <opqdonut> torstein: also, that type signature for move means the caller gets to decide whether the result is Game InPlay or Game Finished
11:19 <mivael> HKei, opqdonut: http://codepad.org/toYymO59
11:20 <torstein> opqdonut, Okay so removing classes yields this: "Not in scope: type constructor or class ‘NotFinished’". Also, is there a way (type families perhaps) to make the function determine the return type (InPlay or Finished)?
11:21 zariuq joined
11:21 ziocroc joined
11:21 <mivael> HKei, this is without actual processing for measurements. My practice solution was reduced from 500+ ms down to about 120 ms using ByteString (it is about 60 ms using the same algorithm implemented in C++)
11:21 <dysfun> are there any nondeterministic monads that have nothing to do with IO ?
11:21 erikd joined
11:21 <opqdonut> mivael: hmm, that seems like an IO-heavy task
11:21 tomphp joined
11:21 <opqdonut> mivael: so it seems reasonable interact (i.e. the IO) takes most of the time
11:22 <mivael> opqdonut, yes, but it is reduced (approximatelty by 80%) by using ByteString
11:23 <opqdonut> mivael: 2x of C++ sounds reasonable to me. especially if you were using ByteString's interact and the vanilla read
11:23 <opqdonut> (Haskell Read is notoriously slow...)
11:23 <opqdonut> it's reduced because input for bytestring is more efficient
11:23 fenedor joined
11:23 robatosan joined
11:23 <mivael> +400 ms is important in competitive programming contexts (when there is 1000 ms overall time limit)
11:23 <opqdonut> can just read into a buffer instead of allocating a linked list element for every char
11:24 <opqdonut> yes
11:24 iulian joined
11:24 <opqdonut> so what was the problem with using ByteString?
11:24 <* dysfun> saw a job ad for a service with 10ms response SLAs recently
11:24 <opqdonut> In my experience of competitive programming, the inputs are usually pretty small so IO doesn't matter. In this case the input is pretty large so you have to use performant things like ByteString
11:24 iulian joined
11:24 <mivael> opqdonut, in theory, it is possible to use buffer, but would prefer to use lazy I/O because competitive programming problems also have memory limit...
11:24 <HKei> mivael: Again, if text is available you could also try Data.Text.IO.interact, which is... well, interact, except with Text
11:26 <mivael> opqdonut, "2x of C++" is reasonable for me too, I'm okak with 120 ms, I'm just not with 500+ ms :)
11:26 <mivael> s/okak/okay/
11:26 <opqdonut> so what was the problem with ByteString?
11:27 <mivael> opqdonut, ugly code :)
11:27 <mivael> hard to remember (and retype fast, if needed)
11:28 <mivael> I can show it too. Maybe I just implemented it wrong...
11:28 <HKei> mivael: Do that, please. I'm having troubles imagining what your issue is
11:28 <mivael> HKei, so you think I should give a try to Text?
11:29 <mivael> HKei, just a sec... I will provide a couple of links.
11:29 erikd joined
11:33 Guest18903 joined
11:33 <Guest18903> hey guys
11:33 coot____ joined
11:33 <Guest18903> i'm bax
11:33 butterthebuddha joined
11:33 <mivael> HKei, opqdonut: fast (ByteString, 124 ms): http://codeforces.com/contest/456/submission/26607428
11:33 coot____ joined
11:33 asmyers joined
11:34 <HKei> mivael: oh
11:34 <HKei> well...
11:34 <mivael> HKei, opqdonut: slow (514 ms): http://codeforces.com/contest/456/submission/26607734
11:34 <mivael> HKei, badly implemented? :)
11:34 egis joined
11:35 sampuka_ joined
11:35 <HKei> mivael: you're losing a lot of time because of interact, instead of just using bytestring io
11:35 Aruro joined
11:36 <mivael> HKei, this is ByteString's interact (if you are looking at the fast version), not the one from Prelude
11:36 JeanCarloMachado joined
11:36 <HKei> oohhh
11:36 <HKei> ah yeah, sorry
11:36 <HKei> didn't see you hid prelude interact, most people just import bytestring qualified
11:37 soLucien joined
11:37 <mivael> sorry for that :)
11:37 <mivael> It was my firts attempt, now I would prefix it...
11:37 <opqdonut> mivael: some tips, showResultsBS can be defined using BS.intercalate
11:37 <mivael> s/firts/first/
11:38 fakenerd joined
11:38 JeanCarloMachado joined
11:38 newhoggy joined
11:38 fXl joined
11:40 biglambda joined
11:40 Elhamer joined
11:40 <opqdonut> mivael: and yeah, the lack of read for BS is a bit painful. I'd probably just do "unpackSingleInt = fromIntegral . fst . fromJust" and not check errors
11:40 <HKei> otherwise, this doesn't look so bad. Did the non-bs string look so much better? You're only doing IO in main anyway
11:40 <mivael> opqdonut, I had an impression that I must use Builder + toLazyByteString to optimize performance, instead of constructing one bytestring per number and that do 'unlines' or similar.
11:41 <opqdonut> mivael: might be, but do measure
11:42 <opqdonut> mivael: but with an explicit IO loop that goes getLine and putStrLn you can avoid the unlines/lines stuff all together
11:42 ertes joined
11:42 <mivael> HKei, yes, it did. This is much better to memorize and, then, faster to re-type: interact $ unlines . map show . processing . map read . words
11:43 <opqdonut> mivael: or you can do a hybrid, input with getContents, but output with putStrLn
11:43 <mivael> It is clear and brief.
11:43 <opqdonut> mivael: ... but in this case the output is just one number on one line, right?
11:43 robatosan joined
11:44 <mivael> okay, I will measure bs + unlines. And I should probably also try Text? Or not?
11:44 <opqdonut> Text should be pretty equivalent to ByteString
11:44 sproingie joined
11:44 sproingie joined
11:44 <opqdonut> might be more convenient depending on the exact functions available
11:45 newhoggy_ joined
11:46 <mivael> I should also use Builder there, yeah?
11:47 butterthebuddha joined
11:47 <opqdonut> if you're outputting a couple of lines, I doubt it
11:48 <torstein> Is it possible to call functions or do some logic in type family instances? Like this: Move ('Game GInPlay b) pos = if someLogic b then 'Game GInPlay b else 'Game GFinished b
11:48 <opqdonut> torstein: you're looking for dependent typing
11:48 <opqdonut> torstein: you can do almost arbitrary computation with type families, but then you need to program in a painful typelevel language
11:48 <mivael> HKei, opqdonut: Well... 1. Measure BS+unlines. 2. Maybe consider Text. 3. Consider using explicit do-notation IO loop. Thank you very much! I will try.
11:49 fakenerd joined
11:49 <opqdonut> mivael: have fun
11:49 <opqdonut> torstein: see e.g. https://aphyr.com/posts/342-typing-the-technical-interview
11:49 doomlord joined
11:50 butterthebuddha joined
11:50 <mivael> HKei, opqdonut: Should I also look to the Pipes/Conduits side? Or better not? :)
11:50 <torstein> Okay I'll read that. So it should be possible?
11:50 oish joined
11:51 ziocroc joined
11:51 <opqdonut> mivael: probably overly complex for your use case
11:51 <opqdonut> torstein: everything is possible, but not everything makes sense
11:53 blym_ joined
11:54 tomphp joined
11:54 <mivael> opqdonut, I was afraid it is :) I had an impression that they can be of use when I need more real-time kind of I/O (when, for example I need to lazily read test cases and print a result for each one as fast as the whole test case available in input, not some time later).
11:54 koneko joined
11:55 phaji joined
11:56 <mivael> I mean that if a program should have worked not just in batch mode but in interactive contexts as well.
11:56 robatosan joined
11:56 sdothum joined
11:56 butterthebuddha joined
11:57 tomphp joined
11:58 Mon_Ouie joined
11:58 zeroed joined
11:58 ziocroc joined
11:59 erikd joined
11:59 ketil_ joined
12:00 <fXl> hello guys, i have a list like let x = unlines ["hola", vars ,"fire"] , i have another list vars and i want to add elements of vars one by one like in C. how can i do that ?
12:01 tomphp joined
12:01 <ketil_> Hi all! I may be having some problems with Judy. One option might be to move to a different associative map structure. I only need Word64 keys (although Word128 would be awesome) and some integer type as values to be stored, but speed and especially compactness is essential. Data.HashTable.IO? Or are there other alternatives?
12:01 <mivael> fXl, add to what?
12:02 <fXl> let vars = [1,2,3] add this to x
12:02 Denthir joined
12:02 <ketil_> fXl, x is a list of Char, how would you add numbers?
12:02 <fXl> let x = unlines ["hola",vars,"fire"]
12:03 <fXl> i know, i just saying , i want to do something like this
12:03 <ketil_> what would you like the result to look like?
12:03 <fXl> x = ["hola",1,2,3,"fire"]
12:04 <Boomerang> fX1 what output format do you want? "hola\n1 2 3\nfire"? If so try: let x = unlines ["hola", unwords (map show vars), "fire"]
12:04 nomicflux joined
12:05 <fXl> Boomerang, thanks i got the idea i guess, i will try
12:05 <ketil_> fXl, x = ["hola",1,2,3,"fire"] doesn't make sense, what is the type? [String] or [Int]? It can't be both.
12:05 <mivael> fXl, ["hola",1,2,3,"fire"] is not a valid list
12:06 <mivael> > ["hola",1,2,3,"fire"]
12:06 <lambdabot> error:
12:06 <lambdabot> • No instance for (Num [Char]) arising from the literal ‘1’
12:06 <lambdabot> • In the expression: 1
12:06 <fXl> ["hola","1","2","3","fire"]
12:06 <fXl> i just want this then :D
12:06 bjz_ joined
12:06 <fXl> but Boomerang's answer is what i need i guess
12:06 <mivael> > ["hola"] ++ map show [1,2,3] ++ ["fire"]
12:06 <lambdabot> ["hola","1","2","3","fire"]
12:07 <mivael> oh, I missed that
12:07 <fXl> cool thanks
12:07 <ketil_> So...anybody use HashTable?
12:08 <fXl> mivael, can't i do this in unlines? i have to seperate them ?
12:08 Gurkenglas joined
12:08 yoneda joined
12:09 <mivael> fXl, you can but you'll get different result
12:09 <mivael> which one you want?
12:09 <mivael> > ["hola", unwords (map show vars), "fire"]
12:09 <lambdabot> error:
12:09 <lambdabot> • Variable not in scope: vars :: [()]
12:09 <lambdabot> • Perhaps you meant one of these:
12:09 <mivael> > ["hola", unwords (map show [1,2,3]), "fire"]
12:09 oish joined
12:09 <lambdabot> ["hola","1 2 3","fire"]
12:10 emerson joined
12:10 <fXl> yeah, "1 2 3" this is not what i intended to do
12:10 newhoggy joined
12:11 beanbagula joined
12:11 <mivael> fXl, unlines/unwords version makes 3-element resulting list, without them is is (2+len(vars)-element list
12:11 nighty-- joined
12:11 <mivael> s/is is/it is/
12:12 <Boomerang> /// Accelerometer sensor values (ADXL337) ///
12:12 <mivael> ketil_, I tried HashTable once
12:12 <Boomerang> (sorry wrong copy paste)
12:12 jleon joined
12:12 eacameron joined
12:14 vlatkoB joined
12:16 <ketil_> mivael, any idea how it performs, esp. compared to Judy arrays?
12:16 <ketil_> Guess I could just try it myself, of course - but I worry about memory use (so IntMap etc are right out).
12:17 zeroed joined
12:18 bbee joined
12:18 bbee joined
12:18 _sras_ joined
12:18 soniku joined
12:18 <fXl> > unwords $ map (\y -> "\"" ++ y ++ "\"") $ map show [1,2,3]
12:18 <lambdabot> "\"1\" \"2\" \"3\""
12:18 <fXl> mivael, i dont want those \ back slashes
12:18 <_sras_> Is there another function like `symbolVal` that can convert types of arbitrary kinds back to values?
12:19 alfredo joined
12:22 coot____ joined
12:25 sproingie joined
12:28 danthemyth joined
12:28 NoCreativity_ joined
12:28 Filip__ joined
12:30 Maerten joined
12:30 Frans-Willem joined
12:31 alpert joined
12:31 <mivael> ketil_, I never used Judy arrays
12:31 <cocreature> _sras_: I’m not entirely sure I understand your question but maybe you’re looking for something like the singletons library? in particular, singByProxy
12:32 alpert joined
12:32 <niez> fXl, if I understand correctly, you want to convert a list of integers to some string representation, what is your desired output?
12:32 leothrix joined
12:32 <ketil_> _sras_, undefined? By some definitions, that is a value that inhabits any type.
12:33 <cocreature> ketil_: it’s just not a particularly useful value :)
12:33 <fXl> niez, lets say i have this list [1,2] what i want to do is "1 = {}" "2 = {}"
12:34 <ketil_> mivael, but HashTable performance? And memory overhead? Judy stores key-value pairs very close to the optimal 2*64bit. Some space for hashtable sparsity is survivable, I guess, but boxing or copy-GC is out.
12:34 <fXl> > unwords $ map (\y -> "\"" ++ y ++ "\"") $ map show [1,2,3] and this works i guess
12:34 <lambdabot> error:
12:34 <lambdabot> • Couldn't match expected type ‘([Bool] -> Bool)
12:34 <lambdabot> -> t2 -> t1 -> Expr -> t0 -> [[Char]]’
12:34 <fXl> oops sorry lambdabot :D
12:35 <ketil_> cocreature, well if you want something useful, better to specify how it's intended to be used, don't you think? :-)
12:35 aglorei joined
12:35 <niez> fXl, like this? map ((++ " = {}") . show) [1,2]
12:36 <fXl> > map ((++ " = {}") . show) [1,2]
12:36 <lambdabot> ["1 = {}","2 = {}"]
12:36 <fXl> > unwords $ map ((++ " = {}") . show) [1,2]
12:36 <lambdabot> "1 = {} 2 = {}"
12:37 <fXl> > unwords $ map ((++ " = {}\n") . show) [1,2]
12:37 <lambdabot> "1 = {}\n 2 = {}\n"
12:37 sepp2k joined
12:37 <mivael> ketil_, oh I'm sorry, I confused HashMap and HashTable
12:37 <fXl> niez, thats cool though , i kinda understand . show part :D
12:38 <ketil_> mivael, or maybe I confused them?
12:38 coot joined
12:39 roconnor joined
12:40 blender3 joined
12:40 ixxie joined
12:41 <fXl> mivael, niez and others thank you for your suggestions, i learnt something new
12:41 <mivael> ketil_, I used HashMap only once. Can't really judge about performance much. In my case I switched (back) to array because interval of possible keys allowed that and time was more important.
12:42 <torstein> Quick question .. In type families, can the return type depend upon the value of the input types (in contrast to the input type itself)?
12:44 newhoggy joined
12:44 <niez> fXl, it's a function composition, first numbers are converted to strings and then this extra suffix " = {}\n" is appended to each item, you can write this in two steps (two maps) to understand what's going on: map (++" = {}\n") (map show [1,2])
12:44 <fXl> niez, for now only i have struggles about . show thing
12:44 <fXl> :D
12:44 <ketil_> HashMap is just an IntMap using hashes of keys. So it will be memory expensive due to the IntMap tree, as well as needing to store the actual keys (in case of hash collisions). So that's certainly not useful for my use.
12:45 <ketil_> But thanks anyway :-)
12:45 <_sras_> cocreature: can you please take a look here. Been hacking on this for a couple of days, and I am pretty sure there is a better way. http://lpaste.net/355027
12:45 <fXl> i always doing it wrong :D how can i now which function composition will work :D
12:45 <_sras_> cocreature: The aim is to implement a generic function that can return a Digestive Functors Form for any record....
12:45 <fXl> map ((++ " = {}") . show) [1,2] for this lets say
12:46 <fXl> (++ " = {}") . show = (++ " = {}") is this input for show ?
12:46 moll joined
12:46 <cocreature> _sras_: step 1: use generics-sop instead of GHC.Generics :)
12:47 <_sras_> cocreature: Really? And I have been asking here for two days...Where have you been ? :)
12:47 Filip__ joined
12:47 dmiles joined
12:48 Jynx651_ joined
12:48 Wizek_ joined
12:49 Hunter1 joined
12:49 dmiles joined
12:51 <_sras_> "As an example of a generic function, let us define a generic version of rnf from the deepseq package." -- Why do Haskell documentation always use obscure examples?
12:51 <niez> fXl, no, show takes integer an converts it to string, so you get list of string out of list of integers, and after that this list is processed by (++ " = {}")
12:52 <niez> fXl, the (.) works from right to left
12:52 erisco joined
12:52 <niez> fXl, I hope it helps :)
12:53 <_sras_> cocreature: so should I throw away he current code and start in generics-sop?
12:53 jdnavarro joined
12:53 <fXl> yeah thank you so much niez
12:54 <mivael> :t (.) -- fXl
12:54 <lambdabot> (b -> c) -> (a -> b) -> a -> c
12:55 Itkovian joined
12:55 mmhat joined
12:56 <cocreature> _sras_: I haven’t written a lot of generics code tbh, but the little I’ve written has been significantly more pleasant using generics-sop than using GHC.Generics
12:58 blym_ joined
12:59 ninjazoete joined
13:02 cemd_ joined
13:02 mattyw joined
13:03 cic joined
13:03 alfredo joined
13:03 jathan joined
13:04 cemg__ joined
13:06 tsmish joined
13:08 tomphp joined
13:08 Kater1 joined
13:11 Aruro joined
13:11 sepp2k joined
13:11 darlan joined
13:11 angelbeats[m] joined
13:13 blender3 joined
13:13 sepp2k joined
13:14 theelous3 joined
13:16 kmels joined
13:18 zariuq joined
13:19 mizu_no_oto_work joined
13:19 lazersmoke-w joined
13:20 soniku joined
13:20 fakenerd joined
13:22 alpert joined
13:23 newhoggy joined
13:24 erikd joined
13:24 ixxie joined
13:25 ziocroc joined
13:29 sproingie joined
13:29 sproingie joined
13:30 cdg joined
13:31 Scorchin joined
13:32 epsilonhalbe joined
13:36 osa1_ joined
13:36 <vaibhavsagar> ketil_: I think you're describing Data.Map instead of Data.HashMap
13:36 mmachenry joined
13:37 jangsutsr joined
13:37 <vaibhavsagar> Data.HashMap is implemented using HAMTs whereas Data.IntMap and Data.Map are implemented using Patricia tries
13:39 newhoggy joined
13:40 meba joined
13:43 mmachenry joined
13:43 dsh joined
13:44 ystael joined
13:44 <adamCS> cocreature, _sras_: Yes, generics-sop.
13:45 gottcha joined
13:45 robotroll joined
13:46 `^_^v joined
13:50 Costar joined
13:50 Fendor joined
13:52 bjz joined
13:52 DocWinter joined
13:53 chlong joined
13:53 ephemeral joined
13:54 <pfoetchen> hn nicht aufräumen ich muss
13:54 ChristopherBurg joined
13:54 <pfoetchen> uups ;)
13:55 <Fendor> german is a great language :P
13:56 yqt joined
13:58 descender joined
13:59 hurkan1 joined
13:59 crobbins joined
14:00 umib0zu joined
14:01 Levex joined
14:01 beanbagula joined
14:02 mmachenry joined
14:04 jleon joined
14:05 <ongy> the name gave it away either way
14:05 firef1y joined
14:06 Itkovian joined
14:07 ziocroc joined
14:07 robkennedy joined
14:09 filterfish__ joined
14:10 <erisco> what is the purpose of Show1?
14:10 fragamus joined
14:10 fenedor joined
14:12 epsilonhalbe joined
14:12 darlan joined
14:12 <MitchellSalad> erisco: it lets you abstract over a Functor (or whatever * -> *) with no mention of its type parameter, yet still know that no matter what the type parameter ultimately is, you can show the whole thing
14:12 <erisco> how? what function lets me show it?
14:13 <MitchellSalad> (assuming the param itself has a Show instance)
14:13 <MitchellSalad> 'show' will show it, haha
14:13 iAmerikan joined
14:13 eacameron joined
14:13 <erisco> so why not Show a => Show (F a)
14:13 eschnett joined
14:14 <MitchellSalad> ah, so, say I write such an instance for my F
14:14 <MitchellSalad> how might some other code work generically over such F-things with that instance?
14:14 newhoggy joined
14:14 <MitchellSalad> that's what Show1 is for
14:15 <erisco> I am not following
14:15 <erisco> so I am writing a function that wants to show x :: F a ?
14:15 <erisco> then (Show a, Show (F a) => ...
14:16 <nshepperd_> If the same function uses F at different types
14:16 <MitchellSalad> nshepperd_: that's not it
14:16 <nshepperd_> eg. Polymorphic recursion
14:16 <MitchellSalad> erisco: that constraint is totally fine, but what if you wanted to abstract over the F part? (i.e. 'f')
14:17 sigmundv_ joined
14:17 <nshepperd_> There's no (Show (F a)) constraint you can write that correctly expresses that this should work for all a
14:17 <erisco> then lowercase it? does that make GHC unhappy?
14:17 obadz joined
14:17 <MitchellSalad> nshepperd_: yes there is! -__-
14:18 <nshepperd_> Well, i suppose there's that hack in the constraints package
14:18 <MitchellSalad> erisco: no, that doesn't make GHC unhappy (if this is a function constraint)
14:18 <glguy> how about a Show instance for: data T f = forall a. Show a => C a
14:19 <MitchellSalad> but consider if it was a constraint on a typeclass
14:19 <MitchellSalad> nshepperd_: no, I'm not talking about constraints... 'Show (F a)' is a perfectly valid constraint! 'F' here is a concrete type...
14:20 <glguy> how about a Show instance for: data T f = forall a. Show a => C ( f a )
14:20 Gurkenglas joined
14:20 <nshepperd_> MitchellSalad: yes, that's a valid constraint. But doesn't say "for all a". It says "for the previously instantiated a"
14:20 <glguy> you can have Show (f a) constraints. Show1 shines when a is unnameable
14:21 <MitchellSalad> glguy: yes! that's what I'm trying to say
14:21 chlong joined
14:21 <erisco> T :: (* -> *) -> * and so does that work with Show1 :: (* -> *) -> Constraint ?
14:21 <MitchellSalad> this class is impossible to write ('a' is not in scope): class (Show a, Show (f a)) => Foo f where ...
14:21 newhoggy joined
14:21 soniku joined
14:21 <lyxia> erisco: think if the constraints you need for Show (T f)
14:22 burtons joined
14:22 <erisco> I am not disagreeing with that
14:22 eacameron joined
14:23 <erisco> I don't see how I write a Show1 instance for it either
14:23 <MitchellSalad> hmm?
14:23 <erisco> kind mismatch
14:24 <MitchellSalad> wha? =)
14:24 <MitchellSalad> you'd have to write: class Show1 f => Foo f
14:24 <erisco> what is Foo?
14:24 e_svedang joined
14:24 firef1y joined
14:24 <erisco> this is all over the board for me. I don't get what anyone is saying right now
14:24 <erisco> glguy brought up the type T
14:25 <erisco> I don't see how we can write a Show1 instance for T
14:25 <lyxia> because that's not the point of T
14:25 oish joined
14:25 <lyxia> the point is to write a Show instance for T
14:25 <MitchellSalad> erisco: he meant to write 'data T f a = forall a. Show a => C (f a)'
14:25 <erisco> what does that have to do with Show1 then
14:26 <MitchellSalad> (I think)
14:26 <nshepperd_> erisco: the instance is Show1 f => Show (T f)
14:26 <lyxia> well try to write Show (T f) and you'll see that you need soomething like Show1
14:27 newhoggy joined
14:27 <MitchellSalad> whoops, I put an extra 'a' on T. heh
14:28 rkazak joined
14:29 tomphp joined
14:29 <erisco> okay, I know what is being said now, thanks
14:29 Apocalisp joined
14:29 HarveyPwca joined
14:29 fenedor joined
14:30 <erisco> what is showsPrec?
14:30 <nshepperd_> Show1 f is basically synonymous with (forall a. Show a => Show (f a)). Except that you can't write the latter in a constraint
14:30 <ski> `showsPrec' is what one should normally implement, if and when one manually makes a `Show' instance
14:31 <erisco> so what is the Int and what is the purpose of ShowS
14:31 <ski> it keeps track of the current precedence level, in order to determine (using `showParen') whether to wrap the shown value in a pair of brackets
14:31 <ski> `ShowS' is an optimization of `String', to avoid the inefficiency of left-associating `(++)'
14:32 piyush-kurur joined
14:32 newhoggy joined
14:33 mada joined
14:33 <erisco> > (showsPrec 0 (Just 0) "", showsPrec 9 (Just 0) "")
14:33 <lambdabot> ("Just 0","Just 0")
14:33 <erisco> at what point is it going to put parens around it
14:33 <ski> > showsPrec 11 (Just ()) ""
14:34 <lambdabot> "(Just ())"
14:34 <ski> `10' is the precedence of application
14:34 <erisco> 11? then I need to read on these precedence levels
14:34 beanbagula joined
14:34 codesoup joined
14:35 <nshepperd_> > showsPrec 10 (Just ()) ""
14:35 <lambdabot> "Just ()"
14:35 <ski> consider something like
14:35 piyush-kurur left
14:35 <ski> data Tree a = Leaf a
14:35 <ski> | Tree a :+: Tree a
14:35 <c_wraith> if you wanted to describe some precedence as 11, it'd be record updates
14:35 <ski> infix 5 :+:
14:36 <mivael> :t (:+:)
14:36 <lambdabot> error:
14:36 <lambdabot> • Data constructor not in scope: :+:
14:36 <lambdabot> • Perhaps you meant ‘:+’ (imported from Data.Complex)
14:36 <ski> (:+:) :: Tree a -> Tree a -> Tree a
14:36 <ski> if one were to derive `Show' for this, it would generate the instance
14:36 <ski> instance Show a => Show (Tree a)
14:36 <ski> where
14:37 carlomagno joined
14:37 <ski> showsPrec p (Leaf a) = showParen (p > 10)
14:37 <ski> $ showString "Leaf "
14:37 <ski> . showsPrec 11 a
14:38 fotonzade joined
14:38 bjz_ joined
14:38 <erisco> > show (Just (Just 0))
14:38 <ski> showsPrec p (l :+: r) = showParen (p > 5)
14:38 <lambdabot> "Just (Just 0)"
14:38 <glguy> paste bin down?
14:38 <ski> $ showsPrec 6 l
14:38 <erisco> so going into show for Just 0 the precedence is 11?
14:38 <ski> . showString " :+: "
14:38 newhoggy joined
14:38 <ski> . showsPrec 6 r
14:39 <nshepperd_> Hm. So the int passed to showsPrec is the precedence of the operator applied to us, plus 1? Or 0 if there is none
14:39 <ski> the precedence for both operands of `:+:' is one more than the precedence of the operator, i.e. `5'
14:39 <ski> if `:+:' had been `infixl', then we'd have passed `5' for the left operand, and `6' for the right operand
14:39 <ski> if `:+:' had been `infixr', then we'd have passed `6' for the left operand, and `5' for the right operand
14:40 luntain joined
14:40 <ski> in the `Leaf a' case, conceptually we pass `10' for `Leaf' and `11' for `a'
14:40 carlomagno1 joined
14:40 <erisco> so why did you pass 6 for both?
14:40 <ski> but `Leaf' is always the same string, so the precedence disappears there
14:40 <glguy> since showsPrec doesn't know about left and right fixities, it's risky to assume that it's ok to send a5 there
14:40 <ski> because i defined `:+:' to be `infix', non-associative
14:40 <glguy> in general
14:41 <ski> so you need to increment the precedence level in both operands
14:41 <glguy> it works out here because we know it's another Tree
14:41 <ski> so that if you have `(...) :+: (...)', the brackets for the operand here will actually be emitted by `showParen'
14:42 <ski> similarly, you can't write `a == b == c', you must write either `(a == b) == c' or `a == (b == c)', depending on which you mean
14:42 <ski> brackets are required, since `==' is non-associative. so we need to increment the precedence level
14:43 <ski> in the `Just (Just 0)' case, the `showsPrec' defining equation will pass `11' as precedence level to the showing of `Just 0', and then `showParen (p > 10)' will then emit brackets around that
14:44 <glguy> If you had a datatype like: data Pair a b = a :.: b -- You'd need to increment the precedence no matter the associativity of (:.:)
14:44 <ski> no
14:45 <glguy> because if you had some other operator +++ with differing associativity you'd end up with situations like:
14:45 <glguy> x +++ y :.: z
14:45 <ski> `showsPrec' called on `a' and `b' here will be told the precedence level of the surrounding context (here being in the left or right operand of `:.:')
14:45 <glguy> and you'll just get an error trying to use that as Haskell syntax
14:45 <glguy> so you can't use whether it's a left or right associative operator to decide whether or not to increment the precendence, you just have to increment
14:46 <ski> i don't follow
14:46 newhoggy joined
14:46 sellout- joined
14:46 <glguy> No matter if it's infix, infixl or infixr 5 :.:
14:46 <glguy> You'll need to call showsPrec with 6 on both the lft and right arguments
14:46 <ski> what is precedence of `+++' ?
14:47 <glguy> It could have been infixl 5 or infixr 5, we don't know
14:47 <glguy> showsPrec don't convey the associativity of the containing context
14:47 <glguy> just the precedence
14:47 robatosan joined
14:48 raichoo joined
14:48 <ski> if we have `infixl 5 +++,:.:' then given `(x +++ y) :.: z' we're safe to pass on `5' to `x +++ y', which will then omit the brackets, which is safe here
14:48 <glguy> If they're both infixl then it would have worked
14:48 <glguy> if +++ was infixr it won't be safe to omit
14:49 buttbutter joined
14:49 buttbutt1r joined
14:49 <ski> oh, i see what you mean. i stand corrected
14:49 <ski> thank you
14:50 carlomagno joined
14:52 newhoggy joined
14:52 <glguy> so you know of a complete document explaining how to work these things?
14:52 <ski> not apart from the description in the report
14:54 <sproingie> i'm trying to model RPG stats with some measure of type safety, but I'm not sure if I'm on the right track. someone want to give me opinions on https://gist.github.com/chuckadams/e5ccd9e92b0c9c7c64d3e93a805a0024 ?
14:55 filterfish_ joined
14:55 conal joined
14:55 bjz joined
14:56 newhoggy_ joined
14:57 Itkovian joined
14:57 uglyfigurine joined
14:58 <erisco> am I supposed to implement readPrec or readsPrec?
14:58 pete joined
14:59 peterbecich joined
14:59 Guest45352 left
14:59 Giulia joined
14:59 uglyfigurine joined
15:01 nscott76 joined
15:01 <ski> `readsPrec'
15:01 <ski> @type readParen
15:01 <lambdabot> Bool -> ReadS a -> ReadS a
15:01 Jesin joined
15:01 <erisco> says readPrec is newer
15:02 cschneid_ joined
15:03 <Giulia> Hi
15:03 thatguy joined
15:03 danza joined
15:04 <Giulia> anyone located in the US and interested in Blockchain?
15:04 asmyers joined
15:05 <Hafydd> Hi
15:05 <Hafydd> anyone located in the northern hemisphere and interested in Program?
15:06 <Giulia> @hafydd whats the tech stack?
15:06 <lambdabot> Unknown command, try @list
15:06 <Hafydd> Giulia: the HHHH (Haskell, Haskell, Haskell, Haskell) stack.
15:06 drcode joined
15:07 Sgeo__ joined
15:07 <Giulia> Hafydd: interest in Blockchain ?
15:08 <Hafydd> Giulia: mildly, but I'm afraid I am not located in the United Snakes.'
15:08 <Giulia> lol
15:08 <Giulia> where are you
15:08 <Hafydd> The United Kingdom.
15:09 <Giulia> whats your GitHub?
15:09 newhoggy joined
15:09 <Hafydd> I think it's too early in our relationship for that.
15:10 <Giulia> No worries :)
15:11 <Hafydd> Giulia: if you have some kind of proposal, you may as well just state it; but if it's not related to Haskell this might be the right channel for it. You might prefer #haskell-offtopic.
15:13 <shapr> Giulia: there are some haskell blockchain startups, are you working at one of them?
15:13 <Giulia> Hafydd: Yes I do, don't know if this appropriate here tho. I work with loads of interesting companies that are looking to hire Haskell engineers
15:13 <Giulia> Yes shapr, precisely
15:13 flatmap13 joined
15:13 <luntain> cassava problem: header names start with upper case and one is a reserved word. Is it possible to derive FromNamedRecord instance?
15:14 <Giulia> dont want to be rude or annoy anyone here with my recruitment talks, so let me know if this is the wrong channel
15:14 danthemyth joined
15:15 <quchen> If it’s Haskell-related you can ask here. But don’t spam it.
15:16 <shapr> Giulia: what's the big advantage of combining Haskell and blockchain?
15:16 Elhamer joined
15:16 bennofs joined
15:16 <quchen> shapr: (the answer is obvious, isn’t it) ;-)
15:17 <shapr> quchen: Yes? Haskell can do that?
15:18 cpennington joined
15:19 szymon joined
15:19 <shapr> Giulia: What's the name of the company doing blockchain stuff in Haskell?
15:20 fakenerd joined
15:22 drcode joined
15:22 ninjazoete joined
15:22 newhoggy joined
15:22 erikd joined
15:23 rdococ joined
15:23 averell joined
15:24 <Giulia> shapr: sorry for my short absence
15:25 <Giulia> shapr: mainly because this company have built their own language with haskell
15:25 sproingie joined
15:25 <Giulia> they build financial smart contracts for various banks
15:25 sproingie joined
15:26 andreypopp joined
15:26 trism joined
15:26 flatmap13 joined
15:28 newhoggy joined
15:28 fXl joined
15:29 kadoban joined
15:30 fXl joined
15:31 <quchen> Giulia: Haskell-exclusive?
15:31 danthemyth joined
15:32 <quchen> Or is it just some internal tooling some devs managed to sneak in ;-)
15:33 epsilonhalbe joined
15:34 ara joined
15:35 al-damiri joined
15:35 Wuzzy joined
15:35 urodna joined
15:36 <Giulia> I'm not sure
15:36 <Giulia> I think its exclusive
15:36 eacameron joined
15:36 crobbins joined
15:37 wires joined
15:37 zeroed joined
15:37 zeroed joined
15:39 <Giulia> I'd love to tell you more @quchen but I'm really unsure about saying more over this channel
15:39 newhoggy_ joined
15:39 <kosmikus> _sras_: have you been able to solve your generics problem?
15:40 takle joined
15:41 Sgeo_ joined
15:44 mattyw joined
15:46 LordBrain joined
15:47 uglyfigurine joined
15:48 newhoggy joined
15:48 <bonparaara> when using State, can I modify the state for just one call? like `withState`, but with an undo after the action?
15:48 a3Dman joined
15:48 <LordBrain> if you save it
15:48 <LordBrain> sure
15:48 <dysfun> any recommendation on what Random to use for generating secure random UUIDs?
15:48 <bonparaara> I just wrote a helper that does that, but it seems like something basic, so I assumed that something like that is probably already out there
15:49 <LordBrain> bonparaara, well you might be thinking of reader monad
15:49 Itkovian joined
15:49 rkazak joined
15:50 drcode joined
15:51 tomphp joined
15:51 <LordBrain> then again, there might be something already out there bonparaara specifically for MonadState monads, i'm unfamiliar if so.
15:51 <bonparaara> maybe, my use case is recursive descent through a data structure where I want to have the path to the current node available
15:52 <bonparaara> still small enough where having the path as an explicit parameter is not really ugly, but i never really used State much, so I thought why not try it out
15:52 Moto-chan joined
15:52 Moto-chan joined
15:53 newhoggy joined
15:53 jmelesky joined
15:54 eacameron joined
15:55 drcode joined
15:55 mmachenry joined
15:55 vektorweg1 joined
15:56 Hunter1 joined
15:56 <c_wraith> neither state nor reader is exactly what you want, but you can fake it with either..
15:56 Vulume joined
15:57 <Vulume> @pl \xs n -> take n xs
15:57 <lambdabot> flip take
15:57 ertes joined
15:57 <Vulume> @pl \ds -> ds == nub ds
15:57 <lambdabot> ap (==) nub
15:58 <c_wraith> I guess Reader's local is pretty close to what you want
15:58 <Vulume> @pl \f -> (ap (==) nub) (zipWith f xs ns)
15:58 <lambdabot> ap (==) nub . flip (flip zipWith xs) ns
15:58 <LordBrain> could call your helper localState
15:59 <_sras_> kosmikus: No. :(
15:59 <ski> bonparaara : are you sure you need to get the updated state after an action ?
15:59 <Vulume> @pl \ds -> nub ds == ds
15:59 <lambdabot> (==) =<< nub
16:00 <LordBrain> if you dont run 'put' after the action, state disnt updated anyway
16:00 <byorgey> bonparaara: you want Reader. Using the 'local' function this does exactly what you want.
16:00 <* ski> thinks it sounds like they want `local' and `Reader'
16:00 geekosaur joined
16:00 <LordBrain> well he might need it to be State in other parts of the program tho
16:01 <ski> yes .. hence my question
16:01 LordBrain left
16:01 LordBrain joined
16:02 <bonparaara> yep, I definitely want local and maybe Reader is a good fit there
16:02 <byorgey> bonparaara: here's an example of this kind of style: https://github.com/disco-lang/disco/blob/master/src/Disco/Typecheck.hs see especially the definition of TCM, extend, and extends
16:02 <bonparaara> true, with nested 'local
16:02 lambdaman joined
16:03 <bonparaara> nested 'local'-calls I get the behaviour I want
16:03 <ski> good
16:03 lambdaman joined
16:04 <bonparaara> thanks for the help guys :)
16:04 geekosaur joined
16:06 <bonparaara> as for the helper I used before: \f m = do s <- get; result <- withState f m; put s; return result;
16:06 newhoggy joined
16:06 <bonparaara> what's very ugly about this is that it has the same signature as withState
16:06 mjora7 joined
16:06 sleffy joined
16:06 bennofs joined
16:07 hvr joined
16:08 Sonolin joined
16:09 mattyw joined
16:09 pera_ joined
16:10 eacameron joined
16:11 thunderrd joined
16:12 wroathe joined
16:13 meandi_2 joined
16:13 zacharypch joined
16:14 oisdk joined
16:15 newhoggy joined
16:15 eacameron joined
16:15 baweaver left
16:17 chlong joined
16:17 gmcabrita joined
16:18 mizu_no_oto_work joined
16:19 newhoggy joined
16:20 <kosmikus> _sras_: I'm willing to help, if you can explain to me what the problem is.
16:20 <kosmikus> _sras_: but I also have to leave for dinner in a few minutes. (but I'll be back later)
16:20 eacameron joined
16:21 <kosmikus> _sras_: I've looked at your original paste. So this code compiles, but you say it's broken. what's the desired behaviour?
16:21 soniku joined
16:22 shivansh joined
16:22 shivansh left
16:24 oish joined
16:26 newhoggy joined
16:26 chrisdotcode joined
16:27 eacameron joined
16:28 Jseph joined
16:29 seveg joined
16:31 alx741 joined
16:32 Costar joined
16:32 whiteline joined
16:32 <Jinixt> what does it mean when there's a Constructor{} in a pattern matching?
16:32 alx741 joined
16:33 newhoggy joined
16:34 <byorgey> Jinixt: it matches any value with that constructor, regardless of its arguments
16:34 Costar_ joined
16:34 <Jinixt> oh god damnit i've been wanting that for ages
16:34 <byorgey> i.e. it's like matching on (Constructor _ _ _) for however many _'s you need
16:34 <Jinixt> thanks
16:34 <byorgey> (it does this by abusing record pattern-matching syntax)
16:36 fragamus joined
16:36 conal joined
16:36 EvanR_ joined
16:37 dunx joined
16:38 Itkovian_ joined
16:39 newhoggy joined
16:39 HarveyPwca joined
16:40 <geekosaur> it's not abuse when it's explicitly sanctioned by the Report :)
16:40 abhiroop joined
16:41 <geekosaur> (in particular, the Constructor{} syntax is explicitly available even when the constructor was not defined with record syntax)
16:42 <sproingie> NamedFieldPuns is nice to have too. foo Constructor{bar,baz} = ...
16:43 ondrejs joined
16:43 tomphp joined
16:44 <ondrejs> hello. Anyone using Liquid Haskell? I have GHC 8, LH works only with 7.10. However when importing a lib like GHC.Reals I think it tries to match the spec against GHC 8 version. Can I somehow tell it where to look for GHC libs?
16:45 <ondrejs> I have both GHC 7.10 and 8 installed with stack, but 8 is default (I suppose this is determined by my global config lts version)
16:46 <Jinixt> sproingie: how is that different from foo (Constructor bar baz)?
16:46 <sproingie> comes in handy when you only want a few out of a dozen fields
16:46 Gentilhomme joined
16:46 <Jinixt> but it has to be the first in order?
16:46 robotroll joined
16:47 newhoggy joined
16:47 <sproingie> any order, does have to be declared as a record of course
16:47 <torstein> In regards to the blogpost 'typing the technical interview'... How does this work? instance (ListConcat as bs cs) => ListConcat (Cons a as) bs (Cons a cs)
16:47 <Jinixt> so wait, is bar and baz the record names or the names you give the values?
16:47 <sproingie> both!
16:47 flatmap13 joined
16:47 <Jinixt> so it shadows i suppose
16:48 <sproingie> Foo{a,b} is short for Foo{a=a,b=b}
16:48 jship joined
16:48 ragepandemic joined
16:48 <mniip> that's what the "puns" means
16:48 <sproingie> works in pattern matching and updates both
16:48 <Jinixt> oh
16:48 <glguy> torstein: Maybe you can be more specific in your question, why shouldn't it work?
16:49 <kosmikus> or Foo{..} with RecordWildCards. although I guess that's a bit more controversial, because it brings "random" names into scope.
16:49 <torstein> glguy, I don't understand how that line concat's two lists by itself
16:49 <mniip> it doesn't
16:49 <sproingie> kosmikus: wildcards don't work in pattern matches
16:49 <mniip> you need 'instance ListConcat Nil bs bs'
16:50 <kosmikus> sproingie: they do, or I'm misunderstanding what you're saying
16:50 Itkovian joined
16:50 <sproingie> foo Bar{..} = show baz
16:50 <kosmikus> sproingie: that works
16:50 <torstein> mniip, yeah there's that line too. So does i pattern match on left or right side of => ?
16:50 <sproingie> oh hm nevermind i was typoing the damn thing every time
16:50 <torstein> it*
16:50 <kosmikus> sproingie: :)
16:51 <niez> I like Foo{..}, very handy sometimes
16:51 <kosmikus> niez: yes, I like it too. although I think it's a bit evil.
16:51 <mniip> torstein, first the instance head is matched, then the context is applied
16:51 <_sras_> kosmikus: Around?
16:51 <niez> kosmikus, why it is considered evil?
16:51 <sproingie> yah i'd generally want to make the names brought into scope explicit. but i guess sometimes they're obvious
16:51 <kosmikus> _sras_: I am for the moment. Will have to leave again at some point soon for 15-30 minutes.
16:52 <EvanR> Foo{..} reminds me of PHP extract
16:52 <pikajude> :')
16:52 <kosmikus> niez: as I said, because it's not easy to see what names it introduces
16:52 <kosmikus> niez: so in particular if it leads to shadowing of other names that are in scope, it can be quite confusing
16:52 o joined
16:53 <sproingie> making some progress on my strongly typed D20 rules now
16:53 <_sras_> kosmikus: Ok. No problem. To answer your question, the problem with the code is that I cannot get the field names to match with the corresponding `Forms`...
16:53 jordie left
16:53 newhoggy joined
16:53 gawen joined
16:53 <EvanR> sproingie: dependently typed?
16:53 <kosmikus> sproingie: heh, sounds interesting
16:54 <sproingie> EvanR: god no, i've no idea how to do that
16:54 <EvanR> heh
16:54 <niez> ok, I see, is it somewhat releated to importing stuff? is it considered evil to import implicit everything from a module? like 'import COntriol.Monad' ?
16:54 dominik joined
16:54 <sproingie> https://gist.github.com/chuckadams/e5ccd9e92b0c9c7c64d3e93a805a0024
16:54 <kosmikus> _sras_: do you have some example code that demonstrates the problem?
16:55 <sproingie> the design so far. Caster is a hack til i figure out how to assemble all this later
16:55 osa1_ joined
16:55 <kosmikus> _sras_: I mean, given the code you pasted, an expression that yields one result where you want another?
16:55 lazersmoke-w joined
16:56 <kosmikus> sproingie: reminds me of my library that implements quite a few of the Ars Magica rules, for an IRC bot
16:56 geekosaur joined
16:57 tomphp joined
16:57 <_sras_> kosmikus: Yes
16:58 <kosmikus> _sras_: the thing is, I'm quite familiar with generics, but not with digestive-functors
16:58 sz0 joined
16:58 newhoggy joined
16:59 <lazersmoke-w> It turns out you can fork free monads if it makes sense for your effect by "commuting" the effect outside of the typeindexed coproduct bit and into an actual value https://gist.github.com/Lazersmoke/d49ea7f7d715ac5d51d0b15afb229cc3
16:59 Elhamer joined
17:00 <EvanR> im forking free monads right now
17:00 <EvanR> didnt know it was that sophisticated!
17:00 cyborg-one joined
17:02 angelos joined
17:02 Levex joined
17:02 fragamus joined
17:02 <fragamus> https://hackage.haskell.org/package/pipes-4.3.3/docs/Pipes-Core.html#v:-62--43--62-
17:03 <fragamus> When I read about >~> in that page, it has a diagram which seems inaccurate based on my experience
17:03 <_sras_> kosmikus: I don't think you need to know about digestive-functors. Please take a look here. http://lpaste.net/355042, You can see how I am trying to get the fields names corresponding to `r` and `s` in `r :*: s`. The problem is that `r` and `s` can be nested and I cannot find a way to make it work for such cases..
17:04 newhoggy joined
17:05 rkazak joined
17:05 <kosmikus> _sras_: I see
17:06 acertain joined
17:06 <fragamus> this is my example which seems to show that the data flow diagram is inaccurate
17:06 <fragamus> https://gist.github.com/fragamus/3cc5ab02a9ea89c42111ed7069d7e53b
17:06 flatmap13 joined
17:07 dm3 joined
17:07 newhoggy_ joined
17:08 connrs joined
17:09 filterfish__ joined
17:10 <fragamus> it seems like the first data in "middle" comes from the function argument but the diagram implies it doesn't
17:10 DTZUZU joined
17:11 filterfish_ joined
17:12 filterfish_ joined
17:12 newhoggy joined
17:13 nscott76 joined
17:15 <fragamus> anybody out there experienced with pipes
17:15 <kosmikus> _sras_: so I think you need to decouple the fieldName access from the product instance
17:15 <kosmikus> _sras_: let me prepare a paste
17:16 epsilonhalbe left
17:17 ixxie joined
17:17 <_sras_> kosmikus: Yes. Thank you.
17:17 zv joined
17:17 <kosmikus> _sras_: https://gist.github.com/kosmikus/33a1a7daa7f9dc8c51425e784d1c3063
17:18 <_sras_> kosmikus: Yes. Let me see...
17:18 oish joined
17:19 ph88 joined
17:21 uelen joined
17:23 replay joined
17:23 <_sras_> kosmikus: Works!
17:23 bcmiller joined
17:23 iAmerikan joined
17:24 <kosmikus> _sras_: ok, glad to hear it. I'll also try to produce a version using generics-sop for this, then you can compare the two. [because in principle, I agree that generics-sop is nicer to work with in most cases.]
17:25 acidjnk joined
17:28 tomphp joined
17:28 dm3 joined
17:29 <_sras_> kosmikus: I have lost last couple of days sleep over this. If it weren't for you, it would have been the same today :) So a big thank you! Now let me try to figure out what I was doing wrong...
17:29 Rodya_ joined
17:29 eazar001 joined
17:29 newhoggy joined
17:30 CoderPuppy joined
17:31 govg joined
17:31 <_sras_> kosmikus: I grappled a lot with `symbolVal` earlier today. Couldn't get it to work...Basically I didn't think I could implement an instance for MetaX like this. Can you tell me how the overlapping of instances work?
17:33 modal joined
17:33 Guest27636 joined
17:34 newhoggy_ joined
17:34 justin2 joined
17:34 iomonad joined
17:35 srcerer joined
17:36 Levex joined
17:37 mbuf joined
17:39 tomphp joined
17:39 newhoggy joined
17:39 maarhart joined
17:41 sepp2k joined
17:42 meoblast001 joined
17:42 DTZUZU joined
17:43 Levex joined
17:44 cpup joined
17:44 <kosmikus> _sras_: the general M1 instance and the specific S1 instance overlap, but because the S1 instance is strictly more specific, it takes precedence.
17:45 {emptyset} joined
17:45 phyrex1an joined
17:46 <_sras_> kosmikus: Specific, becuase of the constraints?
17:46 <kosmikus> _sras_: if you don't like overlapping instances, you can also define two instances for D1 and C1 instead.
17:46 <kosmikus> _sras_: no, the constraints are irrelevant for determining how specific an instance is.
17:47 meoblast joined
17:48 <ondrejs> hello, can anyone please point me to an explanation of the meaning of the sharp symbols here? https://www.stackage.org/haddock/lts-8.9/base-4.9.1.0/src/GHC-Char.html#chr
17:49 newhoggy joined
17:49 <LordBrain> usually # means unlifted, but thats a convention is my understanding, it is just a regular identifier symbol
17:49 <kosmikus> _sras_: but the general instance is for "M1 i a r", and the more specific instance is for "M1 S (MetaSel ...) r"
17:49 <MarcelineVQ> ondrejs: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#the-magic-hash
17:49 <LordBrain> page is not loading for me
17:50 <_sras_> kosmikus: Yes,
17:50 <ondrejs> LordBrain, MarcelineVQ: oh, missed that in the header. Thank you
17:51 <kosmikus> _sras_: so if one of two matching overlapping instances is strictly more specific than the other, it "wins"
17:51 <lyxia> fragamus: I think it's more likely you're giving a meaning to the diagram that it doesn't have
17:51 ketil_ joined
17:51 <kosmikus> _sras_: that's why it works; but as I said, you can also replace the general M1 instance by two instances, one for "M1 D a r" and "M1 C a r", both with the same definition
17:52 <kosmikus> _sras_: then you don't need the overlapping instances
17:52 <LordBrain> typically, # types are strict, and are stored without any pointer to dereference
17:52 revtintin joined
17:52 <lyxia> fragamus: but I don't understand what you find to be unexpected about this
17:52 <fragamus> lyxia: no it is the same diagram for >+>
17:53 meandi_2 joined
17:53 <fragamus> the unexpected behavior is that the function on the right side of the >~> is receiving all of its data from the function argument and none of it from await
17:53 <lyxia> it's not
17:54 newhoggy joined
17:55 dsh joined
17:56 <lyxia> fragamus: does that mean the rightward arrow labelled with b should also feed into the input of g at the top ?
17:57 fXl joined
17:58 <lyxia> It doesn't sound like such a big deal, the argument of g has to come from somewhere, and there is only one place where it can come from...
18:00 abhiroop joined
18:01 ckubrak joined
18:01 buttbutter joined
18:01 nicknovi1 joined
18:02 buttbutt1r joined
18:03 uglyfigurine joined
18:03 newhoggy joined
18:04 gillesmajor joined
18:05 uglyfigurine joined
18:07 cpup joined
18:08 jrm joined
18:08 newhoggy joined
18:11 psychicist__ joined
18:14 robertkennedy joined
18:14 gehmehgeh joined
18:15 cpup joined
18:15 oish joined
18:16 cfricke joined
18:16 zariuq joined
18:17 newhoggy joined
18:17 bennofs joined
18:18 talet joined
18:18 HarveyPwca joined
18:19 Levex joined
18:19 zargoertzel joined
18:20 oleo joined
18:20 oleo joined
18:20 sigmundv_ joined
18:20 <talet> Anyone familiar with accelerate? I have an implementation of the game of life using it, but it seems slower than it should be. My repa implementation was a little more than twice as fast, and using nvprof on the accelerate code shows 89% of the time is spent executing the generate function
18:23 beanbagula joined
18:23 zero_byte joined
18:24 kazagistar joined
18:27 dedicated joined
18:27 actualHuman_462 joined
18:27 ckubrak joined
18:28 chaosmasttter joined
18:28 newhoggy joined
18:29 <actualHuman_462> Hiya folks - Running windows 7, trying to build a haskell-gi package with stack. stack ghci works fine if executed from the shell launched by 'stack exec bash'. 'stack build' fails from any environment, with an error about missing routines in libcairo dlls. Anyone have any suggestions about where to start troubleshooting this?
18:29 <MitchellSalad> is there a reason why 'sameMutVar#' does not have type 'MutVar# s a -> MutVar# s b -> Int#'?
18:30 cpup joined
18:30 iAmerikan joined
18:30 <MitchellSalad> it instead takes two 'MutVar# s a'
18:31 <MitchellSalad> i thinketh not, just checked the ghc source
18:32 twanvl joined
18:32 arpl joined
18:35 diegoksp joined
18:35 mjora7 joined
18:36 cpennington joined
18:36 flatmap13 joined
18:37 newhoggy joined
18:38 <kosmikus> @tell _sras_ generics-sop-based solution for your problem: https://gist.github.com/kosmikus/3b88af208827db3c1bf413fc40aa4fc8
18:38 <lambdabot> Consider it noted.
18:39 smillmorel joined
18:40 ystael joined
18:41 robkennedy joined
18:41 plutoniix joined
18:42 Aruro joined
18:42 sellout- joined
18:43 takle joined
18:43 meoblast joined
18:43 HarveyPwca joined
18:44 fotonzade joined
18:44 earldouglas joined
18:44 umib0zu joined
18:45 newhoggy joined
18:45 kazagistar joined
18:45 jamestastic joined
18:46 crave joined
18:46 mehs joined
18:46 connrs joined
18:47 nathanic joined
18:48 lykos__ joined
18:50 __main__ joined
18:50 newhoggy joined
18:51 abhiroop_ joined
18:51 takle joined
18:53 <torstein> is it possible to import something like a type level prelude?
18:55 lykos__ joined
18:56 <geekosaur> I don't think there is one. I'm not sure there can be one without a bunch more plugins like http://hackage.haskell.org/package/ghc-typelits-natnormalise
18:56 newhoggy joined
18:56 <MarcelineVQ> the singletons package has quite a lot of type level prelude things, dunno if it's what you're looking for
18:58 carlomagno1 joined
18:59 <torstein> MarcelineVQ, seems perfect thx
18:59 async_prince joined
19:01 hachi joined
19:01 unK_ joined
19:01 Kreest__ joined
19:04 newhoggy joined
19:06 NikolajK joined
19:09 xinming joined
19:11 wires joined
19:12 ragepandemic joined
19:12 ArchaicLord joined
19:12 abhiroop_ joined
19:13 tomphp joined
19:13 connrs joined
19:15 zv joined
19:16 darjeeling_ joined
19:16 newhoggy joined
19:19 replay joined
19:19 <AaronFriel> Is my Haskell project Web Scale yet? "Result size of Tidy Core = {terms: 2,122, types: 963,728, coercions: 979,013}"
19:21 slentzen joined
19:21 troydm joined
19:22 Costar joined
19:23 bennofs1 joined
19:24 Deide joined
19:24 foofighterbar joined
19:24 laplacian joined
19:25 newhoggy joined
19:25 abhiroop joined
19:28 <actualHuman_462> does anyone know what 'stack exec bash' actually -does- on windows? I can't seem to find any documentation on how it decides what to launch
19:30 newhoggy joined
19:30 <sm> maybe 'stack exec which bash' helps ?
19:31 flatmap13 joined
19:32 iAmerikan joined
19:34 sproingie joined
19:34 sproingie joined
19:35 buttbutter joined
19:36 <actualHuman_462> sm you're the best, yes, that does help
19:36 <ephemeral> why does `last [1..99999999999999999999]` take such a long time to evaluate?
19:36 <ephemeral> I thought GHC was smart ;D
19:37 <kadoban> xD
19:37 Rodya_ joined
19:37 <ezyang> in principle, you could add a REWRITE rule which would ge tthis correct
19:38 <ephemeral> what's that?
19:38 danza joined
19:38 <ephemeral> I'm a total noob fwiw
19:38 <AaronFriel> ezyang: alternatively, you need to describe [1..x] in terms of more informative types which allow you to know the upper bound, and then implement "last" using "IfCxt"
19:39 <AaronFriel> ephemeral: A rewrite rule does what it says on the tin: you tell the compiler, "Hey, when you see __this__, replace it with __that__", where the burden is on you to know that the rule is correct.
19:39 <torstein> How to do lists with Singletons? This gives a kind error ([E00] != Nat): data Game = Game Nat (SList Nat)
19:40 <AaronFriel> torstein: You can't encode "nats" directly in singletons right now.
19:40 Rodya_ joined
19:41 <AaronFriel> torstein: Use `data Game' n = Game n [n]`, and then outside of the $(singletons) declaration use `type Game = Game Nat`
19:41 <sm> ephemeral: List is an inherently inefficient data structure for accessing the last elements, there are alternative types that work better for that
19:41 <AaronFriel> torstein: Sorry,`type Game = Game' Nat`
19:42 ziocroc joined
19:42 newhoggy joined
19:42 <ephemeral> heh, sounds pretty ad hoc
19:42 abhiroop joined
19:42 <AaronFriel> ephemeral: ad hoc how?
19:42 <shapr> ezyang: oh hey, do I need to get credentials or anything from you for taking over TMR?
19:43 <shapr> ezyang: want to write an article? ;-)
19:43 <torstein> AaronFriel, can I put my own data structures inside an SList? E.g. a list of: data Cell = A | B | E
19:43 <actualHuman_462> ephemeral - Lists are sort of weird. They're more like a control structure than a general array type. Think of it as a way to abstract 'lazily' iterating over x things rather than as an array or list. I'd recommend using the Data.Sequence type if you're a total beginner, it has the easiest docs to understand.
19:43 <ephemeral> uh, as in the meaning of the term ad hoc? :P
19:43 <ezyang> yes, let me handle that tonight
19:43 <AaronFriel> @torstein Yes, but if you're promoting things with singletons don't use SList in the declaration.
19:43 <lambdabot> Unknown command, try @list
19:43 <actualHuman_462> Data.Vector is probably the best for performance use-cases, but Sequences have friendly docs
19:43 <ephemeral> anyway, I'm just running through the real world haskell, finally a period of my life in which I have enough mental clarity and focus to actually comprehend it
19:43 <AaronFriel> @ephemeral
19:43 <lambdabot> Unknown command, try @list
19:44 <ephemeral> marvel at the wondrous `lastButOne`-function:
19:44 <AaronFriel> Oops, ephemeral: Lists in Haskell are linked lists.
19:44 <ephemeral> lastButOne :: [a] -> a
19:44 <ephemeral> lastButOne xs = if length xs == 2
19:44 <ephemeral> then head xs
19:44 <ephemeral> else lastButOne $ tail xs
19:44 <ephemeral> such effective, much wow
19:44 <AaronFriel> What happens if you call lastButOne [1]?
19:44 <ephemeral> crash
19:44 <AaronFriel> That's not good
19:44 <ephemeral> well
19:45 <ephemeral> in-built last-function crashes on empty lists as well though
19:45 <AaronFriel> True, that's also not good :)
19:45 tcsavage joined
19:45 zeroed joined
19:46 <AaronFriel> We're just stuck with it because of backwards compatibility (and ugly types/bending over backwards... that should improve some day.)
19:46 <ephemeral> you mean it should return something like Nothing?
19:46 <AaronFriel> That sounds good
19:46 <sm> exactly, like lastMay in the safe package
19:47 <ephemeral> last :: [a] -> Maybe a
19:47 <AaronFriel> Now that looks like it could be a good function
19:47 <ephemeral> not a bad idea
19:47 beanbagula joined
19:47 newhoggy joined
19:48 Eduard_Munteanu joined
19:49 <actualHuman_462> ephemeral - Something that took a while for me to pick up on - multiple function declarations to specify different patterns is a really useful tool for problems like this
19:49 <actualHuman_462> example
19:49 <actualHuman_462> head' [] = Nothing
19:49 <actualHuman_462> head' (x:xs) = Just x
19:49 chaosmasttter joined
19:49 <ephemeral> yeah, I just posted a function I wrote with three declarations, heh
19:49 ph88 joined
19:50 <AaronFriel> Does this look like what you wrote?
19:50 <AaronFriel> sndToLast :: [a] -> Maybe a
19:50 <AaronFriel> sndToLast [] = Nothing
19:50 <AaronFriel> sndToLast [x1] = Nothing
19:50 <AaronFriel> sndToLast (x1:x2:xs) = case xs of
19:50 <AaronFriel> [] -> Just x1
19:50 <AaronFriel> _ -> sndToLast (x2:xs)
19:50 <ephemeral> oh, nvm
19:50 <ephemeral> but yeah, I get it
19:51 <AaronFriel> That last definition could be split out into two definitions instead of using "case", as well. Just a matter of preference.
19:51 evincar joined
19:51 erisco joined
19:52 Aeroxam joined
19:52 augur joined
19:52 <* ski> would use an "as"-pattern there
19:52 ragepandemic joined
19:52 <ski> (well, unless you prefer overlapping patterns)
19:53 modal joined
19:53 <MarcelineVQ> could also reverse the list it for some terseness since you have to get to the end anyway
19:53 <MarcelineVQ> *the list for
19:53 biglambda joined
19:53 jer1 joined
19:53 <ephemeral> ok, how about this:
19:53 <ephemeral> lastButOne :: [a] -> Maybe a
19:53 <ephemeral> lastButOne [] = Nothing
19:53 <ephemeral> lastButOne x:xs = if null xs
19:53 <ephemeral> then Nothing
19:53 <ephemeral> else if length xs == 1
19:53 <ephemeral> then Just x
19:53 <ephemeral> else lastButOne xs
19:53 <ephemeral> except it gives me a parse error
19:53 <ski> missing pair of brackets
19:53 <Aeroxam> Hello ! I'm curious about something : why am I allowed to do this ?
19:53 <Aeroxam> http://lpaste.net/355044
19:53 <ski> `lastButOne x:xs' means `(lastButOne x):xs'
19:54 <AaronFriel> wrap your "x:xs" in parenthesis
19:54 <ephemeral> ah, thanks
19:54 <ski> also, don't use `length' like that
19:54 <ski> it's inefficient
19:54 <AaronFriel> ephemeral: you're doing work twice, is what ski means
19:54 <AaronFriel> Actually, possibly many more times
19:54 <ski> if the list is long, it'll still need to traverse it to the end, only to determine whether it had a single element or not
19:54 <kadoban> Aeroxam: Any particular part?
19:54 <ski> much more efficient to use pattern-matching
19:54 <AaronFriel> ephemeral: as a thought experiment, imagine you had a list that was infinitely long
19:55 <AaronFriel> ephemeral: how long will it take to compute "length"?
19:55 <ephemeral> haha
19:55 <ski> > length [0 ..] == 1
19:55 <ephemeral> I know it's super inefficient guys, even though I'm a noob
19:55 <lambdabot> mueval-core: Time limit exceeded
19:55 <AaronFriel> ^ it takes longer than time limit ;)
19:55 <ski> > case [0 ..] of [_] -> True; [] -> False; _:_:_ -> False
19:55 <lambdabot> False
19:55 <Aeroxam> but not this : http://lpaste.net/355045
19:55 <Aeroxam> kadoban : yeah, last line.
19:56 <kadoban> Oh. Because sometimes recursive definitions make sense. That one doesn't seem like it does though
19:56 newhoggy joined
19:56 <ephemeral> ah
19:56 <ephemeral> so
19:57 <Aeroxam> I mean I didn't expect it to be allowed in the first one
19:57 <ephemeral> nvm, I get the idea, but need to think
19:57 <Aeroxam> is GHC "getting" that it won't ever have to evaluate it so it doesn't care ?
19:57 geekosaur joined
19:58 <Aeroxam> and if that's it, why does he bugger me in the second case ?
19:58 <Aeroxam> "he"
19:58 <ski> Aeroxam : sometimes "tying the knot" like that can be useful ..
19:58 ChaiTRex joined
19:58 <kadoban> Aeroxam: Are you just talking about the recursive definition of 'o' there?
19:59 <ski> > let x = 0 : y; y = 1 : x in x
19:59 <lambdabot> [0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1...
19:59 Melite joined
19:59 strykerkkd joined
20:00 <ski> > let fibs = 0 : 1 : zipWith (+) fibs (tail fibs) in fibs -- a traditional one
20:00 <lambdabot> [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,...
20:00 <ski> Aeroxam : can you figure out how that one works ?
20:01 <Aeroxam> Wew one minute lemme try to wrap my head around that
20:02 newhoggy joined
20:02 <Aeroxam> yep
20:02 <Aeroxam> I got it
20:03 <ephemeral> ok, I've got a definition now
20:03 beerdrop joined
20:04 <ephemeral> get an error for null list though :/
20:04 <Tuplanolla> > fix $ (0 :) . (1 :) . (zipWith (+) <*> tail) -- Have a better variation, Aeroxam.
20:04 <lambdabot> [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,...
20:04 <ephemeral> should I paste it in a separate paste, or are small functions fine in here?
20:04 <Aeroxam> kadoban : Yes. i'm basically trying to get a list of n "results" after a coroutine or a modstream (coroutine with same type of i and o) while disregarding the input. I wonder why I was allowed to do it for the ModStream and not for the Coroutine, I had to do this for the Coroutine : http://lpaste.net/355046
20:04 <Tuplanolla> (By better I mean more confusing.)
20:05 <ski> > let fibs = listArray (0,12) [case n of 0 -> 0; 1 -> 1; _ -> fibs ! (n-1) + fibs ! (n-2) | n <- range (0,12)] in fibs ! 12
20:05 <lambdabot> 144
20:05 <ski> Aeroxam : and that one ^ ?
20:05 <ski> @quote aztec
20:05 <lambdabot> quicksilver says: zip`ap`tail the aztec god of consecutive numbers
20:05 <ephemeral> http://lpaste.net/355047
20:05 <Aeroxam> basically I'm treating them as streams when the input doesn't matter, and I wonder why the trick of 'tying the knot' works for one and not the other.
20:06 <ski> ephemeral : annotate the original paste with updates, if you have one
20:06 <ephemeral> huh?
20:06 <ski> there's an "Annotate" button on LPaste
20:06 <Aeroxam> Tuplanolla: whoah hm what is '<*>' ?
20:06 abhiroop joined
20:06 <ephemeral> that's the first paste I've ever posted though
20:06 <ski> it will add your annotation to the existing paste page
20:06 <ski> ok
20:07 <ski> (that's wasn't clear to me)
20:07 <Tuplanolla> It's the `Applicative` instance for `(->) a`, Aeroxam.
20:07 <ephemeral> I get this though: Ambiguous type variable ‘a0’ arising from a use of ‘show’
20:07 <ephemeral> prevents the constraint ‘(Show a0)’ from being solved.
20:07 <ski> (if you select the channel, then lpaste will itself announce the paste in here, btw)
20:07 <ephemeral> for an empty list
20:07 <ephemeral> right, I thought I marked for that, soI was kinda expecting it to do so, but didn't happen apparently :O
20:07 <ephemeral> or maybe I have to specify my nick as author?
20:08 oisdk joined
20:08 Aeroxam_ joined
20:08 <Aeroxam_> ski: I never tried to use arrays with haskell yet.. but I think I get the general idea even if I don't get the typeflow
20:10 <ski> Aeroxam_ : the interesting thing here is that this (immutable, in this case) array is defined recursively. but the elements are lazily computed, so only the elements that actually need to be computed to determine the element you're accessing will actually be computed. in this case, all elements are computed, but one can often use this idea to code up dynamic programming algorithms in a nice way
20:10 cdg joined
20:11 <ski> Aeroxam_ : this would be top-down dynamic programming, as opposed to bottom-up, since demand is driving the computation from "top", rather than manually having to schedule the computation from the bottom (as you would do in a language with strict evaluation)
20:12 sssilver joined
20:12 Aeroxam joined
20:12 Gurkenglas joined
20:12 <Aeroxam> re. net hiccups
20:12 <ski> ephemeral : `xs' in your last defining equation must always be `[]'
20:13 <ephemeral> what if it has exactly two elements?
20:13 <ephemeral> ah
20:13 <ski> then the middle defining equation is used, with `xs' being `[]'
20:13 <ephemeral> I mean, what if it has one element
20:14 <ski> i'd use pattern-matching rather than `null' there
20:14 <ski> neither of the first two cases will match a singleton list. leaving the last case, which gives `xs = []'
20:15 evincar joined
20:15 <ski> (and, as i said, this is the only way that case can be reached, so it would be less confusing for a reader to write `[]' instead of `xs' there)
20:15 <ski> (or, simply, instead of `x:[]', one can of course write `[x]')
20:15 <ephemeral> ah, I understand
20:16 mmachenry joined
20:16 <ephemeral> what did you mean about using pattern matching instead of null, though?
20:16 zv joined
20:18 <ephemeral> or maybe that's what you were referring to
20:18 newhoggy joined
20:18 <ephemeral> [] being null
20:18 abhiroop joined
20:18 Boomerang joined
20:19 <lpaste> ephemeral annotated “lastButOne” with “lastButOne (annotation)” at http://lpaste.net/355047#a355048
20:19 <ephemeral> I still get the same error when trying to pass it an empty list though
20:20 <ephemeral> seems to be a problem with show though, since I'm using it to print out the result
20:20 <ski> well, that's not a problem with `lastButOne'
20:21 <ski> that's GHCi not knowing what kind of list elements you want
20:21 <ski> try adding a type ascription like `:: Maybe [Integer]' after the call
20:21 <ski> anyway, instead of
20:21 <ski> lastButOne (x:x':xs) = if null xs then ... else ...
20:21 <ski> you could say
20:22 <ski> lastButOne [x,x'] = ...
20:22 <ski> lastButOne (x:x':xs) = ...
20:22 <ski> splitting the two `if' branches onto separate defining equations
20:22 <ephemeral> right, of course
20:23 <ephemeral> what about the naming convention, is it normal to use x and x' like that there?
20:24 tcsavage joined
20:24 <ephemeral> what if I wanted another element, or even 4, x:x':x'':x''' looks kind of ugly
20:24 <MonadHendrix> shoutout to atan2 for being better than atan
20:25 <ephemeral> I suppose I could do `lastButOne (_:x:xs) = lastButOne (x:xs)` in this specific case though
20:25 newhoggy joined
20:25 <geekosaur> at some point on e usually nmoves to x0:x1:x2:...
20:25 <geekosaur> since it gets hard to count primes and it's typo-prone
20:25 connrs joined
20:26 <lpaste> ephemeral annotated “lastButOne” with “lastButOne (annotation) (annotation)” at http://lpaste.net/355047#a355049
20:26 Guest5182 joined
20:26 <ephemeral> I thought that was nice, but now "pattern match is redundant" apparently
20:27 <ski> ephemeral : i'd often use `x0:x1:x2:xs' in such cases
20:27 Aruro joined
20:27 <ephemeral> yeah, that sounds better
20:27 <ski> some people like it like `x:y:z:xs' or something
20:27 <ephemeral> right; why does it tell me that "pattern match is redundant" now though, pointing to the last pattern?
20:28 <ski> ephemeral : yes `x:xs' overlaps with `_:x:xs'. the latter will never be reached
20:28 <ephemeral> hmm
20:28 oisdk_ joined
20:28 <geekosaur> swap them?
20:28 cdg joined
20:29 <* ski> generally prefers to not have overlapping patterns at all, when reasonable
20:29 <ephemeral> how about: lastButOne [x, _] = Just x
20:29 <ski> that's better :)
20:29 <ski> gets rid of the overlapping, so that ordering doesn't matter
20:30 <ephemeral> sweet; now what was that about the show function and the error on the empty list?
20:30 newhoggy joined
20:30 butterthebuddha joined
20:30 <ski> (iow, so that each defining equation can be understood in isolation, as a true thing to say about the function, without having to pay heed to the context (the preceding defining equations))
20:30 <lpaste> ephemeral annotated “lastButOne” with “lastButOne (annotation) (annotation) (annotation)” at http://lpaste.net/355047#a355050
20:30 <ephemeral> that's the final version btw
20:31 <ephemeral> yeah, agree that that's much nicer
20:31 <ski> the last defining equation could be written
20:31 <ski> lastButOne (x:xs@(_:_)) = lastButOne xs
20:31 <ski> makes it more explicit that we know that `xs' will be a non-empty list here
20:31 <ski> this is the same as
20:31 connrs joined
20:31 arpl left
20:31 <ski> lastButOne (x0:x1:xs) = lastButOne (x1:xs)
20:32 <ski> except that using an "as"-pattern (the `xs@(_:_)') gives a strong hint to the implementation that it shouldn't allocate a new cons `x1:xs'
20:32 <ephemeral> ok, that went way over my head
20:33 ph88 joined
20:33 <ski> an "as"-pattern is of the shape `<variable> @ <pattern>', it's "both eating the cake and having it". both giving a name to the value in that position, and also matching that value further with the pattern
20:34 takuan joined
20:34 <ski> > let xs0@(x:xs) [0,1,2] in (xs0,x,xs)
20:34 <lambdabot> <hint>:1:24: error: parse error on input ‘in’
20:34 <ski> er, missing `=' :)
20:34 <ski> > let xs0@(x:xs) = [0,1,2] in (xs0,x,xs)
20:34 <lambdabot> ([0,1,2],0,[1,2])
20:34 <ski> `xs0' is the whole thing, `x' is the first element, `xs' is the list of the remaining elements
20:34 <ski> (the tail)
20:34 Destol joined
20:36 chrisdotcode_ joined
20:36 <* ski> looks at ephemeral
20:36 cloudhead joined
20:36 <* ephemeral> is thinking
20:37 <ephemeral> so
20:37 unyu joined
20:37 abhiroop joined
20:38 newhoggy joined
20:38 <ephemeral> if the @ is 'as', I still don't get how (x:xs@(_:_)) makes sense
20:38 <ski> `x:xs@(_:_)' is parsed as `x:(xs@(_:_))'
20:38 whaletechno joined
20:39 <ephemeral> isn't that then parsed as x:(x:(xs@(_:_))) and so on?
20:39 <ski> so, to match, the input must be a non-empty list, and the first element (the head) must match with `x' (and it does, because a variable pattern like `x' matches anything, and in the process binding the variable `x' to that value, the head element of the list)
20:39 <kadoban> ephemeral: I think you're attributing more magic to @ than exists
20:39 <ephemeral> oh, nvm, disregard that last thing I said
20:39 <ephemeral> haha, yeah
20:40 <ephemeral> right, when it's parsed that way, I get it
20:40 <ski> further, the tail of the list must match `xs@(_:_)' .. since this is an "as"-pattern, this value (the tail) is given the name `xs' (`xs' is bound to the tail value)
20:40 <ski> and further, the tail value is *also* matched with `_:_'
20:40 Destol joined
20:41 <ski> which only works if the tail is a non-empty list, with first element (second element of the original list) matching `_', and list of remaining elements (after those two) matching `_'
20:41 <ephemeral> x:xs also needs a non-empty list to match, though?
20:41 <kadoban> Yep, there has to be a (:) to match on, so it's got to be non-empty
20:42 <ski> but `_' matches anything (and doesn't bind a variable in the process). `_' is sometimes known as the "wildcard" pattern, or the "anonymous" pattern (acting "like an anonymous variable", a new one each time it is used)
20:42 <ski> ephemeral, aye
20:42 <ephemeral> yeah, I know that
20:42 <ski> you can't actually write a "non-linear" pattern like `x:x:...', repeating the same variable name `x' in it
20:42 <ski> (but you can repeat `_' as many times as you like in a pattern)
20:44 <ephemeral> in this case though, since we not only want to make it clear that xs is not empty, but never even consists of just 1 element, would it be even better to write it as (x:xs@(_:_:_))? :P
20:44 crobbins joined
20:44 <ski> (in some other programming languages with pattern-matching, you can actually write "non-linear" patterns, even match on the value in a previously bound variable)
20:44 <ephemeral> that doesn't sound very orderly
20:44 <ski> ephemeral : well, that would require it to have at least *three* elements ..
20:45 newhoggy joined
20:45 sgflt joined
20:45 <ski> (think about it. each `:' corresponds to a cons cell, with an element, and a tail)
20:45 <ephemeral> right, right, it's me thinking wrong
20:45 <ephemeral> I get it
20:46 <ski> hm
20:46 <ephemeral> no
20:46 <ski> oh, you're right
20:46 <ephemeral> yeah, haha
20:46 <ski> (and i as well)
20:46 <actualHuman_462> Depends on whether or not you consider [] to be an element
20:46 <ski> one case of zero elements, one for one element, one for two elements, and one for at least three elements
20:47 <ski> yeah, that works fine
20:47 <ephemeral> right
20:47 argent0 joined
20:47 <ephemeral> so...how about that error caused by show?
20:48 <ephemeral> I don't really get it, since it shows Nothing just fine
20:48 <ski> could you repeat the error, and what you did to provoke it ?
20:48 <* ski> possibly misunderstood the situation ..
20:48 <ephemeral> right, I'll put up a snippet with the code and the error
20:48 <ski> *nod*
20:49 <lpaste> ephemeral annotated “lastButOne” with “realworld.hs” at http://lpaste.net/355047#a355051
20:49 <ski> (btw, if you're in a situation where you want a non-linear pattern in Haskell, then you usually have to add a guard with an `==' check between the parts you want to check are equal)
20:50 <ski> @src print
20:50 <lambdabot> print x = putStrLn (show x)
20:50 govg joined
20:50 <ephemeral> what's a non-linear pattern?
20:50 <actualHuman_462> The show thing
20:50 newhoggy joined
20:50 <ski> <ski> you can't actually write a "non-linear" pattern like `x:x:...', repeating the same variable name `x' in it
20:50 <Gurkenglas> ephemeral, it doesn't know what the a is in "show ([] :: [a])"
20:51 <actualHuman_462> You call show on a variable, which implies that it must implement an instance declaration for show
20:51 <ephemeral> also I remember guards briefly from previously going through real world haskell and other sources, but haven't comprehended it just yet, seem to recall it being a simple concept though
20:51 Itkovian joined
20:51 <Gurkenglas> So it doesn't know whether it should show all the elements of [] as Ints or as Strings or what
20:51 <actualHuman_462> Using a type variable without a constraint means 'This function should work for literally everything'
20:51 <geekosaur> worth noting here is that error doesn't happen in ghci because of ExtendedDefaultRules, so it picks ()
20:51 <Gurkenglas> If you add l :: [Int] before that l = [] line that should work
20:51 <ephemeral> but I never tell it to show any list
20:52 <ski> ephemeral : if you add a monomorphic type signature for `l', or type ascription for the use of `l', or the call to `lastButOne', in `main', that should do it
20:52 <Gurkenglas> ephemeral, right, you turn the [a] into Maybe a, meaning that instead you have "show (Nothing :: Maybe a)" for exactly the same problem
20:52 <ephemeral> yeah, that does fix it
20:52 <ski> geekosaur : yeah, i momentarily forgot that this wasn't an issue in the interactor anymore ..
20:52 <actualHuman_462> GHC isn't erroring because of what it's being passed, it's erroring because of what it COULD be passed
20:52 <ephemeral> ah
20:52 <ephemeral> right, yeah
20:53 <ski> main = print (lastButOne l :: Maybe Integer)
20:53 <ski> would work
20:53 Hunter1 joined
20:53 <ski> (that's a type ascription)
20:53 <Gurkenglas> (Does defer type errors make this work?)
20:53 <ski> Gurkenglas : i suspect not, but i don't know
20:54 jsgrant__ joined
20:54 <geekosaur> defer type errors just causes that call to resolve to one to error
20:54 <ski> (it's not a type inconsistency. it's an ambiguity)
20:54 <Gurkenglas> Is there a way to make this work because there isn't actually any a to call show on?
20:55 <geekosaur> do you know how typeclasses are implemented? if you do, think about it a bit
20:55 <ski> perhaps `-fdefer-type-errors' could spoof a `Show' instance for the skolem `a' ..
20:56 <geekosaur> regardless of what's going on, it needs to be passed a function pointer for the Show instance method, and the compiler has no clue which pointer to give it
20:56 <ski> (well, treating it as one, i mean)
20:56 <Gurkenglas> geekosaur, give it a call to error?
20:56 <geekosaur> that's what defer type errors does in this case
20:56 <Gurkenglas> (If you mean the a one, not the [a] one)
20:57 <geekosaur> uh
20:57 <geekosaur> there;s actually no difference here, I think
20:57 <ephemeral> alright people, thanks for all the help so far; now over to something even more challenging; I just checked the source for `lastMay`: liftMay null last
20:57 <geekosaur> since the [a] one immediately resolves to showList @a
20:57 <ephemeral> I've read vaguely about various forms of lift being functions to transform things into monads, in this case the Maybe monad I suppose, but don't really comprehend it
20:58 <Gurkenglas> We have an instance with the head [a] (instances not overlapping helps us here), you just pass it the pointer to the [a] instance and when that one says it actually needs a Show a instance then you pass that the call to error because theres no fully general instance
20:58 <ski> ephemeral : looks like it just checks `null' and then calls `last' if negative. wrapping results in `Maybe'
20:58 <kadoban> ephemeral: It's probably just a helper function defined somewhere in there
20:58 <MarcelineVQ> it's just a helper function from a module that isn't publicly exported https://hackage.haskell.org/package/safe-0.3.14/src/Safe/Util.hs
20:59 <ski> looks like `liftMay :: (a -> Bool) -> (a -> b) -> (a -> Maybe b)' if my internal type inferencer is working properly
20:59 <ephemeral> liftMay :: (a -> b) -> (a -> Bool) -> (a -> Maybe b)
20:59 <ephemeral> liftMay func test val = if test val then Nothing else Just $ func val
20:59 newhoggy joined
20:59 <ephemeral> sick skills
20:59 <ski> right
21:00 <ski> note the nice "ambiguity" there regarding whether it accepts two or three arguments
21:00 <ski> (compare the type signature with the definiendum, what's to the left of the `=')
21:01 <ephemeral> yeah, it looks like it takes three arguments to me :P
21:01 <ski> liftMay :: (a -> b) -> (a -> Bool) -> (a -> Maybe b)
21:01 <ephemeral> yeah
21:01 <ski> is the same thing as
21:01 <ski> liftMay :: (a -> b) -> (a -> Bool) -> a -> Maybe b
21:01 <ski> (`->' is right-associative)
21:01 <ephemeral> right, currying
21:02 <sproingie> though you're usually interested in the (a -> Maybe b) as the returned value, being lift and all
21:02 <ski> also, `liftMay func test val' is the same thing as `(liftMay func test) val' is the same thing as `((liftMay func) test) val'
21:02 <ski> (application is left-associative)
21:02 <ephemeral> so if I gave it 4 arguments, it would treat it like liftMay :: (a -> b) -> a -> Bool -> a -> Maybe b?
21:02 <ski> `liftMay' is written in "curried style", yes
21:02 <ski> no, you can't remove brackets to the left of `->' like that
21:02 <ski> only to the right
21:03 <ski> `X -> Y -> Z' means `X -> (Y -> Z)'
21:03 eq4life1581_ joined
21:03 <ski> `(X -> Y) -> Z' is something else. very different
21:03 <eq4life1581_> Hi
21:03 <Gurkenglas> uh guys its "(a -> Bool) -> (a -> b) -> (a -> Maybe b)" as ski first said
21:03 kernelj_arch joined
21:03 <ski> you couldn't pass four arguments ("curriedly") to `liftMay'. you'd get a type error
21:04 newhoggy joined
21:04 <ski> hello eq4life1581_
21:04 ryxai joined
21:04 <eq4life1581_> Hi
21:04 Aruro joined
21:04 <ephemeral> Gurkenglas: it had the type signature liftMay :: (a -> b) -> (a -> Bool) -> (a -> Maybe b) in the Safe library
21:04 <ski> note that : all functions in Haskell takes *exactly* one argument. no more and no less
21:05 <ephemeral> I mean, those are basically equivalent I guess, if it's the order you're talking about
21:05 <ski> (there is no such thing as a "nullary function")
21:05 <ephemeral> right
21:05 <Gurkenglas> ephemeral, let me go ahead and stick my neck out really far on this one so it can be cleanly chopped off
21:05 <sproingie> a nullary function is also known as a value
21:05 <ephemeral> creds to curry, whose first name gave us the name of this glorious language, praise be
21:05 <Gurkenglas> and say that youre wrong and its the other way :D
21:05 <ski> however, there's two common *conventions* for *encoding* multiple arguments : one is known as "curried style", and the other as "tupled style"
21:06 <ephemeral> Gurkenglas: I just c/ped from here: https://hackage.haskell.org/package/safe-0.3/docs/src/Safe.html
21:06 <sproingie> according to his widow, Haskell Curry never actually liked his first name
21:06 <ski> to *encode* a function `f' taking both an `A' and a `B', returning a `C', in the *curried* fashion, we do `f :: A -> (B -> C); f = \a -> \b -> ..a..b..'. the definition can be more prettily written as `f = \a b -> ..a..b..' or `f a = \b -> ..a..b..' or `f a b = ..a..b..'
21:06 <Gurkenglas> ephemeral, ah you're looking at an old version of safe
21:06 <Gurkenglas> http://hackage.haskell.org/package/safe-0.3.14/docs/src/Safe.html#lastMay https://hackage.haskell.org/package/safe-0.3.14/src/Safe/Util.hs
21:07 jleon joined
21:07 subtlebot joined
21:07 <ski> (and the type signature can then be more prettily written as `f :: A -> B -> C', because "curried style" is expected to be the common convention in Haskell. so this gets the nicer looking type signature)
21:07 <ski> to *encode* a function `f' taking both an `A' and a `B', returning a `C', in the *tupled* fashion, we do `f :: (A,B) -> C; f = \(a,b) -> ..a..b..'. the definition can be more prettily written as `f (a,b) = ..a..b..'
21:08 <ephemeral> ah, I found that first file where they used liftMay all over, but couldn't find that second file; I see now
21:08 <actualHuman_462> ski - I know that it's technically correct that there are no nullary functions, but isn't it kind of useful to think of some things that way? For example, getLine is a 'value' by that definition, but it's a value that has side effects...
21:08 <lpaste> KernelJ pasted “What makes this slow?” at http://lpaste.net/355053
21:08 <ephemeral> ski: going a bit too fast atm
21:08 <ski> (btw, functions are also values ..)
21:08 <ephemeral> yeah, functions as values is comprehended
21:09 <ski> @where haskel
21:09 <lambdabot> <http://web.archive.org/web/20070703001910/http://www.cs.chalmers.se/~augustss/pics/haskel.gif>
21:09 <kadoban> actualHuman_462: Sounds like that'd be at best confusing. Maybe calling :: IO a a "procedure" or something could make sense, but personally I wouldn't call it a function.
21:10 <Tuplanolla> I think it's more common to consider the isomorphism between `a` and `() -> a`, actualHuman_462.
21:10 <pikajude> IO a is kind * so it's a value
21:10 <ski> actualHuman_462 : there are no *side* effects in Haskell. there are effects, however. `getLine' is a value (often called an action, or an I/O action, or an `IO'-action), that *encodes* an effect
21:10 <ski> actualHuman_462 : just like a recipe encodes some actions to do with foodstuffs
21:10 zero_byte joined
21:10 <Aruro> there are no side effect in haskell, but haskell program can crash, so yeah.
21:10 <pikajude> what's the difference between IO a being a value that produces an a when run and a C program being a value that produces a side effect when compiled and run
21:11 <ski> i believe the technical term is "abort" ;)
21:11 <ephemeral> hah
21:11 <Aruro> haskell program as a part of a bigger program is pretty usual, can crash do whatever.
21:11 <kernelj_arch> anyone have a quick look at this it's only 16 lines? http://lpaste.net/355053
21:11 moth joined
21:11 <ski> pikajude : the difference lies at the *language* level. not at the level of a compiled executable
21:11 <Aruro> haskell program in vacuum is indeed pure and perfect.
21:11 <pikajude> oh
21:11 <pikajude> what does that mean
21:12 <ski> pikajude : the difference lies in what *reasoning* laws apply at this language level
21:12 <sproingie> pikajude: C won't let you treat gets() as a value, whereas getLine returns an action and actually does nothing until the evaluator gets ahold of it
21:12 <pikajude> oh
21:12 <actualHuman_462> Yeah ok. There's no side effect, except for the part where the value that it resolves to is determined by something completely external to the system. I get that there is another context which you're using to define 'side effects', but I am skeptical as to whether or not that's a more useful paradigm.
21:12 <pikajude> sproingie: but it lets me treat gets as a value
21:12 <sproingie> sure, the *function* gets
21:12 <sproingie> but not the return value of it
21:12 <pikajude> ok
21:12 <ski> (those reasoning laws being useful to be able to predict what a program should do, understanding it, analyzing it, refactoring it, &c.)
21:13 <pikajude> i'm not firmly on one side or other of the issue
21:13 <Aruro> ski: not always, its hard to find leaks, so there is hard reasoning in haskell too
21:13 <pikajude> i just remember reading a (satirical) blog post by someone saying that the C language is a DSL for producing an IO action that does something when executed
21:13 <ski> sproingie : s/evaluator/executor/
21:13 <pikajude> and the counterargument wasn't obvious to me
21:14 <sproingie> ski: ah right, i'm constantly mixing those up
21:14 biglambda joined
21:14 Rodya_ joined
21:14 <ski> actualHuman_462 : it's not a side-effect because it's accounted for in the interface (the types). an expression of type `String' is distinguished from an expression of type `IO String'
21:15 laplacian joined
21:15 newhoggy joined
21:15 <ski> and you can't mix one up for the other in code, even if you're not aware of which of those types it has (no implicit coercion between them)
21:15 <sproingie> unsafePerformIO will give you true "side" effects. with a raft of gotchas of course, as the name should make clear
21:15 codesoup joined
21:16 <kernelj_arch> bad algorithm, bad code or what? http://lpaste.net/355053
21:16 <ski> Aruro : yes. i was referring to reasoning about behaviour (as defined by e.g. denotational semantics, or axiomatic semantics). for performance, you do need some kind of operational semantics, yes
21:17 <Aruro> reasoning in declarative language has to be easy by default :), otherwise whats the point of declaring
21:18 <ski> pikajude : yes, `gets' will get you a function pointer .. but there's no way to express in C a function that doesn't, *potentially*, have some effect on the side, when called
21:18 <actualHuman_462> I guess what I'm saying is that distinguishing between effects that are not deterministic and effects which have are not deterministic but have a categorical boundary is useful from 1,000 feet, but can also introduce a false sense of security.
21:18 <lyxia> kernelj_arch: what kind of feedback are you looking for? are you having problems with your code?
21:18 <sproingie> i don't know that declarative necessarily makes it *easy* as much as it at least makes it *possible*
21:18 <lyxia> kernelj_arch: what does your code do?
21:18 <kernelj_arch> lyxia: it's for a problem I'm doing, the code works but it is too slow
21:19 <ski> actualHuman_462 : can you rephrase "effects that are not deterministic and effects which have are not deterministic but have a categorical boundary" ?
21:19 <Aruro> actualHuman_462: haskell has all best ideas, but it has a lot of problems too, thats in short :)
21:19 <kernelj_arch> lyxia: it finds the length of the range containing index d in the range a_d .. a_d+M
21:20 <sproingie> Aruro: Haskell has all the best problems :)
21:20 <Aruro> :D
21:20 ahf joined
21:20 <Aruro> of course, natural consequence of best ideas
21:20 <monochrom> easier = more possible.
21:20 newhoggy joined
21:20 Itkovian joined
21:21 <Aruro> reasoning from prehistory is based on declarations
21:21 <Aruro> nobody can think of mechanisms which are working
21:21 mmachenry joined
21:21 <Aruro> so declarative language is already perfect start
21:22 jlouis joined
21:23 <lyxia> kernelj_arch: you're repeatedly traversing the list as with (!!), drop, countWhile. Look for better data structures.
21:25 <kernelj_arch> lyxia: Data.Array or something?
21:26 DemiMarie joined
21:26 newhoggy joined
21:26 <kernelj_arch> doesn't countWhile kinda have to iterate over the list
21:26 <Aruro> wiki says curring has been first used by Frege
21:26 JMT1345 joined
21:26 <ski> wouldn't surprise me
21:27 <sproingie> :t countWhile
21:27 <lambdabot> error: Variable not in scope: countWhile
21:27 <ski> he sure had functions as arguments
21:27 <lyxia> kernelj_arch: Structure your data so that you don't need to traverse all of your data.
21:28 <sproingie> Aruro: none of us really care to call it "Schönfinkeling" or "Fregification"
21:28 <pikajude> Fregging
21:28 <MonadHendrix> i do
21:28 fDev2179 joined
21:28 <pikajude> you can always install acme-schoenfinkel
21:28 <sproingie> wouldn't be the first concept to be named for the guy with the catchier name
21:29 <MonadHendrix> 3>not finckeling your functions
21:29 <kernelj_arch> lyxia: binary tree with (min,max) stored on the nodes?
21:29 xinming joined
21:30 ragepandemic joined
21:30 dfeuer joined
21:31 newhoggy joined
21:31 jordan36363 joined
21:32 <jordan36363> hi guys
21:32 <ski> hello jordan36363
21:32 geekosaur joined
21:32 <jordan36363> i have a question concerning list comparisions
21:32 <jordan36363> [1, 2] >= [1, 2, 0]
21:33 <jordan36363> this is obviously "False" but I wonder what it compared in the last step
21:33 <AaronFriel> Can someone explain the magic of the SPEC constructor to me?
21:33 <jordan36363> which value has a missing element?
21:33 <ski> > [] >= [0]
21:33 <lambdabot> False
21:33 <ski> the shorter list is considered to be lesser, in case it is a prefix of the longer one
21:34 <jordan36363> [] is the empty element?
21:34 <ski> (i don't understand "which value has a missing element?")
21:34 <ski> there is no empty element
21:34 <monochrom> empty list.
21:34 abhiroop joined
21:34 <jordan36363> i thought every element in a list has to be the same type
21:34 <Aruro> > [] < [[]]
21:34 <lyxia> kernelj_arch: you can try things and see whether they work or not. Learn by practice.
21:34 <lambdabot> True
21:34 <ski> jordan36363 : yes
21:34 <jordan36363> an empty list in a list of integers?
21:34 <ski> no
21:34 <sproingie> jordan36363: they do, but [] is polymorphic to any type
21:34 <ski> all the elements here are numbers
21:35 <monochrom> every element in the empty list has the same type as the type of 0, yes.
21:35 <sproingie> :t []
21:35 <lambdabot> [t]
21:35 <ski> lists are compared in "lexicographic" order, more or less the same as in a dictionary
21:35 <ski> "the" should come before "there"
21:36 <jordan36363> sproingie ty thats a good example
21:36 <ski> > "the" < "there"
21:36 <lambdabot> True
21:36 <jordan36363> ok ski thanks!
21:36 <ski> jordan36363 : basically, as long as we haven't come to the end of any of the two lists yet, we compare the current two elements we're looking at
21:37 <ski> jordan36363 : if they're different, then their respective ordering determines the ordering of the two containing lists. only if they're equal do we proceed to look at the next two elements (if any)
21:37 <Aruro> jordan36363: u can see how ord instance is realized for [a]
21:38 rkazak joined
21:38 <ski> jordan36363 : the list that runs out of elements first is considered the lesser. if both run out of elements at the same time, then the lists are equal
21:39 <ski> (to clarify, if the current two elements are not compared as equal, then we stop at this point, not bothering to look further into any of the lists)
21:40 <ski> > [0,0 ..] < [0] ++ [1,1 ..] -- this works, despite the two lists being infinite in length
21:40 <lambdabot> True
21:40 <ski> > [0] ++ [1,1 ..] -- showing it's infinite
21:40 <lambdabot> [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1...
21:41 replay joined
21:41 <ski> jordan36363 : makes sense ?
21:41 <jordan36363> nice, I got it
21:41 <ski> ok
21:41 <jordan36363> thanks a lot ski
21:41 <ski> no problem
21:41 <Aruro> jordan36363: btw lists can be compared only if elements can. there is Ord a constraint.
21:41 fDev2179 left
21:41 newhoggy joined
21:42 <Aruro> Ord a => Ord [a]
21:42 <geekosaur> ...which is why we recommend (null xs) instead of (xs /= []); the former needs no Ord
21:42 <ski> (well .. `Eq')
21:43 <geekosaur> yes, actually, Eq
21:43 <* ski> . o O ( `xs <= []' )
21:43 <geekosaur> but, you can test empty list without Eq because it's a constructor / structure test
21:43 <ski> @type null
21:43 <lambdabot> Foldable t => t a -> Bool
21:43 jsgrant joined
21:43 <ski> @src null
21:43 <lambdabot> null [] = True
21:43 <lambdabot> null (_:_) = False
21:44 <ski> oh, the type signature for this less general definition is actually `null :: [a] -> Bool'
21:44 iAmerikan joined
21:44 redcedar joined
21:44 <Aruro> @djin [a] -> Bool
21:44 <lambdabot> Maybe you meant: djinn djinn-add djinn-clr djinn-del djinn-env djinn-names djinn-ver
21:45 <ephemeral> hmm
21:45 <ephemeral> <sproingie> :t []
21:45 <ephemeral> <lambdabot> [t]
21:45 <Tuplanolla> Not happening, Aruro.
21:45 <ephemeral> what kind of syntax is [t]?
21:45 <pikajude> it's a type
21:45 anuxivm joined
21:45 <pikajude> it means list of t
21:46 <ephemeral> but why not [a]
21:46 <sproingie> means for all types 't'. the two t's have nothing to do with each other, it's just coincidence
21:46 <pikajude> great question
21:46 darjeeling_ joined
21:46 <pikajude> the type variable name selection happens somewhere in the compiler
21:46 <sproingie> ghc likes 't' to mean type, it uses a and b and such for functions
21:46 <pikajude> who knows where
21:46 <ephemeral> lol sproingie, I understood as much
21:46 <ephemeral> :D
21:47 newhoggy joined
21:47 <sproingie> actually it does seem to always generate 't' and 't0', 't1', and so on when there's no signature
21:47 <sproingie> :t \x y -> y
21:47 <lambdabot> t1 -> t -> t
21:48 <Aruro> :t Just
21:48 <lambdabot> a -> Maybe a
21:48 <sproingie> that was declared that way though
21:48 <sproingie> :t (\x y -> y :: a -> b -> b)
21:48 <lambdabot> error:
21:48 <lambdabot> • Couldn't match expected type ‘a1 -> b1 -> b1’
21:48 <lambdabot> with actual type ‘t’
21:48 <sproingie> :t (\x y -> y) :: a -> b -> b
21:48 <lambdabot> a -> b -> b
21:49 <AaronFriel> I am very surprised the compiler is still okay with me doing this: Result size of Tidy Core = {terms: 626, types: 17,162,396, coercions: 14,588,102}
21:50 <ephemeral> AaronFriel: what's that?
21:50 <Aruro> :t undefined
21:50 <lambdabot> a
21:51 <AaronFriel> ephemeral: Oh, I am writing code that generates _lots and lots_ of intermediate types. "Core" is a language that Haskell compiles down to (as an intermediate step) before it compiles to machine code.
21:51 ckubrak joined
21:51 <Aruro> :t [undefined]
21:51 <lambdabot> [t]
21:52 <ephemeral> right, I remember briefly opening a paper on Core, but realized pretty quickly that it would still be quite a few years before I could hope to comprehend
21:52 <jordan36363> http://imgur.com/a/3Dcqa
21:52 <jordan36363> this is so cute
21:52 newhoggy joined
21:52 <ephemeral> heh, that's from learn you a haskell, right?
21:52 hiratara joined
21:53 <jordan36363> yep ^
21:53 <AaronFriel> ephemeral: Core is, ostensibly, simpler than Haskell, but it could take a lot more work to do "interesting stuff" in it. Like assembly?
21:53 <jordan36363> did you read it too when u started out?
21:54 <ephemeral> I've read it on and off during the last couple of years, but until recently I haven't really been in a state to gain any comprehension, so should definitely pick it up again now that I'm actually learning well
21:54 <ephemeral> currently working on real world haskell though
21:55 <AaronFriel> Unless you need to debug the performance of something at a low level (as in, how language extensions are interacting) you probably will not need to look at core.
21:55 <ephemeral> right; perhaps some day in the distant future
21:55 takuan joined
21:55 <ephemeral> right now I'm still learning the language, baby steps
21:56 laplacian joined
21:57 aarvar joined
21:57 newhoggy_ joined
21:57 <thoughtpolice> AaronFriel: Well, it's "okay" with it only to the extent it doesn't choke out the optimizer, of course! There are some nasty cases where GHC can go exponential when at the Core level, though, and it's not clear anyone knows how to fix it at the moment other than some crude, large hammers.
21:58 <thoughtpolice> (e.g. the compiler begins generating types that are exponential in the size of the input program, which is clearly awful.)
21:59 mjora7 joined
22:00 <AaronFriel> @thoughtpolice Yeah, I can only really compile this at -O0, but that's okay because there's enough redundancy that LLVM output length is (approximately) constant relative to the types.
22:00 <lambdabot> Unknown command, try @list
22:00 srbaker_ joined
22:00 plutoniix joined
22:00 <AaronFriel> Slack habits.
22:00 <thoughtpolice> The only "fix" I think that wasn't "hire someone to figure it out and publish a PhD about it" was, to essentially, not generate coercions. Coercions are important but their *existence* is only a witness to some equality. If you just assume the equality is legit, you don't need them. You can just throw them away; they are, after all, not present at runtime.
22:01 <thoughtpolice> This is horribly bad for a number of reasons though, the most important being that GHC can no longer typecheck its IR during compilation. That means bugs in the frontend are far more dangerous and difficult to find. It can be done, but only if you compile *with* coercions enabled. And that would require recompiling all of GHC, too. That's not good.
22:01 iAmerikan joined
22:02 crobbins joined
22:03 <jordan36363> who can u contact if u find errors in a book?
22:03 <jordan36363> https://imgur.com/a/FESeP
22:03 <jordan36363> it should say "from the end of a list" righ
22:03 <jordan36363> right
22:04 <AaronFriel> thoughtpolice: so you're saying there's a chance
22:04 <Tuplanolla> Nope, jordan36363.
22:04 <thoughtpolice> I mean it's not the end of the world... Most compilers, in fact, probably don't have as strong of types in the IR, much less typecheck their IR at all, or have as rigorous a theory as GHC's. But I can say that from direct experience: IR typechecking has found *lots* of bugs and helps fix them dramatically faster.
22:04 <actualHuman_462> > drop 1 [1,2] == 2
22:04 <lambdabot> error:
22:04 <lambdabot> • Ambiguous type variable ‘a0’ arising from a use of ‘==’
22:04 <lambdabot> prevents the constraint ‘(Eq a0)’ from being solved.
22:04 kadoban joined
22:04 <actualHuman_462> > drop 1 [1,2] == [2]
22:04 <monochrom> No, hire someone to do a PhD on proving EXPTIME-completeness :)
22:04 jleon joined
22:04 <lambdabot> True
22:05 <thoughtpolice> I guess it would mostly just make life worse for GHC developers.
22:05 <AaronFriel> thoughtpolice: I am trolling, a little. My research project might be dead in the water from the type explosion though.
22:05 <kernelj_arch> learn you a haskell still thinks Monad isn't a subclass of Applicative
22:05 newhoggy joined
22:05 <sproingie> LYAH needs a fork. and some editing.
22:06 <jordan36363> Tuplanolla what do you mean "nope"
22:06 <ski> @quote BONUS
22:06 <lambdabot> BONUS says: C++ is saner than something? imo C++ is like the guy that goes around shouting "I am napoleon!!!"
22:06 <Tuplanolla> Not wrong, jordan36363.
22:06 <sproingie> it's CC-BY-NC-SA plus you have to do it with a smile on your face
22:06 <jordan36363> why not
22:06 <nitrix> I try not to compare programming languages using analogies.
22:07 <sproingie> data IAm = HenryTheEighth IAm
22:07 <nitrix> Using analogies in general seems to be a pretty bad idea.
22:08 <thoughtpolice> AaronFriel: Mmm. It's certainly a problem for sure and has bitten me several times.Unfortunately, yeah, fixing it is hard :( Maybe we really could just turn off coercions, though, idk.
22:08 Sonderblade joined
22:08 bennofs joined
22:08 <thoughtpolice> I'm of two minds on that because on one hand it does make finding some bugs much harder, AND it is only really a sidestep of the problem, it feels like. (It might just get even worse and worse in the future). OTOH waiting around on the compiler going exponential isn't exactly fun, either, I admit.
22:09 <jordan36363> I mean the examples arent wrong, but the sentence describing it rather odd
22:09 <jordan36363> easy to misunderstand that is
22:10 <kernelj_arch> jordan36363: I think the examples were good enough to figure out what was going on in all cases
22:10 <AaronFriel> thoughtpolice: It seems like a target for partitioning the problem? If you can verify the coercions are valid at -O0, and the optimization passes preserve equality, can you erase coercions before optimization? I know very little about the core-to-core passes though, what I said could have made no sense at all.
22:11 <thoughtpolice> AaronFriel: Well, depends on what you mean. If you can *prove* that all optimization passes don't violate it, then sure, but now you're writing Coq. :) If you mean, "The input program at -O0 with coercions typechecked, so I am free to throw them away" -- that's true, but it doesn't really fix the problem.
22:11 bjz joined
22:12 <thoughtpolice> Because perhaps now, at -O2, after you threw away coercions early on, a bug in the optimizer causes you to generate invalid code. But you already threw the coercions away: so you can't typecheck to try and find the bug. Womp womp.
22:12 <AaronFriel> What does "-fno-opt-coercion" do?
22:12 <thoughtpolice> You'll probably notice, in your case (I'm just guessing) that if you actually look at the simplifier being run, your program doesn't *just* start off massive. It generally *becomes* massive with coercions, etc, after a few passes.
22:13 <thoughtpolice> Because the inliner, type checking etc just so "happened" to align the stars correctly and everything explodes.
22:13 <AaronFriel> Oh no it starts off pretty massive
22:13 <AaronFriel> I've been waiting five minutes for ghci to start so I can record the type of a function and throw it up on hpaste
22:13 cpup joined
22:14 <thoughtpolice> Also, -fno-opt-coercion, IIRC, just means that GHC won't optimize coercions away, later on. GHC *does* optimize them away so they are not present at runtime.
22:14 <thoughtpolice> So the proposed fix I mentioned earlier would be more like a -fno-never-generate-coercions, or something, in comparison.
22:15 <thoughtpolice> (Optimizing them away later is of course different from ever generating them at all)
22:15 MrWoohoo joined
22:15 ditadi joined
22:15 <thoughtpolice> AaronFriel: Oh, that's a more interesting case then. I imagine the rough idea is probably still the same however, where typechecking elaborates a Core program that has some kind of non-linear behavior in the input. I'd have to look at the exact program, ofc.
22:16 newhoggy joined
22:16 <sproingie> -fno-never-dont-not-stop-generating-coercions
22:17 strykerkkd joined
22:19 <jordan36363> its a bit sad that the factorial function is not included in the standard prelude
22:19 safe joined
22:20 <kernelj_arch> product [1..n]
22:20 <AaronFriel> thoughtpolice: http://lpaste.net/355054
22:20 <sproingie> which one? https://www.willamette.edu/~fruehr/haskell/evolution.html
22:20 <jordan36363> kernelj_arch they should have just added "!"
22:20 <kernelj_arch> they use that for array indexing though
22:20 <AaronFriel> thoughtpolice: oops, just fixed the truncated function at the top
22:20 <jordan36363> especially since haskell often is used for maths
22:20 <pikajude> just need a dialect of haskell that replaces strictness with factorial
22:21 <kernelj_arch> people use haskell for maths?
22:21 <jordan36363> not theoretical maths
22:21 <AaronFriel> kernelj_arch: Haskell is maths
22:21 <thoughtpolice> "This continues for ~300,000 lines"
22:21 <thoughtpolice> Sounds about right.
22:21 newhoggy joined
22:21 <kernelj_arch> no Coq is maths, Haskell is a functional programming playground
22:22 <jordan36363> https://wiki.haskell.org/Haskell_and_mathematics
22:22 <actualHuman_462> Anybody have much experience building c ffi stuff in windows? I am drowning in dll errors here
22:22 <kernelj_arch> people use Python for maths, SciPy+NumPy and whatever
22:23 <kernelj_arch> or the programming language R
22:23 <monochrom> "maths" is a highly overloaded word.
22:23 <jordan36363> and so is "people"
22:23 <NikolajK> mathematicans use Mathematica and sometimes C. Python is used in data science and for statistics by scientists
22:23 <AaronFriel> kernelj_arch: well that's just being pedantic, nothing stops you from defining partial functions or using restricted domains in math. Coq is just different math, doesn't mean that you cannot use Haskell (or more likely, if you're writing a paper, Core/System F, etc.) to do math.
22:23 <thoughtpolice> pikajude: "In GHC 8.4, if GHC detects your program invokes undefined behavior, it will now replace your entire program with 'factorial 666'"
22:24 <pikajude> GHC 8.2 is the version that will add undefined behavior, right?
22:24 <AaronFriel> "Undefined behavior" has specific meanings in every language, what do you mean in the context of Haskell?
22:24 <kernelj_arch> isn't System F a bit useless in practice?
22:25 <sproingie> execvp "nethack"
22:25 <pikajude> GHC 8.4 will replace any usage of a monad with factorial 666
22:25 <AaronFriel> Nice
22:25 seanpars1 joined
22:25 <thoughtpolice> AaronFriel: Nothing, I'm being tongue-in-cheek :) (It's actually a kind-of reference, yes, to GCC replacing your program with a call to invoke nethack back in the day, when it found UB)
22:25 <pikajude> that sounds cool
22:25 <hpc> i heard GHC 8.4 will only compile programs that can't compile themselves
22:25 <nitrix> kernelj_arch: It's a good foundation. I think Haskell is using System F for the general idea, then added turing completeness to it.
22:26 <pikajude> compiling any haskell program that won't terminate with GHC 8.4 will be a warning
22:26 <AaronFriel> System F isn't turing complete?
22:26 <pikajude> you can turn it off with -Wno-halt
22:26 <sproingie> haskell 8.5 will be copendently typed
22:26 soniku joined
22:26 <nitrix> AaronFriel: It lacks recursion.
22:26 <sproingie> *codependently
22:27 <centril> Turing complete in what? the type system or runtime values... ? im guessing the former
22:27 <nitrix> Type system yeah
22:27 DoubleDonkey joined
22:27 <AaronFriel> Ah, yeah now I understand what you mean.
22:27 <monochrom> Is this April 1st?!
22:27 Warrigal joined
22:28 <actualHuman_462> April 1st was a Saturday
22:28 <kernelj_arch> it's Saturday tomorrow...
22:28 <actualHuman_462> *mind blown*
22:29 <centril> Isn't Haskell is System Fω ?
22:29 <jordan36363> Im confused about something
22:29 <centril> (remove the second is)
22:29 beanbagula joined
22:29 <centril> https://en.wikipedia.org/wiki/System_F#System_F.CF.89
22:30 <jordan36363> if you quote something in English and you dont use " but instead the thing where there is only one line
22:30 <jordan36363> which one do u use? ´, `, '
22:30 blym joined
22:30 newhoggy joined
22:30 meoblast001 joined
22:30 Achylles joined
22:31 <nitrix> jordan36363: Seems to me that quoting should be done with quotes. Not apostrophe or ticks/backticks.
22:31 <centril> mmhm... in a bachelor thesis, would you use "w.r.t." or "with respect to" ?
22:31 <centril> monochrom: ^
22:31 <kernelj_arch> jordan36363: You use the ' normally
22:31 erikd joined
22:31 hiratara joined
22:31 <jordan36363> ` and ´ are called backticks and ticks?
22:31 cpup joined
22:32 <jordan36363> what is ' called?
22:32 <sproingie> if you're james joyce, you don't use anything
22:32 <Tuplanolla> Why would you ever abbreviate if you're not running out of space or repeating the same phrase over and over, centril?
22:32 <monochrom> centril: I think both are fine.
22:32 <kernelj_arch> jordan36363: apostrophe usually
22:32 <centril> also... I need some volunteers to read ours in a few days ;)
22:32 <centril> Tuplanolla: it is repeated a few times
22:32 <centril> monochrom: but your bias is towards ?
22:33 <jordan36363> ok thx kernelj_arch
22:33 <monochrom> I use fewer abbreviations.
22:33 <nitrix> jordan36363: an apostrophe?
22:33 <centril> monochrom: =)
22:33 <monochrom> I repeat "almost everywhere" almost everywhere. :)
22:34 <jordan36363> i was just confused that "str" 'elem' ["a", "str"] didnt work
22:34 <ski> ' APOSTROPHE
22:34 <ski> ` GRAVE ACCENT
22:34 <ski> ´ ACUTE ACCENT
22:34 <jordan36363> then i found out that u need to use "str" `elem` ["a", "str"]
22:34 newhoggy_ joined
22:34 <kernelj_arch> ` is sometimes called backtick, the acute accent isn't used much
22:35 <nitrix> Acute and grave are used in french on some characters, but you never see them used alone like this.
22:35 <jordan36363> aigu not acute
22:35 <jordan36363> i speak french
22:35 <ski> ‛single quotation marks’
22:35 <nitrix> jordan36363: So do I, the name's acute in english.
22:35 abhiroop joined
22:35 Guest55823 joined
22:35 <kernelj_arch> inb4 ski “double quotation marks”
22:35 <centril> nitrix speaks the truth.
22:35 <jordan36363> oh you have another word for it in english alright
22:36 <actualHuman_462> Exonyms forever!
22:36 <ski> kernelj_arch : or "‟"
22:36 <nitrix> jordan36363: English borrows some words rarely like risqué, so yeah.
22:37 <kernelj_arch> ski: too many damned characters aren't there?
22:37 <MarcelineVQ> kernelj_arch, nitrix, jordan36363: sometimes ' is called prime
22:37 <kernelj_arch> MarcelineVQ: that's usually typeset differently though
22:37 <kernelj_arch> it might even have its own unicode codepoint
22:37 ertes joined
22:37 <ski> ′ PRIME
22:38 <actualHuman_462> What is the deal with that anyway? The only explanation I've heard for ' == prime is something like "Blah blah math blah math math blah"
22:38 <nitrix> MarcelineVQ: Should be ' apostrophe ′ prime
22:39 <MarcelineVQ> keep your special chars out of my source code you damn dirty apes
22:39 <nitrix> I wouldn't want to be on the unicode commitee....
22:39 <kernelj_arch> committee
22:39 <* centril> concurs with MarcelineVQ
22:39 <centril> kernelj_arch: is this the correct-typos channel :P ?
22:39 <jordan36363> single quotation marks arent on my keyboard wth
22:39 <nitrix> centril: In this case it's appreciated to better my english (:
22:39 <MarcelineVQ> actualHuman_462: I've seen ' used for derivates in math where ' is first '' second ''' third etc
22:40 <kernelj_arch> centril: a channel like that exists???
22:40 <kernelj_arch> I imagine people would avoid saying anything in case they misspell something... is that even how you spell misspell?
22:40 <MarcelineVQ> a.k.a. prime notation for derivatives
22:40 <Tuplanolla> It's the universal "can't think of a new name for this variable" symbol, actualHuman_462.
22:41 <ski> ⌜f′⌝,⌜f″⌝,⌜f‴⌝
22:41 <Tuplanolla> Using it for derivatives is heresy anyway.
22:41 <sproingie> it's a pretty common notation for that
22:42 <ski> ⌜D f⌝,⌜D² f⌝,⌜D³ f⌝
22:42 <actualHuman_462> Is there some sort of relationship between the concept of derivatives and the word "prime"?
22:42 <sproingie> doubt it
22:42 <ski> not anymore than the derivative being a "variant" of the function, in some very rough sense
22:43 <ski> (being derived from it, by the process of differentiation)
22:43 <centril> ski: well - not a semantic preserving sense
22:43 newhoggy joined
22:43 <centril> so very rough indeed
22:43 <ski> aye
22:43 <kernelj_arch> usually f²(x) means f(f(x)) though
22:44 <ski> yes, and ⌜D² f⌝ means ⌜D (D f)⌝
22:44 <centril> just write f . f $ x
22:44 Sgeo joined
22:44 <centril> or (f . f) x
22:44 <kernelj_arch> except when f is a trigonometric function then for some reason it actually means squared
22:44 <* ski> dislikes that usage of exponent, refuses to use it
22:44 <sproingie> math is hard, let's go shopping
22:44 <jordan36363> then you wouldnt say f though
22:44 <* centril> agrees with ski
22:45 <actualHuman_462> Yeah, this is why I never did so well in math past a certain point, same reason I couldn't swallow perl, everything changes meaning based on context
22:45 <centril> what's wrong with good old function composition...
22:45 <centril> actualHuman_462: haha... type classes anyone... ?
22:45 <centril> they don't change meaning based on context ?
22:45 Melite joined
22:45 <ski> centril : at least there's a most general type there
22:46 peterbecich joined
22:46 cpup joined
22:46 niklasb joined
22:46 niklasb joined
22:47 <sproingie> with perl contexts there's really just list and scalar. try C++ code where some twit decides to overload all the casts he can think of
22:48 <actualHuman_462> perl is full of magic syntactical constructs. Like '$_'
22:48 Aruro joined
22:48 <actualHuman_462> There's sanity and consistency there - Like math, if you get all the rules, it's not ambiguous
22:48 <ertes> haskell has those, too
22:49 <sproingie> modern idiomatic perl tends to steer clear of the gotchas. 'course they're always *there*
22:49 <sproingie> with a few that can be turned off with pragmas
22:49 <actualHuman_462> I'm not aware of any in Haskell outside of do notation? Are there other examples?
22:50 <ski> perhaps you'd count list comprehensions and enumerations
22:50 Quenty joined
22:50 dan_f joined
22:50 <ertes> actualHuman_462: x <- (| f (c -< 5) (d -< y) |); …
22:50 <ski> (and definite lists)
22:50 <ertes> actualHuman_462: if you have no idea what that means, don't worry… nobody does
22:50 <* ski> smiles
22:50 <actualHuman_462> ertes : lol
22:50 biglambda joined
22:51 <sproingie> ertes: how does one actually enable that syntax?
22:51 <ertes> granted it's not haskell… it's haskell + -XArrows
22:51 <ertes> =)
22:51 argent0 joined
22:52 joe9 joined
22:52 <ertes> sproingie: it's a "convenience" syntax for arrow notation… to be honest it *is* convenient, because the equivalent syntax without those banana brackets is WAY worse
22:53 augur joined
22:54 <ertes> it's bad enough when you have to use arrows, but when you have to use bananas, you know that you REALLY want to find a monad that does the job =)
22:55 sillyotter joined
22:55 Warrigal joined
22:55 <* ski> thinks `TransformListComp' is interesting
22:56 <ski> (though i think some parts of it could be done better)
22:57 <actualHuman_462> Why not just use do notation?
22:57 <actualHuman_462> Oh, nvm, additional research answers this question, that way lies madness
22:58 newhoggy joined
23:01 mekeor joined
23:02 peterbecich joined
23:02 epsilonhalbe joined
23:02 ditadi left
23:02 takle joined
23:02 niklasb joined
23:03 newhoggy joined
23:03 JeanCarloMachado joined
23:04 ublubu joined
23:06 taksuyu joined
23:07 iqubic joined
23:08 eq4life1581_ joined
23:08 <ertes> i wish there was an IsString instance for (Vector Char)
23:09 cpup joined
23:09 <ertes> in fact i wish Vector had more text-related functions
23:10 soniku joined
23:12 <actualHuman_462> ertes : What's your usecase there? Just curious
23:12 ckubrak joined
23:12 fXl joined
23:14 {emptyset} joined
23:14 <fXl> hello guys
23:15 <fXl> how can i define 3 variables, depends on something else ?
23:15 seanparsons joined
23:17 ecognium joined
23:18 rperry joined
23:19 <Eduard_Munteanu> fXl, hi, can you explain that?
23:19 <Eduard_Munteanu> I don't understand what you're aiming for.
23:19 <kernelj_arch> haskell doesn't do variables
23:19 smillmorel joined
23:20 kernelj_arch joined
23:20 nomicflux joined
23:21 <fXl> Eduard_Munteanu, okey
23:21 takle joined
23:22 <fXl> http://lpaste.net/355056, like here
23:23 <fXl> Eduard_Munteanu, fullPathEntryScript and entryScriptContent will be avaliable globally if entryScript /= ""
23:24 newhoggy joined
23:24 <ertes> actualHuman_462: i need O(1) splitting and indexing for text
23:24 geekosaur joined
23:25 <fXl> i am trying to read a file named in entryScript. if it has no value readEntryScriptContent fails of course
23:25 halogenandtoast joined
23:25 <ecognium> I have looked around but couldn't find a quick way to do some date manipulation. I have a date (usually end of the moth like "2017-04-30") and would like to generate the past x-months from this date so "2017-03-31", "2017-02-28", ... "2016-01-31", etc.
23:25 <fXl> Eduard_Munteanu, obviously it tries to read folder not the file in that folder
23:25 <ecognium> Is there a quick way to "subtract months" from a `Day` type
23:25 peterbecich joined
23:25 abhiroop joined
23:26 zv joined
23:26 kyle1320 joined
23:26 <ertes> ecognium: i have written a library for that: https://hackage.haskell.org/package/timelike
23:26 Welkin joined
23:26 cpup joined
23:26 <Eduard_Munteanu> fXl, '<-' belongs to a 'do' block, not 'let'.
23:26 <fXl> ertugrul yok artik :D
23:27 <fXl> Eduard_Munteanu, yeah i know ofc
23:27 <Welkin> hamjambo
23:27 <fXl> i just explained what i intended to do
23:28 <Eduard_Munteanu> fXl, can you test readEntryScriptContent separately?
23:28 <Eduard_Munteanu> e.g. in ghci
23:28 <fXl> Eduard_Munteanu, if i give file name, it works
23:28 <ecognium> ertes: thanks. I just skimmed the package quickly the docs are available only for Data.Time.Class and I am not sure how I can subtract a month?
23:29 newhoggy joined
23:29 <Eduard_Munteanu> fXl, what does the entryScript /= "" test return?
23:29 <ecognium> Do I need to know i am in end of Feb and I need to subtract the time equivalent of 28 days + some seconds to go to Jan 31?
23:30 <fXl> there is no problem about reading, i just want to do , if file name is not given then dont do these or if its given then do these..
23:30 <Welkin> use a proper calendar library
23:30 <Welkin> there should be one
23:30 <Welkin> you should be able to specify an offset in months and it will "do the right thing"
23:31 <ephemeral> https://hackage.haskell.org/package/time-1.8.0.1/docs/Data-Time-Calendar.html
23:31 <ephemeral> addGregorianMonthsClip :: Integer -> Day -> Day Source #
23:31 <ephemeral> Add months, with days past the last day of the month clipped to the last day. For instance, 2005-01-30 + 1 month = 2005-02-28.
23:32 biglambda joined
23:32 <ertes> ecognium: you can use dateSkip with a negative count
23:32 <ertes> dateSkip (-4) Month
23:32 <Eduard_Munteanu> fXl, oh, you can just use 'case ... of ...' ?
23:33 <Eduard_Munteanu> Or guards, or if-then-else.
23:33 <Welkin> is `time` the best library?
23:33 <ertes> ecognium: oh, what ephemeral said
23:33 <ecognium> ertes: thank you. I did not see the DateUnit (I only looked at the TimeUnit and was not sure how to do it). I will check it out.
23:33 <Welkin> I haven't used it in a while
23:33 <fXl> Eduard_Munteanu, original working one, http://lpaste.net/8287532481628864512
23:33 <Welkin> I have gotten used to using moment.js though, which is good (in js though)
23:33 <ertes> ecognium: then you don't need two extra library dependencies =)
23:33 <ephemeral> I have no idea, I'm still learning haskell, just googled it :P
23:34 <ertes> i forgot that the time library has that itself =)
23:34 <ecognium> ephemeral: thank you. your google-fu is much better than mine.. Maybe I was stuck on subtract month instead of addition with negative values
23:34 <ertes> but yeah, a lot of basic time arithmetic is surprisingly difficult with 'time', hence 'timelike'
23:34 yellowj joined
23:35 <Welkin> (written by ertes)
23:35 <ertes> especially something like "skip to the next tuesday"
23:35 <fXl> :D
23:35 <Eduard_Munteanu> fXl, you can do something like let entryScript = fromMaybe "" <$> useEntryPointPath
23:35 <Eduard_Munteanu> > fromMaybe "foo" Nothing
23:35 <lambdabot> "foo"
23:35 <Eduard_Munteanu> > fromMaybe "foo" (Just "bar")
23:35 <lambdabot> "bar"
23:36 jsgrant__ left
23:36 <Welkin> ertes: does it have a nice api like moment.js?
23:36 <Welkin> It looks pretty good from a quick glance
23:36 <ertes> Welkin: i don't know
23:36 <ertes> but if you compare it, let me know =)
23:36 <fXl> Eduard_Munteanu, cool that fromMaybe thing exists :D
23:37 <ecognium> ephemeral: that may not quite work for subtraction it looks like.. let x = read "2017-04-30" :: Day; addGregorianMonthsClip (-1) x ... 2017-03-30 and not 2017-03-31
23:37 <ecognium> I will have to add timelike to see if it produces the behavior I want
23:37 LeaChim joined
23:38 <ephemeral> uh
23:38 <ertes> ecognium: timelike will also give you day 30
23:38 jsgrant__ joined
23:38 <fXl> Eduard_Munteanu, then i will say if it is not Nothing then do line 10 and 11, http://lpaste.net/8287532481628864512
23:38 <ephemeral> it works as intended, I mean, how is any library supposed to know that you want the last day from that info alone?
23:38 <ertes> it reads april 30th as the "30th day", not the "last day"
23:39 <ephemeral> it will clip down, but it won't add extra days :P
23:39 <Eduard_Munteanu> fXl, oh, if you only want to do it when it's a Just, then you can use mapM_/forM_
23:39 cpup joined
23:39 <Welkin> http://momentjs.com/docs/#/manipulating/end-of/
23:39 <ertes> i guess one could implement special variants
23:39 <fXl> Eduard_Munteanu, yes excatly
23:39 <Welkin> this is the best calendar/time api I have seen
23:39 <Eduard_Munteanu> > forM_ (Just 15) $ \n -> putStrLn (show n)
23:39 <lambdabot> <IO ()>
23:40 <ertes> Welkin: not quite the same thing
23:40 <ecognium> ertes: I see. Ok. I may have to roll my own for my use case. I probably have to just look up the month and do some subtraction so it takes me the end of the previous month.. or keep it simple and create a cycle on going back by months and just create the Day type once I know the month.
23:41 fragamus joined
23:41 <ertes> ecognium: what you could do is to check whether the original date was the last day, and if yes, set the day to the last day yourself… be sure to use an API that understands stuff like feb 29th in leap years
23:41 <fXl> Eduard_Munteanu, can i pm you ?
23:42 erikd joined
23:42 <ertes> ecognium: BTW, if you implement extra functionality, i'll be happy to merge it =)
23:42 <Eduard_Munteanu> fXl, we should rather discuss Haskell stuff in here, more people can help, unless it's something else.
23:42 fizbin joined
23:42 <fXl> yes its something else :D
23:42 <ephemeral> he's going to solicit sex services
23:42 <fXl> ^^
23:43 <fXl> ephemeral, will show my boobs
23:43 <ecognium> ertes: roger that. I am not very good at Haskell but if I create something that is not too hacky I will share it with you as a snippet first
23:43 <ertes> ecognium: don't worry about it, i don't mind improving your code
23:44 <ertes> or, if you want to learn, i can just tell you how to improve it yourself, and then you can just add more commits
23:45 thunderrd joined
23:45 <kernelj_arch> I really miss pointers and being able to walk around datastructures
23:45 <kernelj_arch> it just seems easier
23:45 <sproingie> walking around datastructures still happens. you won't miss raw pointers.
23:45 flatmap13 joined
23:46 <kernelj_arch> how do you do things like walk up to the parent node without pointers?
23:46 <Welkin> kernelj_arch: it's not easier, it's just different
23:46 <ski> no can do
23:46 <ertes> kernelj_arch: you return from a recursive function
23:46 <sproingie> by keeping the parent node in scope when you access the child
23:46 <Welkin> you use recursion
23:46 <sproingie> or when you return, yeah
23:46 <Welkin> you don't need pointers
23:47 indi_ joined
23:47 brisbin_ joined
23:47 <kernelj_arch> it's awkward having to write all the logic based on the top of the tree
23:47 <ski> (you could make the child "point" to the parent, by tying-the-knot .. but it's usually not that useful)
23:47 <sproingie> you don't have to keep it at the top of the tree either. there's lots of ways to do it.
23:47 <ski> (since you can't change it to point to something else)
23:47 <Welkin> you can also, of course, use a zipper
23:48 <ertes> there is also the concept of paramorphisms, if you really need the "surrounding structure" in deeper recursion levels
23:48 <Welkin> forget about pointers and the way you already know how to do it
23:48 Aruro joined
23:48 <Welkin> be ready to learn something totally new and maybe weird
23:48 <rotaerk> paramorphisms, like telekinesis
23:48 <ski> there's `STRef' if you really need pointers/references
23:48 subtlebot joined
23:48 <kernelj_arch> I don't of course
23:48 flatmap13 joined
23:49 <ski> but learning when you can do without them can be helpful
23:49 <ertes> kernelj_arch: it does require a different way of thinking… in many cases it's actually *easier* than pointer
23:49 <ertes> pointers
23:49 <Welkin> pointers are too low-level and prone to errors
23:49 <kernelj_arch> I just find it very unnatural this way
23:49 <ski> (oh, and `Ptr' is also a thing, if you want pointer arithmetic. usually when interfacing with foreign languages)
23:49 nakal joined
23:50 <ertes> kernelj_arch: because you're used to it… once you get used to the algebraic approach, you will find pointers far less natural =)
23:50 robertkennedy joined
23:50 <Welkin> you'll probably never use pointers in haskell unless you need to interact with a C librar/codebasy directly
23:50 <sproingie> "natural" is just a matter of what you're used to
23:50 <sproingie> there ain't nothing natural about programming anyway
23:51 markus1209 joined
23:51 <rotaerk> but cats program me
23:51 markus1219 joined
23:51 <rotaerk> very natural
23:51 <sproingie> they're better programmers :)
23:51 <kernelj_arch> well procedural programming is like following a recipe
23:51 <kernelj_arch> you know what the steps are
23:51 <sproingie> so is functional, you just describe the steps differently
23:51 <ertes> kernelj_arch: humans are good at following recipes, but rather bad at writing them =)
23:52 <Welkin> with haskell, you describe the result you want, not the details of how you get that result (at least that is a helpful way to think about it)
23:52 <kernelj_arch> if you mess up in haskell, you messed up bad
23:52 <rotaerk> "functional programming" is a bit too vague an umbrella term, IMO; I prefer to refer to concrete, specific concepts
23:52 <ertes> just try to assemble an ikea wardrobe, and you'll know exactly what i mean
23:52 <ertes> kernelj_arch: if you mess up *and* the compiler doesn't catch it
23:52 <kernelj_arch> that's what I meant
23:53 <ertes> but it's not just a matter of safety… algebraic data structures are actually more convenient
23:53 <ertes> … most of the time
23:53 <rotaerk> one of those concepts is the distinction between expressions and statements; in procedural languages, you tend to write series of statements; in haskell you build expressions
23:53 <* ski> . o O ( commands )
23:54 eacameron joined
23:54 <kernelj_arch> and that's why it takes forever to write one line
23:55 <ski> practice makes perfect
23:55 <ski> @quote rules.of
23:55 <lambdabot> sarah says: "But I don't _want_ functional programming!" -- Sarah Peyton Jones, age 11, upon hearing the rules of Go
23:55 darlan joined
23:56 theDon_ joined
23:56 Elhamer_ joined
23:57 <Welkin> o.o
23:57 <ertes> too bad, she was young enough to learn go… or FP
23:58 infinity0 joined