<    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:01 ragepandemic joined
00:03 flatmap13 joined
00:04 quobo joined
00:05 m0rphism joined
00:05 carlosda1 joined
00:09 jer1 joined
00:11 XorSwap joined
00:13 mthek joined
00:13 morphit_ joined
00:14 pandabo joined
00:15 harblcat joined
00:16 acarrico joined
00:16 watabou joined
00:18 lambda-11235 joined
00:19 tennix joined
00:21 augur joined
00:22 ystael joined
00:23 Spondyl joined
00:25 aarvar joined
00:26 vaibhavsagar joined
00:27 juhp joined
00:30 jer1 joined
00:30 jason85 joined
00:30 theelous3 joined
00:31 muesli4 joined
00:31 umib0zu joined
00:31 taktoa joined
00:32 twanvl_ joined
00:33 robertkennedy joined
00:34 sproingie joined
00:36 nighty-- joined
00:44 andyhuzhill joined
00:47 andyhuzhill1 joined
00:47 plutoniix joined
00:49 Stanley00 joined
00:50 jer1 joined
00:50 peterbec` joined
00:51 xcmw joined
00:52 watersoul joined
00:54 wenzowski joined
00:54 sclv joined
00:54 pdxleif joined
00:55 mac10688 joined
00:55 Chousuke joined
00:55 ion joined
00:56 aidecoe joined
00:56 lstrano joined
00:56 throughnothing joined
00:56 nerdystreetrat joined
00:56 Purlox joined
00:56 tctara joined
00:57 geekosaur joined
00:57 dan64 joined
00:58 sshine joined
00:58 filterfish joined
00:58 jelleke joined
00:59 vaibhavsagar joined
00:59 k0 joined
01:00 __name__ joined
01:01 tristero left
01:02 ragepandemic joined
01:02 emmanuel_erc joined
01:05 orhan89 joined
01:06 carlosda1 joined
01:14 fgaz joined
01:15 s_spiff joined
01:16 abel-abel joined
01:16 whaletechno joined
01:17 ilyaigpetrov joined
01:18 NoCreativity joined
01:19 darjeeling_ joined
01:22 <adamCS> kosmikus: That worked! Thanks so much for all the help. Now it's time for me to backtrack and understand a bit more of it.
01:22 tych0 joined
01:23 ystael joined
01:25 gcross_ joined
01:29 k0 joined
01:31 pandabo joined
01:36 avn_nb joined
01:36 Denommus joined
01:36 avn joined
01:37 Denommus joined
01:38 bhiliyam joined
01:38 vaibhavsagar joined
01:40 Supersonic112_ joined
01:41 Spondyl joined
01:42 hiptobecubic joined
01:44 eacameron joined
01:44 zcourts_ joined
01:44 jer1 joined
01:45 ertes joined
01:46 nick123 joined
01:48 baweaver left
01:50 zcourts joined
01:52 peterbec` joined
01:57 acarrico joined
01:58 Denommus joined
01:58 cyborg-one joined
01:59 watabou joined
01:59 revprez_atlanta joined
02:00 takle joined
02:00 hucksy_ joined
02:02 jer1 joined
02:03 ragepandemic joined
02:04 wroathe joined
02:04 kellytk joined
02:05 <kellytk> Does it make sense to model time as IO and the passage of time as IO input events?
02:07 HoierM joined
02:07 carlosda1 joined
02:07 takle joined
02:09 flobberlet joined
02:10 e14 joined
02:10 tigerfinch joined
02:10 tigerfinch left
02:12 a3Dman joined
02:12 <sproingie> kellytk: FRP would be the usual thing for modeling time. you get an infinite list of events, making List the go to abstraction
02:13 sleffy joined
02:13 <kellytk> Do events come through IO?
02:13 <sproingie> ultimately, yeah, though FRP libraries tend to lift it out of IO as soon as possible
02:14 biglambda joined
02:14 le_frogballs joined
02:14 <kellytk> Thought so, thanks
02:16 iqubic joined
02:16 <iqubic> Who here uses Vim?
02:16 splanch joined
02:17 Denommus joined
02:19 <orion> I do.
02:19 revprez_atlanta joined
02:20 takle joined
02:20 orhan89 joined
02:20 <vaibhavsagar> I do!
02:20 <ExpHP> I did...
02:21 <iqubic> What plugins do you guys use in Vim?
02:21 tigerfinch joined
02:22 <orion> VundleVim/Vundle.vim, scrooloose/syntastic, bitc/vim-hdevtools, dag/vim2hs, eagletmt/ghcmod-vim
02:22 tigerfinch left
02:22 <sproingie> intero works for vim, right?
02:22 Goplat joined
02:22 <sproingie> (i'm an emacs guy myself)
02:23 <iqubic> Not tryed intero, but I know it works with Vim yeah.
02:24 jer1 joined
02:24 <sproingie> it's fantastic in emacs, feels like a real IDE
02:24 <ExpHP> (when it works)
02:24 <sproingie> true for all IDEs, ainnit?
02:24 <ExpHP> ....ok yeah :)
02:25 <monochrom> Tautologies are true for all IDEs. :)
02:26 <sproingie> tautologies are tautologies for all tautologies
02:26 <sproingie> tonight's free theorem
02:26 <monochrom> :)
02:27 <iqubic> So, anyone know what the best haskell linter is? This will work with my current set-up: https://github.com/eagletmt/neco-ghc
02:27 <iqubic> Not quite sure what the install instructions want me to do though.
02:28 <iqubic> Wait, I know what they want me to do.
02:28 <ExpHP> when I used vim, I used syntastic, which IIRC had built-in support for hlint
02:29 <ExpHP> ...and I ripped that right out because it was too prissy for my code :V
02:29 <iqubic> Also, That's not a linter, but a completion engine.
02:29 <vaibhavsagar> I like neomake
02:30 <vaibhavsagar> it has support for hlint and hdevtools, which I use heavily
02:30 darjeeling_ joined
02:30 <iqubic> Yeah, I use neomake.
02:30 coot joined
02:30 <vaibhavsagar> It's also supposed to support ghc-mod but I couldn't figure out how to get that to work
02:30 <iqubic> vaibhavsagar: Do you use ghc-mod?
02:30 <vaibhavsagar> no, hdevtools is enough for me
02:31 <iqubic> Now, what completion engine do I use??? I'm currently using Deoplete, but I don't think that has Haskell code completion built in.
02:31 <iqubic> What do people think of the neco-ghc I posted earlier?
02:32 <vaibhavsagar> does it work well for you?
02:32 s_spiff joined
02:33 pandabo joined
02:33 ian-mi joined
02:33 <vaibhavsagar> I've given up on ghc-mod + vim for now in favour of hdevtools
02:33 <iqubic> vaibhavsagar: So, you use hdevtools, instead of vim?
02:34 jer1 joined
02:34 <vaibhavsagar> no, I don't use a completion engine right now
02:34 <vaibhavsagar> that would be pretty sweet though
02:35 Jesin joined
02:35 <iqubic> vaibhavsagar: Do I need a completion engine?
02:35 <iqubic> The answer is no.
02:35 <vaibhavsagar> no :)
02:35 <vaibhavsagar> hdevtools + vim
02:35 <vaibhavsagar> ghcid is nice too, but that's editor agnostic
02:35 <iqubic> And do you have a linter too?
02:35 <vaibhavsagar> hlint
02:36 <iqubic> Cool.
02:36 <vaibhavsagar> but neomake takes care of hdevtools + hlint integration
02:36 <iqubic> So I just install hdevtools as I would normally, and neomake will just magically make everything work for me?
02:36 <vaibhavsagar> yes!
02:36 <vaibhavsagar> I usually `stack install hdevtools`
02:37 <vaibhavsagar> and `stack install hlint`
02:37 <iqubic> vaibhavsagar: You don't install it with your vim plugin manager?
02:37 bhiliyam joined
02:37 erikd_ joined
02:37 <vaibhavsagar> neomake is the plugin
02:38 <vaibhavsagar> hlint and hdevtools are the system applications
02:38 falafel joined
02:39 <iqubic> And have you set any special whitespace options for haskell files. I saw a thing about that on the Haskell Wiki.
02:39 sleffy joined
02:43 <vaibhavsagar> no, I use https://github.com/tpope/vim-sleuth
02:45 pavonia joined
02:46 ublubu joined
02:47 hybrid joined
02:48 le_frogballs joined
02:49 takle joined
02:49 ph88_ joined
02:50 ystael joined
02:51 xrogaan1 joined
02:53 peterbec` joined
02:54 ericsagnes joined
02:55 taktoa joined
02:56 lordcirth_ joined
02:56 exferenceBot joined
02:56 mizu_no_oto joined
02:56 dubois joined
02:57 meandi_2 joined
03:00 hexagoxel joined
03:00 takle joined
03:03 dan_f joined
03:03 user21 joined
03:04 ragepandemic joined
03:04 aarvar joined
03:05 xcmw joined
03:05 afarmer joined
03:06 haskell969 joined
03:06 _sg joined
03:08 carlosda1 joined
03:10 locallycompact joined
03:10 jer1 joined
03:11 felixsch__ joined
03:11 takle joined
03:12 xcmw joined
03:19 vaibhavsagar joined
03:19 takle joined
03:20 matt179 joined
03:21 pandabo left
03:22 brynedwards joined
03:23 BlueRavenGT joined
03:24 hamishmack_ joined
03:25 wroathe joined
03:27 eiGHttt joined
03:27 jer1 joined
03:31 tromp joined
03:31 LordBrain joined
03:32 s_spiff joined
03:32 takle joined
03:32 sword865 joined
03:33 Guest55 joined
03:34 peterbec` joined
03:36 gibbers joined
03:37 tjtaill joined
03:37 <iqubic> So, how does hdevtools work. I install it with stack, and then stuff magically works for me?
03:38 juhp joined
03:38 <iqubic> Well, provided I also have neomake?
03:38 mmachenry joined
03:40 <kadoban> hdevtools that you install with stack is simply a command line program. If it's supposed to do something in your editor, you probably need a plugin of some kind that calls the CLI tool correctly and etc. Which maybe that's what neomake is, never heard of that myself.
03:40 takle joined
03:40 <tjtaill> Hi I am trying to get back into haskell after a couple of years absence trying to use wreq to make some REST api calls but I get (InternalException (HandshakeFailed Error_EOF)) anyone have experience using wreq ?
03:40 codesoup joined
03:41 <c_wraith> tjtaill: that looks like one side of the connection is trying to use tls and the other isn't
03:41 hexagoxel joined
03:43 <tjtaill> c_wraith any idea how I turn TLS on or off from the haskell side using wreq ?
03:43 <c_wraith> No. :)
03:43 <iqubic> kadoban: Actually what I needed was this: https://github.com/bitc/vim-hdevtools
03:44 <iqubic> What is TLS
03:44 <iqubic> ??
03:44 <c_wraith> transport-level security. The replacement for SSL
03:44 <kadoban> TLS is the new name for SSL, kinda.
03:44 <iqubic> And you can use TLS in haskell?
03:45 <iqubic> What does that even mean?
03:45 hazyPurple_ joined
03:45 <kadoban> Should be able to in pretty much every language. Every time you want to visit a website, it's usually a good idea that TLS is at least an option.
03:45 <kadoban> TLS is pretty close to a required part of the internet
03:46 <c_wraith> Browsers are really pushing for it being mandatory for web sites.
03:46 <pacak> iqubic: http vs https in this case. Typing any passwords over http is a stupid idea.
03:47 <iqubic> Ah. I see.
03:48 <tjtaill> c_wraith ah they don't use tls in the sandbox it is working now thanks :)
03:49 <c_wraith> tjtaill: I've got a lot of experience with speaking the wrong protocol to services. So I've got a good sense of what error messages can result from that mixup. :)
03:50 Destol joined
03:52 ystael joined
03:52 soniku joined
03:54 jer1 joined
03:55 hybrid joined
03:55 takle joined
03:55 infinity0_ joined
03:56 infinity0_ joined
03:57 robotroll joined
03:57 MP2E joined
03:58 splanch_ joined
03:59 infinity0 joined
03:59 biglambda joined
04:01 infinity0 joined
04:02 vaibhavsagar joined
04:03 Intensity joined
04:04 mbuf joined
04:04 infinity0 joined
04:04 ragepandemic joined
04:07 infinity0 joined
04:07 hazyPurple_ joined
04:08 <tjtaill> Anyone have a recommendation for a lookup table is Data.Map what most people use ?
04:08 <lyxia> that or HashMap
04:08 carlosda1 joined
04:08 kellytk left
04:08 fakenerd joined
04:09 <kadoban> Data.Map is a decent default, sure. Depending on what properties you need, there may be more performant options or etc.
04:09 u___ joined
04:10 infinity0 joined
04:10 bkboggy joined
04:11 mbuf joined
04:12 <tjtaill> kadoban it is for a small lookup table still good to learn what recommendations the pros have
04:12 jer1 joined
04:14 <kadoban> Other common options I use are IntMap, Array, STArray, or even just plain [(a, b)] sometimes.
04:16 BartAdv joined
04:16 <pacak> tjtaill: There's also EnumMap
04:17 pungi-man joined
04:18 safe joined
04:19 darjeeling_ joined
04:20 ohsix joined
04:20 s_spiff left
04:21 takle joined
04:22 benl23 joined
04:23 <Cale> I would tend to just go with Data.Map
04:23 Guest55 joined
04:23 <Cale> My confidence in Data.HashMap is really low at the moment
04:24 hazyPurple_ joined
04:25 <Cale> There was a user in here a short while ago whose program which was pretty much entirely pure was producing different results on each run (the result was a Double). It was using pure parallelism (par). I went through and replaced Data.HashMap with Data.Map and that behaviour stopped.
04:25 <Cale> (and the program became 2% slower as a result)
04:26 <Cale> Data.HashMap does a bunch of reallyUnsafePtrEquality# trickery that I think was possibly the cause of it.
04:26 <kadoban> Sounds wacky, wonder why that would be.
04:26 <pacak> kadoban: Eq instance for floating point number
04:26 <Cale> It wasn't keying the Maps on floating point values or anything silly like that
04:26 <kadoban> I have an aversion to hash tables in general I guess, so I don't think I've ever tried haskell's. Maybe that's for the best.
04:27 <kadoban> Ya, using as keys was my guess, but if anything the Data.Map would probably be worse for that so I figured it wasn't that.
04:27 <kadoban> Since the Ord/Eq instances are ... fun for IEEE usually, heh.
04:27 <Cale> It was something to do with parallel accesses to the HashMaps
04:29 <pacak> Cale: Interesting. Do you recall any more details?
04:31 halogenandtoast joined
04:32 abel-abel joined
04:34 jer1 joined
04:35 <Cale> https://github.com/tibbe/unordered-containers/issues/147
04:36 <Cale> It only happens with the parallel runtime, set to use multiple capabilities
04:37 <Cale> pacak: ^^
04:37 <pacak> Cale: Thanks!
04:37 splanch joined
04:38 diegoksp joined
04:39 ninjazoete joined
04:39 latro`a joined
04:39 rblaze joined
04:40 mmachenry joined
04:40 Sh4rPEYE joined
04:41 matt179 joined
04:41 bhiliyam joined
04:41 afarmer joined
04:41 revprez_atlanta joined
04:42 Gurkenglas joined
04:43 _sras_ joined
04:43 darjeeling_ joined
04:44 eklavya joined
04:45 splanch joined
04:45 <_sras_> I am trying to use hdevtools on a project, I am getting this error when I issue a "check" command from cli, http://lpaste.net/354720
04:46 <_sras_> How can I fix this?
04:47 ebzzry joined
04:47 takle joined
04:49 fakenerd joined
04:49 sssilver joined
04:53 ystael joined
04:53 watabou joined
04:54 jer1 joined
04:56 takle joined
04:57 splanch joined
05:00 flatmap13 joined
05:00 splanch_ joined
05:01 <_sras_> How can I fix this hdevtools error http://lpaste.net/354720 ?
05:01 vaibhavsagar joined
05:03 azahi joined
05:03 splanch joined
05:04 takle joined
05:05 ragepandemic joined
05:09 carlosda1 joined
05:10 {emptyset} joined
05:11 pzuck joined
05:12 takle joined
05:13 P1RATEZ joined
05:13 howdoi joined
05:13 Mutter_ joined
05:14 castlelore joined
05:15 jer1 joined
05:15 tobiasBora joined
05:16 flatmap13 joined
05:17 crobbins joined
05:18 electrostat joined
05:20 steeze joined
05:21 takle joined
05:22 Xanather joined
05:23 le_frogballs joined
05:23 okuu joined
05:24 osa1 joined
05:29 skeuomorf joined
05:34 kritzcreek joined
05:35 jer1 joined
05:38 biglambda joined
05:39 eacameron joined
05:39 electrostat joined
05:40 takle joined
05:41 fakenerd joined
05:42 vlatkoB joined
05:43 eacamero_ joined
05:43 carlosda1 joined
05:45 takuan joined
05:46 asthasr joined
05:46 ThomasLocke joined
05:48 fakenerd joined
05:49 eacameron joined
05:49 takle joined
05:51 vaibhavsagar joined
05:52 splanch joined
05:52 insitu joined
05:53 eacamero_ joined
05:53 soniku joined
05:53 ystael joined
05:54 zcourts joined
05:54 takle joined
05:55 ninjazoete joined
05:56 jer1 joined
05:57 augur joined
05:57 eacameron joined
05:57 forgottenone joined
05:58 bvad joined
05:58 augur joined
05:59 jhrcek joined
05:59 takle joined
06:01 quchen joined
06:01 xtreak joined
06:02 eacameron joined
06:02 tripped joined
06:04 peterbec` joined
06:05 ogrady joined
06:06 ragepandemic joined
06:06 hurkan joined
06:07 mszczygiel joined
06:07 takle joined
06:07 Gabemo joined
06:08 raichoo joined
06:09 <cocreature> _sras_: are you using TH?
06:09 eacameron joined
06:10 hazyPurple_ joined
06:14 <_sras_> cocreature: Yes
06:14 <cocreature> _sras_: afaik that error comes from using -fno-code which hdevtools probably does and TH. sadly I don’t know of a fix
06:17 jer1 joined
06:18 Sampuka joined
06:20 takle joined
06:22 fakenerd joined
06:22 <pacak> _sras_: You can try compiling modules that declare TH separately via ghc -c or placing them into a separate cabal package
06:24 somewone joined
06:24 Spondyl joined
06:25 freusque joined
06:29 augur joined
06:29 fakenerd_ joined
06:30 <quchen> Is anyone here using the Iosevka font? I can’t seem to get the <*> and <+> ligatures to work (in Atom).
06:30 fakenerd joined
06:31 takle joined
06:32 flatmap1_ joined
06:35 edsko joined
06:35 alfredo joined
06:35 asthasr joined
06:36 boombanana joined
06:37 mfukar joined
06:38 ubsan_ joined
06:40 Itkovian joined
06:40 jer1 joined
06:42 bhiliyam joined
06:42 cdidd joined
06:43 laplacian joined
06:44 takle joined
06:44 sgflt joined
06:44 laz joined
06:45 harfangk joined
06:45 zeroed joined
06:45 zeroed joined
06:50 mjora7 joined
06:51 guiben joined
06:51 chichou joined
06:52 yellowj joined
06:53 sproingie joined
06:54 JohnEgbert joined
06:54 ystael joined
06:55 aphorisme joined
06:55 takle joined
06:55 hazyPurple_ joined
06:56 raichoo joined
06:58 MoALTz joined
07:00 jer1 joined
07:01 zcourts joined
07:01 halogenandtoast joined
07:02 connrs joined
07:02 dmiles joined
07:03 detrumi joined
07:04 zeroed joined
07:05 dmiles joined
07:07 thc202 joined
07:07 ragepandemic joined
07:07 lithie joined
07:08 TheLemonMan joined
07:08 takle joined
07:08 vaibhavsagar joined
07:08 kamyar joined
07:09 vaibhavsagar joined
07:10 <kamyar> Please check my code: http://lpaste.net/354722
07:10 <kamyar> What is wrong with it?
07:10 seveg joined
07:11 <cocreature> kamyar: please add the error message to your code
07:12 watabou joined
07:12 <kamyar> cocreature: I did
07:13 <cocreature> kamyar: you can use hoogle to find the module that you need to import to get an identifier http://hoogle.haskell.org/?hoogle=runput
07:13 <cocreature> in your case it’s Data.Binary.Put
07:14 matt179 joined
07:14 <kamyar> cocreature: thnx1
07:16 takle joined
07:16 ragepandemic joined
07:16 ventonegro joined
07:17 vlatkoB joined
07:18 m3adi3c joined
07:20 alios joined
07:20 chidy joined
07:20 _paul0 joined
07:20 guiben joined
07:21 jer1 joined
07:21 razi1 joined
07:23 <halogenandtoast> What's new in the Haskell world?
07:23 <jle`> ghc 8.2 is almost out so that's kinda nice
07:24 cyborg-one joined
07:24 albertid joined
07:24 <jle`> linear types are more or less ready to go for 8.4 i believe...and dependent haskell planned for 8.6/8.8
07:25 <jle`> ecosystem wise, the answer depends on when you last looked into it
07:25 BartAdv joined
07:25 <MP2E> wow, didn't know they were that close
07:25 <MP2E> excellent
07:26 <halogenandtoast> heh I just realized I'm still running 8.0.2
07:26 <cocreature> halogenandtoast: well 8.2 is not yet out :)
07:26 <cocreature> only rc1
07:26 <halogenandtoast> cocreature: was there an 8.1?
07:26 <cocreature> no
07:26 <halogenandtoast> *facedesk*
07:27 <jle`> we don't speak about 8.1
07:27 <halogenandtoast> Show me where the bad man touched your compiler.
07:27 <halogenandtoast> What happened in 8.1 that we don't speak about it?
07:27 <jle`> oh, nothing, ghc releases are just on even numbers
07:27 <cocreature> the same that happened to 7.9
07:28 raichoo joined
07:29 <halogenandtoast> Odd, I'm not sure I'll ever understand a justification for that system of versioning.
07:29 <halogenandtoast> I just want semver major.minor.patch
07:29 <halogenandtoast> But I'll live.
07:29 <halogenandtoast> I'll need to read up abou tlinear types and dependent haskell, not sure what those mean just yet.
07:29 <jle`> https://downloads.haskell.org/~ghc/6.2.2/docs/html/users_guide/version-numbering.html
07:30 <jle`> odd numbers are for HEAD i believe
07:30 leat joined
07:30 <MarcelineVQ> if it helps you can get 8.1.2 on git
07:31 OnkelTem joined
07:31 <halogenandtoast> It probably won't help me.
07:31 xtreak joined
07:31 <halogenandtoast> But I've commited to memory the versioning scheme and can live with it.
07:32 zcourts joined
07:33 orhan89 joined
07:34 skeuomorf joined
07:34 <jle`> it'll come up on jeopardy some day probably
07:35 takle joined
07:35 <MarcelineVQ> base versioning, the daily double
07:35 indi_ joined
07:35 bennofs joined
07:35 eatman joined
07:36 <halogenandtoast> For web frameworks, is Yesod still the way to go (or Snap) or are there new more enticing options?
07:37 indi_ joined
07:38 connrs joined
07:38 LAZAR joined
07:39 <LAZAR> How can I actually use the diamond operator for Lists? They are monoids so I should be able to [1,2,3] <> [4,5,6]
07:39 qzo joined
07:39 <kadoban> Sure
07:39 vaibhavsagar joined
07:40 <kadoban> Perhaps you don't have (<>) in scope? Not sure what error you're getting.
07:40 <halogenandtoast> > [1,2,3] <> [4,5,6]
07:40 <lambdabot> [1,2,3,4,5,6]
07:40 splanch joined
07:41 <LAZAR> i only tried it in ghci and its not in scope there
07:41 jer1 joined
07:41 <LAZAR> Variable not in scope: (<>) :: [Integer] -> [Integer] -> t
07:42 <Sampuka> > (\x->x^2) 4
07:42 <lambdabot> 16
07:42 ptek joined
07:42 <vaibhavsagar> LAZAR: import Data.Monoid ((<>))
07:42 <kadoban> import Data.Monoid ((<>)) -- it's not in Prelude as far as I know
07:42 <Sampuka> > :t map
07:42 <lambdabot> <hint>:1:1: error: parse error on input ‘:’
07:42 <jle`> lambdabot: you need to import it :)
07:42 splanch_ joined
07:42 <Sampuka> how do I ask for type?
07:42 <LAZAR> I have to import Monoids? lol ok
07:42 <jle`> * LAZAR: you need to import it :)
07:43 <kadoban> :t map
07:43 <lambdabot> (a -> b) -> [a] -> [b]
07:43 <Sampuka> oh
07:43 <jle`> LAZAR: just the Data.Monoid module
07:43 <LAZAR> Thats just super weird because mappend is in Prelude
07:43 <jle`> i think it might be for historical reasons
07:43 <LAZAR> Which is the same
07:43 mthek joined
07:43 <jle`> also there's another module in base that exports (<>)
07:43 <jle`> that is different
07:43 <jle`> so it might be to prevent that from getting messy
07:43 <halogenandtoast> Semigroup?
07:44 <jle`> this other module is also commonly used, so it might get messy often if prelude exported its own (<>)
07:44 <jle`> yes, Data.Semigroup
07:44 <LAZAR> well if you use both you are screwed anyways so they should have made that operator polymorphic probably
07:44 <jle`> well
07:45 <jle`> (<>)/mappend should actually be in the Semigroup typeclass
07:45 <jle`> and not in Monoid
07:45 <jle`> but moving it would break a lot of code
07:45 mstruebing joined
07:45 adeohluwa left
07:46 johnw joined
07:46 osa1_ joined
07:46 <jle`> (<>) from Semigroup should be able to replace (<>)/mappend in most situations
07:46 seveg joined
07:46 takle joined
07:47 <LAZAR> java class hierarchy to the rescue lol
07:47 <MarcelineVQ> in the not far too future semigroup should be a superclass of monoid and that issue should relax, unless that plan was changed
07:48 marr joined
07:48 darjeeling_ joined
07:48 <jle`> the issues are mostly the same as with AMP i believe
07:48 bollu joined
07:49 <Unode> MarcelineVQ: on the book I'm reading this was supposed to be a ghc-8 target. Has this changed?
07:49 <jle`> but semigroup is not as ubiquitous as applicative is
07:50 fakenerd_ joined
07:51 <MarcelineVQ> dunno, seems to be in the cards though as a -Wsemigroup and -Wnoncanonical-monoid-instances flags exist
07:52 KorriX joined
07:55 jimmyrcom joined
07:55 ystael joined
07:56 dcoutts_ joined
07:56 soniku joined
07:57 rootnode joined
07:57 TheQuietCoder joined
07:59 oisdk joined
07:59 TheQuietCoder joined
08:00 MVQq joined
08:00 sproingie joined
08:00 sproingie joined
08:01 sullyj3 joined
08:01 <lpaste> jimmy pasted “No title” at http://lpaste.net/354724
08:02 markus_ joined
08:02 jer1 joined
08:02 <sullyj3> Hey guys, I have a function that compiles ^^^ , but when I try to use it in the repl, things start exploding. Any ideas?
08:02 <markus_> hi! is it true that classy lenses don't allow for type changing updates?
08:02 AfC joined
08:03 balor joined
08:03 <sullyj3> ```Ambiguous type variable ‘a0’ arising from a use of ‘it’```
08:03 thunderrd joined
08:03 filterfish joined
08:04 <pavonia> sullyj3: How are you using it?
08:04 <sullyj3> eto 1
08:05 <sullyj3> eto 1.0 gives the same error
08:05 <sullyj3> sorry, pavonia
08:05 peterbec` joined
08:06 <pavonia> Try giving a type annotation for the result
08:06 xtreak joined
08:06 nilof joined
08:06 Sampuka joined
08:07 bennofs joined
08:08 <sullyj3> pavonia: :t eto gives ```eto :: (Integral a, a) => a -> a```, which is confusing to me. I want it to be able to return non-integrals, obviously. What about the function is causing that constraint?
08:08 <Cale> eto :: (Integral a, Fractional a) => a -> a
08:08 <Cale> Yeah, that's not good
08:08 twanvl joined
08:09 <Cale> It's because you're using ^
08:09 <Cale> :t (^)
08:09 <lambdabot> (Num a, Integral b) => a -> b -> a
08:09 <Cale> and of course (/)
08:09 <Cale> :t (/)
08:09 <lambdabot> Fractional a => a -> a -> a
08:10 Swizec joined
08:10 mathk joined
08:11 CoderPuppy joined
08:11 Yuras joined
08:11 <sullyj3> Cale: obviously n (as in nth term) has to be Integral, but x doesn't have to be. So, x/y is a Num, right? That's not a relevant constraint
08:11 <Cale> You probably want a fromIntegral around the factoral
08:12 <Cale> factorial*
08:12 <sullyj3> ohhhhhh
08:12 <Cale> Also, the first two lines of the definition of factorial would be redundant if you used foldl to define it.
08:12 <Cale> factorial n = foldl (*) 1 [1..n]
08:13 <Cale> Or better yet, use product [1..n]
08:13 infinity0 joined
08:13 <sullyj3> It works!
08:14 <sullyj3> Thanks, also a nice tip. Appreciate it!
08:14 juhp joined
08:15 biglama joined
08:15 eacameron joined
08:16 <sullyj3> So, :t factorial is just ```factorial :: (Num t, Eq t, Enum t) => t -> t```, why is that becoming an integral?
08:16 <jle`> sullyj3: because of (^)
08:17 cordawyn joined
08:17 <sullyj3> jle`: but factorial is being used over the other side of the division, why would (^) constrain its result?
08:18 <Cale> sullyj3: The type of the result of factorial is the same as the type of its argument
08:18 <Cale> So n has whatever type the factorial does
08:18 <Cale> and n is being used as the exponent for (^)
08:19 <Cale> so its type is required to be an instance of Integral for that reason
08:19 osa1 joined
08:19 markus_ left
08:20 lep-delete joined
08:20 qzo joined
08:20 bjz joined
08:20 vaibhavsagar joined
08:21 <sullyj3> Cale: I get it now. Took a bit of pondering. Thank you!
08:22 <Cale> sullyj3: Oh, also, x / y is always going to be of some Fractional type. Num isn't enough on its own.
08:22 locallycompact joined
08:23 <Cale> :t (/)
08:23 <lambdabot> Fractional a => a -> a -> a
08:23 jer1 joined
08:23 govg joined
08:23 <sullyj3> Oh, of course.
08:23 <sullyj3> duh haha
08:23 <sullyj3> should've thought of that on
08:24 Aruro joined
08:24 kamyar joined
08:24 <kamyar> hello all
08:24 <kamyar> I have read about lifting and liftIO and there are many criticism that say lifting is a bad habit
08:24 <kamyar> makes the code bad smell
08:25 armyriad joined
08:25 <Lokathor> https://gist.github.com/Lokathor/b2df34e820c6d298dd5f110f48ed42ee made a little demo of an IRC bot using async and STM
08:25 <kamyar> How can we avoid? see my code: http://lpaste.net/4157881788271689728
08:26 <kamyar> so many liftIO's
08:26 vaibhavsagar joined
08:26 augur joined
08:27 <Aruro> kamyar: make separate function
08:27 <Aruro> which is just IO
08:27 <Aruro> and then lift it
08:27 <Aruro> now indeed looks bad :)
08:27 quobo joined
08:28 <cocreature> putStrLn' = liftIO putStrLn :)
08:28 <Lokathor> yeah, let liftPrint = liftIO putStrLn in ...
08:28 <Aruro> kamyar: whole block of geting name and password should be one function
08:29 <LAZAR> Any suggestions for my Euclid based primality test? isPrime n = n >= 2 && all (\z -> gcd n z == 1) [2..(div n 2)]
08:30 <Aruro> LAZAR: who needs primality test ? :)
08:30 <cocreature> Aruro: primality tests are almost as important as implementing fibonacci!
08:30 <MVQq> those are good ways to avoid the word lift but typically the suggestion I see for a problem like this is to use IO exceptions to handle errors when the majority of your work is IO
08:30 <LAZAR> Aruro: Im doing some coding exercises to get to use with haskell
08:31 <Aruro> LAZAR: do some simple stuff u will LIKE, and feel its YOUR code , not some artificial problem put on you by somebody
08:31 <LiaoTao> LAZAR: You're supposed to check up to the square root
08:31 <LiaoTao> Not half
08:32 <MVQq> Lokathor: what will you do with your robut
08:32 Yuras joined
08:32 <LAZAR> LiaoTao: You are right
08:33 <LAZAR> Aruro: Well i love crypto and math so working with primes and alike is fun for me
08:33 <cocreature> LAZAR: usually you also want to use "mod" instead of "gcd" here which should be faster
08:33 <LiaoTao> I still don't understand how to implement a prime sieve :(
08:33 <Lokathor> MVQq, well now I have two versions: one in rust using the standard library, and one in haskell using STM. I think I want to learn more about rust's "tokio" library and attempt a version using that at least
08:33 <Aruro> LAZAR: there are many aspects of haskell which are not captured in this problems, one of the most important one is making your own data types
08:33 <Lokathor> MVQq, get a basic comparison perhaps
08:33 <Aruro> these math problems are rather language agnostic
08:34 <MVQq> make a rust ffi lib, save the future from the present :O
08:34 kamyar_ joined
08:35 <Lokathor> MVQq, what? I don't get what you mean
08:35 KorriX joined
08:35 mounty joined
08:35 <MVQq> I mean test out your rust stuff, from haskell!
08:36 <Lokathor> on that's easy. Rust functions can be tagged as no_mangle and given a C-compatible signature and then compiled into a C-callable module with a snap
08:36 <LiaoTao> LAZAR: Regardless of the performance of your algorithm, div can be replaced with quot for more efficiency
08:36 <Lokathor> then we'd use inline-c on the Haskell side to call that rust module
08:36 splanch joined
08:37 <cocreature> I wonder if we’ll ever get rid of the C FFI as the plumbing between different languages
08:37 mszczygiel joined
08:37 biglambda joined
08:38 zero_byte joined
08:38 <Aruro> cocreature: never
08:38 <Aruro> nobody wants it
08:38 <cocreature> Aruro: don’t destroy my dreams!
08:38 _sg joined
08:39 <Aruro> i share your dreams, but reality is harsh :D
08:39 <cocreature> I just ignore reality
08:40 <LAZAR> isPrime n = n >= 2 && all (\z -> gcd n z == 1) [2..(round $ sqrt $ n)] why does the (round $ sqrt $ n) part give me an No Instance error... it should evaluate to an Integral value which serves as the upper limit?
08:41 starmix joined
08:41 <cocreature> LAZAR: the problem is that "n" is an Integral and you can’t call sqrt on that
08:41 <LAZAR> cocreature: why can i not sqrt an integral? O.o
08:42 <cocreature> :t sqrt
08:42 <lambdabot> Floating a => a -> a
08:42 starmix joined
08:42 <cocreature> LAZAR: because the result is not an Integral
08:42 fvgs joined
08:42 revprez_atlanta joined
08:43 <LAZAR> lol... just why? the result can have a different type than the parameter
08:43 splanch joined
08:43 bhiliyam joined
08:43 jer1 joined
08:43 <LAZAR> It should be Num a => a -> Double
08:43 soLucien joined
08:44 biglambda_ joined
08:44 tusj joined
08:44 <Lokathor> let mySqrt = sqrt . fromIntegral
08:44 <LAZAR> its just a weird design decision not to allow taking the square root of any number
08:44 <LAZAR> so much ceremony
08:45 <Lokathor> the sqrt of almost any number is going to be a floating value, not integral. Haskell doesn't auto-convert, so they just have you convert ahead of time in this case
08:45 splanch_ joined
08:45 fizruk joined
08:46 <cocreature> it definitely shouldn’t be "Num a => a -> Double". you can’t implement that function
08:46 <LAZAR> Lokathor: Still it doesnt make much sense to me. Yes, the return value will always be a Floating, yet the function could be polymorphic to cover all number types
08:47 cordawyn joined
08:48 coot joined
08:48 salva joined
08:48 <Aruro> LAZAR: it is polymorphic
08:49 carlosda1 joined
08:49 <LAZAR> Aruro: well the polymorphism is not total
08:50 <ahihi> sqrt :: Num a => a -> Double makes no sense for e.g. complex numbers
08:50 <fvgs> New to Haskell, I'm looking for advice on how to best setup Haskell on macOS. Haskell Platform seems to make too many opinionated decisions. I'm looking for a simple setup.
08:51 heurist` joined
08:51 <fvgs> I use Homebrew, so instinctively I would like to just `brew install` the compiler (both ghc and ghci)
08:51 <LAZAR> ahihi: Complex numbers are not in Num because they cant have an ordering
08:51 <Aruro> :t sqrt
08:51 <lambdabot> Floating a => a -> a
08:51 <Iceland_jack> They are in Num
08:51 <Iceland_jack> they're just not Integral
08:51 <cocreature> and Num doesn’t require Ord
08:52 <* Iceland_jack> . o O ( remembers a time when Num required Eq )
08:52 <cocreature> lambdabot: tbh I don’t even know what a more polymorphic signature for sqrt would look like
08:52 <cocreature> eh LAZAR
08:52 bkboggy joined
08:52 <Aruro> fvgs: i installed with brew platform, what is opinionated?
08:53 <LAZAR> cocreature: well it should accept integral and floating
08:53 <LAZAR> because thats how square rooting is defined
08:53 <cocreature> LAZAR: give me a type signature that would actually be work and is more general than the current signature
08:53 <LAZAR> it takes real numbers
08:53 <fvgs> @Aruro what do you mean by "brew platform"? I meant that the Haskell Platform seems rather opinionated given all the tools and libraries it comes with
08:53 <lambdabot> Unknown command, try @list
08:54 <ahihi> square roots are not limited to the reals
08:54 fakenerd joined
08:54 <Aruro> :t sqrt
08:54 <lambdabot> Floating a => a -> a
08:54 <ahihi> I also don't know what the type of the function you want would look like
08:55 <Aruro> realize your instance for complex, where is problem?
08:55 insitu joined
08:55 <Aruro> fvgs: haskell platform is good choice, i dont know what is opinionated in it, seriously, its just compiler and cabal
08:56 ystael joined
08:56 xtreak joined
08:56 <Aruro> i installed it with brew and had no problems
08:56 biglambda joined
08:56 dramforever joined
08:56 dramforever joined
08:56 dramforever joined
08:57 <Aruro> ahihi: u have to make your complex numbers an instance of Floating typeclass
08:57 <ahihi> Aruro: I don't know why you're telling me this
08:58 <Aruro> ahihi: because u made wrong type signature there is no function sqrt::a->Double
08:58 <dramforever> Q: Why did Haskell designers choose to use '::' for type signature and ':' for cons? I heard that it's because they expected cons to be used more often (uh oh), but any reliable resource?
08:58 <Aruro> ahihi: there could be function sqrt :: Complex->Complex
08:58 <ahihi> Aruro: perhaps read the discussion from the beginning
08:59 <fvgs> Well, right now I'm considering just installing ghc via brew manually. But I'll pivot to a different question: what are the roles of cabal and stack? The downloads page seems to indicate that stack
08:59 <LAZAR> cocreature: sqrt :: Real => a -> Real for all real numbers and optionally complexSqrt :: Complex => a -> [Real]
08:59 <fvgs> can be installed as a single solution for all package management, including the installation of ghc
08:59 <fvgs> is the difference the same as nvm vs npm?
08:59 <Aruro> fvgs: dont do that, brew is crazy it wants to compile ghc, platform has binary
08:59 xtreak joined
08:59 <fvgs> brew uses bottles typically?
09:00 <cocreature> LAZAR: that makes no sense. the first function is less general than the current function. and the second for some reason returns a list and is even less general. apart from that "Real => a -> Real" is a syntax error. you probably want "Real a => a -> Real"
09:00 sproingie joined
09:01 <Aruro> :t fromIntegral
09:01 <lambdabot> (Num b, Integral a) => a -> b
09:02 circ-user-Bdo65 joined
09:02 <ahihi> LAZAR: so, do we then need a third function for quaternions? :)
09:02 <dramforever> 'Haskell doesn't auto convert'
09:02 <Aruro> fvgs: i dont know much about brew, but install ghc tries to compile which will take very long time, like a day
09:02 <Iceland_jack> dramforever: Yes in retrospect is should be the other way 'round
09:02 <LAZAR> cocreature: assuming Real was not the haskell real but the set of real numbers, containing both Floating and Integral and thus being more general than Floating alone
09:03 <dramforever> Iceland_jack: Yeah, but it's no big deal TBH
09:03 fakenerd joined
09:03 <Iceland_jack> It literally makes Haskell unusable for me dramforever
09:03 <cocreature> LAZAR: then it still doesn’t work for complex numbers, quaternions, …
09:03 <LAZAR> dramforever: its a parametric type with instances covering both floating and integral...
09:04 <LAZAR> cocreature: sqrt is not defined for complex numbers anyways
09:04 <dramforever> Huh
09:04 jer1 joined
09:04 <cocreature> LAZAR: what? sqrt is just the inverse of ^2 and that’s definitely defined for complex numbers
09:04 <LAZAR> but it is generally reasonable to assume people want to sqrt both integrals and floatings
09:04 <ahihi> > sqrt (1 :+ 1)
09:04 <lambdabot> 1.09868411346781 :+ 0.45508986056222733
09:04 vaibhavsagar joined
09:04 richi235 joined
09:05 <dramforever> There's a 'branch cut' thingy that specifies which number gets returned
09:05 <dramforever> > (1.09868411346781 :+ 0.45508986056222733) ^ 2
09:05 <lambdabot> 1.0000000000000002 :+ 1.0
09:05 Yuras joined
09:05 <dramforever> > (1.09868411346781 :+ -0.45508986056222733) ^ 2
09:05 <lambdabot> error:
09:05 <lambdabot> Precedence parsing error
09:05 <lambdabot> cannot mix ‘:+’ [infix 6] and prefix `-' [infixl 6] in the same infi...
09:05 <dramforever> > (1.09868411346781 :+ (-0.45508986056222733)) ^ 2
09:05 <lambdabot> 1.0000000000000002 :+ (-1.0)
09:05 <dramforever> Damn I can't do math today
09:06 takle_ joined
09:06 <fvgs> Aruro: perhaps the more important thing for me to understand right now is the ecosystem. Are cabal and stack complementary, in that cabal handles global packages and stack handles all sandboxing?'
09:06 <fvgs> Or does make sense just to use cabal OR stack?
09:06 <LAZAR> cocreature: The most general definition would be to accept any complex number and pass back an array containing the solutions
09:06 <jle`> fvgs: you can think of stack as a wrapper around Cabal the library
09:07 <Aruro> LAZAR: ok, here people already wrote : https://wiki.haskell.org/Generic_number_type
09:07 <dramforever> fvgs: cabal is actually two things
09:07 <cocreature> LAZAR: so now I want to use quaternions and it doesn’t work
09:07 <jle`> stack doesn't actually use the command line tool 'cabal'
09:07 <jle`> it replaces the functionality of the command line tool, using the Cabal library
09:07 peterbec` joined
09:07 <dramforever> fvfs: a package manager, and a packaging system
09:07 mkoenig joined
09:07 <dramforever> would it make more sense if I said 'front end' and 'back end'?
09:08 <fvgs> jle: That suggests to me that the functionality offered by stack is a superset of that offered by cabal?
09:08 <dramforever> stack replaces the front end, and adds compiler version managing and stackage snapshot
09:08 sirreal joined
09:08 <fvgs> dramforever: I understand what you mean, yes
09:08 <jle`> fvgs: they implement their functionality in different ways, and it's a different workflow
09:09 sirreal_ joined
09:09 <fvgs> my understanding so far makes them sound a far bit like npm and nvm
09:09 <dramforever> But the underlying packaging system is the same
09:09 <dramforever> A bit like npm and npm+nvm
09:09 <jle`> the thing that is the same is that they both know how to read '.cabal' files
09:09 sirreal_ joined
09:09 <fvgs> so do stack users typically not use cabal?
09:09 <jle`> cabal actually has sandboxing/reusable builds nowadays, so you can be ok using cabal without stack
09:10 <jle`> fvgs: yeah, they are pretty much two independent tools
09:10 <fvgs> Rather, not use cabal directly via the cabal cli
09:10 <jle`> yeah, both of them use the Cabal library
09:10 <dramforever> not use cabal the front end
09:10 <jle`> but they are two independent tools for the most part
09:10 <dramforever> but use cabal packages
09:10 <fvgs> what are "cabal packages"?
09:10 splanch joined
09:10 <dramforever> like instead of 'npm build' you could also 'nvm build'
09:11 <jle`> the Cabal library lets you read '.cabal' files that specify a package. basically package metadata
09:11 <Aruro> fvgs: tbh, those days when tooling were dealbraker in haskell are over, cabal and stack are both just fine, unless u are writing something mega huge
09:11 <dramforever> fvgs: Just like how Node has `package.json` packages
09:11 <dramforever> Haskell has `.cabal` packages
09:11 <jle`> it standardizes the packaging system that haskell uses
09:11 <LAZAR> cocreature: for normal application development you need quaternions? i highly doubt. even if, there are specialized modules for handling those.
09:11 fakenerd joined
09:11 <jle`> but i think for the most part using only cabal or only stack is fine
09:11 <jle`> maybe like easy-install and pip, even
09:11 andyhuzhill joined
09:12 tabaqui joined
09:12 <fvgs> Makes sense, in the same way yarn replaces npm
09:12 <Aruro> LAZAR: its perfectly nomral to want sqrt to work on all numbers.
09:12 takle joined
09:12 <jle`> they also both get their packages from the same repository
09:12 splanch_ joined
09:12 <jle`> stack just is smarter with managing versions
09:12 <jle`> well. maybe not smarter
09:12 <fvgs> with that said, it sounds like stack is the one to use unless you don't care about versioning your projects to a specific compiler version, which seems like a mistake in most cases
09:12 <jle`> more curated
09:13 <dramforever> I'm not so sure about that
09:13 <jle`> using LTS snapshots with stackage is why i use stack over cabal these days
09:13 <LAZAR> Aruro: which haskell obviously doesn't do, right? ;-) because it doesnt support squaring integers
09:13 <dramforever> > (2 :: Integer) ^ 2 -- Like that?
09:13 <lambdabot> 4
09:13 <MVQq> the point of stack is reproduceable builds, something that builds now should build a year from now, the other benefits people find in it are consequences of that decision
09:13 <LAZAR> *square rooting
09:13 <quchen> The complex square root still has just a single solution, otherwise it wouldn’t be a function (but just a relation). The quadratic equation has two solutions, but »solution of this quadratic equation« is not a map from quadratic equations to the reals.
09:13 <Aruro> LAZAR: did u read that article i sent you? thereare deep thought on why it is like that
09:13 <jle`> cabal has 'cabal freeze', which helps you get reproducable builds in the same way, though
09:13 <dramforever> > (2 :: Integer) ** 2 -- Oh you mean this
09:13 <lambdabot> error:
09:13 <lambdabot> • No instance for (Floating Integer) arising from a use of ‘**’
09:13 <lambdabot> • In the expression: (2 :: Integer) ** 2
09:14 <quchen> s//unique/
09:14 <fvgs> but does cabal freeze allow you to build with a specific compiler version?
09:14 <jle`> but i prefer picking snapshots to freezing whatever ephemeral package version state you have
09:14 TheQuietCoder joined
09:14 <fvgs> right, it sounds like it suffers the same issues as pip freeze
09:15 <fvgs> you need to lock down the compiler/interpreter version as well as the individual package versions
09:15 <jle`> i like the idea of a canonical set of package versions that everyone in the community agrees on at different stages
09:15 <fvgs> for guaranteed reproducible builds
09:15 <dramforever> Upgrading from working deps to working deps works pretty easily
09:15 <Aruro> fvgs: also u may wish to know that its very easy to switch your project from stack to cabal and vice versa
09:15 <dramforever> So I think snapshots work for Haskell
09:16 <fvgs> Aruro: if they use the same sort of package metadata, shouldn't they essentially interoperate?
09:16 <dramforever> They do
09:16 <jle`> i think stack and cabal are different tools that can do pretty much the same big-picture things, but with just slightly different workflows
09:17 <dramforever> I think you can switch your workflow on a package from cabal to stack easily
09:17 <jle`> and yes, both of them look at the same package metadata. 'stack' actually adds some extra metadata to help with build reproducability and makes it a bit easier to swap out local versions for dev
09:17 <dramforever> I haven't really tried the other direction so....
09:17 <jle`> i'm not sure if cabal lets you say "this package comes from this github url"
09:17 <jle`> but it probably does
09:18 <fvgs> what about for global package management and installing multiple versions of ghc?
09:18 <fvgs> are cabal and stack the same in that regard?
09:18 <dramforever> Can I say 'there's no global package management'?
09:18 <jle`> hm. i don't know what cabal offers there
09:18 <dramforever> Oh I mean for stack
09:18 <jle`> stack abstracts over different ghc versions for you so that's nice
09:19 <quchen> fvgs: Stack is all (smartly shared) sandboxes. Cabal supports sandboxing mostly on a per-project basis, and uses the available compiler (as in $PATH).
09:19 <fvgs> For instance, go get takes it kinda to the extreme and makes all packages effectively global
09:19 <dramforever> There *is* a global project, that stack uses when you run stack outside of a stack package
09:19 <fvgs> which is pretty much why you can't use go get for depedency management
09:19 <jle`> hm. so i guess there's an important feature difference. stack abstracts over ghc versions and manages them for you, and you don't have to worry about $PATH or anything
09:19 <Aruro> LAZAR: short answer is because of floating sqrt of very big 16 may not give very big 4
09:19 <jle`> it just picks the one associated with the snapshot
09:20 <jle`> and downloads it if necessary
09:20 <Aruro> LAZAR: thats why there is no sqrt :: Integer -> Integer
09:20 <jle`> for cabal you might have to go out of your way to install it manually and adjust $PATH by hand on a per-project basis
09:20 <jle`> (maybe)
09:20 <jle`> i haven't been following cabal development too closely
09:20 dc0de joined
09:21 <fvgs> that sounds like about what I would expect, if the primary difference is in stack's ability to version the compiler on a per-package basis
09:21 <cocreature> cabal has a --with-ghc option
09:21 sirreal_ joined
09:21 mszczygiel joined
09:21 <jle`> oh, there you go
09:21 <Aruro> cabal is secretly becoming better and better
09:21 <cocreature> and iirc cabal master also has ghc environment fiels where you can configure the compiler
09:22 <jle`> but i think maybe it can be said that stack abstracts over ghc versions the same way it abstracts over packages, it's all sort of one unified thing
09:22 <cocreature> yep
09:22 <jle`> the same way that your snapshot determines your package versions, it also determines your ghc
09:22 <dramforever> I thought it's called 'snapshot'
09:22 <jle`> cabal talks about them as separate entities
09:22 <jle`> well, i guess that's because cabal doesn't have "snapshots" per se, just per-package freezes
09:23 <quchen> Stackage started as a huge freeze file IIRC
09:23 <quchen> (Before we even had Stack)
09:24 <cocreature> the distinction becomes slightly fuzzy since base effectively is a freeze of the GHC version
09:24 <jle`> oh yeah, so freezing your package versions effectively freezes your ghc version
09:25 <fvgs> so do either cabal or stack formally allow for global package installation? Does the --with-ghc mean ghc is installed as another package and update by using cabal update?
09:25 hiratara joined
09:25 <jle`> maybe cabal is just missing auto-downloading of ghc
09:25 slomo joined
09:25 <Aruro> fvgs: yes both global packages are alowed , we just said these tools are ALMOST same :)
09:25 <Aruro> u can not make big mistake, pick any
09:26 <dramforever> 'u can not make big mistake, pick any' -- best advice
09:26 <quchen> For some value of »same«. I find the Cabal workflow much less intuitive, but theoretically they’re equally capable.
09:26 <jle`> fvgs: stack doesn't really have global packages, just a global cache. and the snapshot you're working on determines what part of the cache you use
09:26 <cocreature> yeah that’s definitely missing. but I think the main difference is more of a philosophical nature, i.e use dependency solvers vs use a consistent snapshot. both allow using the other but are clearly targeted at one of those
09:26 <dramforever> I want to say if you don't understand what's going on just pick stack
09:27 <jle`> stack has better documentation anyways, in my opinion
09:27 <Aruro> jle`: cabal recently imroved
09:27 <Aruro> even has fancy readthedocs :D
09:27 <cocreature> also stack just has better defaults. without sandboxes or new-build you will shoot yourself in the foot
09:27 <fvgs> I'm more just curious in understanding the ecosystem rather than messing around and encountering the subtle issues firsthand. Been there done that...
09:27 <jle`> :D
09:27 <cocreature> and neither of those is the default atm
09:28 jer1 joined
09:28 biglambda joined
09:28 <jle`> the differences are subtle, it's just that if you ask us to expand on the details, we can talk about any small difference at great length, heh
09:28 hazyPurple_ joined
09:28 takle joined
09:29 <dramforever> The fact that both stack and cabal work on .cabal packages says a lot about how similar they are...
09:29 <fvgs> indeed, I think I have a better idea of what each has to offer now though :D
09:29 <jle`> yeah, if you want a picture of the ecosystem, you'd probably gain more on looking on how they are the same :)
09:29 <fvgs> can stack manage my global version of ghc?
09:29 <jle`> s/gain more on/gain more by
09:29 <fvgs> or do I also have to install ghc separately?
09:29 <jle`> i don't think it's made for that
09:29 <dramforever> fvgs: global?
09:29 <Aruro> fvgs: there is also nix way, which hardcore haskellers use
09:29 <dramforever> How global?
09:30 <jle`> stack installs ghc to its own cache
09:30 blender joined
09:30 <jle`> the same place it caches its packages
09:30 <fvgs> the same way you might install a global version of python to your system
09:30 <jle`> ah, yeah. stack isn't quite meant for that, i believe
09:30 <dramforever> No, stack doesn't do that
09:30 <dramforever> but I don't really do that either....
09:30 <Aruro> fvgs: nix can do what u want
09:30 <jle`> stack installing a ghc is the same as installing a package, it's all abstracted over when you want to build a package
09:31 <dramforever> stack can run single files
09:31 oish joined
09:31 <fvgs> I've looked into nix, but haven't given it a serious try yet
09:31 <jle`> it uses a cached ghc and cached packages to build your package
09:31 <dramforever> Hmm... Anyone tried stack exec bash?
09:31 michielb joined
09:31 <jle`> i used to do cabal exec bash all the time, but now i just stack exec (thing i want to run)
09:32 <fvgs> it sounds like using stack to run a single file would be inappropriate since how does it know what version of ghc to use?
09:32 <jle`> fvgs: and yeah, stack exposes the interface of whatever ghc the snapshot is using with 'stack ghc ...'
09:32 <dramforever> fvgs: nvm doesn't really install a global node.js, right?
09:32 <fvgs> That's the use case for which I would use a globally installed version
09:32 <jle`> fvgs: it uses the version of the snapshot you're in
09:32 <dramforever> fvgs: You can specify
09:32 <jle`> you're always in a snapshot, no matter what
09:32 <fvgs> jle: right
09:32 <Aruro> fvgs: https://github.com/Gabriel439/haskell-nix
09:32 <fvgs> but you can install your own global version if desired
09:32 <Aruro> fvgs: too much information, isnt it?
09:33 <dramforever> In the file, write a line like: -- stack script --resolver lts-?.? --package ...
09:33 <dramforever> fvgs: essentially, write your deps in your file
09:33 <jle`> you can pick to use a specific ghc version of desired, which is like an override of your resolver
09:33 <dramforever> This: https://docs.haskellstack.org/en/stable/GUIDE/#script-interpreter
09:33 jaspervdj joined
09:33 <jle`> *specific ghc installation
09:33 <jle`> but you don't need to
09:33 xtreak joined
09:34 <dramforever> fvgs: The most 'global' ghc stack offers is in the global project
09:34 <jle`> the global project is basically just a "default" resolver that stack uses if you aren't in a project with its own resolver
09:35 <fvgs> but does stack symlink anything from the global project into /usr/local/bin or somewhere else in your path?
09:35 andyhuzhill joined
09:35 <jle`> no
09:35 <dramforever> no
09:35 <jle`> stack does not affect anything outside of stack
09:35 orhan89 joined
09:35 <jle`> if you want to use ghc that stack has cached, you'd use 'stack ghc ...'
09:35 <jle`> or 'stack ghci'
09:35 <fvgs> but it might have many cached versions?
09:36 <jle`> yeah, so it uses the one that the resolver/snapshot specifies
09:36 <dramforever> jle`: Idea: how about `stack exec bash`? Can you do that?
09:36 <* dramforever> is on Windows so, can't
09:36 <jle`> basically all usage of ghc/ghci/etc. are abstracted over
09:36 <jle`> dramforever: works for me :o
09:37 <dramforever> Can run ghc there?
09:37 <dramforever> I mean, just 'ghc' gives the snapshot ghc
09:37 <dramforever> 'whereis ghc' should tell
09:38 <fvgs> if ghc is available in your path, who's putting it there?
09:38 <jle`> fvgs: not stack
09:38 <fvgs> obviously I can install ghc myself, independent of any package manager
09:38 <jle`> dramforever: it looks like using ghc gives me not-the-snapshot ghc
09:38 <fvgs> that's what I would expect
09:38 <dramforever> duh
09:38 <jle`> fvgs: yes, if ghc is in your path, then something (or someone) put it there, not stack. stack doesn't touch that stuff
09:39 <jle`> dramforever: i wonder if that's a bug?
09:39 oisdk joined
09:39 <dramforever> does PATH have the stack paths in it?
09:39 <geekosaur> fvgs, the general rule in *all* programming languages other than C/C++ is that if you want to install packages, you should also install your own version of the language not from the system package manager. and if you install the language from the system package manager, only install packages to it from the system package manager
09:40 <jle`> dramforever: oh
09:40 <jle`> yes, it does
09:40 <dramforever> Huh
09:40 <jle`> but i think i overwrode it with mby .bash_profile
09:40 <* dramforever> gotta go
09:40 <jle`> hehe
09:40 <dramforever> sorry
09:40 somewone joined
09:40 <jle`> so stack did add the right ghc version
09:40 <dramforever> jle`: That's nice!
09:40 <jle`> but my .bash_profile added another ghc version on top of that, so
09:40 <jle`> i guess that's the flaw of exec bash
09:41 biglambda joined
09:41 <dramforever> Actually makes me think, perhaps we can make a tool that make stack work like, say, rvm
09:41 <geekosaur> that shouldn't happen from .bash_propfile, but it will happen if you follow the common idiocy of setting $PATH in .bashrc
09:41 <jle`> fvgs: btw, to make it more confusing, there's also a thing that exists called the Haskell Platform, which installs both cabal *and* stack
09:41 <jle`> because why not
09:42 <jle`> geekosaur: ah that might be it :)
09:42 <geekosaur> which is a lovely wayy to break stack, rvm, pyenv, ...
09:42 <jle`> i do do that >_>
09:42 <dramforever> Selecting GHC from bash
09:42 <dramforever> how lovely
09:42 <* jle`> hangs head in shame
09:42 <jle`> anyway , i'm out too :)
09:43 <fvgs> jle: I took a look at the Haskell Platform but quickly decided against it. Too opinionated for what I'm looking for, at least at this time
09:43 <fvgs> but that's part of why I thought cabal and stack might go together
09:43 <fvgs> as opposed to offer similar functionality
09:44 <Aruro> what is opinionated i still dont get
09:45 locallycompact joined
09:45 byte512 joined
09:46 <fvgs> installing two package managers and 35+ libraries in addition to the compiler is opinionated imo
09:46 <geekosaur> espeically when stack wants to force you to use predefined resolvers/sets of packages
09:46 netheranthem joined
09:46 <fvgs> I mean it's perfectly fine, but as someone starting out with Haskell, I just want the bare bones
09:46 <Aruro> no
09:46 <Aruro> u want that libs
09:46 <geekosaur> you'll be cured of tat one the fiurst time you install something that depends on lens :)
09:46 bjz_ joined
09:47 <geekosaur> also, the bare bones are *very* bare
09:47 <Aruro> fvgs: its REALLY most beginner friendly thing
09:47 jer1 joined
09:47 <fvgs> absolutely fair, but I want to understand *why* I need x, y, z, and 50 other letters
09:47 <Aruro> i would personallyinstall all 100 most popular packages from start.
09:48 <Aruro> whats to understand? everything depends on something else
09:49 Sh4rPEYE joined
09:49 <Aruro> tons of alternative libraries
09:49 <fvgs> with the objective of learning, I haven't found a need for those 100 libraries yet
09:50 <Aruro> haskell has really little from start
09:50 <Aruro> u will be inventing wheel in most cases
09:50 <sullyj3> say I have a function f defined at the top level, and a function g defined inside a where clause in the definition of f...
09:51 locallycompact joined
09:51 <sullyj3> is there a way to get the type of g from ghci?
09:51 carlosda1 joined
09:51 <fvgs> it's the same difference between using an IDE vs building your own vimrc from scratch
09:51 TheQuietCoder joined
09:52 <Aruro> i like when there is no need to go to internet for every little thing like opening a directory or reading an url
09:53 <Aruro> fvgs: btw cabal and stack compile libraries, so time needs to be spent to build good system
09:53 danthemyth joined
09:53 <Iceland_jack> sullyj3: yes
09:53 <Iceland_jack> with `:set +c` https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#ghci-cmd-:set +c
09:54 <fvgs> build good system?
09:54 <Aruro> like all tools u need
09:54 <fvgs> you're saying they always download source?
09:54 <Aruro> yes
09:54 <sullyj3> Iceland_jack:
09:54 <fvgs> oh you're referring to building a local cache of common libraries?
09:54 <sullyj3> Iceland_jack: awesome thanks
09:55 <Iceland_jack> The most recent Haskell-mode you can use "haskell-mode-show-type-at" to easily find the type at a given point
09:55 Destol joined
09:55 <Iceland_jack> but I suppose without tooling support you'd have to type in the location manually? yuck
09:55 <Aruro> fvgs: yeah, installing globally or in sandbox will take time
09:55 <fvgs> oh yeah, also what is stackage?
09:56 <Aruro> its same as hackage but libs are curated
09:56 <Aruro> version collisions are absent
09:56 ystael joined
09:56 <fvgs> so stackage is to debian as hackage is to arch?
09:57 <Aruro> mmm, i have no idea about debian :D
09:58 <Aruro> hackage is original, stackage is maintained as a filtered set of hackage packages
09:58 TheQuietCoder joined
09:59 uglyfigurine joined
10:01 <fvgs> thanks for answering my questions all, I'm off
10:02 fvgs left
10:05 fakenerd joined
10:07 slomo joined
10:07 slomo joined
10:08 ub joined
10:08 jer1 joined
10:08 Gloomy joined
10:11 sirreal joined
10:12 splanch joined
10:13 Wizek_ joined
10:13 splanch_ joined
10:15 fakenerd joined
10:16 sanett joined
10:16 rcat joined
10:18 fragamus joined
10:18 asthasr joined
10:20 eklavya joined
10:23 locallycompact joined
10:26 fakenerd joined
10:28 forgottenone joined
10:28 jer1 joined
10:29 mmn80 joined
10:31 oisdk joined
10:31 juhp joined
10:35 <Engen> A question regarding using lambda expressions. I saw on this chat last night something that was of use to me today and was wondering if these sort of uses had a specific name
10:35 <Engen> Sort of how you have patterns in java
10:35 <Engen> The piece of code in question is map (\x -> myFunction x [1,2,3,4]) [1,2,3,4]
10:36 <Engen> And this (I think) is akin to doing two for loops in any other procedural language
10:37 <Engen> Loop over every element of the list, and do something with it and a list containing identical values
10:37 <Engen> I guess 'patterns' isn't really the right word to describe it
10:38 Luna521 joined
10:39 Mutter joined
10:42 NyanPasu joined
10:42 nerarith joined
10:43 tv1 joined
10:43 oisdk joined
10:44 bhiliyam joined
10:44 tv joined
10:47 jer1 joined
10:47 mzf joined
10:48 tv1 joined
10:49 m3adi3c joined
10:49 soniku joined
10:49 splanch joined
10:51 xcmw joined
10:51 orhan89 joined
10:52 carlosda1 joined
10:53 dubois joined
10:53 tv joined
10:53 Gurkenglas joined
10:54 <quchen> Engen: That’s a single »loop«: map.
10:55 <Gurkenglas> What library should I use to traverse a website and send a form? (I've taught tagsoup to find the form once it appears, but I think that manually constructing the POST request is a little smelly)
10:55 <quchen> myFunction could be anything, for example the function »\x y -> 1«.
10:56 soLucien joined
10:57 <quchen> Engen: The pattern of looping over a set of things is the Iterator pattern. In Haskell we don’t have an iterator pattern because we can just abstract over this with the »map« function (or, more generally, fmap).
10:57 ystael joined
10:58 <quchen> (In Java the iterator pattern is probably also past its end of life. But it’s in GoF so it’s pretty much undead.)
10:59 mmachenry joined
11:00 Spondyl joined
11:01 Rembane joined
11:01 latro`a joined
11:01 sproingie joined
11:02 Snircle joined
11:02 beckyconning joined
11:03 Mazurka joined
11:03 <opqdonut> quchen: I'd say folds instead of maps
11:04 <quchen> Or traversals? :-)
11:05 <quchen> opqdonut: ^
11:06 <opqdonut> well, yeah
11:06 <opqdonut> they're folds :)
11:07 benl23 joined
11:07 <Geekingfrog> «traversing a website» wouldn't that mean using some kind of queue, because links are added as they as discovered?
11:08 <Geekingfrog> s/as/are
11:08 jeltsch joined
11:08 <quchen> Gurkenglas: Sounds like a breadth-first search through the URL graph, in which case it would be a queue, yes.
11:08 peterbec` joined
11:09 <Gurkenglas> I must have miscommunicated. I have the URL with the form, just need to find out how to automatically fill it out. (searching github for postRequest in Haskell files finds nothing!?)
11:10 oisdk joined
11:10 <quchen> Oh, so you want to craft a HTTP request?
11:11 <quchen> wreq or req come to mind
11:11 <quchen> Haven’t used either though
11:11 <cocreature> I’ve used wreq and http-conduit
11:12 <cocreature> I don’t know of anything that automatically creates post requests based on html forms
11:12 MarioBranco joined
11:12 <LAZAR> is it preferred to use Text over String?
11:12 xcmw joined
11:12 <cocreature> yes
11:13 AfC joined
11:14 saurabhnanda joined
11:14 <quchen> String has one use, and that’s showing hello world in talks.
11:14 <saurabhnanda> tdammers: are you around?
11:15 matt179 joined
11:15 sepp2k joined
11:16 nighty-- joined
11:16 jokester joined
11:17 jokester joined
11:18 Wizek joined
11:19 <Faucelme> Both the "bound" and the "unbound" Hackage packages for abstract syntax trees seem to use the "locally nameless" representation. Is there some overview of their differences?
11:19 fakenerd joined
11:20 rockkid777 joined
11:20 <LAZAR> cocreature: So where do I do the cast from String to Text when reading Input?
11:20 <cocreature> LAZAR: just read your input as Text?
11:20 <LAZAR> Assuming i get an IO String
11:20 <cocreature> why do you get that?
11:20 cordawyn joined
11:20 <LAZAR> well readFile returns one
11:21 <cocreature> use readFile from Data.Text.IO
11:21 fXl joined
11:21 <LAZAR> ah thanks
11:22 soniku joined
11:22 <fXl> hello guys, how can i add and use data and functions from DataYml in my Main function, file structure is here. https://hastebin.com/obatobevek.hs
11:23 <cocreature> Faucelme: it’s been quite some time since I’ve looked at either of those libraries but iirc unbound does slightly more things for you automatically at the cost of relying heavily on TH
11:23 <fXl> i get this error, Expected: ‘Data.DataYml’
11:24 <cocreature> fXl: can you show us Data/DataYml.hs?
11:24 <LAZAR> Is there someting like read for Texts, too?
11:24 <cocreature> sounds like you probably have the wrong module name there
11:25 <fXl> okey
11:25 <quchen> LAZAR: Parser libraries. Read is really just a hack for demonstrational purposes if you ask me.
11:25 <LAZAR> quchen: found it, Text.Data.Read
11:26 <fXl> cocreature, https://hastebin.com/eruqabutuf.hs
11:27 <cocreature> fXl: change the first line to "module Data.DataYml where"
11:27 barua joined
11:27 jer1 joined
11:28 fgaz joined
11:28 <fXl> cocreature, cool it worked ty
11:28 MarioBranco joined
11:30 augur joined
11:33 fgaz_ joined
11:35 <LAZAR> When an either returns Right or Left, how can I access the contents of the latter? for example if i want the integer from Right (99," guys")
11:35 <cocreature> pattern matching
11:36 <cocreature> > case Right (99, "guys") of Right val -> val
11:36 <lambdabot> (99,"guys")
11:36 fragamus joined
11:36 AfC joined
11:37 tdammers joined
11:37 <geekosaur> not quite the question I think
11:37 <geekosaur> > case Right (99, "guys") of Right (i,_) -> i
11:37 dhil joined
11:37 <lambdabot> 99
11:38 <cocreature> oh right, sry
11:38 fgaz_ joined
11:38 xtreak joined
11:41 NoCreativity joined
11:45 jer1 joined
11:45 mzf joined
11:45 ExpHP joined
11:46 Shatnerz joined
11:46 HoierM joined
11:46 splanch joined
11:48 splanch_ joined
11:49 netheranthem joined
11:49 hazyPurple_ joined
11:52 richi235 joined
11:53 carlosda1 joined
11:56 sirreal joined
11:56 Gloomy joined
11:56 <LAZAR> do i really have to pack all string literals as text? (Text.pack " ")
11:56 gehmehgeh joined
11:56 asmyers joined
11:57 <quchen> LAZAR: Not if you enable OverloadedStrings
11:57 <tdammers> LAZAR: you can use the OverloadedStrings language extension
11:57 <LAZAR> the docs say i can use literals but ghc complains
11:57 <LAZAR> oh
11:57 <quchen> :set -XOverloadedStrings <--- in GHCi
11:57 <tdammers> the downside is that it makes string literals polymorphic, so there may be situation where you need to explitly annotate them
11:57 <quchen> Then you can just write »"hello" :: Text«
11:58 ystael joined
11:59 <hpc> or in a file, {-# LANGUAGE OverloadedStrings #-}
12:00 Yuras joined
12:01 <LAZAR> Ah i see
12:01 mstruebing joined
12:01 <Profpatsch> Hi #haskell
12:01 <LAZAR> whats the preferred way to handle ambiguity? Like when using Text it will require me to write Prelude.map each time I need a map...
12:01 _sg joined
12:02 j2j joined
12:02 <cocreature> LAZAR: qualified imports
12:02 <tdammers> the ambiguity is not about which map function to use, but which type to use for the string literal
12:02 <cocreature> import qualified Data.Text as Text
12:02 <fXl> http://lpaste.net/354728, i am getting this. import qualified Data.ByteString.Char8 as BS
12:02 gehmehgeh joined
12:02 <Profpatsch> I’d need a type of collection that has equality defined to be true if one element is Equal.
12:02 <tdammers> oh, that
12:02 <tdammers> nm
12:03 austinkeeley joined
12:03 <Profpatsch> LAZAR: Also, typeclasses. Everything that is a functor has an instance for fmap.
12:03 <Profpatsch> fmap is Text.map for Text and List.map for Lists.
12:03 castlelore joined
12:03 castlelore joined
12:03 <cocreature> Profpatsch: it’s not. Text is not an instance of Functor :)
12:04 <Profpatsch> cocreature: Oh, right. Monotraversable and stuff.
12:04 <cocreature> (and it can’t be because it has the wrong kind)
12:04 <LAZAR> Can you give an example? I already use import Data.Text as T, how will the qualified change things?
12:05 revprez_atlanta joined
12:05 <cocreature> LAZAR: import Data.Text as T will import all symbols from Data.Text and make them available without any prefix. "as T" means that you _can_ refer to them by T.symbolname but you don’t have to. a qualified import will only make them available using a prefix
12:06 <LAZAR> cocreature: oh well i thought it was justa shortcut
12:06 fXl joined
12:07 oisdk joined
12:07 j2j joined
12:07 <LAZAR> Well if i use import qualified Data.Text, i then have to prepend Data.Text before every instance of Text...
12:08 <fXl> http://lpaste.net/354728, i am getting this error for import qualified Data.ByteString.Char8 as BS
12:09 <Clint> fXl: you're mixing strict and lazy bytestrings
12:10 <fXl> how should i add then ?
12:10 <Clint> depends what you're trying to do
12:10 fizruk joined
12:10 peterbec` joined
12:10 <fXl> Clint, trying this http://blog.ssanj.net/posts/2014-10-09-How-to-read-a-YAML-file-from-Haskell.html
12:11 <LAZAR> So the best way to avoid both Data.Text.Text as well as Prelude.map is just using import Data.Text hiding (map)?
12:12 <Clint> fXl: and what's on line 34
12:13 <fXl> same lines there
12:13 <fXl> i just copied it to try
12:14 carlomagno1 joined
12:14 <tdammers> LAZAR: I usually import Data.Text (Text); import qualified Data.Text as Text
12:14 <Clint> fXl: that only has 18 lines
12:14 <tdammers> and then Text.map if you have to
12:14 <tdammers> however I rarely need to map over a Text
12:14 <fXl> Clint, i added them after my code
12:14 <fXl> but same lines
12:15 <Clint> fXl: SO WHICH ONE IS LINE 34
12:15 <fXl> case parsedContent of
12:15 <Clint> okay, and what is the type signature of decode in your version of the yaml library?
12:16 <Profpatsch> I’ve got a datastructure which is basically a map of mutliple keys to value
12:16 <fXl> i dont know how to check :D
12:16 <Profpatsch> Is there a type that can represent that?
12:17 <fXl> Data.ByteString.Lazy.Internal.ByteString -> Maybe a
12:17 <Clint> fXl: there you go
12:17 acarrico joined
12:17 <Profpatsch> I need to be able to update an entry by referencing one of the multiple keys.
12:17 <fXl> :D is there any differences between them ?
12:17 <Profpatsch> But the entry should then be updated for all keys in the same group.
12:20 <LAZAR> tdammers: But that would disable treating string literals as text?
12:20 WarmCookie_ joined
12:20 <LAZAR> At least i think strings cant be overloaded when you dont import Text unqualified
12:21 <geekosaur> incorrect
12:21 iulian joined
12:22 <LAZAR> Just checked, it won't treat literals as text if you just make a qualified import of Text
12:22 gawen joined
12:22 segmond joined
12:24 vaibhavsagar joined
12:25 <Profpatsch> Is an IxSet maybe what I want?
12:25 AntiSpamMeta joined
12:29 magneticduck joined
12:29 <quchen> Profpatsch: How about a Map (Map ks k) v? The (Map k ks) associates all the different keys of a value (ks) with a single key (k) that then does a lookup on the outer map
12:29 <quchen> k could be Int, for example
12:29 <Unode> What's the difference between "import Modules (Module, moduleFunction)" and "import Modules (Module(moduleFunction))" ?
12:29 fgaz joined
12:29 <Profpatsch> quchen: I thought about that, but I have the case where I want to update the actual values.
12:30 igniting joined
12:30 <Profpatsch> It’s probably easier than my tired brain made it out to be.
12:30 <geekosaur> Unode, the latter is not moduleFunction, it is data constructors and possibly field names
12:31 <Profpatsch> I kind of refuse to believe this is not a semi-common problem though, and already solved with a nice data structure somewhere. :)
12:31 <Unode> geekosaur: I get confused because for some cases both forms seem to make the compiler happy. While in other cases only one form actually works.
12:32 <geekosaur> 'both forms' sounds like field names, where exporting separately gives you the accessor function/deconstructor but likely doesn't allow pattern matching with record syntax or record update syntax
12:32 <Unode> geekosaur: so if I get it correctly, the two forms import different things?
12:32 orhan89 joined
12:33 <geekosaur> which is a way to hide the internal details of a type, so you can change them later without breaking the published API
12:34 bjz joined
12:34 fgaz_ joined
12:34 michielb joined
12:36 cemd_ joined
12:36 terrorjack joined
12:37 cpup joined
12:38 asthasr joined
12:39 fgaz__ joined
12:40 Sampuka joined
12:40 skeuomorf joined
12:41 oisdk joined
12:42 aib joined
12:44 bhiliyam joined
12:44 mohsen_1 joined
12:45 cordawyn joined
12:45 <quchen> Profpatsch: Hm, a pair of maps sounds better: http://lpaste.net/354729
12:45 <quchen> Something like this?
12:45 a3Dman joined
12:45 <quchen> A pair of (keys -> key) and (key -> value), that is.
12:46 <quchen> Where (key) is whatever you want, probably Int.
12:46 <quchen> But anything Ord should go.
12:46 <quchen> s/go/work/
12:46 <Profpatsch> quchen: That seems nice, thanks.
12:46 <Profpatsch> Maybe it’s really this trivial so nobody has bothered adding it to a package.
12:47 <quchen> Profpatsch: What you’re really doing here is function composition, since (Map a b) is pretty much (a -> Maybe b)
12:47 <Profpatsch> But then it’s either a really big map or a pretty partial function. :)
12:48 <quchen> Sure, the runtime will be dramatically different :-)
12:48 _sras_ joined
12:48 somewone joined
12:50 Denommus` joined
12:50 <_sras_> Is there anyway to make ghc-mod to check the whole project?
12:51 ultalbot joined
12:51 jer1 joined
12:51 <quchen> _sras_: GHC? :-þ
12:51 bennofs1 joined
12:51 Yuras joined
12:52 <quchen> Profpatsch: Wah, my code is pretty wrong type-wise now that I look at it
12:52 <cocreature> quchen: GHC doesn’t know about whole projects either :) you want cabal/stack
12:52 <quchen> It used to be a longer Maybe-do block :-)
12:52 <Profpatsch> quchen: Ah, that’s Maybe. :)
12:53 <Profpatsch> I thought it might be the Monad instance of Map or something
12:53 eklavya joined
12:53 <quchen> Naah
12:53 carlosda1 joined
12:54 maxirater joined
12:54 <c_wraith> Profpatsch: Map would have a weird monad instance.. What would return do?
12:54 phaji joined
12:55 <Profpatsch> c_wraith: No idea, I thought when I skimmed the instances before I saw one.
12:55 <_sras_> quchen: True :) But I was looking for something that can work with vim...
12:55 <Profpatsch> But it’s only Functor, Foldable & Traversable, what you’d expect.
12:55 <_sras_> and populate a window of with errors
12:55 <lpaste> quchen revised “No title”: “Profpatsch Map” at http://lpaste.net/354729
12:55 fgaz joined
12:56 <quchen> Meh, and adjust (const v) = insert v
12:56 <quchen> Anyway, you get the idea. :-)
12:56 <Profpatsch> Yes, thanks
12:57 dogui joined
12:58 orhan89 joined
12:58 <_sras_> So I will rephrase the question, is there a vim plugin that can take the output of stack build or cabal, and populate a qucikfix window in vim?
12:59 splanch joined
13:00 Gurkenglas_ joined
13:02 sproingie joined
13:02 sproingie joined
13:03 gregman_ joined
13:03 gregman_ left
13:04 soniku joined
13:05 OneFixt joined
13:06 asthasr joined
13:06 nerarith joined
13:08 kthnnlg joined
13:08 orhan89 joined
13:09 kthnnlg joined
13:09 PennyNeko joined
13:09 jship joined
13:10 mekeor joined
13:11 mettekou joined
13:11 jer1 joined
13:11 jeltsch joined
13:11 <LAZAR> Whats the easiest way to print the elements of a list in one line? Like [13,16,225,14,120,10] -> 13 16 225 14 120 10
13:11 <c_wraith> LAZAR: mapM_ print
13:11 <lpaste> quchen revised “Profpatsch Map”: “Profpatsch Map” at http://lpaste.net/354729
13:12 Mighty_Warthog joined
13:12 <OnkelTem> Guys, when do I add dependencies to library section and to executable section?
13:12 <c_wraith> LAZAR: oh, wait, you said *one* line
13:12 <OnkelTem> in the .cabal file
13:12 <LAZAR> c_wraith: yeah, mapM_ would get me n lines
13:12 <c_wraith> LAZAR: in that case, I'd go like... pustStrLn . unwords . map show
13:13 ziocroc joined
13:13 <LAZAR> c_wraith: well unwords just works on strings?
13:13 <quchen> :t T.unwords
13:13 <lambdabot> error:
13:13 <lambdabot> Not in scope: ‘T.unwords’
13:13 <lambdabot> No module named ‘T’ is imported.
13:13 <quchen> :-(
13:13 <c_wraith> LAZAR: that's why the "map show" part is there
13:13 <quchen> Text has unwords as well
13:13 ericsagnes joined
13:14 zeroed joined
13:15 <Iceland_jack> LAZAR: for_ ... print
13:15 <Iceland_jack> looks nicer (from Data.Foldable)
13:15 <c_wraith> LAZAR: by the time you're talking about "on a single line" you're talking about a textual representation anyway. So yeah, you have to be converting things to a textual form.
13:15 <c_wraith> Iceland_jack: but it solves the wrong problem :)
13:15 Edith joined
13:15 <Iceland_jack> Correctly!
13:16 cpennington joined
13:16 <c_wraith> can I use that excuse at work? I know I was supposed to be implementing ADFS support, but I would have done that wrong so I wrote Hello World correctly!
13:17 <Iceland_jack> Yes you may, first step is not reading the problem description
13:17 <Iceland_jack> and you're well on your way
13:17 mjhoy joined
13:18 sullyj3 joined
13:19 <OnkelTem> How to search for a package using stack?
13:20 <LAZAR> Someone wants to take a loot at my function? I'm trying to zip with multiply two lists, [1,2,3] * []
13:20 <LAZAR> [1,2,3] * [2,3,4] = 2 6 12. link is here http://lpaste.net/354732
13:21 IanKelling joined
13:21 <Iceland_jack> LAZAR: Can you use existing funtions like zipWith?
13:22 yogsotot_ joined
13:22 <LAZAR> Iceland_jack: Yeah, the problem is more like learning to wrap and unwrap stuff from files to string to integers and back
13:23 <sullyj3> So, the only way I know of repeating an IO () n times is `mapM_ [1..n]` and recursion with an explicit counter argument. Not really a fan of the first since it builds an unnecessary list, the second feels kinda ugly. Is there a nicer way? What I really want is some f :: Int -> IO () -> IO (), but hoogle didn't turn up anything like that.
13:23 bodisiw joined
13:23 <Iceland_jack> sullyj3: replicateM_
13:23 <sullyj3> ways I know*
13:23 <sullyj3> oohh
13:23 <Iceland_jack> :t replicateM_ :: Int -> IO a -> IO ()
13:23 <lambdabot> Int -> IO a -> IO ()
13:24 <Iceland_jack> :t replicateM :: Int -> [a] -> [[a]]
13:24 <sullyj3> Iceland_jack: Thankyou!
13:24 <lambdabot> Int -> [a] -> [[a]]
13:24 <sproingie> mapM_ shouldn't build up a list, it just returns unit
13:24 <Iceland_jack> > replicateM 3 [0,1]
13:24 <lambdabot> [[0,0,0],[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1]]
13:24 <sproingie> that's the difference between mapM and mapM_
13:24 orhan89 joined
13:24 <Iceland_jack> you're welcome sullyj3
13:24 <sullyj3> sproingie: I know, I meant i don't like having the [1..n]
13:24 <sproingie> oh _that_ list :)
13:24 <sullyj3> sorry that was ambiguous
13:25 unK_ joined
13:27 muzzle joined
13:27 <muzzle> when using HaRe, how do i get it to directly apply a refactoring instead of creating .refactored.hs files?
13:28 <alanz> muzzle: What ide are you using?
13:28 <muzzle> emacs
13:28 <muzzle> with intero
13:29 <alanz> There was a post around that recently, hold on
13:29 mekeor joined
13:29 chipp joined
13:29 selthas joined
13:29 KorriX joined
13:31 dfeuer joined
13:32 jer1 joined
13:32 <alanz> muzzle: Here is a spacemacs hint on it: https://github.com/syl20bnr/spacemacs/issues/8664
13:32 <alanz> not sure how to do it with straight emacs.
13:32 jathan joined
13:32 yellowj joined
13:32 <alanz> Otherwise the elisp shipped with HaRe should do the job, and not interfere
13:33 flatmap13 joined
13:33 <alanz> Future support will be via https://github.com/emacs-lsp/lsp-mode
13:33 <alanz> but it is still work in progress
13:35 <muzzle> alanz: thanks, I will look into it
13:35 ChristopherBurg joined
13:36 umib0zu joined
13:36 NikolajK joined
13:36 mekeor joined
13:36 `^_^v joined
13:38 muzzle joined
13:39 the_2nd joined
13:39 <the_2nd> Im currently using scotty. It seems like it will only parse one parameter from an array.
13:39 <the_2nd> e.g. xs <- param "xs[]"
13:39 <the_2nd> will only contain the first x in xs
13:40 <muzzle> alanz: I got it to work. This is great, now I just have to get rid of the backup files. Thank you!
13:40 somewone joined
13:40 <alanz> muzzle: great. PRs gladly accepted
13:41 fotonzade joined
13:42 orhan89 joined
13:42 ortmage joined
13:43 <pacak> Cale: It's not a problem with HashMap, it's a problem with that program.
13:43 jrajav joined
13:44 NoCreativity joined
13:44 <pacak> Cale: https://github.com/tibbe/unordered-containers/issues/147#issuecomment-295274825
13:44 meba joined
13:44 mizu_no_oto_work joined
13:45 butterthebuddha joined
13:49 KtorZ joined
13:51 <Cale> pacak: Ah, but wait, why is regroup run with a different number of elements each time?
13:52 edsko joined
13:52 <Cale> pacak: Also, if Data.HashMap.toList produces the elements in a randomized order, it shouldn't be a pure function.
13:52 msks joined
13:52 jer1 joined
13:52 ebzzry joined
13:53 <Cale> pacak: I'm not sure that's the problem, because if it were, the problem would appear in single-threaded usage, which it doesn't.
13:53 NikolajK1 joined
13:53 NikolajK1 left
13:53 NikolajK1 joined
13:54 mmachenry joined
13:54 Sh4rPEYE joined
13:54 carlosda1 joined
13:54 somewone joined
13:54 egis joined
13:55 ystael joined
13:55 eschnett joined
13:56 butterthebuddha joined
13:59 descender joined
14:01 roconnor joined
14:04 Dr8128 joined
14:04 chlong joined
14:04 <Gurkenglas> When running "stack script.hs" recommends "stack solver", what do I do?
14:05 <quchen> Gurkenglas: Isn’t it »stack script script.hs«?
14:05 <Gurkenglas> nope
14:05 <ph88_> Can someone help me with conduit? i would like to use the conduit Producer and give it to the parser, then put numbers in a vector, run calculations on them and write the results back to a file .. not sure how i can tie the code together, i have this at the moment https://bpaste.net/show/efca3e4d440d
14:06 <quchen> Gurkenglas: stack runhaskell?
14:06 <Gurkenglas> just stack script.hs
14:07 <Gurkenglas> (using runhaskell complains about the same missing modules, but doesn't recommend stack solver)
14:07 pungi-man joined
14:07 <quchen> That stack invocation doesn’t look right.
14:07 <sproingie> more usually invoked as #!/path/to/stack. usually there's a magic comment right below with the dependencies on it
14:07 <quchen> Maybe it just recommends stack solver because solver is somewhat close to script?
14:07 <quchen> sproingie: Ah, right, that’s true
14:08 plutoniix joined
14:08 filterfish joined
14:08 <Gurkenglas> quchen, "COMMAND|FILE" in "stack"'s "Usage:"
14:08 <sproingie> -- stack runghc --package foo-bar
14:09 <sproingie> comment should look something like that
14:09 <quchen> Example script: Gurkenglas: For example: https://github.com/quchen/dotfiles/blob/master/bin/util/PgpPass.hs
14:09 plutoniix joined
14:09 <quchen> λ. PgpPass.hs ---> island conformist aztec provincial python clergyman chairlift gossamer
14:09 <Gurkenglas> Mine has pretty much that except for -hide-all-packages
14:09 <quchen> Not that that’s a particularly good password generator ;-)
14:10 m3adi3c joined
14:10 <Gurkenglas> (mine starts with http://lpaste.net/3427771681920253952 )
14:11 simukis__ joined
14:11 <sproingie> quchen: beats "letmein1"
14:11 <quchen> In terms of entropy the two might be on par, apart from the security by obscurity thing.
14:11 <ph88_> i don't understand with conduit how i can put something between a Producer and a Consumer, especially with type (AttoparsecInput a, Monad m) => Parser a b -> Consumer a m (Either ParseError b)
14:12 <sproingie> i don't actually know any of my passwords except for amazon, google, and lastpass
14:12 sullyj3_ joined
14:12 CoderPuppy joined
14:12 robkennedy joined
14:12 Gurkenglas__ joined
14:12 <sproingie> quchen: yeah it's all dictionary words, but think of it as a several-thousand char alphabet
14:12 <quchen> I know the one for my self-written password manager script that’s less crappy than all password managers I’ve used so far ;(
14:13 jer1 joined
14:13 revprez_atlanta joined
14:13 <sproingie> using only dictionary words you know is not great, most people have a working vocabulary of only a couple thousand words
14:13 syx joined
14:13 <syx> hi
14:13 <ph88_> hi syx
14:13 <quchen> sproingie: The PGP wordlist is somewhat standard, which is kind of the point of that password. You can easily correct and detect typos.
14:13 <quchen> Downside is that it’s very long.
14:13 cdg joined
14:14 <quchen> But each word is technically worth 8 bit.
14:14 <sproingie> i'd figure PGP uses it for fingerprints, right?
14:14 <quchen> Probably
14:14 <sproingie> in which case you want to flatten it down some
14:15 <quchen> Hm?
14:15 <quchen> Flatten?
14:15 Denommus joined
14:15 <sproingie> as in deliberately reduce the entropy, since it's aimed at being recognized quickly
14:16 <sproingie> generating grammatical sentences would be even better. probably really amusing too.
14:16 besenwesen joined
14:16 earldouglas joined
14:16 <quchen> But then the randomness is pretty hard to judge.
14:16 <sproingie> 9. 9. 9. 9. :)
14:17 <quchen> I do have a generator running on the Bible and Faust 1 though. (I couldn’t fit HoTT in, sadly)
14:17 butterthebuddha joined
14:17 earldoug1as joined
14:17 <sproingie> best text generator i saw was seeded with the works of ayn rand and kal marx
14:18 <ystael> sproingie: D:
14:18 <sproingie> *karl
14:19 <ph88_> can anyone explain =$= in conduit ?
14:19 muesli4 joined
14:19 le_frogballs joined
14:20 <dolio> Cale: Arguably, it's still pure, because the order you get is determined by exactly how you built the map, not on what order things are evaluated. It's still violating the quotient most people would expect, though.
14:21 <Cale> dolio: Well, it *does* look like it's dependent on the order in which things got evaluated
14:21 <dolio> Does it?
14:21 <Cale> dolio: The very same program which had no randomisation or input effects and which did nothing but compute a Double, would produce different Double results each time you ran it.
14:21 Wuzzy joined
14:22 <Cale> (and this doesn't happen with -N1 only with actual parallelism available)
14:23 <ph88_> i found an example of using conduit with attoparsec and i try to do the same but i get a type error https://bpaste.net/show/a65f56373bcb
14:24 besenwesen joined
14:24 <Cale> ph88_: I like to think of your question there as being a general yes-or-no sort of question, rather than a request for explanation :)
14:25 <Cale> "can *anyone* explain =$= in conduit?"
14:25 <Cale> https://hackage.haskell.org/package/conduit-1.2.10/docs/src/Data-Conduit-Internal-Conduit.html#%3D%24%3D -- very implementation, wow
14:26 <ph88_> eh i just mean how to use it
14:26 <Cale> I know
14:26 ziyourenxiang joined
14:26 <ph88_> not to explain the internals of that function you linked to source of
14:27 <ph88_> i'm just trying to recreate what i see from the example code
14:27 <ph88_> i have a feeling what =?= is used for but clearly i'm missing stuff (see error in paste)
14:28 <sproingie> https://github.com/snoyberg/conduit#legacy-syntax
14:28 <Cale> ph88_: What's the type of conduitParserEither?
14:28 dbeacham joined
14:28 <Gurkenglas__> http://hackage.haskell.org/package/shpider doesn't build with stack. What should I use instead?
14:28 <Cale> You have a type signature there for sinkParserEither...
14:29 <sirius[m]> ph88_: `conduitParserEither' yields values of type `Either ParseError b' but your sink accepts only `ByteString', hence the type error
14:29 Kreest__ joined
14:29 <ph88_> conduitParserEither :: (Monad m, AttoparsecInput a) => Parser a b -> Conduit a m (Either ParseError (PositionRange, b))
14:30 <Cale> Ah, and snk is a Consumer BS.ByteString (ResourceT IO) ()
14:30 cordawyn joined
14:30 <glguy> Gurkenglas__: instead of stack?
14:30 <Gurkenglas__> Instead of shpider.
14:30 <ph88_> src and snk are of the right types .. because it type check when i comment line 10, and then use snk instead of snk2
14:30 takle joined
14:31 <Cale> ph88_: So that's the issue, you need to do something with this Either ParseError (PositionRange, [Double]) to turn it into a ByteString if you want to send it on to snk
14:32 <glguy> Gurkenglas__: what's it doing that stack can't handle?
14:32 StoneToad joined
14:33 <ph88_> sproingie, ok good to know, i replaced all operators with .| now
14:33 butterthebuddha joined
14:33 <Gurkenglas__> glguy: http://lpaste.net/2035273401144180736
14:33 jer1 joined
14:33 <ph88_> Cale, how can i pattern match on that either ? at the moment it seems to be wrapped in a ConduitM
14:33 dsh joined
14:34 <ph88_> ConduitM (Either foo bar) c (ResourceT IO) ()
14:34 douglascorrea joined
14:34 <Cale> ph88_: Well, yeah, it's a whole stream of Either ParseError ... values.
14:35 <butterthebuddha> Hey peeps; could someone help me out with exercise 6 -> https://www.seas.upenn.edu/~cis194/spring13/hw/01-intro.pdf
14:35 <ph88_> if there is a ParseError i want to send something to stderr, and when i have a vale i want to make a bytestring of it
14:35 <ph88_> value
14:35 skeuomorf joined
14:36 <ph88_> how can i write a "stream inspector" function for conduit that can direct these actions ?
14:36 NikolajK1 left
14:36 feynhat joined
14:37 <lyxia> butterthebuddha: what help do you need
14:37 <butterthebuddha> I'm not sure how to get started really
14:38 <ph88_> oh i done some of cis194 too :P
14:39 <ph88_> butterthebuddha, maybe first figure out what are the actual moves you can make on the pegs and why it require 129 moves
14:39 Fendor joined
14:40 peterbec` joined
14:40 <c_wraith> seems more likely to require 127 moves...
14:40 <ph88_> Cale, i think i need to do something with await and yield at least
14:41 <butterthebuddha> ph88_: Haskell as generators??
14:41 <c_wraith> Oh, the extended variant takes 129. I see
14:42 <ph88_> butterthebuddha, i'm reading this https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/conduit-overview#primitives
14:42 fizruk joined
14:43 <butterthebuddha> Ah
14:44 carlomagno joined
14:45 bhiliyam joined
14:45 crobbins joined
14:46 <Cale> ph88_: Yeah, possibly something like awaitForever $ \x -> do case x of Left e -> hPrint stderr e; Right v -> yield v
14:47 <Cale> ph88_: :: (Show e, MonadIO m) => Conduit (Either e o) m o
14:47 <ph88_> Cale, what monad is that ? don't i need liftIO for stderr ?
14:48 <ph88_> oh
14:48 <Cale> oh, sorry, yes, you do
14:48 somewone joined
14:48 <Cale> I just wrote that carelessly
14:48 <ph88_> i will try it
14:49 <Cale> That'll get you to the point of needing to deal with lists of Double values
14:49 <Cale> So maybe instead of yield v there, you just want to yield some ByteString
14:50 <ph88_> yes :D
14:50 <Cale> e.g. yield . T.encodeUtf8 . BS.pack . show $ v
14:50 <Cale> oops
14:51 <Cale> e.g. yield . T.encodeUtf8 . T.pack . show $ v
14:51 pera joined
14:51 mmachenry joined
14:51 {emptyset} joined
14:51 <Cale> (where you have import qualified Data.Text as T; import qualified Data.Text.Encoding as T)
14:52 <ph88_> Cale, oh actually .. those [Double] i want that to become [Vector Double] .. so as more [Double] come in [1.0, 2.0] and then [3.0, 4.0] i want to turn that into [ Vector {1.0, 3,0}, Vector {2.0, 4,0} ] where {} is just something i came up with in the moment to describe a vector of doubles
14:52 insitu joined
14:53 <Cale> ph88_: It always takes me twice as long to figure out how to do anything with Conduit as it does with Pipes, it's like the whole library is just a little bit off. :)
14:53 augur joined
14:53 <ph88_> hhmm i thought conduit was the go-to library
14:54 <c_wraith> Do you really want to accumulate into a big vector? That is kind of the worst way to use a streaming library
14:54 flatmap13 joined
14:54 jer1 joined
14:54 aglorei joined
14:54 bodisiw joined
14:54 <ph88_> i need to have a sliding window over those numbers
14:55 <Cale> c_wraith: Well, we're getting chunks of type [Double], so I assume that we just want each one to separately become a Vector?
14:55 steeze joined
14:55 <Cale> or... I dunno
14:55 carlosda1 joined
14:55 <Cale> Oh, maybe the chunks are too large and you want to yield multiple times for each one?
14:55 <ph88_> https://bpaste.net/show/a65f56373bcb on line 35 to 38
14:55 <ph88_> i need to put all the numbers of 1 column into a big vector
14:56 <ph88_> this is just 4 lines but a real file can be hundreds of MB's
14:56 alx741 joined
14:57 hackebeilchen joined
14:57 darlan joined
14:57 <Cale> oh, of one *column*?
14:57 <Cale> hmm
14:58 <ph88_> i don't need the entire vector to already start processing the first numbers
14:58 <Cale> So for that sample_data.txt, what should the output look like?
14:58 beanbagu1 joined
14:59 <ph88_> that's the input data ... but the output data should be much smaller
14:59 <Cale> I realise that
14:59 <ph88_> like 1 million lines to 250 lines or so
14:59 <Gurkenglas__> How should I construct the POST request for a form?
14:59 <Cale> I just don't know what output you want
15:00 dfeuer joined
15:00 insitu joined
15:00 <ph88_> Cale, not sure how to answer that question .. it should be a file with textual format just as the input file .. and to get those new numbers i have now two functions that process the data after each other
15:00 Sh4rPEYE joined
15:01 <Cale> Gurkenglas_: http-conduit can do it
15:01 <ph88_> the first function does some kind of interpolation (already reducing the amount of numbers to 250) .. the second function does some extra processing to get the final values
15:02 <Cale> Gurkenglas_: there's an example here of setting the method on a request: http://hackage.haskell.org/package/http-conduit-2.2.3.1/docs/Network-HTTP-Conduit.html#t:Request
15:02 <Cale> Gurkenglas_: and if you scroll up, there's an example at the top which shows how to actually make the request
15:02 butterthebuddha joined
15:02 <ph88_> Cale, this is the first function which already reduces the numbers significantly .. i haven't quite figured out how it works yet, but i'm trying to rewrite this software https://bpaste.net/show/51f01965c8c0
15:03 igniting joined
15:03 <Cale> ph88_: ah, okay
15:04 <ph88_> Cale, the idea was to put a chunk of numbers into a vector .. then do some calculation .. then process the next chunk
15:04 soniku joined
15:05 <Cale> ph88_: Presumably each column here has a distinct meaning?
15:05 <ph88_> yes
15:05 <Cale> ph88_: You might want to define some record type and parse to that first.
15:06 <Cale> Rather than to lists of Doubles
15:06 <Gurkenglas__> http://hackage.haskell.org/package/http-client-0.5.6.1/docs/Network-HTTP-Client-MultipartFormData.html#v:partLBS should this be ByteString, when I'm putting text into those form fields?
15:06 <ph88_> the amount of columns can be variable and the user should select which column he wants to process as an option to the program
15:06 <Cale> ahhh
15:06 <Cale> okay
15:06 <Cale> so you're basically discarding the rest?
15:06 mada joined
15:06 sproingie joined
15:06 <Cale> (perhaps you want to do *that*?)
15:06 fgaz joined
15:06 <ph88_> i think it's faster to process [Vector Double] than Vector [Double]
15:07 <ph88_> yes other columns can be discarded
15:07 <ph88_> might need 1 or 2 columns out of 3
15:07 <Cale> ah, fair enough
15:07 <ph88_> i figure when i have [Vector Double] it doesn't matter that the list only hold 1 vector
15:07 raichoo joined
15:07 <Cale> Well, you won't have a list
15:07 Gloomy joined
15:07 <ph88_> i thought a list of columns ..
15:08 <ph88_> where the vector is the column itself ..
15:08 <Cale> uhh, so you're transposing the entire input?
15:08 <ph88_> i thought in my conduit inspector function i can keep track of how many numbers i put in the vector already and when i have enough do some calculation
15:08 orhan89 joined
15:09 wroathe joined
15:09 <ph88_> what's that transposing ? rotating ? no no columns stay columns
15:09 <Cale> Well, you're not going to be "putting them in" -- Vector is immutable
15:09 burtons joined
15:09 <ph88_> need to make a new immutable vector or use mutable vector or use some other structure
15:10 rockkid777 joined
15:10 <ph88_> i just need X numbers from the columns to start doing some calculations ... then those numbers can be discarded and i can start reading the next chunk
15:10 <Gurkenglas__> When stack script.hs is at 11/21, does that already mean it compiles?
15:10 <Cale> ph88_: I'm sure there's some way to do that with conduit...
15:10 <Gurkenglas> (as in, my code has done nuthin wrong)
15:11 <ph88_> Cale, that's why i was using conduit here (it came recommended) .. but ok you can probably tell it's my first time :P
15:11 <ph88_> Gurkenglas, what's that 11/21 ?
15:12 <Cale> ph88_: Conduit is just so much uglier than pipes...
15:12 <ph88_> :'(
15:12 <ph88_> i can throw out conduit no problem
15:12 <ph88_> i have nearly nothing in my code
15:12 <Cale> okay, let's switch
15:13 mstruebing joined
15:14 <ph88_> i'm looking at the C code more closely .. i thought i needed to buffer (in the vector) an amount of samples determined by the loop on line 73 to 83 https://bpaste.net/show/51f01965c8c0 but now i think i don't even need that ! all i need is to access the current sample org_sample_nr and the next sample org_sample_nr + 1
15:14 magneticduck joined
15:14 jer1 joined
15:15 <Cale> ph88_: cool... actually, it might be easy enough to do that with conduit, it's just slightly uglier because of the type of await
15:15 <ph88_> any way .. i think i can tweak the calculation part later .. first i just like to make some simple functions that do dummy calculations and see how to glue the code together
15:15 <Cale> You can do two awaits
15:15 nicknovitski joined
15:16 <Cale> and then a yield
15:16 <Cale> (calculating something with the two values you obtained)
15:16 <ph88_> yeah good idea !
15:16 <Cale> Well, if you need a sliding window, that's not right
15:16 <c_wraith> yeah, there's no requirement that the numbers of yield and await need to have anything to do with each other.
15:16 <Cale> that'll work with chunks of two
15:16 <ph88_> well my sliding window will be of size 2 :P
15:17 <Cale> Okay, so for the sliding window, you'll want to use recursion
15:17 <ph88_> i saw it here https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/conduit-overview#primitives
15:17 Jesin joined
15:17 <ph88_> it seems what you suggest: 2x await then recursion
15:17 <Cale> Do an await at the start, and pass its result to a function which does the second await, yields a result, and then applies itself to the value it just awaited
15:18 whiteline joined
15:18 <Cale> (i.e. you need one await before the recursion begins)
15:18 <ph88_> maybe they solved that with leftover ?
15:18 <ph88_> leftover i2 to put the value back
15:19 somewone joined
15:20 <Cale> ah, yes, that might also be a good way to go
15:20 <ph88_> thank you Cale you give me some good ideas, i will study the code for a bit and report back later ok ?
15:20 <Cale> sure
15:21 ziocroc joined
15:21 jmelesky joined
15:23 bvad joined
15:24 al-damiri joined
15:24 ragepandemic joined
15:24 urodna joined
15:26 etehtsea joined
15:26 acowley joined
15:26 butterthebuddha joined
15:27 butterthebuddha joined
15:28 fresheyeball joined
15:28 <fresheyeball> question
15:28 <fresheyeball> do ADTs that are uber simple have a name?
15:29 <fresheyeball> let me give some examples
15:29 <fresheyeball> data Foo = Foo | Bar | Baz
15:29 <fresheyeball> so to be the variety of ADT I'm interested in
15:29 <fresheyeball> the type must be of kind *
15:29 tlaxkit joined
15:29 <fresheyeball> and all its constructors must not be arrows
15:30 oisdk joined
15:30 <fresheyeball> for these ADTs Ord, Bounded, Enum, Eq can all be derived
15:30 paolino joined
15:31 <zomg> iirc types which are basically X | Y | Z are known as union types
15:31 uglyfigurine joined
15:32 epsilonhalbe joined
15:32 Sh4rPEYE joined
15:32 <paolino> hi, I don't understand the "Illegal type synonym family application in instance"
15:33 <Cale> paolino: Don't use synonyms in instance heads
15:33 <Cale> Just write the instances for the actual underlying types
15:33 <glguy> paolino: type synonyms don't create new, distinct types. The instances go on types introduced by data and newtype
15:33 <paolino> is it the same as TypeSynonymInstances ?
15:34 pikajude joined
15:34 <paolino> Cale, but I cannot do it now
15:34 <Cale> Why not?
15:34 <fresheyeball> zomg: wouldn't this also be a union?
15:34 <fresheyeball> data Foo = Bar String | Baz
15:34 m3adi3c joined
15:34 <zomg> Yes
15:34 <glguy> paolino: You can't use type families when creating instances
15:35 <MitchellSalad> Cale: I don't think that's the solution to paolino's problem
15:35 <fresheyeball> I'm saying the constructors must not be arrows as well
15:35 <glguy> paolino: Those, like normal type synonyms, do not create new types that can have instances
15:35 <Cale> paolino: Just work out which types the instances evaluate to, and then write the instances for those types.
15:35 <fresheyeball> in that last example Bar :: String -> Foo
15:35 jer1 joined
15:35 psychicist__ joined
15:35 <Cale> If you can't do that, then what you're trying to do probably doesn't make sense.
15:35 <fresheyeball> is there a name for this? like a flat union?
15:36 ludat joined
15:36 <fresheyeball> it's like the staight of equivelant of an imperative Enumerable
15:36 <paolino> Cale I don't know the implementation but I ask for it to be an instance to use it in another
15:36 <paolino> if I switch to data family no complains
15:36 <Cale> paolino: Let's see which instance you're trying to write?
15:37 <Cale> paolino: Note that for example, your type family might send every type to Int
15:37 <zomg> fresheyeball: unfortunately my type-fu doesn't quite reach that far :)
15:38 <lpaste> paolino pasted “type families in head” at http://lpaste.net/354735
15:38 eazar001 joined
15:38 pikajude joined
15:39 <Cale> and Zone here is a type family?
15:39 raichoo joined
15:39 rockkid777 joined
15:39 <paolino> yes
15:39 <Cale> So what if Zone a = Int?
15:39 <Cale> let's just suppose
15:39 <Cale> Is Location b a also?
15:40 Denommus joined
15:40 <paolino> also what ?
15:40 <paolino> a tf ?
15:40 <Cale> a type family
15:40 <Cale> yeah
15:40 <paolino> no
15:40 <paolino> it's a GADT
15:40 <Cale> Okay
15:40 <glguy> paolino: That's right, type families can't have new instances, but data families can
15:40 <MitchellSalad> Cale: I don't think that really illustrates the issue. So what if 'Zone a' is an Int? You can write type families for Ints. The problem is that 'Zone a' changes depending on what 'a' is, so what instance are you actually writing?
15:40 <MitchellSalad> type classes* for Ints
15:41 Mutter joined
15:41 <Cale> MitchellSalad: Right, my point was going to be that it's hard to determine 'a'
15:41 trevor` joined
15:41 Itkovian joined
15:41 peterbec` joined
15:41 <glguy> The problem is that type families "go away", so there's nothing to attach an instance to
15:42 <Cale> Type families might not be injective: you can have Zone a = Zone b without a = b
15:42 <MitchellSalad> I wonder if GHC would let you write such an instance if Zone was injective though?
15:43 <Cale> It will -- in order to make sure it's injective, you can use a data family instead.
15:43 <glguy> We have injective type families in GHC 8, but it wouldn't make sense to provide an instance for one
15:43 <Cale> Oh
15:43 <MitchellSalad> yeah I meant an injective type family, not a data family
15:43 mmachenry joined
15:43 <glguy> The problem isn't injectivity, it's that they're aliases for other types.
15:43 <MitchellSalad> glguy: hm? that's not a problem
15:43 <glguy> It's like pattern matching on an arbitrary function instead of a value constructor
15:43 <Cale> ah, I wasn't aware those were a thing -- I suppose it might make sense
15:44 cdg joined
15:44 <Cale> But it would mean that when doing instance resolution, GHC would have to invert all the possible injective type families to see if an instance matched, which would suck.
15:44 <glguy> Cale: I think they're restricted to closed type families
15:45 <Cale> also, it gets quite hard to tell if instances are overlapping
15:45 <paolino> I'm confused now
15:46 <paolino> what if I put a constraint on Zone a in a function
15:46 <Cale> (you have to intersect the ranges of your injective type families and make sure there's no overlap)
15:47 <paolino> it compiles, but you said I cannot write an instance for it
15:47 <glguy> paolino: If you have a 'type family Zone a', and a function 'stuff :: C (Zone a) => a -> a'
15:47 theelous3 joined
15:47 <glguy> then you need an instance on whatever type Zone a evaluates to
15:47 baweaver joined
15:47 <glguy> paolino: so suppose type instance Zone Int = Bool
15:47 <MitchellSalad> ghc won't allow this instance even if Zone is injective, btw. I just tried it
15:47 abhiroop joined
15:47 <paolino> that's not in the same position as the constraint in an instance
15:47 conal joined
15:48 <Cale> MitchellSalad: Yeah, that makes sense, the things I was proposing would need to happen are onerous and silly.
15:48 whiteline joined
15:48 mjhoy joined
15:48 <glguy> It doesn't matter if the type family is injective, you need to konw what it evaluates to so you can attach the instance to that type
15:49 <mjhoy> can i rexport a module under a qualified name? e.g. reexport Data.Text qualified as T ?
15:49 <glguy> no
15:49 oisdk joined
15:49 <Cale> I suppose if it's for closed injective type families, you could have it unfold *all* the possible types
15:49 hazyPurple_ joined
15:50 <Cale> and just be as if you wrote the instances for each of them
15:50 <ph88_> fresheyeball, looks more like an enum than a union to me
15:50 <Cale> That could be reasonable, though it might result in a very large amount of code being generated.
15:51 <dolio> An infinite amount of code.
15:51 glamas joined
15:51 sproingie joined
15:51 sw1nn joined
15:51 <Cale> dolio: For closed type families?
15:51 <dolio> Sure.
15:52 <Cale> I just mean, you substitute in each of the finitely many instances in all possible ways
15:52 <MitchellSalad> glguy: ah, you're right! of course
15:53 <fresheyeball> ph88_: interesting
15:53 <paolino> with data family the types are already known so it's possible to "attach" ?
15:53 <fresheyeball> I should play around with what is Enum derivable and what is not
15:53 <glguy> Right, data families are like data and newtype, they don't evaluate away. They are distinct types from all other types
15:54 <paolino> well Zone :: * -> * is known
15:54 <ph88_> hhmm i just found out that MonadIO m => m is the same as IO
15:55 peterbecich joined
15:55 <Cale> paolino: Suppose I want to define a function f: R -> R. Is it okay if I say something like for all x in R, f (sin x) = x^2?
15:56 carlosda1 joined
15:56 jer1 joined
15:56 sleffy joined
15:56 <Cale> Even if I want to define f: [-1,1] -> R, this has a problem
15:56 abhiroop joined
15:56 <paolino> I'm ok with injectiveness
15:56 <Cale> In that there are many values of x which will give any given value sin x
15:56 slomo joined
15:57 <Cale> So, okay, think about the job that the instance resolver has to do
15:57 <paolino> I think I understand when I get the NB, tf might not be injective
15:57 <Cale> It sees something like include x y and it might know the concrete types of x and y
15:57 <paolino> but yeah, I don't now the machinery for typeclasses
15:58 <ph88_> what's the difference between an Int64 and Word64 ?
15:58 <Cale> perhaps x :: Int and y :: String
15:58 <Cale> paolino: and then it has to look at your instance for Include (Zone a) (Location b a) and ask "does this match?"
15:59 osa1 joined
15:59 <Cale> paolino: It might! But it might do so in more than one possible way. Perhaps Zone a is Int for many different types.
15:59 <Cale> I guess we'd need y :: Location something something
16:00 <Cale> paolino: Actually you might be able to get the effect you want
16:00 <Cale> with a type equality constraint
16:00 <paolino> oh b is another kind
16:00 <Cale> because of this Location bit
16:01 <Cale> What if we made it instance (Include (Zone a) (Zone a), Include (Zone a) (Place a), c ~ Zone a) => Include c (Location b a) where
16:01 abhiroop joined
16:02 <paolino> goes undecidable
16:03 <ph88_> why does this parser take a parser ? https://hackage.haskell.org/package/attoparsec-0.13.1.0/docs/Data-Attoparsec-ByteString-Char8.html#v:signed
16:03 <Gurkenglas> What library should I use to fetch https pages?
16:03 <Cale> paolino: well, that's okay
16:03 <Cale> turn on UndecidableInstances
16:04 <byorgey> ph88_: I think the idea is that the argument is a parser for some kind of (unsigned) number
16:04 <Cale> paolino: What that'll do then is commit to the instance immediately
16:04 <byorgey> ph88_: so you could say 'signed integer' or 'signed float' etc. (assuming 'integer' and 'float' are parsers to parse unsigned integers and floats)
16:04 <ph88_> ah ok
16:04 <Cale> paolino: as soon as it sees that the second argument to Include is of the form Location b a
16:04 <paolino> Cale it compiless
16:04 mohsen_ joined
16:05 beanbagula joined
16:05 <Cale> paolino: The part before the => is always ignored by the instance resolver when trying to decide which instance matches
16:05 Sonolin joined
16:05 <Cale> paolino: So, it can say "okay, we're committing to this one"
16:05 <Cale> and then after that, it will check the stuff before the =>
16:06 <Cale> in particular, it will insist that c is Zone a, and give you an error if it's not.
16:07 <paolino> ah
16:07 jao joined
16:08 hazyPurple_ joined
16:08 <ph88_> if i want to keep track of some state can i just prefix the type signature with StateT ?
16:08 <* paolino> is asked to identify by ghc after last modification
16:08 flatmap13 joined
16:08 afarmer joined
16:09 <* paolino> admitted this was Cale
16:09 <Cale> paolino: and yeah, the instance is undecidable now -- that just means that the usual property which guarantees that the instance resolver terminates has been violated... depending on what other instances there are and how you define these type families, it might be possible to make the compiler go into an infinite loop
16:10 <Cale> Rather, it's not that the instance on its own is undecidable, but that it has a property which makes instance resolution in general potentially undecidable.
16:11 <paolino> Never got the "instance head bigger" proglem
16:13 <paolino> I suppose I must take some time to understand typeclasses more
16:14 <OnkelTem> How to search for a package using stack?
16:15 <OnkelTem> if I need for example "snap" packages, how can I a) see what versions are available b) install packages c) add dependecies to .cabal file?
16:15 <paolino> Thanks Cale, glguy, MitchellSalad for this
16:16 S1 joined
16:16 <Cale> OnkelTem: Start by adding the dependency to your .cabal file, and then it will install an appropriate version of snap for you
16:16 jer1 joined
16:16 <Cale> OnkelTem: It won't edit the .cabal for you, as far as I'm aware
16:17 <Cale> But it will examine it when figuring out which dependencies to install in order to build the package
16:17 <OnkelTem> Cale: where should I place my deps - in library part or executable?
16:18 <glguy> OnkelTem: Everywhere you're using them
16:18 <Cale> Whatever part they're dependencies of
16:18 <glguy> OnkelTem: If your library has dependencies, then those go into the lib section
16:18 <glguy> if your executable has them, same story
16:18 <glguy> You don't need to list your library's dependencies in your executable
16:18 <glguy> (but you do need to depend on your library)
16:18 <OnkelTem> I don't know what is called library and what is not :) Would you point me to some reading?
16:19 mizu_no_oto_work joined
16:19 <OnkelTem> I just try to start
16:19 <OnkelTem> for the 3rd damned day
16:19 <Cale> OnkelTem: It might be confusing because the initial project that stack makes for you defines both a library and an executable
16:19 <OnkelTem> Cale: that's exactly what I see yeah :)
16:19 <Cale> OnkelTem: If your project is just one or the other, you might want to get rid of the other section in your .cabal file
16:20 iomonad joined
16:20 <sm> OnkelTem: for a, go to https://www.stackage.org/package/snap, or https://www.stackage.org/lts (eg) and search in page for "snap"
16:21 abhiroop joined
16:22 dhil joined
16:22 <abhiroop> I was looking at the Data.Graph library
16:22 codesoup joined
16:22 <abhiroop> @hoogle graphFromEdges'
16:22 <lambdabot> Data.Graph graphFromEdges' :: Ord key => [(node, key, [key])] -> (Graph, Vertex -> (node, key, [key]))
16:22 <abhiroop> What does the node typevariable here stand for?
16:22 gcross_ joined
16:23 coot joined
16:23 <abhiroop> I have type Vertex = Text as the key
16:23 <abhiroop> I am just wondering about the node type variable
16:24 <Cale> abhiroop: It can be any type at all
16:25 <Cale> abhiroop: Some type with which the vertices are going to be labelled
16:25 <abhiroop> So I am just interested in the Graph type here
16:26 <abhiroop> SO from the docs type Graph = Table [Vertex]
16:26 <sm> OnkelTem: for reading: https://www.haskell.org/cabal/users-guide/developing-packages.html
16:26 <abhiroop> So do i get Table [Vertex] as the result here?
16:26 <OnkelTem> sm: thanks!
16:26 <Cale> abhiroop: yeah
16:26 <abhiroop> where in my case type Vertex = Text
16:26 <abhiroop> Okay great!
16:27 <Cale> abhiroop: btw, Data.Graph is kinda terrible under a lot of circumstances -- depending on how you're using the graphs
16:27 <abhiroop> i have a list of dependencies
16:27 <abhiroop> I wanted a topological sort on them
16:27 hazyPurple_ joined
16:27 <abhiroop> The Data.Graph library has an in built function for that
16:27 <Cale> I guess if all you're going to do is topSort and be done with it, that's fine
16:28 <Cale> and don't need to edit the graph much
16:28 <abhiroop> Yup mostly that
16:28 soLucien joined
16:28 <Cale> So, you can put information about what the dependencies are in those 'node' bits.
16:28 <ph88_> is there maybe a nicer (shorter) way to write function for record ? https://bpaste.net/show/e32f0573fca8
16:28 <Cale> and the function that it gives you will recover that information from the Vertex
16:29 Dr8128 joined
16:30 <Cale> ph88_: You *can* write toggle (StreamState b) = StreamState (not b)
16:30 <Cale> ph88_: But then that definition needs to be maintained every time you add a new field
16:30 <Cale> and it starts becoming unclear what such a definition does, if there are many fields
16:30 <ph88_> ya ok .. so no joy
16:30 <Cale> You could also use lenses
16:31 <Cale> toggle = over foundStartOfMeasurement not
16:32 <ph88_> can i also pattern match on a record ?
16:32 <Cale> yes
16:33 muesli4 joined
16:33 ixxie joined
16:33 des_ joined
16:33 <Cale> toggle state@StreamState { _foundStartOfMeasurement = b } = state { _foundStartOfMeasurement = not b }
16:34 <Cale> probably a little worse :P
16:35 Noldorin joined
16:35 Mighty_Warthog joined
16:36 forgottenone joined
16:36 aarvar joined
16:37 jer1 joined
16:37 gcross_ joined
16:37 detrumi joined
16:38 orhan89 joined
16:38 <ph88_> Cale, when i try to pattern match {_foundStartOfMeasurement = started} <- lift get i get parse error on input ‘{’
16:38 steeze joined
16:38 zeroed joined
16:38 zeroed joined
16:39 <Cale> You left out the data constructor
16:39 <cocreature> ph88_: you need the constructor name
16:39 <ph88_> oh
16:39 fizbin joined
16:39 Robin_Jadoul joined
16:40 splanch_ joined
16:40 <Cale> You know, that would be another design path
16:40 <Cale> Decide that instead of having record types with overlapping field names, we'll just do away with the data constructors for record types
16:41 {emptyset} joined
16:41 <Cale> and determine which type is meant by the fields present.
16:41 <Cale> Doesn't quite work out so nicely
16:41 <Cale> But almost :)
16:42 <Cale> (then again, I hate all the overlapping field shenanigans too)
16:42 earldouglas joined
16:42 <Cale> (I might actually hate this idea slightly less)
16:43 peterbec` joined
16:45 hazyPurple_ joined
16:46 dubois joined
16:46 bhiliyam joined
16:46 butterthebuddha joined
16:47 revprez_atlanta joined
16:50 <ph88_> No instance for (Fractional Int64) arising from the literal ‘0.001’ In the expression: i2 - i1 > 0.001 why do i get this error ?
16:50 <ph88_> if i2 and i1 are Int64 then why does it want Fractional ?
16:51 <geekosaur> because 0.001 is Fractional
16:51 <geekosaur> what Int64 value is represented by 0.001?
16:51 <geekosaur> :t (-)
16:51 <lambdabot> Num a => a -> a -> a
16:52 oisdk joined
16:52 <Cale> :t (>)
16:52 <lambdabot> Ord a => a -> a -> Bool
16:52 abhiroop joined
16:53 arpl left
16:53 cfricke joined
16:53 conal joined
16:54 <geekosaur> (perhaps more to the point, when will any two Int64 values differ by an amount that is not Integral?)
16:55 Mighty_Warthog joined
16:56 butterthebuddha joined
16:56 raichoo joined
16:56 carlosda1 joined
16:57 <monochrom> Sometimes, you what to ask "where" rather than "when", in order to cue the answer "over my dead body" :)
16:57 sz0 joined
16:57 des_ joined
16:58 abhiroop joined
16:58 jer1 joined
16:59 t7 joined
16:59 <monochrom> Actually, for integers i1 and i2, i2-i1 > 0.001 iff i2-i1>0.
17:01 <geekosaur> yes, but that does not answer my question :)
17:01 <monochrom> Over my dead body!
17:02 <* monochrom> decides to leave it ambiguous
17:02 connrs joined
17:03 ralu joined
17:03 hazyPurple_ joined
17:03 flatmap13 joined
17:05 fizruk joined
17:06 gnull joined
17:06 <gnull> Hello everyone!
17:06 xmonader joined
17:07 ebzzry joined
17:08 <gnull> I have a little trouble with understanding haskell channels (Control.Concurrent.Chan)
17:09 <gnull> I want to run some programs in parallel threads, then collect their outputs into the main thread
17:09 Mighty_Warthog joined
17:10 feynhat joined
17:11 <gnull> I create a Control.Concurrent.Chan and start many threads using Control.Concurrent.ThreadManager.fork
17:11 steeze joined
17:11 bvad joined
17:11 butterthebuddha joined
17:12 <gnull> Each of such threads runs some program with System.Process.readProcess, puts its output into the channel, and exits
17:12 <gnull> The main thread gets the data from the channel
17:14 <gnull> The problem is that the main thread can't determine if the child threads have already written all the data to the channel or they are still running
17:15 <glguy> gnull: You'll need to signal in the channel that all the data has been sent if the data can span multiple messages
17:15 <glguy> For example (Chan (Maybe Msg)) where Nothing signals the end
17:16 <gnull> I tried using Control.Concurrent.STM.TMChan that supports closing the channel, but there is another problem with it.
17:16 <gnull> glguy: TMChan seems to do this
17:16 beech joined
17:16 <gnull> But closing the channel by one of the child threads will close it for all of them
17:17 chbatey joined
17:17 theelous3 joined
17:17 <beech> Has anybody here bought 'Haskell Programming from First Principles'?
17:17 trism joined
17:18 hazyPurple_ joined
17:18 <glguy> then instead of Nothing, you can have: data Message = Done WorkerId | Content WorkerId SomeContent
17:18 insitu joined
17:18 <gnull> glguy: Probably, I could make the main thread read the data from Chan until it receives N Nothing's, where n in the number of child threads.
17:18 aglorei joined
17:18 jer1 joined
17:19 <beech> How am I able to get the latest version of HaskellBook? I have an old version of the book and no longer have the email I bought it with.
17:19 <gnull> glguy: Yes, that would be better
17:21 <gnull> glguy: I hoped that there is an out-of-the box haskell primitive like 'closable channel with N inputs and single output'
17:21 sergrest joined
17:21 Mighty_Warthog joined
17:22 <gnull> glguy: But your solution is also good. Thank you.
17:22 Mighty_Warthog joined
17:22 Mighty_Warthog joined
17:22 Mighty_Warthog joined
17:22 dhil joined
17:22 Mighty_Warthog joined
17:24 kosorith joined
17:24 toure joined
17:26 chlong joined
17:27 soniku joined
17:27 Supersonic112 joined
17:27 burtons_ joined
17:27 slomo joined
17:29 mr_sm1th joined
17:30 <gnull> glguy: How common is this approach for solving problems like this? Isn't there a way to achieve this without implementing some kind of protocol on data passed through channel?
17:31 Denommus joined
17:31 <glguy> gnull: If what you want to do is already implemented in the "async" package, then I'd use that. If you need something custom you'll have to write it. There are a lot of small variations around what you might actually want a solution in this space to do
17:32 <mmachenry> Did anyone see that Haskell is the most nocturnal language on StackOverflow? https://stackoverflow.blog/2017/04/19/programming-languages-used-late-night/
17:32 cables joined
17:35 <Tuplanolla> That post made me realize that I hardly ever use Stack Overflow for Haskell questions, mmachenry.
17:35 xmonader joined
17:36 dcoutts_ joined
17:36 <mmachenry> Tuplanolla: You're part of the problem. :) People look to those asking questions on StackOverflow for how popular the language is.
17:36 srbaker joined
17:37 <gnull> glguy: Yes, async is also close to what I want, but not exactly. Looks like I'll have to write a little bit of code by myself :)
17:37 <Tuplanolla> Don't blame me, mmachenry. Haskell doesn't have enough common problems with stupid workarounds.
17:38 jmelesky joined
17:38 hazyPurple_ joined
17:39 jer1 joined
17:39 <Tuplanolla> Like "what standards or platforms provide `va_copy`" or "is GCC's `__thread` a drop-in replacement for `_Thread_local`".
17:39 <mmachenry> Tuplanolla: I blame Simon. Add more WAT!! and we'd be the next big thing.
17:41 SpinTensor joined
17:41 kthnnlg joined
17:42 mivael joined
17:42 flatmap13 joined
17:44 peterbec` joined
17:45 m3adi3c joined
17:46 wroathe joined
17:47 yogsotot_ joined
17:47 abhiroop joined
17:48 somewone joined
17:49 robertkennedy joined
17:50 MarioBranco joined
17:51 cyborg-one joined
17:53 steeze joined
17:54 robertkennedy joined
17:54 BlueRavenGT joined
17:55 <robertkennedy> Does this look like the right way to consume streaming results `consume f handle = go mempty where go acc = do {next <- get handle; if null next then return acc else let acc' = mappend acc (f acc) in acc' `par` go acc'}`
17:57 carlosda1 joined
17:57 hazyPurple_ joined
17:58 <robertkennedy> Hopefully the types are clear enough. In particular `get :: Handle -> IO [a]` and `f :: Monoid m => [a] -> m`
17:59 <EvanR> par ?
18:00 <robertkennedy> From Control.Parallel
18:00 ebzzry joined
18:00 Supersonic112 joined
18:01 lazar joined
18:01 abhiroop joined
18:01 <EvanR> is accumulating expensive enough to benefit (and not unbenefit) from parallelism?
18:02 path[l] joined
18:02 splanch joined
18:02 <robertkennedy> The usecase is counting occurrences from 11mm objects streamed from Handle. The parallelism seems to allow the handle to immediately continue streaming.
18:03 jer1 joined
18:03 <lazarljubenovic> Just wanted to drop by to say that, my first two hours into Haskell ever, and I'm already in love.
18:03 <koala_man> lazarljubenovic \o/
18:03 <koala_man> it just gets better
18:03 <EvanR> another satisfied customer
18:04 <Tuplanolla> Then you see Template Haskell and hit the Lisp envy.
18:04 connrs joined
18:04 <EvanR> no i do not
18:04 <Tuplanolla> Then you see kind extensions and hit the Idris envy.
18:04 <EvanR> when generics doesnt work, i envy some even better language feature and not lisp
18:05 syx left
18:05 mizu_no_oto_work joined
18:05 fotonzade joined
18:06 cyberlard joined
18:06 <lazarljubenovic> Can't wait to explore more :) But pattern matching already blew me away. And I'm NOT easy to impress!
18:06 insitu joined
18:06 <EvanR> yeah other languages are jumping on the pattern matching band wagon
18:07 wroathe joined
18:07 <EvanR> it makes functional algorithms incredibly easy to express
18:08 osa1 joined
18:08 uglyfigurine joined
18:09 <Tuplanolla> Then you see rewrite rules and... I don't actually know a single language where that's pleasant.
18:13 abhiroop joined
18:14 <ph88_> is there any way i can bring variables in scope in a where function without passing them as arguments ?
18:15 asmyers joined
18:16 <geekosaur> no? unless they're parameters to the outer function
18:16 <EvanR> theres ImplicitParameters
18:16 <Tuplanolla> You could use record wildcards too.
18:17 <EvanR> sort :: (?cmp :: a -> a -> Bool) => [a] -> [a]
18:17 <EvanR> sort = sortBy ?cmp
18:17 <EvanR> i havent seen a good usecase for this
18:17 <mivael> hi
18:17 richi235 joined
18:17 <mivael> > let freq = accumArray (+) 0 (1, 10) . map (head &&& length) . group . sort $ myList; myList = [4,1,7,6,9,1,3,3,8,1,1,1,1,1,1,1,1,1,1,1,1] in (elems freq)
18:17 <lambdabot> [14,0,2,1,0,1,1,1,1,0]
18:18 <Tuplanolla> The syntax would be `f Args {..}`.
18:18 ystael joined
18:18 <mivael> Is there faster way to calculate the above 'freq' without using immutable types?
18:18 ludat joined
18:18 <ph88_> mivael, how fast is it now ?
18:19 <mivael> (Number of occurrences of each number of the input list)
18:19 whaletechno joined
18:19 xcmw joined
18:19 nschoe_ joined
18:19 <EvanR> ImplicitParams actually
18:20 StoneToad joined
18:20 <mivael> ph88_, I mean I would want to avoid "log N" multiplier in O(N * log N) due to sorting.
18:20 robkennedy joined
18:21 <mniip> you'd need a hashtable
18:21 <ph88_> mivael, just out of curiosity .. would you be able to make it faster in big-O in another language ?
18:21 <mniip> with O(1) amortized insert
18:21 <mniip> /lookup
18:22 <reactormonk[m]> What's the haskell equivalent to elm Never? (aka a type with no inhabitants)
18:22 jer1 joined
18:22 <ph88_> reactormonk[m], you mean a type without data constructors? there is an extension for that
18:22 <sternenseemann> reactormonk[m]: import Data.Void (Void (..))
18:23 <mivael> ph88_, yes, this is O(N), in one pass (providing O(1) access to frequency array by index)
18:23 <sternenseemann> > :i Void
18:23 <lambdabot> <hint>:1:1: error: parse error on input ‘:’
18:23 <sternenseemann> > undefined :: Void
18:23 <lambdabot> *Exception: Prelude.undefined
18:23 fizruk joined
18:23 <mniip> mivael, frequency *array*?
18:23 <mniip> there's a bound on the largest element?
18:24 <mivael> mniip, yes
18:24 <ph88_> that function is so difficult to read :/
18:24 <mniip> what is it
18:24 <sternenseemann> reactormonk[m]: http://hackage.haskell.org/package/base-4.9.1.0/docs/Data-Void.html
18:24 meoblast001 joined
18:24 Gentilhomme joined
18:24 <reactormonk[m]> A nice way to write https://gist.github.com/dc48bb0070e74e69d8e43361b0ed4c74 ?
18:24 <mniip> mivael, if the upper bound is K,
18:25 <mniip> then it's impossible to do it in under N log K time
18:25 <sternenseemann> reactormonk[m]: totally fine, the code
18:25 <mivael> ph88_, yes, there is a bound (minimal possible and maximum possible value for an element of input list -- sorry I did not mentioned this in my question)
18:26 <ph88_> geekosaur, do you know why ghc reports my record update line is now a function that is applied to 4 arguments? https://bpaste.net/show/95cc54c16387
18:26 <reactormonk[m]> sternenseemann: doesn't compile, because InvalidRequest is in there twice.
18:26 <reactormonk[m]> I'll take Void, thanks.
18:27 sssilver joined
18:27 Dr8128 joined
18:27 theorbtwo joined
18:28 <geekosaur> ph88_, because you missed 'do' on line 32
18:28 sepp2k joined
18:28 mjhoy joined
18:28 <geekosaur> so the following lines are all part of the expression starting with `modifyState`
18:28 <ph88_> i add do and it compiles without error
18:29 <ph88_> -____-
18:29 <ph88_> ok well nice function
18:29 biglama joined
18:29 <geekosaur> and the do you put on line 30 does nothing since it's only one expression not using do syntax :)
18:30 yellowj joined
18:30 <mivael> mniip, why? in an imperative language and with O(1) access to array elements it seems to be O(max(N,L)): iterating through the input list -- O(N) -- and increasing a counter in an output array -- O(1)... Generally we also need to initialize output array with zeros -- O(L).
18:30 <ph88_> geekosaur, but it looks like i'm do-ing more work as programmer :P
18:31 <mniip> mivael, if you use a hashtable you can go down to O(N)
18:31 <ph88_> hurray for hashtables !
18:31 <mniip> but
18:31 <mniip> that's mutable datatypes
18:31 <mivael> mniip, is it an immutable type in Haskell?
18:32 <mniip> no
18:32 <mniip> you need to store an array of uniq(L) values
18:33 mizu_no_oto_work joined
18:33 <mivael> I also could use mutable arrays, but my question is about doing it using immutable types
18:33 <mniip> with immutable haskell types access to such array can't be under log(uniq(L))
18:33 locallycompact joined
18:33 <jackhill> llcdvfvbugguchghctfinverhvfvfvfd
18:33 <jackhill> sorry!
18:33 <mniip> unless you use Array but then it's a very long write
18:34 <mivael> mniip, thanks!
18:35 <mniip> now, I don't have a formal proof,
18:35 <mniip> but in a finite haskell program all datatypes have a bounded number of fields
18:35 <mniip> and the only way you can represent an unbounded array is with a tree of some shape
18:35 Itkovian joined
18:35 EvanR_ joined
18:36 <mniip> (Array is not a tree of some shape, but its implementation is fairly unmathematical)
18:36 <EvanR_> uh are there anything other than finite haskell programs
18:36 <mivael> mniip, I understand
18:36 xcmw joined
18:36 <EvanR_> also arrays implementation as silicon suffers from the same log(n) limitation technically
18:38 ystael joined
18:39 sleffy joined
18:39 kamog joined
18:40 tristanp_ joined
18:41 bennofs1 joined
18:41 <mivael> mniip, I was just inspired by a blog post on lazy dynamic programming (http://jelv.is/blog/Lazy-Dynamic-Programming/) and I thought that maybe there is a way to hide the actual mutations using laziness or so...
18:42 <mivael> mniip, EvanR_, ph88_: thank you for your help
18:43 jer1 joined
18:45 simendsjo joined
18:45 foton joined
18:45 chlong joined
18:45 insitu joined
18:46 mmhat joined
18:47 bhiliyam joined
18:47 uelen joined
18:48 splanch joined
18:48 wroathe joined
18:49 unK_ joined
18:49 FjordPrefect joined
18:50 gawen joined
18:51 sellout- joined
18:52 raynold joined
18:53 BartAdv joined
18:54 epsilonhalbe joined
18:56 <ph88_> let is not working here on line 7 https://bpaste.net/show/7caa2bdff59c what should i use instead ?
18:57 <geekosaur> once again, do notation... or rephrase as let-in
18:58 carlosda1 joined
18:58 <ph88_> geekosaur, is there an elegant way to avoid that go function on line 3 ? it seems to have little purpose
18:58 <EvanR> do notation or don't notation, thats the question
18:59 <geekosaur> you could rephrase as awaitForever $ \result -> case result of ...
19:00 <geekosaur> although in this case I think I'd stay with the go function and absorb the case on result into it
19:00 magneticduck joined
19:00 <geekosaur> go (Left e) = ...; go (Right (posRange, numbers)) = ...
19:01 <mniip> don't launchMissiles
19:01 <geekosaur> @hachage acme-dont
19:01 <lambdabot> http://hackage.haskell.org/package/acme-dont
19:02 <mniip> word
19:02 <ph88_> can be useful instead of using comments
19:03 gcross joined
19:03 abhiroop joined
19:04 jer1 joined
19:05 revprez_atlanta joined
19:05 <Hafydd> don't $ do it
19:06 <* mniip> . o O ( IOT Proxy )
19:09 coot_ joined
19:09 <lyxia> Internet Of Things Proxy
19:09 <mniip> > runIOT $ lift Proxy >> liftIO (putStrLn "hi")
19:09 <mniip> Proxy
19:09 wroathe joined
19:09 WarmCookie joined
19:10 <scav> will this ever return?
19:10 <scav> tail [1..] ?
19:10 <mniip> depends on your definition of return
19:10 <jle`> > head (tail [1..])
19:10 <mniip> as far as haskell's notion of strictness is concerned - yes
19:10 <lambdabot> 2
19:11 <mniip> it can be evaluated to WHNF
19:11 <mniip> tail [1..] = _ : _
19:11 <geekosaur> scav, the answer depends on the circumstances
19:11 <scav> i meant in any meaningful sense, as in what value will it actually return? is it limited by maxbounds e.g.?
19:12 <jle`> scav: the value it returns is [2..]
19:12 <geekosaur> > take 3 $ tail [1..]
19:12 <lambdabot> [2,3,4]
19:12 darjeeling_ joined
19:12 <mniip> it will return a value representationally equivalent to [2..]
19:12 <geekosaur> that seems a perfectly meaningful sense...
19:12 <jle`> scav: and you can do whatever you'd do with [2..]
19:12 featherlessbiped joined
19:12 <jle`> > head [2..]
19:12 <lambdabot> 2
19:12 <jle`> > head (tail [1..])
19:12 <mniip> [2..] defaults to [Integer], so no
19:12 <lambdabot> 2
19:12 <mniip> no maxBounds
19:13 <geekosaur> since it's Integer, it will produce until you run out of memory to hold the value, which will take a while :)
19:13 <scav> you get 2 by doing 'head [1..]' and nothing else?
19:13 <jle`> scav: no
19:13 <jle`> 2 is head [2..]
19:13 <jle`> head (tail [1..]) = head [2..] = 2
19:13 <jle`> math is power ~
19:13 <geekosaur> even if it were Int or Int32, neither one checks bounds and neither does Enum, so it would just wrap around
19:13 sleffy joined
19:14 <scav> jle` i was kinda leading that question along.
19:14 <mniip> > [maxBound..] :: [Int]
19:14 bollu joined
19:14 <lambdabot> [9223372036854775807]
19:14 <scav> geekosaur ah
19:14 <mniip> geekosaur--
19:14 <jle`> scav: tail [1..] returns [2..], so head (tail [1..]) is the same as head [2..]
19:14 <jle`> scav: which is 2
19:14 <geekosaur> oy
19:14 <jle`> so yes, tail [1..] does return immediately with [2..]
19:15 <mniip> "immediately"
19:15 <scav> by not using head, are you ever going to see 2?
19:15 <mniip> in this context it's within finite time or not :p
19:15 <mniip> scav, you could write your own head
19:15 <jle`> well,the way tail is defined, it's pretty much afte rone evaluation step
19:15 guiraldelli joined
19:15 <jle`> tail (x:xs) = xs, so tail (1:[2..]) = [2..]
19:15 <mniip> > (\(x:xs) -> x) (tail [1..])
19:15 <lambdabot> 2
19:15 <mniip> look ma no head
19:16 <jle`> if you consider [1..] = 1:[2..], then tail (1:[2..]) = [2..] 'immdiately', from the definition of tail
19:16 <jle`> immediately in the mathematical sense, heh
19:16 <jle`> no extra reduction steps required
19:16 <geekosaur> scav, there's a reason people are evading your direct question: *asking* that question strongly suggests misunderstanding of laziness
19:17 <mniip> their direct question makes no sense is all
19:17 <jle`> scav: if you consider the denotational semantics, tail [1..] directly returns, denotatively, [2..]. tail [1..] is operationally and denotatively identical to [2..]
19:17 <jle`> so whatever you'd do with [2..] is what yu'd do with tail [1..]
19:18 <jle`> but instead of htinking of [2..] like something that exists in memory, think of it as an abstract concept
19:18 Denommus joined
19:18 <jle`> that *represents* the list [2..] forever
19:18 cables joined
19:19 coot joined
19:19 <jle`> the abstract idea of [1..] is a list that starts from 1 and goes on forever, the abstract idea of [2..] is a list that starts from 2 and goes on forever, and tail [1..] represents the same thing that [2..] represents
19:19 dsh joined
19:19 <scav> geekosaur yes, perhaps it would have been easier to just ask how long [1..] could potentially run for. i understand how everything after 1 is returned
19:19 <jle`> [1..] isn't "run"
19:20 <jle`> it represents a list, mathematically
19:20 <jle`> it can be manipulated using functions like head, tail, etc.
19:20 <mniip> are you asking what is the largest Integer?
19:20 <jle`> [1..] isn't actually any data structure containing 1, 2, 3, et.c in memory
19:20 marr joined
19:20 MrWoohoo joined
19:20 <mniip> the answer is 2^(2^64 + 64)
19:20 ohsix joined
19:21 <jle`> if you're familiar with python iterators/generaotrs, it's a similar concept
19:21 <scav> so it will hold every number from 0 to the largest number possible?
19:21 <mniip> no
19:21 <jle`> it doesnt "hold" numbers
19:21 <mniip> well
19:21 <mniip> it will hold, but not in memory
19:21 <jle`> heh yes
19:22 <mniip> > 718474 `elem` [1..]
19:22 <lambdabot> True
19:22 <mniip> see, it contains the number 718474
19:22 coot joined
19:22 Destol joined
19:22 <mniip> yet, even during evaluation of that, not more than a single Integer was contained in memory
19:22 gcross_ joined
19:22 chrisdotcode joined
19:23 flatmap13 joined
19:23 nitrix joined
19:23 nitrix joined
19:23 nschoe_ joined
19:23 <mniip> (that's actually a fairly strong statement depending on the implementation of elem, ||, and enumFrom, but I think I am correct)
19:24 <jle`> scav: it *represents* a list starting from 1, 2, 3, etc. forever
19:24 jer1 joined
19:24 <jle`> it doesn't mean that it actually contains 1, 2, 3, etc. in memory
19:25 <jle`> its operations like head, tail, elem, etc. work on the idea that [1..] represents
19:25 <jle`> and not on some actual infinitely large data structure in memory
19:25 <mniip> (actually, head, tail, elem don't care)
19:25 <scav> that is purely semantics, as i would argue that the abstract concepts to represent that is contained in memory
19:25 <mniip> sure
19:25 <EvanR> we work with abstract objects directly ;)
19:25 <jle`> yes, this is semantics
19:26 <mniip> there's an enumFrom closure
19:26 <mniip> pointing to an Integer 1
19:26 <EvanR> because you cant tell what it "really is" because "what it really is" has been erased by abstraction
19:26 <jle`> scav: sure, but "returning [2..]" doesn't mean that you literally return an infinite list in memory
19:26 Matajon joined
19:26 <jle`> scav: tail [1..] immediately returns [2..]
19:27 <jle`> just from the definition of tail, and [1..]. [1..] is 1:[2..], and tail (x:xs) = xs, so tail (1:[2..]) = [2..]
19:27 <EvanR> you cant tell its not an infinite list in memory
19:27 <EvanR> because theres no observable difference
19:27 <* mniip> . o O ( does [1..] ++ [] "immediately" return )
19:27 <scav> jle` no, i understand that, i also understand how it is possible - i was merely curious about any actual limits to it
19:27 <jle`> limits to what?
19:27 <mniip> scav, that depends on what you do with it
19:27 <EvanR> only the limits imposed by the OS
19:27 <mniip> like, a lot
19:28 <jle`> limits to how much of [1..] you can expand and store in-memory?
19:28 <scav> EvanR thank you
19:28 <EvanR> see the generic versions of the list operations
19:28 <EvanR> :t genericIndex
19:28 <lambdabot> Integral i => [a] -> i -> a
19:28 coot joined
19:28 <EvanR> not that accessing something farther than max 64bit int will ever happen
19:29 <jle`> scav: this is a different question than tail [1..], though; it's a question about how much of [2..] you can expand/evaluate/store in memory
19:29 <mniip> scav, if you do something like 'reverse [1..]'
19:29 <mniip> it will have to contain the entire list in memory
19:29 <scav> jle` questions evolves - after your initial response and after getting the semantics out of the way it was easier to formulate the question
19:29 <mniip> so you'll run out of memory after a couple billion integers
19:30 <EvanR> if you do something like reverse [1..] you get _|_
19:30 sproingie joined
19:30 <EvanR> and memory means nothing
19:30 wroathe joined
19:30 soniku joined
19:30 bollu joined
19:30 <mniip> if you do something like 'filter (const False) [1..]'
19:30 steeze joined
19:30 <mniip> it will only contain a single integer in memory
19:30 <mniip> so you might actually get closer to 2^40
19:31 <mniip> er
19:31 m3adi3c joined
19:31 <seequ_> And the structures for that expression
19:31 <mniip> so you might actually get closer to 2^(2^40)
19:31 <mniip> once you survive the heat death of the universe of course
19:31 <EvanR> screw the universe lets get abstract
19:32 <mniip> filter (const False) is actually constant time
19:32 <mniip> er
19:32 <mniip> constant space
19:32 coot joined
19:32 kirillow joined
19:32 <Tuplanolla> The fact that you die first doesn't make the solution any less unsatisfying.
19:33 hybrid joined
19:33 <mniip> closure(x) -> whnf x; if x is [] then return []; if x is _:y then tailcall closure(y)
19:33 michielb joined
19:34 <EvanR_> Tuplanolla: that might be the answer ultrafinitists were looking for
19:34 <EvanR_> when asked exactly what the limit of finite is
19:35 xificurC joined
19:38 dsh joined
19:39 <mniip> I think we scared them away
19:39 <mniip> I think I scared them away :(
19:39 <scav> na, i just don`t have much more to add
19:40 <scav> only been doing haskell for a couple of days so far, so i guess my question was pretty dumb
19:40 <Tuplanolla> In the space of inquiry, almost all questions are dumber.
19:41 <mniip> well
19:42 <mniip> unlike C, in haskell the question of how something is computed/stored in memory is a rather advanced concept
19:42 <mniip> that has many, many prerequisited
19:42 mmachenry joined
19:43 bollu joined
19:43 <jle`> scav: definitely not a dumb question :)
19:44 dsh joined
19:44 coot joined
19:45 jer1 joined
19:45 balor joined
19:46 peterbec` joined
19:49 bollu joined
19:50 <mniip> I guess IOT Proxy ~ Proxy after all
19:50 <jle`> Proxy is the zero of monad transformers
19:50 insitu joined
19:51 valdyn joined
19:51 coot_ joined
19:51 <jle`> under monad transformer composition
19:51 <mniip> I remember there being some criterion for monad transformer commutativity
19:52 <scav> jle` haskell makes me feel dumb every day :)
19:52 <jle`> haskell is a language where you are allowed to be dumb and your programs still work
19:52 <jle`> so i'm ok with that
19:52 <jle`> :)
19:53 <mniip> yeah, either it works or it doesn't compile :p
19:53 msks joined
19:54 chasm joined
19:54 <sproingie> if whatever you're studying *doesn't* make you feel dumb once in a while, then there's nothing left to learn
19:54 <sproingie> so haskell will probably make me feel dumb forever
19:54 <jle`> mniip: that's why i think there should be a ProxyT somewhere, maybe in transformers
19:55 <jle`> just for mathematical completeness
19:55 <mniip> isn't there?
19:55 <scav> i guess i feel dumbest for not having picked up haskell earlier
19:55 <jle`> sometimes picking up haskell comes at a cost
19:55 <sproingie> gets harder to unlearn ... but then again other languages are picking up a lot of FP, types and all
19:55 <jle`> it makes working in other languages so much more painful
19:56 <jle`> see: https://lukeplant.me.uk/blog/posts/why-learning-haskell-python-makes-you-a-worse-programmer/
19:56 <mniip> makes working with people who are mediocre programmers so much more painful
19:56 <sproingie> once concepts land in C++, you'll be seeing monoids and functors and whatnot all over the place
19:56 <jle`> the argument is that after learning haskell, programming in other languages is demoralizing to an extent that you feel less motivated and your productivity declines
19:56 <mniip> has C++ got return type polymorphism yet?
19:56 religious joined
19:57 <jle`> mniip: there's only a curried form of ProxyT
19:57 <jle`> but no uncurried form yet
19:57 <sproingie> sorta, with 'auto'. it's not quite as clever as haskell's
19:57 <jle`> er i mean, only an uncurried form of ProxyT. but no curried form yet
19:57 <mniip> sproingie, without that you can't have a monoid or monad
19:57 <mniip> not it its pure form
19:57 <jle`> so it doesn't admit a MonadTrans instance
19:57 bollu joined
19:57 <sproingie> mniip: presumably you'd have some sort of type witness, scala style
19:58 <religious> hello
19:58 <mniip> well that kind of sucks
19:58 <sproingie> i'm not familiar enough with concepts to say exactly
19:59 <sproingie> c++'s approach is usually "get it working with gross template magic, then extend the language if necessary"
19:59 carlosda1 joined
19:59 flatmap13 joined
19:59 dhil joined
19:59 <sproingie> it pushes a lot of the ugly verbosity on library writers, but consuming the library is usually pretty clean
20:00 <sproingie> that said i got really sick of having to deal with copy/move semantics last time i dove into c++
20:00 DocScrutinizer joined
20:00 _sg joined
20:02 orhan89 joined
20:02 <mniip> I like C++'s template magic but haskell's typesystem is just better
20:02 <mniip> until C++ impements at least hindley milner, you can't have all the FP stuff
20:02 <sproingie> scala gets by pretty well without H-M
20:03 <cocreature> c++ template magic is great until you want to call some undocumented library function that accepts 5 template arguments and you need to guess what the arguments should be
20:04 <mniip> haha yes
20:04 <sproingie> usually the args are inferred. makes the error messages pretty awful tho
20:04 <mniip> I hear ed is writing some C++ templated library
20:04 <mniip> those 5 undocumented args are going to be pretty bad :p
20:05 <dolio> I wouldn't say Scala gets by well.
20:05 <Tuplanolla> Scientific C++ is pretty alright.
20:05 <dolio> Unless they fixed it in the newest release.
20:05 <Tuplanolla> It's C with `std::vector`.
20:05 mda1 joined
20:06 <sproingie> scala adds plenty of noise to express the same things, but at least not dozens of lines of noise
20:06 jer1 joined
20:06 <michielb> Coming to Haskell from Scala, I can say for sure a lot of concepts in Haskell 'feel' more natural (typeclasses, for starters).
20:07 <sproingie> which suggests the problem is mere syntax, not lack of expressivity
20:07 nick123 joined
20:07 <sproingie> *mere surface syntax
20:07 <dolio> I mean stuff like: the order you put arguments in affects whether it can infer the types.
20:07 <dolio> Or whether you break them up into multiple argument groups.
20:08 uglyfigurine joined
20:08 oisdk joined
20:08 insitu joined
20:11 uglyfigurine joined
20:16 uglyfigurine joined
20:16 religious left
20:17 mgaare joined
20:18 uglyfigurine joined
20:19 uglyfigu_ joined
20:22 yogsotot_ joined
20:23 twanvl joined
20:24 kamyar joined
20:24 bollu joined
20:24 <kamyar> Hello all! I have a question about Haskell records:
20:25 <kamyar> We can declare a record using data keyword and optionally use field names
20:25 <kamyar> How can we use field names when instantiating record?
20:26 <kamyar> For example instead of Person "John" "Smith" "20"
20:26 jer1 joined
20:26 <kamyar> I wanna say Person {firstname="John", lastname="Smith", age=20}
20:26 <Taneb> If you have data Person = Person {firstName, surname :: String, age :: Int} you can write john = Person {surname = "Smith", firstname = "John", age = 20}
20:27 <kamyar> Taneb: Thanks!
20:29 <sternenseemann> reactormonk[m]: then you got to rename it, or place it in different module (which are imported qualified)
20:29 user21 joined
20:29 bollu joined
20:31 wroathe joined
20:32 xormor joined
20:32 augur joined
20:32 takle joined
20:34 takle joined
20:34 augur joined
20:37 user21 joined
20:37 sproingie joined
20:38 prophile joined
20:39 abhiroop joined
20:39 steeze joined
20:40 uglyfigurine joined
20:40 magneticduck joined
20:41 iddqd joined
20:44 sleffy joined
20:45 Swizec joined
20:46 user21 joined
20:47 jer1 joined
20:47 EvanR_ joined
20:47 peterbec` joined
20:48 bjz joined
20:48 bhiliyam joined
20:48 sigmundv_ joined
20:49 egis joined
20:50 blender joined
20:52 bennofs joined
20:53 {emptyset} joined
20:55 laplacian joined
20:56 abhiroop joined
20:56 Boomerang joined
20:58 ragepandemic joined
20:58 ertesx joined
20:59 uglyfigurine joined
20:59 carlosda1 joined
21:00 msko joined
21:03 cdg_ joined
21:05 oisdk joined
21:07 anuxivm joined
21:07 jer1 joined
21:08 Denommus` joined
21:15 ChaiTRex joined
21:16 EvanR_ joined
21:17 SegFaultAX joined
21:18 Mighty_Warthog2 joined
21:19 Mighty_Warthog3 joined
21:22 Swizec joined
21:23 Swizec joined
21:23 oisdk joined
21:23 bd_ joined
21:24 Swizec joined
21:24 Snircle joined
21:24 Swizec joined
21:24 sproingie joined
21:24 sproingie joined
21:25 aib joined
21:25 coot_ joined
21:25 Swizec joined
21:25 snowalpaca joined
21:26 Fendor joined
21:28 doomlord joined
21:28 jer1 joined
21:31 ExpHP joined
21:33 dimberman joined
21:33 `^_^v joined
21:38 bjz joined
21:38 revprez_ joined
21:39 epsilonhalbe left
21:41 revprez_atlanta joined
21:41 darjeeling_ joined
21:42 coot_ joined
21:45 abhiroop joined
21:45 conal joined
21:47 <OnkelTem> I'm trying to `stack build` a simple program but it doesn't build: https://apaste.info/yCgC
21:47 splanch joined
21:48 <OnkelTem> I don't understand what does it want
21:48 <OnkelTem> I see no error messages
21:48 <OnkelTem> [warn] <command line>: cannot satisfy -package-id h2-0.1.0.0-5EMJE0Ih4BwGpTWRbQJHpL -- makes no sense for me
21:48 <OnkelTem> ideas?
21:49 jer1 joined
21:50 flatmap13 joined
21:50 <isd> Is there a standard-ish function somewhere of type Either SomeException a -> IO a that raises the exception in the case of a Left?
21:50 coot_ joined
21:50 <jle`> OnkelTem: it looks like it can't find the package h2-0.1.0.0
21:51 <jle`> isd: you can use 'either throwIO return'
21:51 <OnkelTem> jle`: hm, it's the package name I'm trying to build :) LOL, I don't know how it managed to get there
21:51 <jle`> can you show the cabal file?
21:51 <OnkelTem> I was using 'stack new h2 new-template'
21:52 jeltsch joined
21:52 <OnkelTem> jle`: nevermind, that's correct. I was wondering why is it (h2) listed in the deps. Now I see it was an error
21:52 <isd> jle`: thanks.
21:52 <jle`> OnkelTem: no problem!
21:53 <jle`> it sounds like a funky cabal file maybe
21:53 <jle`> isd: no problem. it might be a bit too specialized to warrant a pre-written function
21:53 hiratara joined
21:53 <jle`> there are several various 'either f g' and 'maybe x f' functions that can be added into base that are useful for one situation or another
21:53 <jle`> kind of have to draw the line somewhere
21:54 <isd> jle`: yeah. I think in this instance it's actually more readable to just use an explicit case ... of
21:54 <jle`> mhm. or define it locally
21:54 lordcirth joined
21:54 cdk joined
21:55 <jle`> (if you need to use it in a higher-order function)
21:55 soniku joined
21:56 madsj joined
21:56 zcourts joined
21:56 fresheyeball joined
21:57 <fresheyeball> so I have a dependency that contains a nice attractive typeclass
21:57 <fresheyeball> and another dependency that has a data structure that I sure would like to be an instance
21:57 <fresheyeball> is there any way around orphaned instances with that?
21:58 <jle`> you can patch the data structure's package to include an instance
21:58 <fresheyeball> jle`: boo
21:59 abhiroop joined
21:59 <jle`> alternatively
21:59 <jle`> you can use the data structure with a newtype wrapper
21:59 dfeuer joined
21:59 <jle`> and give the newtype wrapped structure an instance
22:00 <OnkelTem> Folks, how to search for module or interface name? I thought https://www.haskell.org/hoogle may help but it doesn't
22:00 <jle`> this is the route that some libraries have to take
22:00 <OnkelTem> I type: "Snap.Http.Server" and get totally unrelated stuff
22:00 <jle`> OnkelTem: try http://hoogle.haskell.org/
22:00 <jle`> haskell.org/hoogle is a few years out of date
22:00 carlosda1 joined
22:01 <OnkelTem> Wow
22:01 <OnkelTem> jle`: thanks!!
22:01 <jle`> also http://stackage.org/
22:01 <jle`> aka stoogle
22:01 <jle`> (only i call it that)
22:01 <OnkelTem> Guys, I wonder how you fight through all these outdated piles :)
22:01 <MVQq> a googley stoooogaly
22:02 cdk joined
22:02 <jle`> haskell.org/hoogle should be updated any time now, they're just waiting on hoogle 5 to be released
22:02 <jle`> and they're freezing the index until then
22:02 Proteus joined
22:02 <jle`> but it's been a few years, i feel like they should maybe put some sort of deprecation notice up there
22:03 balor joined
22:04 darjeeling_ joined
22:04 <jle`> stackage uses hoogle 4 with an up-to-date index, and hoogle.haskell.org uses hoogle 5 alpha (which is missing some important functionality) with an up-to-date index
22:04 cdk joined
22:04 <jle`> so it seems reasonable that either would be preferable to haskell.org/hoogle's hoogle 4 with an out of date index
22:04 orhan89 joined
22:04 <jle`> a nice warning might be helpful :)
22:07 <hpc> there's also hayoo, for when you really need to find something and who cares if it's near the top of the results
22:08 nicknovitski joined
22:09 mjora7 joined
22:09 jer1 joined
22:13 NJBS joined
22:13 ubsan joined
22:14 zcourts_ joined
22:14 acro joined
22:14 ExpHP joined
22:15 foton joined
22:16 cdg joined
22:16 Koterpillar joined
22:19 steeze joined
22:19 zcourts joined
22:19 <OnkelTem> Yahoooooo! I've build my first snap hello world program!
22:20 wroathe joined
22:20 <OnkelTem> built*
22:20 <jle`> :D
22:20 <NJBS> Came across this while reading Haskell from first principles, any idea how wtf is supposed to typecheck? http://lpaste.net/8895537402194427904
22:20 <OnkelTem> Huh, it took 3 days.
22:20 ExpHP joined
22:20 <OnkelTem> But I have now working docker container with stack and stuff
22:21 <jle`> NJBS: which one are you confused about?
22:21 peterbec` joined
22:21 <Koterpillar> NJBS: which one?
22:21 <jle`> oh, 'wtf'
22:22 <jle`> NJBS: you can work through the types of 'join' and '.'
22:22 <jle`> it's a mechanical process
22:22 <jle`> or are yuo asking about what type it would have?
22:22 darjeeling_ joined
22:22 <jle`> :t zipWith (+) . (join .) . map
22:22 <lambdabot> error:
22:22 <lambdabot> • Couldn't match type ‘[a1] -> [a]’ with ‘[c]’
22:22 <lambdabot> Expected type: (a1 -> [a]) -> [c]
22:22 <NJBS> Both the pointfree and not pointfree `wtf` don't typecheck so I was wondering if maybe there's some language extension that would allow it to typecheck?
22:23 <jle`> oh
22:23 <jle`> it is potentially an error, then
22:23 zcourts_ joined
22:23 <NJBS> Ah well ¯\_(ツ)_/¯
22:23 <jle`> i don't know of any extension that would fix that error
22:23 <jle`> 'fix'
22:24 <jle`> -fdefer-type-errors, maybe :)
22:24 <NJBS> :)
22:24 path[l] joined
22:25 <jle`> ghci> :set -fdefer-type-errors
22:25 <jle`> ghci> wtf = zipWith (+) . (join .) . map
22:25 <jle`> all is ok :)
22:26 <NJBS> Now call it :P
22:26 <jle`> that's someone else's problem :)
22:27 Wizek_ joined
22:27 <AWizzArd> I constructed my own version of >>= which uses traceShow to visualize the state. I now was running data >>= f1 >>= f2 >>= fReset >>= f4 and was surprised to see that it seems that only f4 ran.
22:27 <AWizzArd> Could this be a demonstration of a compiler optimization? Because my fReset _ = state (\_ -> ("", [])) maybe? Could the compiler have detected how I am not using data, f1 and f2?
22:28 <AWizzArd> Or is this more likely lazyness at play?
22:28 <Koterpillar> laziness, yes. There's nothing special about >>= that will make it all evaluate
22:29 <AWizzArd> Right.
22:29 jer1 joined
22:29 <sm> congrats OnkelTem
22:29 <OnkelTem> sm: thank you :)
22:29 begriffs joined
22:29 <AWizzArd> I was just guessing that possibly it was detected by some kind of whole program optimization that indeed the expressions before the fReset were unused.
22:29 <AWizzArd> But yeah, lazyness implicitly already solved that.
22:31 splanch_ joined
22:31 hiratara joined
22:31 zero_byte joined
22:33 path[l] joined
22:33 balor joined
22:34 sigmundv__ joined
22:34 conal joined
22:35 m0rphism joined
22:35 dan_f joined
22:39 dubois joined
22:41 wroathe joined
22:41 MrWoohoo joined
22:43 atomi joined
22:43 mmachenry joined
22:43 yellowj joined
22:45 mmachenry joined
22:49 bhiliyam joined
22:49 lambda-11235 joined
22:50 jer1 joined
22:51 biglambda joined
22:54 blender joined
22:55 netheranthem joined
22:57 Iceland_jack joined
22:58 <pacak> Cale: Author of original program replied so I hope we'll figure it out at some point, but the fact is amount of elements in regroup is different between every time. Singlethreaded program makes evaluation order deterministics.
23:01 lambda-11235 joined
23:01 carlosda1 joined
23:01 <Cale> pacak: Yeah, I couldn't see a reason that they ought to be different in any case though
23:02 <Cale> pacak: So, at some point before that even happens, something has already gone wrong
23:02 nakal_ joined
23:02 <pacak> Something to do with parallelism I suspect.
23:03 markus1189 joined
23:04 markus1199 joined
23:05 <ertes> i once again need a library for doing database migrations, and *only* migrations… is there anything on hackage for that?
23:05 <ChaiTRex> Speaking of parallelism, why did they make it where 'concurrency', which seems like it would mean 'at the same time' doesn't describe things that definitively happen at the same time?
23:06 <ertes> ChaiTRex: "concurrent" can mean "interleaved"
23:06 <ertes> not necessarily "parallel"
23:06 <Koterpillar> ertes: I don't have a candidate, but I'm interested in why you only need migrations. Are you happy with SQL-only migrations? What are you using for the main interface?
23:07 <ertes> Koterpillar: i'm using *-simple, e.g. sqlite-simple
23:07 <ertes> so i pretty much just write SQL
23:07 <Cale> I think ChaiTRex is just referring to the etymology.
23:07 <ChaiTRex> ertes: Oh, sure, in the computer science definition, that's true. I'm just wondering why they made it differ from the colloquial definition of concurrency.
23:07 abhiroop joined
23:08 <ertes> ah
23:08 <ertes> ChaiTRex: well, what would you call it?
23:08 fryguybob joined
23:08 theDon_ joined
23:08 <ChaiTRex> ertes: I'm not sure.
23:08 netheranthem joined
23:09 indi_ joined
23:10 JoshS joined
23:10 yogsoto__ joined
23:10 jer1 joined
23:11 samgaw_ joined
23:11 mjora7 joined
23:12 soniku joined
23:13 <ertes> i'm not sure whether the colloquial definition really means "in parallel"… aren't the moves of two chess players "concurrent" as opposed to a game, where first one player makes all of their moves, then the other player does?
23:17 eacameron joined
23:18 ludat joined
23:18 zcourts joined
23:19 boxofdeath joined
23:20 <koala_man> ChaiTRex: it could have been at a time when computers could only do one thing, and interleaving made it look like it did two things at once. similar to how hard disks were called "random access memory" when they first came because they were compared to tapes
23:21 <ChaiTRex> koala_man: That makes sense.
23:21 hybrid joined
23:22 conal_ joined
23:22 wroathe joined
23:24 justicefries joined
23:24 mjora7 joined
23:25 {emptyset} joined
23:25 forker joined
23:26 Welkin joined
23:29 jmiven joined
23:29 Jololo joined
23:29 <ertes> that's basically how windows 3.* worked =)
23:30 <ertes> if your app doesn't yield, the whole thing freezes
23:31 jer1 joined
23:35 strykerkkd joined
23:36 <mjora7> Is there a better learning resource than Learn You Haskell? I'm 2 chapters in and still have no idea how to properly write a program in a file, basic i/o, how to indent code, etc.
23:37 <geekosaur> @where learnhaskell
23:37 <lambdabot> https://github.com/bitemyapp/learnhaskell
23:37 <geekosaur> @where cis194
23:37 <lambdabot> http://www.seas.upenn.edu/~cis194/spring13/
23:37 chao-tic joined
23:37 <geekosaur> lyah is terrible for learning how to write haskell
23:37 <geekosaur> unless you;re a serious self-starter willing to play around in ghci with the stuff lyah parades before you
23:37 <Cale> Graham Hutton's book is good
23:37 <mjora7> lyah?
23:38 <geekosaur> _Learn You A Haskell_
23:38 edmundsecho joined
23:38 <mjora7> Oh right, didn't realize there was an 'a' in there hahah
23:38 <mjora7> Yeah, lyah is teaching so much unnecessary stuff that I can't actually use cause I don't know how to write a damn program hahah.
23:38 <mjora7> What a terrible intro. Not saying it's bad, just a bad intro.
23:39 <mjora7> Maybe I can come back to it after a more efficient introductory book.
23:39 <geekosaur> it's been characterized as a 2-hour movie trailer >.>
23:40 <mjora7> Ok, so I'm not the only one who thinks that then!
23:40 <Cale> Well, I don't think it's *quite* as bad as that.
23:41 <Welkin> Learn You Some Erlang
23:41 <Cale> It does teach you how to write programs right from the beginning.
23:41 <Cale> Not programs which do I/O necessarily.
23:41 <Cale> But it doesn't necessarily make sense to learn how to do I/O right away while learning Haskell.
23:41 <Welkin> the best way to learn how to program is to read source code
23:42 <Welkin> find the complete source code for a simple project and read it all
23:42 <Welkin> the Write Yourself a Scheme tutorial is good for this
23:44 allenj12 joined
23:45 Wizek joined
23:46 alue-42 joined
23:47 texasmynsted joined
23:48 <Tuplanolla> I'm a bit skeptical of that approach. By reading other people's code, you learn how to write like said people.
23:48 <Welkin> Tuplanolla: that is why you read a lot of code
23:49 <Welkin> of course you will emulate what you see
23:49 <Welkin> over time it changes and you will decide for yourself how you want to write your code
23:49 <Welkin> it's ust how the process works
23:49 <Cale> I'm not sure that's a really great approach when starting out if you don't already know something pretty close like ML.
23:50 <Tuplanolla> I'm not a Haskell expert yet, so I can't comment on that, but had I learned C that way, I'd still be writing garbage.
23:52 jer1 joined
23:52 edmundsecho joined
23:53 matt179 joined
23:53 <Welkin> it depends on what you mean by "learn"
23:53 <Welkin> if you know absolutely nothing, you can't start just by reading code, obviously
23:53 <Welkin> once you know the basics, you can
23:53 acarrico joined
23:54 uuublaa joined
23:54 infinity0 joined
23:55 e14 joined
23:56 blender joined
23:56 matt179 joined
23:57 <geekosaur> some people can learn that way... others can't. which is why it's good to have multiple ways to learn
23:58 YongJoon joined
23:58 Dr8128 joined