<    June 2018     >
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 _2_0 21 22 23  
24 25 26 27 28 29 30
00:00 <pounce> How would I read a line and turn it into a [Integer]? (I'm back to number 2)
00:03 zdenal joined
00:03 <glguy> getLine :: IO String for getting the line
00:04 codesoup joined
00:04 <glguy> in this case where you have a whitespace delimited list of numbers you can use
00:04 <glguy> > (map read . words) "1 2 3 4" :: [Int]
00:04 <lambdabot> error:
00:04 <lambdabot> Ambiguous occurrence ‘map’
00:04 <lambdabot> It could refer to either ‘Data.List.map’,
00:04 <glguy> > (map read . words) "1 2 3 4" :: [Int]
00:04 <lambdabot> [1,2,3,4]
00:05 <jle`> > words "1 2 3 4"
00:05 <lambdabot> ["1","2","3","4"]
00:06 <glguy> Once you get yours working check out: https://github.com/glguy/advent2017/blob/master/execs/Day02.hs
00:06 <* hackage> butter - Monad Transformer for Asyncronous Message Passing http://hackage.haskell.org/package/butter- (mpahrens)
00:07 louispan joined
00:10 <* hackage> butter - Monad Transformer for Asyncronous Message Passing http://hackage.haskell.org/package/butter- (mpahrens)
00:10 jao joined
00:15 evenzhou joined
00:16 <pally> > scanr (\x r -> x + r) 0 [1,2,3]
00:16 <lambdabot> [6,5,3,0]
00:17 <pally> one thing I didn't expect from this experiment, how did I end up with a fourth item?
00:17 <* hackage> relational-query-HDBC - HDBC instance of relational-query and typed query interface for HDBC http://hackage.haskell.org/package/relational-query-HDBC- (KeiHibino)
00:17 <glguy> > scanr f a [b,c,d]
00:17 <lambdabot> [f b (f c (f d a)),f c (f d a),f d a,a]
00:19 <pally> glguy, so the last item is always the second parameter (namely 'a')
00:19 <pally> ?
00:23 louispan joined
00:24 XorSwap joined
00:24 evenzhou_ joined
00:25 crobbins joined
00:26 bontaq joined
00:27 boccato joined
00:28 kmurphy4 joined
00:28 zdenal joined
00:30 jao joined
00:30 ru0mad joined
00:30 bb010g joined
00:30 zykt[m] joined
00:30 ProofTechnique[m joined
00:30 R2D2[m] joined
00:30 d-rk1[m] joined
00:30 jupiter[m] joined
00:30 anomie[m]1 joined
00:30 lycium[m] joined
00:30 idnar[m] joined
00:30 Orbstheorem[m] joined
00:30 sagecube[m] joined
00:30 wzy8L-B2[m] joined
00:30 flounders[m] joined
00:30 Jikstra[m] joined
00:30 ajbreen[m] joined
00:30 pcm77[m] joined
00:30 aiken[m] joined
00:30 dave-aut[m] joined
00:30 lbpc[m] joined
00:30 octalsrc[m] joined
00:30 aniketd[m] joined
00:30 toma[w] joined
00:30 sudoreboot[m] joined
00:30 baderrormgs[m] joined
00:30 isanisan joined
00:30 riadvargas[m] joined
00:30 ph0zzy joined
00:30 weareswarmcity[m joined
00:30 Willjox[m] joined
00:30 thekyriarchy joined
00:30 NapoleonMalapart joined
00:30 noteventime[m] joined
00:30 have-quick[m] joined
00:30 sppqd[m] joined
00:30 porcow[m] joined
00:30 Obscurity[m] joined
00:30 PinkPony[m] joined
00:30 Braveheart[m] joined
00:30 puffnfresh joined
00:30 Rick[29SMPittsbu joined
00:30 aaronc[m] joined
00:30 jameshjacksonjr[ joined
00:30 stekke[m] joined
00:30 morgib[m] joined
00:30 jarodwr[m] joined
00:30 Matthew[m] joined
00:30 zalipuha[m] joined
00:30 asenski[m] joined
00:30 nelag[m] joined
00:30 geodesic[m] joined
00:30 h4z3[m] joined
00:30 asayers[m] joined
00:30 kumori[m] joined
00:30 sethjust[m] joined
00:30 netneon0011[m] joined
00:30 tibike_m[m] joined
00:30 piluex[m] joined
00:30 dadadus[m] joined
00:30 megamanmalte[m] joined
00:30 JackM[m] joined
00:30 qahqah[m] joined
00:30 M-moyamo joined
00:30 bgrayburn[m] joined
00:30 Gg[m] joined
00:30 plll[m] joined
00:30 fizzgig[m] joined
00:30 Baplar[m] joined
00:30 M-ms joined
00:30 Half-Shot joined
00:30 phittacus joined
00:30 cptpie[m] joined
00:30 masaeedu[m] joined
00:30 mrno[m] joined
00:30 sqzlh joined
00:30 Hanma[m] joined
00:30 charlag[m] joined
00:30 bkrn[m] joined
00:30 zyla[m] joined
00:30 naviknair7[m] joined
00:30 vitamin-q joined
00:30 jomari[m] joined
00:31 nattofriends[m] joined
00:31 nh2[m] joined
00:31 M-whoops joined
00:31 mad[m]1 joined
00:31 Yoann[m] joined
00:31 Quillasp[m] joined
00:31 mossid[m] joined
00:31 ttk2[m] joined
00:31 mith[m] joined
00:31 algorev[m] joined
00:31 aoeupl[m] joined
00:31 neel12[m] joined
00:31 stigo[m] joined
00:31 omtcvxyz[m] joined
00:31 fuzen[m] joined
00:31 samprotas[m] joined
00:31 jhhuh[m] joined
00:31 innaytool[m] joined
00:31 Dako300[m] joined
00:31 whanchiandew[m] joined
00:31 blitzlightnin[m] joined
00:31 aquarial[m] joined
00:31 tehidiot[m] joined
00:31 towaii[m] joined
00:31 georg3[m] joined
00:31 guaraqe[m] joined
00:31 FjordPrefect joined
00:31 el_tejon[m] joined
00:31 japhir[m] joined
00:31 nootz[m] joined
00:31 absurd[m] joined
00:31 amidstbinary[m] joined
00:31 benbika[m] joined
00:31 eeyun[m] joined
00:31 durazasa[m] joined
00:31 ArchieT joined
00:31 elih-19[m] joined
00:31 fosskers[m] joined
00:31 blue42[m] joined
00:31 dkellner[m] joined
00:31 tet[m] joined
00:31 tyler274 joined
00:31 Makinit joined
00:31 vsts[m] joined
00:31 ssaavedra[m] joined
00:31 smaller_infinity joined
00:31 joeo[m] joined
00:31 sanfrancisco[m] joined
00:31 vars[m] joined
00:31 mtncoder[m] joined
00:31 sclv[m] joined
00:31 laaksoan[m] joined
00:31 astompydan[m] joined
00:31 shekel[m] joined
00:31 alexshpilkin joined
00:31 sophien[m] joined
00:31 william[m]1 joined
00:31 mgttlinger[m] joined
00:31 patonw[m] joined
00:31 swarm1321[m] joined
00:31 dmitrik[m] joined
00:31 gmzara[m] joined
00:31 devr[m] joined
00:31 beemo[m] joined
00:31 phrnz[m] joined
00:31 jmnoz joined
00:31 intheclouddan joined
00:31 ThousandLions[m] joined
00:31 jiji606[m] joined
00:31 snoyberg joined
00:31 abdolence[m] joined
00:31 losangeles173[m] joined
00:31 jbweston[m] joined
00:31 a-s[m] joined
00:31 tylerkvochick[m] joined
00:31 Heino[m] joined
00:31 romac[m] joined
00:31 dlilja[m] joined
00:31 asthma[m] joined
00:31 christianpoveda[ joined
00:31 qwerty263[m] joined
00:31 Akito[m] joined
00:31 tamwile[m] joined
00:31 pam_cakes[m] joined
00:31 patrl[m] joined
00:31 chominist[m] joined
00:31 geetam joined
00:31 ub[m] joined
00:31 Superman[m] joined
00:31 agraba[m] joined
00:31 vthriller joined
00:31 good_matty[m] joined
00:31 Naughtmare[m] joined
00:31 fxb8[m] joined
00:31 michbad joined
00:31 icrbow[m] joined
00:31 devpav[m] joined
00:31 emme[m] joined
00:31 oilerspoiler[m] joined
00:31 HoelKervadec[m] joined
00:31 kaesebrot[m] joined
00:31 devault[m] joined
00:31 nkhodyunya joined
00:31 xMajedz[m] joined
00:31 superobserver[m] joined
00:31 Cadey[m] joined
00:31 noperope[m] joined
00:31 braidn[m] joined
00:31 h1ccup[m] joined
00:31 embasify[m] joined
00:31 adaschma[m] joined
00:31 r33pich33p[m] joined
00:31 M-kitsune joined
00:31 shenaurin_av[m] joined
00:31 ShalokShalom[m] joined
00:31 onaka[m] joined
00:31 strake[m] joined
00:31 unclechu joined
00:31 gelidae[m] joined
00:31 chatnowvvv[m] joined
00:31 dbane[m] joined
00:31 magnap joined
00:31 rszibele[m] joined
00:31 yefllower[m] joined
00:31 okalldal[m] joined
00:31 stuebinm[m] joined
00:31 putputlaw[m] joined
00:31 alpharho[m] joined
00:31 WinterFox[m] joined
00:31 cipher1024[m] joined
00:31 thekyriarchy__ joined
00:31 Ekho[m] joined
00:31 nepomukspencer[m joined
00:31 Nerka[m] joined
00:31 fristonio[m] joined
00:31 keeganjk[m] joined
00:31 squarfed[m] joined
00:31 lkurusa joined
00:31 tuxether[m] joined
00:31 Aaa[m] joined
00:31 ajtowns[m] joined
00:31 gymcap[m] joined
00:31 M0x8badf00d[m] joined
00:31 jvalleroy[m] joined
00:31 guillaumecherel[ joined
00:31 likwrk[m] joined
00:31 felipeac[m] joined
00:31 adziahel[m] joined
00:31 atopuzov[m] joined
00:31 trikl[m] joined
00:31 henriquezanin[m] joined
00:31 happyente[m] joined
00:31 sm[m] joined
00:31 ritaoncloud[m] joined
00:31 pistasj[m] joined
00:31 herzmeister[m] joined
00:31 brigdeer[m] joined
00:31 Mateus[m]1 joined
00:31 Kevin[m]3 joined
00:31 bondzula[m] joined
00:31 Shaunthesheep[m] joined
00:31 timdeh[m] joined
00:31 srenatus joined
00:31 chkl[m] joined
00:31 icen[m] joined
00:31 superpat[m] joined
00:31 thesilmarilion[m joined
00:31 asyncawake[m] joined
00:31 Google[m] joined
00:31 luminousnine joined
00:31 dam30n[m] joined
00:31 stenowtf[m] joined
00:31 dustman[m] joined
00:31 Mougan[m] joined
00:31 deva[m] joined
00:31 kxra_ joined
00:31 petrolifero[m] joined
00:31 DavesTestingAcco joined
00:31 dbramucci[m] joined
00:31 sgoody[m] joined
00:31 Prince781[m] joined
00:31 razvanc-r[m] joined
00:31 tezos_noob[m] joined
00:31 kebertx[m] joined
00:31 trubii[m] joined
00:31 M-rgh joined
00:31 blackblankx[m] joined
00:31 anjannath[m] joined
00:31 testtt0x11[m] joined
00:31 bmjh joined
00:31 anaxios joined
00:31 coil[m] joined
00:31 techiedesu[m] joined
00:31 dirb joined
00:31 eostre[m] joined
00:31 thisa[m] joined
00:31 mrdjc[m] joined
00:31 youdi[m] joined
00:31 don_quijote[m] joined
00:31 cevin[m] joined
00:31 sielicki joined
00:31 howsiwei[m] joined
00:31 oknf[m] joined
00:31 coorey[m] joined
00:31 brunocado[m] joined
00:31 NikitaKuznetsov[ joined
00:31 ElliotKiyomizu[m joined
00:31 senchopens[m] joined
00:31 dvgroc[m] joined
00:31 camael[m] joined
00:31 kasbah[m] joined
00:31 darkunicorn[m] joined
00:31 pnrfne[m] joined
00:31 Albtrz[m] joined
00:31 zzander57[m] joined
00:31 kbkn[m] joined
00:31 PatrickM[m] joined
00:31 M-DarkTrancer joined
00:31 tchernobog[m] joined
00:31 hd[m] joined
00:31 fgaz[m] joined
00:31 atondwal[m] joined
00:31 m00n[m] joined
00:31 uchronian[m] joined
00:31 am2on joined
00:31 kerscher[m] joined
00:31 kwaku[m] joined
00:31 hdurer[m] joined
00:31 reconmaster[m] joined
00:31 jumzi[m] joined
00:31 sylvainf911[m] joined
00:31 drewfer[m] joined
00:31 nbrr[m] joined
00:31 eyenx joined
00:31 KevinMGranger joined
00:31 maverickwoo[m] joined
00:31 M-HirmeS joined
00:31 sigterm[m] joined
00:31 emptythought[m] joined
00:31 Ecto2501[m] joined
00:31 mrijkeboer[m] joined
00:31 gelnana[m] joined
00:31 osteele[m] joined
00:31 dinkarg[m] joined
00:31 siegvriel[m] joined
00:31 tuxitagnu[m] joined
00:31 Guest1573[m] joined
00:31 Hauctopuce[m] joined
00:31 scrypso[m] joined
00:31 asonixdog[m] joined
00:31 blackfalcon[m] joined
00:31 asm[m]1 joined
00:31 tiktaalik[m] joined
00:31 rprospero[m] joined
00:31 ph[m] joined
00:31 konradha[m] joined
00:31 seanalexander[m] joined
00:31 M-ming8 joined
00:31 falafel[m] joined
00:31 araspik[m] joined
00:31 arrdem[m] joined
00:31 Chris[m]7 joined
00:31 KirillBobyrev[m] joined
00:32 ru0mad left
00:32 sytherax joined
00:34 ru0mad joined
00:34 ru0mad left
00:35 iAmerikan joined
00:36 Versalife joined
00:37 pera joined
00:38 ammazza joined
00:39 silver_ joined
00:39 jao joined
00:40 ru0mad joined
00:40 <pally> > scanl f a [b,c,d]
00:40 <lambdabot> [a,f a b,f (f a b) c,f (f (f a b) c) d]
00:42 cybai joined
00:43 andyhuzhill joined
00:43 blankhart joined
00:43 ru0mad left
00:44 carlomazzaferro joined
00:45 jao joined
00:47 TipsyMe joined
00:47 sytherax joined
00:48 ru0mad joined
00:49 andyhuzhill joined
00:49 andreabedini joined
00:49 <dfeuer> pally: how did lambdabot do that?
00:50 codesoup joined
00:51 ru0mad joined
00:53 <geekosaur> ...
00:53 divVerent joined
00:53 <geekosaur> (that's the simple-reflect package)
00:53 ericsagn1 joined
00:53 andyhuzhill joined
00:54 <pally> In attempt to answer that question, I will turn to the type signature scanl :: (b -> a -> b) -> b -> [a] -> [b]
00:55 ru0mad joined
00:55 <pally> it ("the curried function) makes sense for all the items starting the 2nd
00:55 dxld joined
00:55 Luke joined
00:55 jchia joined
00:56 <pally> If we look at [a,f a b,f (f a b) c,f (f (f a b) c) d], the function f doesn't as though it applied to the first item, 'a'
00:56 <pally> doesn't seem
00:56 rasusto_ joined
00:56 <jle`> yeah, the first item is the unmodified item
00:57 <jle`> it's meant to imitate 'iterate', i suppose
00:57 <pally> jle`, then it is consistent with the type signature.
00:58 <pally> Since I am at still in the learning phase, I try to trace it and see if things match/correspond.
00:58 justaguest joined
00:59 nighty- joined
00:59 orbisvicis left
01:00 <jle`> pally: one problem might be that you are mixing types and values
01:00 <jle`> > scanl f x [y,z]
01:00 <lambdabot> [x,f x y,f (f x y) z]
01:00 <jle`> pally: it's a little confusing because the 'a' value you have has type 'b'
01:00 <jle`> pally: you might be thinking that 'a' has type 'a'
01:01 <jle`> in general it's helpful to not give your values the same name as your types, heh
01:01 <jle`> especially if you have a type variable 'b' and you call your value 'a' ;)
01:01 <jle`> that's why there's the x,y,z convention for values and a,b,c convention for types
01:02 acarrico joined
01:04 ru0mad joined
01:05 <dfeuer> jle`: it's frustrating that you can't get nice total pattern matches with prisms. Has anyone come up with a solution to that? Dependent prisms or something?
01:06 Solonarv_ joined
01:06 woodson_ joined
01:06 <jle`> for the case of prisms on parameterized types, Tekmo has the total library
01:06 <jle`> @hackage total
01:06 <lambdabot> http://hackage.haskell.org/package/total
01:06 jcob joined
01:07 <jle`> it only works for types like `Either a b` where the fields in each constructor correspond to type variables though
01:07 <jcob> Hi I have a question that may be stupid. Monad is a higher kinded type right? Why does it have to be a higher order type?
01:07 <jcob> My intuition is because it is over containers... but I may be wrong
01:10 markus1189 joined
01:10 <geekosaur> "container" is not always correcy (IO doesn't "contain" anything, it is a recipe for something)
01:10 preyalone joined
01:10 <dfeuer> jle`: sad, that. I wonder if something like that could be written for general Generic types....
01:10 cschneid joined
01:10 <dfeuer> (as long as from and to are an isomorphism)
01:11 <dfeuer> Csongor would be the one to ask on that, probably.
01:11 <jcob> geekosaur: aghh IO doesn't contain anything? I thought it was like it was a burrito 😉
01:11 <Tordek> lol
01:12 iAmerikan joined
01:14 <zenspider> I had to run to the dentist... are there IRC logs published somewhere? I see two possible log bots
01:14 <Tordek> topic, zenspider
01:14 <Tordek> Logs:
01:14 <Tordek> http://tunes.org/~nef/logs/haskell/?C=M;O=D |
01:14 Luke_ joined
01:15 <jcob> geekosaur: what makes you say that IO isn't a container? and whyyyy is a monad a higher order type
01:15 camsbury joined
01:15 nivekz joined
01:15 <geekosaur> what makes you say it is?
01:15 <boj> jcob: i suppose if you consider Maybe a, it has the kind * -> *. this means you can stuff any other type inside it
01:16 <geekosaur> why is the only possibility a container?
01:16 nivekz left
01:16 <geekosaur> it's a program. we manipulate the program and then send it off to an impure runtime
01:16 <zenspider> tnx
01:16 <geekosaur> (or if you prefer, we add things to a recipe, then send it off to one of the kids at the culinary academy downtowm to be prepared)
01:17 <geekosaur> @quote /bin/ls
01:17 <lambdabot> shachaf says: getLine :: IO String contains a String in the same way that /bin/ls contains a list of files
01:17 <jcob> Oh ok that makes sense. I guess since maybe is already of type * -> *, you have to have something with the sig (* -> *) -> * or something
01:17 <geekosaur> :k Monad
01:17 <lambdabot> (* -> *) -> Constraint
01:18 <geekosaur> you apply it to a type that itself requires another type
01:18 <jcob> Oh lord this is a real rabbit hole. It doesn't itself make a type when it is applied
01:18 <jcob>
01:19 <geekosaur> instance Monad IO where ... -- but IO is not complete, it's IO Int or IO String or etc.
01:19 <geekosaur> instance Monad Maybe where ... -- same
01:20 <jcob> So is there like a lambda calculus of types where you can start playing around with them and reducing em and stuff
01:20 <Maxdamantus> It might be clearer to not think of `IO` as a type, but a function that takes a type (*) and returns a type (*)
01:20 <Maxdamantus> (hence why `IO`'s kind is `* -> *`)
01:20 <geekosaur> which giuarantees you do the same thing no matter what type IO or Maybe is applied to, because if you did then it would not follow the rules that make Monad useful
01:21 zenspider left
01:21 <Maxdamantus> > let a :: IO; a = a in a
01:21 <lambdabot> error:
01:21 <lambdabot> • Expecting one more argument to ‘IO’
01:21 <lambdabot> Expected a type, but ‘IO’ has kind ‘* -> *’
01:21 SovietBeer__ joined
01:21 <Tordek> jcob: category theory :)
01:22 <Maxdamantus> jcob: you can apply this stuff in the idris CLI, but it's a bit different to Haskell.
01:22 <Maxdamantus> eg, `Monad IO` is itself just a Type there.
01:22 <Maxdamantus> so Monad : (Type -> Type) -> Type
01:22 <geekosaur> (if it were "instance Monad (IO ...)" then you could have different instances for IO Int, IO String, ... --- and then an instance for (IO a) along with those would lead to other problems (can;t guarantee everything picks the same instance any more, and is disallowed for that reason)
01:23 <* hackage> sexp-grammar 2.0.1 - Invertible grammar combinators for S-expressions http://hackage.haskell.org/package/sexp-grammar-2.0.1 (EugeneSmolanka)
01:23 chat_ joined
01:23 ru0mad joined
01:26 xcmw joined
01:27 <jcob> Maxdamantus: great I'm a huge fan of Idris
01:28 ru0mad joined
01:29 daniel-s joined
01:30 <infinisil> Idris \o/
01:30 chat joined
01:32 <Maxdamantus> idris handles a lot of this stuff in a more theoretically concise way imo
01:32 ru0mad joined
01:33 sytherax joined
01:33 tzemanovic joined
01:33 <Maxdamantus> Since `Monad IO` is a type, its instance is an actual value that can be passed around: `the (Monad IO) %instance`
01:33 <infinisil> Yeah, which also allows for different implementations, they're just different values with the same type
01:34 <Maxdamantus> eg, `(>>=) @{the (Monad IO) %instance} (return 4) (\x => return (x + 5))`
01:34 <Maxdamantus> (the `@{..}` syntax is passing the usually-implicit class instance explicitly)
01:34 <Tordek> https://hackage.haskell.org/package/vector- how does one add custom syntax, like this is doing with <...,...,...>? (Or is it just for the examples?)
01:35 <Tordek> also, what's the {-# INLINE ... #-} thing?
01:40 <geekosaur> it's a pragma, sometimes just an optimization, sometimes may be needed for correctness (but not here that I can see, unless it's using unsafePerformIO under the hood)
01:40 jmnk joined
01:40 eschnett joined
01:41 <geekosaur> you don;t get to define your own syntax, aside from quasiquoters which aren't quite the same thing
01:41 <geekosaur> so I assume that's just for the example
01:42 telser joined
01:42 dodong joined
01:44 DSM joined
01:45 blankhart joined
01:45 <Tordek> geekosaur: alright, thanks!... what are quasiquotes, also?
01:47 andreabedini joined
01:47 <geekosaur> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#template-haskell-quasi-quotation
01:47 mizu_no_oto joined
01:47 <Tordek> thanks!
01:47 <geekosaur> gives you something like [vec| ... |] and at compile time it will look for a function "vec" in scope to parse what's inside it1
01:48 <geekosaur> which is painful in a number of ways, but the best you can do for new syntax
01:49 <infinisil> Not just new syntax, embed other languages in it!
01:49 <jcob> Just like lisp macros! how cool
01:50 dfinity-develope joined
01:51 dan_f joined
01:51 sytherax joined
01:51 <geekosaur> well, aside friom lisp macros give you lisp. ghc's internal AST is … less friendly
01:53 <infinisil> What I find really cool is how johnw_ used QuasiQuotes to have inline Nix evaluation: https://github.com/haskell-nix/hnix/blob/master/tests/EvalTests.hs#L136-L143
01:54 Luke joined
01:58 <aarvar> is this a thing? type InvSetter s t a b = Iso a b -> s -> t
01:58 conal_ joined
01:58 bontaq joined
02:00 hucksy joined
02:05 rasusto_ joined
02:07 MoarSpaceFi joined
02:07 raingloom joined
02:08 lortabac_ joined
02:09 dbmikus__ joined
02:12 elfets joined
02:13 sytherax joined
02:14 Guest23311 joined
02:14 theDon joined
02:18 banc joined
02:20 bontaq joined
02:20 <jle`> jcob: a monad is not a higher-kinded type
02:20 <jle`> monads cannot be higher-kinded types by definition
02:20 <jle`> at least, not Monads
02:21 <jle`> jcob: you might be thinking of the Monad typeclass, which is a "higher-kinded typeclass"
02:21 <jle`> jcob: but its instances, like IO, list, Maybe, Either e, etc., are not higher-kinded
02:22 <jle`> IO, list, Maybe, Either e, etc., are all "first-order" types
02:23 <jle`> but being able to talk about all monads under a uniform framework requires a higher-order abstraction
02:24 xpycm joined
02:24 sytherax joined
02:29 sytherax joined
02:30 WhatisRT joined
02:30 Talla joined
02:32 Linter joined
02:33 chano- joined
02:36 dented42 joined
02:36 zdenal joined
02:36 zyla_ joined
02:38 lagothri1 joined
02:39 <pounce> Why does `main` have the IO () type?
02:39 <pally> How do I get ghci to perform the trace like lambda does?
02:39 <pally> e.g.
02:39 <pounce> I mean, what's wrong with main doing some computation and exiting?
02:39 <pally> lambdabot*
02:39 saurabhnanda joined
02:39 <pally> >foldr (-) z [b,c]
02:40 <pally> > foldr (-) z [b,c]
02:40 <lambdabot> b - (c - z)
02:41 AetherWind joined
02:42 Jesin joined
02:45 camsbury joined
02:45 progfun joined
02:45 <geekosaur> pounce, it actually has type IO a, but what is supposed to do what with the a?
02:46 <pounce> huh, didn't know that
02:46 <geekosaur> you are building up a program in the form of an IO action, and handing that back to the runtime to be (impurely) run. the result of the thing generating the IO action isn't useful
02:48 exarkun joined
02:49 <geekosaur> (conceptually at least. ghc actually does something else. but haskell, and in particular IO actions, will make a lot more sense if you think of it this way)
02:49 kefin_ joined
02:49 emilypi joined
02:49 <geekosaur> and you can think of (>>) and (>>=) as attaching callbacks to the end of an IO action. the former fires on completion of the action on the left, the latter also receives its result.
02:50 <geekosaur> so you are purely manipulating a program to be handed off to an impure evaluator
02:50 <geekosaur> which is now we get away with IO in an ure language
02:50 <geekosaur> * a pure
02:51 edmundnoble joined
02:51 <geekosaur> *how
02:53 gregberns joined
02:53 <geekosaur> ghc actually does something a bit more optimal, but if you don;t understand what it's actually doing and how to manipulate it safely, you get https://github.com/haskell/bytestring/blob/master/Data/ByteString/Internal.hs#L566
02:53 saurabhnanda joined
02:54 boccato joined
02:55 dented42 joined
02:55 <pounce> Right now I'm getting an error "Couldn't match type ‘IO String’ with ‘[Char]’" when trying to call `words getLine`. I want this to have the type IO [String], but I'm not sure how to propogate the IO
02:55 sytherax joined
02:56 dented42_ joined
02:56 replay joined
02:56 <geekosaur> fmap words getLine
02:57 <geekosaur> you can't manipulate an IO String directly. it's not a String wrapped in IO, it's a program that can generate a String
02:57 sytherax joined
02:57 <geekosaur> you have to attach a callback to it, via fmap or via (>>=)
02:57 bontaq joined
02:57 xcmw joined
02:58 <pdxleif> On this page, is the part about "if !impl(ghc >= 8.0) build-depends: semigroups == 0.18.*" supposed to say "if less than 8.0"? https://prime.haskell.org/wiki/Libraries/Proposals/SemigroupMonoid#Writingcompatiblecode
02:59 <pdxleif> Data.Semigroup is already in > 8.0, so why would you need to add the lib in that case?
02:59 <pounce> how would I use >>= in this context?
02:59 sword865 joined
02:59 hphuoc25 joined
02:59 <geekosaur> getLine >>= return . words
02:59 <geekosaur> but this is a bit of a code smell, since it's just a wordy version of `fmap words getLine`
02:59 <pdxleif> pounce: fmap words getLine or "words <$> getLine"
03:00 <pdxleif> by the monad laws >>= return is the same as fmap, so either one I guess
03:00 <pdxleif> or even do input <- getLine; return (words input)
03:01 <pdxleif> The error message was just saying you had an IO String instead of a String - "words" wants a String.
03:01 <pdxleif> Like if, you had a [String] or a Maybe String instead of String.
03:02 <* hackage> typenums - Type level numbers using existing Nat functionality http://hackage.haskell.org/package/typenums- (AdituV)
03:02 <geekosaur> you can also use `pure` instead of `return` in any of those, which is preferred these days provided you can be certain you won;t be forced to use a version of ghc which doesn't have `pure` yet (< 7.10 iirc)
03:02 <geekosaur> which is sometimes a problem on e.g. debian
03:02 <pounce> what's the differenece?
03:03 <pounce> <$> works pretty well for me, but I haven't a clue what it does
03:03 <petercommand> :t (<$>)
03:03 <lambdabot> Functor f => (a -> b) -> f a -> f b
03:03 <geekosaur> <$> and fmap are the same thing, but <$> is an infix operator instead of a prefix function
03:03 <petercommand> <$> is fmap
03:03 <pounce> what is fmap?
03:03 <petercommand> a generalized map
03:04 <geekosaur> the fundamental operation of a Functor
03:04 dan_f joined
03:05 <petercommand> > fmap (+1) [1,2]
03:05 <lambdabot> [2,3]
03:05 <petercommand> > fmap (+1) (Just 10)
03:05 <lambdabot> Just 11
03:05 <petercommand> > fmap (+1) Nothing
03:05 <pounce> ah, was just about to ask about Maybe :3
03:05 <lambdabot> Nothing
03:05 <petercommand> :3
03:06 <pdxleif> > map (+1) [1,2]
03:06 <lambdabot> [2,3]
03:06 krone_ joined
03:07 <pdxleif> fmap and <$> are just aliases of each other. I like using <$> as an infix operator - sometimes saves me from having to write parens around its arguments.
03:07 <arahael> Can I format number-literals with a thousands separator of some sort?
03:07 altjsus joined
03:07 fujiy joined
03:08 language_agnosti joined
03:09 <pdxleif> arahael: Like this? https://github.com/chrisdone/formatting/blob/master/src/Formatting/Examples.hs#L40
03:10 <pdxleif> Oh sorry, I misunderstood - you meant putting e.g. a comma every three digits?
03:10 <petercommand> > let f n = if n < 1000 then n else f (n `quot` 1000) :: [n `rem` 1000] in f 11234678
03:10 <lambdabot> error:
03:10 <lambdabot> • Couldn't match type ‘n1’ with ‘n2’
03:10 <lambdabot> because type variables ‘k2’, ‘n2’ would escape their scope
03:10 <arahael> No, not as a string. As a *literal*.
03:10 <petercommand> > let f n = if n < 1000 then n else f (n `quot` 1000) : [n `rem` 1000] in f 11234678
03:10 <lambdabot> error:
03:10 <lambdabot> • Occurs check: cannot construct the infinite type: a1 ~ [a1]
03:10 <lambdabot> • In the expression: f (n `quot` 1000) : [n `rem` 1000]
03:10 <pdxleif> With a quasiquoter, I'd guess.
03:11 <arahael> ie, `1,200 :: Integer`
03:12 <pdxleif> With a quasiquoter you could have e.g. `[int|1,200]`
03:13 <pdxleif> With the qq-literals lib you just need to write a `String -> Either String Integer` function for that to work.
03:13 <arahael> Hmm, so only with a quasiquoter?
03:13 <pounce> How would I read all the lines from stdin instead of just one?
03:13 <arahael> One advantage for C++ and C#, I guess. :(
03:14 justaguest joined
03:14 <pdxleif> You can write comma-delimited numbers in C?
03:14 <arahael> pdxleif: No, and I don't neccessarily need comma-delimited. I just want separators.
03:15 <arahael> Eg, in C++, you can do: int x = 1'200; And in C#, you can do: int x = 1_200;
03:16 pwnz0r joined
03:16 <arahael> C has no such support, though.
03:19 bbrodriguez joined
03:19 <glguy> GHC's getting _ separators for number literals soon
03:19 <arahael> Oh, nice.
03:19 <pdxleif> arahael: I'd be interested in something like that myself. If it doesn't have to be a comma, seems you might define some function to do that. But a literal 000 would still be just 0. I'm thinking something like a quasiquoter would be best for that. Maybe propose it as a language syntax extension if it catches on?
03:19 <glguy> https://ghc.haskell.org/trac/ghc/ticket/14473
03:19 <arahael> pdxleif: glguy has the answer I was after.
03:21 boccato joined
03:22 danso joined
03:22 sytherax joined
03:23 <pounce> How would I read all the lines from stdin instead of just one? (sorry to repeat, there was another conversation happening so idk if people saw)
03:23 <glguy> getContents does that
03:24 sytherax joined
03:26 winter joined
03:27 gestone joined
03:27 <krone_> p
03:29 danso joined
03:30 <Axman6> arahael: I think GHC 8.4 added underscores in numbers a la Ada, 1_000_000, with an excvtension
03:30 nshepper1 joined
03:30 <arahael> Very nice. I think that's the same extension glguy referred to. :)
03:31 <pounce> so is `a . map b` equivilant `a <$> b` ?
03:31 <Axman6> -XNumericUnderscores https://ghc.haskell.org/trac/ghc/ticket/14473
03:31 <arahael> Yep, that's the same one.
03:31 <Axman6> oh, missed that. glguy always beats me
03:31 <* Axman6> cowers in fear of another beating
03:31 <arahael> Haha. :)
03:32 <Axman6> hmm, 8.6 :(
03:33 rasusto_ joined
03:33 <geekosaur> pounce, map is specific to lists. fmap works on any Functor
03:34 <pounce> err, `a . fmap b`
03:35 <pounce> third gold star achieved \o/
03:36 pavolzetor joined
03:36 <pdxleif> That -XNumericUnderscores isn't in GHC 8.4.3.
03:36 <pavolzetor> hello, why does this not print the map? fmap (putStrLn . show) . eval $ res
03:36 <pavolzetor> but
03:36 <pavolzetor> m <- eval res; putStrLn . show $ m
03:36 <pavolzetor> does print it
03:37 <pavolzetor> I am confused why the output is different
03:37 <glguy> pavolzetor: Compare the types of the two things
03:37 dented42 joined
03:37 <pdxleif> pounce: What does `a . map b` mean?
03:37 cschneid joined
03:38 <glguy> pavolzetor: One is going to be something like: IO () and the other IO (IO ())
03:38 <pdxleif> I know `f <$> b` is equivalent to `fmap f b`
03:38 infinisil joined
03:38 <glguy> pounce: No, `a . map b` isn't the same as `a <$> b`
03:38 ant23 joined
03:38 <glguy> nor the same as `a . fmap b`
03:39 lassulus_ joined
03:39 <glguy> pavolzetor: The one that works, using =<< is a single IO action that both evaluates and prints
03:39 sytherax joined
03:39 <glguy> while the second is an action that evaluates and returns an action that would print the result of evaluation, if you ran it
03:40 <pavolzetor> I see, thanks that was helpful; I would need join
03:40 <glguy> correct
03:42 fmixing joined
03:43 <* hackage> speechmatics - Speechmatics api client http://hackage.haskell.org/package/speechmatics- (Jappie)
03:46 chao-tic joined
03:46 znack joined
03:46 otto_s_ joined
03:46 jbayardo joined
03:47 boccato joined
03:51 zdenal joined
03:52 MP2E joined
03:52 jbayardo joined
03:52 JimmyRcom_ joined
03:56 hphuoc25 joined
03:58 iAmDecim joined
03:58 x1ddos joined
03:59 <pounce> glguy: what does surrounding `x `divMod` y` with brackets do here? https://github.com/glguy/advent2017/blob/master/execs/Day02.hs#L48
03:59 x1ddos_ joined
03:59 <glguy> pounce: It makes a singleton list
03:59 <pounce> it doesn't seem like it builds a list
03:59 <pounce> oh, what for?
03:59 <glguy> so that it can pattern match against the pattern on the left side of the arrow
04:00 <pounce> the pattern on the left looks just like a tuple though, how is it a list?
04:00 <glguy> > [x | (x,True) <- [(1,True), (2,False), (3,True)] ]
04:00 <lambdabot> [1,3]
04:00 <glguy> The way list comprehensions work is that each element of the list on the right side is matched against the pattern on the left
04:01 <glguy> > [ (x,y) | x <- [1,2], y <- [3,4] ]
04:01 <lambdabot> [(1,3),(1,4),(2,3),(2,4)]
04:01 <pounce> hmm
04:01 Foritus joined
04:02 <glguy> If the pattern doesn't match, that element is skipped over
04:02 pureNonsense joined
04:02 <glguy> > [ x | Just x <- [ Just 1, Nothing, Just 3 ] ]
04:02 Linter joined
04:02 <lambdabot> [1,3]
04:03 <pureNonsense> hi, does anyone know how the vscode HIE plugin calls Brittany for formatting or is that done through HIE itself?
04:04 <pounce> what about the list comprehentions with booleans? like I was doing [x | x <- xs, any (\a -> a `mod` x == 0) (delete x xs)] because I thought they had to bee bools originally
04:05 <glguy> There are two things that can go on the right side of the | in a list comprehension, either _ <- _, or a boolean expression
04:05 dented42_ joined
04:06 <pounce> ah ok
04:06 <glguy> In the case of a boolean expression, the expression is evaluated and if it is True it succeeds and the current elements are kept and if it is False then the current element is skipped over
04:06 <glguy> > [ x | Just x <- [ Just 1, Nothing, Just 2 ], even x ]
04:06 <lambdabot> [2]
04:07 <pounce> so you can chain them together with commas?
04:07 <glguy> > [ x | Just x <- [ Just 1, Nothing, Just 2 ], even x, 2 == x, True ]
04:07 <lambdabot> [2]
04:08 <glguy> Yeah, you can keep going
04:08 <glguy> > [ 'a' | even 2 ] -- You don't even need any <- components in a list comprehension, you can just have boolean guards
04:08 <lambdabot> "a"
04:08 <glguy> > [ 'a' | odd 2 ]
04:09 <lambdabot> ""
04:09 language_agnosti joined
04:09 <pounce> > [ x | Just x <- [ Just 1, Nothing, Just 2, Just 4], even x, 4 <- x ]
04:09 <lambdabot> error:
04:09 <lambdabot> • No instance for (Integral [Integer])
04:09 <lambdabot> arising from a use of ‘e_11244’
04:09 krone_ joined
04:09 <pounce> >…<
04:09 <glguy> x isn't a list in that example
04:09 <glguy> so it doesn't make sense to put it on the right side of <-
04:09 <mniip> > [() | 4 <- [2, 3, 4, 6, 3, 4]]
04:09 <pounce> ooh I think I'm getting it now, ty
04:09 <lambdabot> [(),()]
04:10 <mniip> fun
04:10 <mniip> (an integer literal is a pattern after all)
04:11 <glguy> Yup, and the original impetus for the question was a 0 pattern
04:13 chao-tic joined
04:13 vmandela joined
04:13 boccato joined
04:14 <glguy> % [ x | x+1 <- [0,10] ]
04:14 <yahb> glguy: [9]
04:16 tombusby joined
04:18 taumuon joined
04:18 WhatisRT joined
04:20 <pounce> oh wow, that's a nice pattern. Is 0 not the successor of -1?
04:20 krone_ joined
04:20 <glguy> That's a relic from the old times of Haskell98, an "n plus k pattern"
04:21 <pounce> reminds me of number theory
04:21 <glguy> the x+k patterns only matched such that x would be non-negative
04:21 freeman42x]NixOS joined
04:21 <glguy> so you'd write: f 0 = this; f (x+1) = that
04:21 <glguy> or f 0 = this; f 1 = that; f (x+2) = theother
04:21 pwnz0r joined
04:21 <pounce> yep, reminds me a lot of number theory xD
04:24 pally joined
04:25 emilypi joined
04:26 hphuoc25 joined
04:28 <pally> Is there a cool oneliner to do the following:
04:28 <pally> somefunc :: <type signature>
04:28 cjreynolds joined
04:28 <pally> somefunc xs [] = []
04:28 exarkun joined
04:28 <pally> somefunc [] xs = []
04:28 <pally> ...
04:29 <geekosaur> semicolons in place of newlines. otherwise, no
04:29 <pally> basically return the empty list if either lists is empty
04:29 jbayardo joined
04:30 mceier joined
04:30 <pally> the second pattern should be `[] ys`
04:30 <pally> but you are quick witted, so you knew what I was tryna get at.
04:31 ian_andrich joined
04:33 <geekosaur> the names don't really matter
04:33 <geekosaur> we'd usually write _ instead of a name since it's not being used
04:36 <jle`> pally: what should it return if the lists are not empty?
04:36 <pounce> > somefunc xs ys = if xs == [] || ys == [] then [] else []
04:36 <lambdabot> <hint>:1:16: error:
04:36 <lambdabot> parse error on input ‘=’
04:36 <lambdabot> Perhaps you need a 'let' in a 'do' block?
04:36 <jle`> if you don't care, you can use (*>) or (<*)
04:36 kuttifunk joined
04:37 <jle`> pounce: if neither are empty, then you also return []?
04:37 <jle`> pounce: sounds just like someFunc _ _ = []
04:37 <pounce> (just trying out pally's question)
04:37 <jle`> oh ah misread the username
04:37 kasra joined
04:38 toovs joined
04:38 <jle`> > [1,2,3] *> []
04:38 <lambdabot> []
04:38 <jle`> > [] <* [1,2,3]
04:38 <lambdabot> []
04:38 <geekosaur> pounce, lambdabot doesn't take definitions (at least not that way). you can use let-in, but not bare let (as in ghci or do blocks) or top level definitions
04:38 <pally> jle` the function will apply some user specified f on the cartesian product of two lists, which I will list comprehension to accomplish. List comprehension is so far my favourite feature.
04:38 progfun joined
04:38 <jle`> pally: that sounds like liftA2 then?
04:39 <geekosaur> there is @let, but that will add to a shared context so you should consider your names carefully
04:39 <jle`> > liftA2 (,) [1,2,3] []
04:39 <lambdabot> []
04:39 <jle`> > liftA2 (,) [] ['a','b','c']
04:39 <geekosaur> or someone will @undefine when they hit a collision and it'll go away
04:39 <lambdabot> []
04:39 <jle`> > liftA2 (,) [1,2,3] ['a','b','c']
04:39 <lambdabot> [(1,'a'),(1,'b'),(1,'c'),(2,'a'),(2,'b'),(2,'c'),(3,'a'),(3,'b'),(3,'c')]
04:39 <jle`> but tbh the "return an empty list" part is the least interesting part ;)
04:40 <pally> while I still haven't referred to the doc, but liftA2 is pretty gangsta
04:40 <pally> or so it seems.
04:40 <jle`> yeah, it was one of the biggest advancements to come out of haskell in the past decade
04:40 <pounce> > \xs ys = if xs == [] || ys == [] then [] else []
04:40 <lambdabot> <hint>:1:8: error:
04:40 <lambdabot> parse error on input ‘=’
04:40 <lambdabot> Perhaps you need a 'let' in a 'do' block?
04:41 <jle`> liftA2 changed the game when it was invented
04:41 <pounce> how do I try a function then?
04:41 <jle`> you can name them
04:41 <pally> list comprehension behave my instant favourite when I learned about it in The Gentle Intro
04:41 mac10688 joined
04:41 <geekosaur> like I said, @let --- but be careful what name you choose, some names are in use and some are just asking for others to run into it, become grumpy, and wipe the @let storage
04:42 <geekosaur> @let fuddle xs ys = if xs == [] || ys == [] then [] else []
04:42 <lambdabot> Defined.
04:42 <geekosaur> :t fuddle
04:42 <lambdabot> (Eq a1, Eq a2) => [a1] -> [a2] -> [a3]
04:42 <geekosaur> note that we don;t use == to determineif a list is empty normally, because why would you care if the list's items can be ==d? use null instead
04:43 <geekosaur> :t null
04:43 <lambdabot> Foldable t => t a -> Bool
04:43 <pounce> well there's your (notso) clever oneliner pally <.<
04:43 fujiy joined
04:43 <pounce> geekosaur: fair
04:43 dented42 joined
04:47 <geekosaur> % :t null @[]
04:47 <yahb> geekosaur: [a] -> Bool
04:48 sytherax joined
04:49 Alan_ joined
04:49 jhrcek joined
04:51 <pally> jle` originally I was going to use list comprehension but if I were to use liftA2 is there a way for me apply a function on the components of each pair (not on the pair itself), sorta like Racket's 'apply' function.
04:51 <jle`> can you give an example of what you mean
04:51 <glguy> :t uncurry
04:51 <jle`> what is the list comprehension equivalent?
04:51 <lambdabot> (a -> b -> c) -> (a, b) -> c
04:52 <pally> your example is best
04:52 <pally> > liftA2 (,) [1,2,3] [4,5]
04:52 <lambdabot> [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)]
04:52 <jle`> there you go :)
04:52 <jle`> does that not do what you want?
04:52 <pally> now apply some function f on the components of each pair
04:53 <jle`> what do you mean exactly?
04:53 <pally> like : [ f 1 4 , f 1 5, f 2 4,, ...]
04:53 <glguy> map (uncurry f)
04:53 <jle`> pally: i mean you could, but why would you want to do that, heh
04:53 <jle`> you could just liftA2 f
04:53 <glguy> or in this case: liftA2 f
04:53 <jle`> > liftA2 (+) [1,2,3] [100,200,300]
04:53 <lambdabot> [101,201,301,102,202,302,103,203,303]
04:54 <pally> if it is difficult, then I stick to list comprehension :-)
04:54 <jle`> i mean, why would you use (,) at all, if you were going to just apply a function? :)
04:54 <jle`> > liftA2 f [1,2,3] [4,5,6]
04:54 <pally> jle`, b/c that's what you had in your example.
04:54 <lambdabot> error:
04:54 <lambdabot> • Ambiguous type variable ‘c0’ arising from a use of ‘show_M251925508488...
04:54 <lambdabot> prevents the constraint ‘(Show c0)’ from being solved.
04:54 <pally> heh
04:54 <jle`> pally: oh yeah, (,) was just ane xample of a function
04:54 <jle`> you can put any function there, heh
04:55 <jle`> (,) was just a generic function, but you can use any function you want
04:55 <jle`> i was trying to show you what `liftA2` did, not what `liftA2 (,)` did :)
04:55 jbayardo joined
04:55 <jle`> do you see what happened with liftA2 (+) up there?
04:56 <jle`> > liftA2 f [1,2,3] [4,5,6] :: [Expr]
04:56 <lambdabot> [f 1 4,f 1 5,f 1 6,f 2 4,f 2 5,f 2 6,f 3 4,f 3 5,f 3 6]
04:56 <jle`> f is the 'user-supplied function' you were talking about
04:56 <pally> yes sir
04:56 <jle`> it doesn't have to be (,)
04:57 <jle`> > liftA2 f [x,y,z] [a,b,c] :: [Expr]
04:57 <lambdabot> [f x a,f x b,f x c,f y a,f y b,f y c,f z a,f z b,f z c]
04:59 bbrodriguez joined
05:00 alx741_ joined
05:00 guessWHo joined
05:01 saurabhnanda joined
05:01 <pally> these features are really chill, compared to recursive ish I was reading (course notes) earlier. I share with you 'myscanr' https://lpaste.net/6065036963516252160
05:01 <pally> heh
05:01 <guessWHo> is this return type fine Either Bool IO()
05:01 <jle`> guessWHo: that's not quite a real type no
05:01 <jle`> but Either Bool (IO ()) is
05:01 eminhi joined
05:02 <jle`> pally: note that liftA2 for lists is implemented, under the hood, with recursion
05:02 <jle`> it's just a higher order function like map, foldr that abstracts over a common usage of lists
05:02 <pally> jle` I know I know.
05:02 <guessWHo> jle` : is it fine to have such return types i mean is this the "haskellish" way of doing things ?
05:03 <glguy> guessWHo: your type didn't kind check, remember that it parses like this: ((Either Bool) IO) ()
05:03 robstr joined
05:03 <jle`> guessWHo: i don't think there's anything particularly bad about it
05:03 <cocreature> it is somewhat uncommon. you see things like IO (Either Bool ()) a lot more often
05:03 <jle`> IO (Either Bool ()) is a completely different thing, though
05:04 <jle`> Either Bool (IO ()) is probably an ok way to represent the possiblity of either a Bool or an IO computation
05:04 <cocreature> sure, my point is that it’s useful way more often than Either Bool (IO ())
05:04 <cocreature> to the point that I wonder if the Either Bool (IO ()) isn’t a typo and it’s actually IO (Either Bool ())
05:05 <jle`> Either Bool (IO ()) often is an intermediate type that's awaiting a 'sequence'
05:05 wchresta joined
05:05 <jle`> sequence :: Either Bool (IO ()) -> IO (Either Bool ())
05:05 <jle`> but usually people just use 'traverse' if possible
05:07 zdenal joined
05:07 Zialus joined
05:08 tsaka__ joined
05:09 <jle`> :t print <$> Left True
05:09 <lambdabot> Either Bool (IO ())
05:09 <jle`> :t traverse print (Left True)
05:09 <lambdabot> IO (Either Bool ())
05:09 eminhi joined
05:09 <jle`> i guess it really just depends on what you are going to be doing with that Either
05:10 Folkol joined
05:10 algorev[m] left
05:11 <cocreature> huh I managed to get ghci to not have (-) in scope and I have no idea how I got to this point
05:12 jbayardo joined
05:12 <guessWHo> jle` : can we do this Right x -> Right $ do .. when my return type is Either Bool (Int()) ? i mean i tried and it throws errors
05:12 <jle`> ghci -XNoImplicitPrelude gets it for me, but i don't know how to get it out of scope once it's already in
05:12 <jle`> guessWHo: what is the error?
05:13 boccato joined
05:13 <jle`> guessWHo: and no, you can't have Either Bool (Int ())
05:13 <jle`> that's definitely not a thing
05:13 WhatisRT joined
05:13 <jle`> unless you're using an `Int` that is user-defined and not the one included with ghc
05:13 <guessWHo> jle` : sorry i mean Either Bool (IO())
05:13 <jle`> ah, ok
05:14 <jle`> yeah, we can't really say anything without an error or the code that caused it
05:14 hphuoc25 joined
05:14 <jle`> having both would be best :)
05:15 hellozee joined
05:15 sytherax joined
05:15 susmus joined
05:16 xtreak joined
05:17 <guessWHo> jle` : https://lpaste.net/4529369675959631872 this is a version of it
05:18 ozzymcduff joined
05:19 slomo joined
05:19 <cocreature> guessWHo: the problem is that foo 10 has type IO (Either x y).
05:19 <cocreature> so to decide whether bar returns Left or Right you need to execute IO
05:20 <cocreature> but Either CustomException (IO ()) would allow you to inspect whether the value is left of right without executing IO
05:20 <cocreature> you need something like "IO (Either CustomException (IO ())"
05:21 toovs joined
05:21 <guessWHo> cocreature : yeah i was thinking that but i was told it's not a very good idea ? is it not ?
05:21 <cocreature> I don’t think there is something inherently wrong with it, it depends on your usecase
05:21 Alan_ left
05:22 <cocreature> IO (Either CustomException ()) might be more appropriate but that won’t allow you to delay the execution of the IO that you’re currently storing in the Right case
05:22 <cocreature> whether that matters depends on your application
05:23 <guessWHo> cocreature : naturally if i see too many functions returning IO , or working with IO , i feel something is wrong or i'm not doing it in proper way
05:23 <jle`> guessWHo: remember that each line in an IO do block has to be IO something
05:23 <jle`> that's why 'case y of Right m -> Right ...' can't work
05:23 <cocreature> guessWHo: well if you want to execute IO, you have to work in IO
05:23 <jle`> the result has to be IO, since you're in an IO do block
05:23 <cocreature> so since foo executes IO you don’t have a choice here
05:23 <jbayardo> guessWHo: how about EitherT? https://hackage.haskell.org/package/either-4.4.1/docs/Control-Monad-Trans-Either.html
05:24 language_agnosti joined
05:24 whaletechho joined
05:24 <jle`> that doesn't really do anything here
05:24 <cocreature> you could separate "bar" into two parts. a non-IO function that processes the result of executing foo and the plumbing that executes foo and passes the result to the pure function
05:24 <jle`> guessWHo: remember the difference between wiath Either Bool (IO ()) and IO (Either Bool ()) are
05:25 <jbayardo> foo :: Int -> EitherT CustomException IO Bool, and then bar :: Int -> EitherT CustomException IO ()
05:25 <jle`> they are completely different types
05:25 <cocreature> jle`: fwiw, you usually want to use ExceptT instead of EitherT
05:25 <jle`> in any case all ExceptT would do here is add a useless newtype wrapper around everything, heh
05:25 <jle`> it would serve no purpose, it'd be like using Sum Bool instead of Bool
05:26 <guessWHo> how can those be helpful here, still haven't read a lot on monad transformers , do point to any resource for me to get started with transformers
05:26 <cocreature> they aren’t helpful here as jle` mentioned :)
05:26 <jle`> like i said, there is nothing at all that ExceptT or EitherT could help here with, heh
05:26 <jle`> guessWHo: Either Bool (IO ()) is either a Bool or an IO action
05:26 <jle`> guessWHo: IO (Either Bool ()) is an IO action that returns either a Bool or ()
05:26 <jle`> what you have here is an IO action
05:27 <jle`> bar is itself an IO action
05:27 <guessWHo> cocreature, jle` : they might not be useful here but i have been meaning to learn monad transformers specifically readerT and stateT and the whole readerT pattern
05:27 knupfer joined
05:28 sytherax joined
05:29 vlatkoB joined
05:29 LiaoTao joined
05:30 ian_andrich joined
05:33 iAmDecim joined
05:36 iAmDecim joined
05:38 cjwelborn joined
05:38 <guessWHo> jle` : so IO (Either Bool () and IO Either Bool (IO()) same
05:39 iAmDecim joined
05:41 <cocreature> guessWHo: no, the latter one allows you to delay the execution of the IO part in the Right case
05:41 language_agnosti joined
05:41 <cocreature> or not execute it at all
05:41 boccato joined
05:43 giraffe joined
05:43 <guessWHo> cocreature : and what about the first one ?
05:44 <cocreature> the first one gives you an IO action that produces an "Either Bool ()". but the Right case just contains () in this case, there is nothing to execute there
05:45 language_agnosti joined
05:45 <guessWHo> cocreature : by delay you mean when i do m <- bar 10 at this point either the IO action will be performed or not right ?
05:46 tumdedum joined
05:46 tumdedum joined
05:46 <cocreature> by delay I mean that if you have "x :: IO (Either Bool (IO ())" and you use something like "do x' <- x; case x of Left _ -> pure (); Right ioAction -> _" you can choose what you want to do with ioAction
05:46 <cocreature> you can execute it at some later point, not execute it at all, …
05:46 seizo joined
05:47 bbrodriguez joined
05:47 krone_ joined
05:47 justaguest joined
05:47 carlomazzaferro joined
05:48 lastmanstanding joined
05:48 <guessWHo> cocreature : ah ohk i got it , also some beginner friendly resources on readerT pattern and monad transformer in general >?
05:49 altjsus_ joined
05:50 Linter joined
05:51 KeyJoo joined
05:51 <cocreature> don’t have a link handy, sry
05:53 <guessWHo> cocreature : it's okay , thanks for the help so far :) , can you describe in brief about the readerT pattern and when it should be used ?
05:54 tumdedum joined
05:54 bbrodriguez joined
05:55 <cocreature> all ReaderT does is to hide the plumbing of having to manually pass around an argument
05:55 kvda joined
05:57 piark_ joined
05:57 kvda joined
05:57 errst joined
05:58 <jle`> guessWHo: IO Either Bool (IO ()) is not a thing
05:58 <jle`> do you mean IO (Either Bool (IO ())) ?
06:00 chat_ joined
06:00 <guessWHo> jle` : yeah i meant that and cocreature explained the difference while you were gone , thanks for the help so far :)
06:00 <guessWHo> jle` : can we move now to readerT :P
06:00 <jle`> no problem :)
06:01 tumdedum joined
06:01 slaznick joined
06:01 osa1 joined
06:02 slaznick1 joined
06:02 keepLearning512 joined
06:02 slaznick1 joined
06:04 ru0mad joined
06:05 yuuki_ joined
06:06 bertschneider joined
06:06 agander joined
06:07 WhatisRT joined
06:08 chat joined
06:08 agander_ joined
06:08 ru0mad_ joined
06:09 exarkun joined
06:10 davr0s joined
06:11 <pdxleif> Can someone explain the reason for the "import Data.Semigroup as Sem" (instead of just "import Data.Semigroup") on https://prime.haskell.org/wiki/Libraries/Proposals/SemigroupMonoid#Writingcompatiblecode ?
06:11 `Guest00000 joined
06:12 <jle`> pdxleif: back in the old days, Data.Semigroup exported a different (<>) than Data.Monoid did
06:12 <jle`> so if you didn't import it qualified, (<>) would be ambiguous
06:15 ru0mad joined
06:15 GodotMisogi joined
06:16 mariatsji joined
06:17 epsilonhalbe joined
06:17 <dysfun> those were not good days
06:17 zdenal joined
06:18 winter joined
06:18 <pdxleif> jle`: Oh, so you risk breaking your code on old GHC (7.10 or something?) if you don't do that when adding a Semigroup instance?
06:19 piark_ joined
06:19 zdenal joined
06:19 sarna joined
06:20 language_agnosti joined
06:20 kvda joined
06:20 ru0mad joined
06:22 tzemanovic joined
06:22 hphuoc25 joined
06:25 takuan joined
06:26 zfnmxt joined
06:26 <* hackage> vulkan-api - Low-level low-overhead vulkan api bindings http://hackage.haskell.org/package/vulkan-api- (achirkin)
06:26 Folkol_ joined
06:27 hamishmack joined
06:27 acidjnk joined
06:27 language_agnosti joined
06:28 don_quijote[m] left
06:28 ru0mad joined
06:29 chele joined
06:29 kuribas joined
06:32 tauta joined
06:33 achirkin joined
06:34 sytherax joined
06:35 mariatsji joined
06:35 hellozee joined
06:36 kvda joined
06:37 <achirkin> Hey! Dear expert haskellers, I need your help :) I try to use POSIX mutexes in Haskell FFI and constantly get some processes hanging on pthread_cond_timedwait. I've posted the full description of the problem on https://stackoverflow.com/questions/50809983/pthread-cond-timedwait-does-not-return-in-ghc-ffi and also created a repo to make it easy to replicate it: https://github.com/achirkin/interprocess/tree/mvar-fail
06:37 <achirkin> And I am happy to answer any questions here or on stackoverflow or on github if you need more information.
06:38 <dminuoso> SO has new design? huh
06:38 iAmDecim` joined
06:38 krone joined
06:40 lastmanstanding joined
06:40 <* hackage> soundgen - sound generator http://hackage.haskell.org/package/soundgen- (CIX_68)
06:40 jesyspa joined
06:41 language_agnosti joined
06:41 ddellacosta joined
06:41 amar joined
06:42 hphuoc25 joined
06:44 kvda joined
06:47 yuuki_ joined
06:47 <guessWHo> can i do type comparison with if ?? like if typeof x is Int
06:47 kvda joined
06:47 <dysfun> in general, you don't
06:48 <dysfun> what is the actual problem you're trying to solve?
06:49 <pavonia> guessWHo: Note that if-expressions are evaluated at runtime, while type checking already happens at compile time
06:49 <guessWHo> dysfun : i have this let temp = fst $ getPeer $ head $ fromMaybe [] lp it will either return a [] or a Custom type
06:50 <dysfun> guessWHo: create an ADT with two constructors and return that?
06:50 zdenal joined
06:51 <guessWHo> dysfun = not possible because i am storing this [customtype] in an hash table and that's why need to use fromMaybe to extract value from it
06:51 <pavonia> Also that crashes if lp is Nothing
06:51 <pally> > liftA2 f [1,2,3] [4,5,6] :: [Expr]
06:51 <lambdabot> [f 1 4,f 1 5,f 1 6,f 2 4,f 2 5,f 2 6,f 3 4,f 3 5,f 3 6]
06:52 <dysfun> right, it's not total
06:52 <pdxleif> And suggestions on how to use Data.Has with an API that as a HasFoo constriant?
06:52 <pally> how can I get ghci to do what lambdabot just did?
06:52 <pdxleif> It tells me it's not a terminating instance if I write instance Has Foo r => HasFoo r.
06:52 encod3 joined
06:52 <pally> for ghci, f is not in scope.
06:53 <jle`> pdxleif: yes, the whole point of the article is for backwards compatibility. if you don't worry about supporting really old ghc's, then importing Semigroup as it is should be fine :)
06:53 bsmt joined
06:53 <pdxleif> And if I turn on undecidable instances, it tells the instance is ambiguous if I try to call something using that.
06:53 <jle`> pdxleif: can you give an example of code
06:53 ccomb joined
06:54 <pavonia> pally: It's from the simple-reflect package, I think
06:54 <pdxleif> jle`: Given a function with this constraint: https://hackage.haskell.org/package/amazonka-1.6.0/docs/Control-Monad-Trans-AWS.html#t:AWSConstraint
06:55 alexad joined
06:55 <jle`> pally: yes, it's not really a ghci or lambdabot feature. it's just a library that defines a value 'f', 'x', etc.
06:55 <jle`> that has interesting Show instances
06:55 <dysfun> guessWHo: anyway, you should not use fromMaybe here, you should match on the result where you attempt to put it in the map
06:55 <pdxleif> I aslo wanted to add a "HasBar" constraint to the reader environment. Only it's less boilerplate and I can just use a tuple of (Env, Bar) as the environment if I use Data.Has, e.g. https://hackage.haskell.org/package/data-has-
06:55 <jle`> remember that it's ok for a library to define a value called 'f'
06:55 <jle`> pdxleif: can you give the code that causes the error
06:55 <dminuoso> :t f
06:55 <lambdabot> FromExpr a => a
06:56 Nussi joined
06:56 <jle`> pdxleif: everything you have linked seems good so far, so it's unclear what is causing the error
06:57 <pally> jle`, okay, now that I know it's from simple-reflect, I'll learn how to download, install, and/or import it later
06:57 <pdxleif> jle`: One sec, I'll come up with a minimal stand-alone example
06:58 <pally> in the meantime, I'll just use lambdabot
06:58 yuuki_ joined
06:59 <dminuoso> I have the desire to write some `f :: forall e. SomeException e => e -> Maybe a -> IO a` - is this a wise idea?
06:59 language_agnosti joined
06:59 <dminuoso> Oh. I missed a quantifier there, it should be `forall e a.`
07:00 ozzymcduff joined
07:00 <jle`> what would it do?
07:00 <jle`> is it just maybe . throwIO ?
07:01 <jle`> also SomeException is not a typeclass
07:01 <jle`> (maybe you mean Exception?)
07:01 <dminuoso> Oh heh. I was changing it forth and back and flipped a coin. Yes I meant Exception :P
07:01 <dminuoso> :t fromMaybe . throwIO
07:01 <lambdabot> Exception e => e -> Maybe (IO a) -> IO a
07:01 <dminuoso> :t maybe . throwIO
07:01 <lambdabot> Exception e => e -> (a1 -> IO a2) -> Maybe a1 -> IO a2
07:01 WhatisRT joined
07:02 <jle`> :t flip maybe pure . throwIO
07:02 <lambdabot> Exception e => e -> Maybe a -> IO a
07:02 <cocreature> seems pretty reasonable
07:02 ammazza joined
07:02 <jle`> :t \e -> maybe (throwIO e) pure
07:02 <lambdabot> Exception e => e -> Maybe a -> IO a
07:02 SpinTensor joined
07:02 language_agnosti joined
07:03 <jle`> if it's a pattern that pops up a lot then go for it :)
07:03 <jle`> i'd probably use it more as a local binding
07:03 <jle`> also:
07:03 <jle`> :t \e -> maybe (throwError e) pure
07:03 <lambdabot> MonadError e m => e -> Maybe a -> m a
07:03 <jle`> i use that a lot to convert Maybe's to Either's
07:03 louispan joined
07:04 <jle`> usually it's so short/simple that i don't bother with giving it a name
07:04 <cocreature> it’s called "note" in various packages
07:04 lortabac_ joined
07:04 <dminuoso> Oh *that* is cool.
07:05 <jle`> too bad fundeps prevent using any exception nakedly with IO
07:05 <jle`> you'd have to wrap in SOmeException
07:05 ddere joined
07:05 <dminuoso> How does MonadError compare to MonadThrow/MonadCatch?
07:06 gestone joined
07:06 <pdxleif> jle`: Hmm, I guess it works if I turn on UndecidableInstances in my standalone example: https://gist.github.com/LeifW/f6c2e6da3647ad43c151cc9e27e46ac6
07:06 <pdxleif> I can look more into why it was saying ambiguous instance in my full code.
07:06 <pdxleif> People probably wouldn't be wild about having UndecidableInstances to use the API.
07:06 <jle`> UndecidableInstances is a pretty common thing
07:07 <jle`> the name is scarier than what it actually is :)
07:07 <jle`> i'm usually more surprised when i'm writing code and UndecidableInstances is off
07:07 <dminuoso> pdxleif: All UndecidableInstances does is turn of some conservative checks that ensure the type checker will terminate. Worst case your type checker will error out in an infinite loop.
07:07 <dminuoso> Rare worst case it will be stuck in the type checker I think.
07:07 <dysfun> isn't that what darcs1 had?
07:07 cosmia joined
07:08 <pdxleif> Ok. I thought what I was asking it seemed like a sensible thing, and I'm pretty certain it will terminate.
07:08 freeman42x]NixOS joined
07:08 <jle`> to me it's on the same level as TupleSections
07:08 tzemanovic joined
07:08 <jle`> where i do (x,) and ghc gives me and error and i get grumpy that such a benign thing is not in haskell by default
07:09 <pdxleif> dminuoso: With MonadError you specify the type of the error, like Either.
07:09 <tdammers> TupleSections is just syntax sugar though
07:09 freeman42x]NixOS joined
07:09 mariatsji joined
07:09 <dysfun> yeah TupleSections is totally reasonable for default enabling
07:09 <pdxleif> With MonadThrow the left is just SomeException instances.
07:09 <tdammers> UndecidableInstances goes a bit deeper
07:10 <jle`> dminuoso: if it helps give any context, MonadError is basically MonadState, MonadReader, MonadWriter, except for Either
07:11 cosmia joined
07:11 mkoenig joined
07:11 <dminuoso> Ah cool - so I dont have to actually use this in a transformer stack because I can use the instance MonadError e (Either e)
07:12 phenoble joined
07:13 <jle`> yeah, it's meant to generalize over Either-like patterns
07:13 <jle`> MonadCatch/MonadThrow are meant to generalize the runtime Exception system that GHC offers
07:14 <jle`> so if you understand the difference between using 'Either e' and using IO exceptions, it's somewhat of a similar analogy
07:14 <jle`> * (Either e, ExceptT e, etc.)
07:15 <dminuoso> pdxleif: The degenerate case it tries to protect you against, is if you had some `instance HasFoo t => Has Foo t` I think. The type checker would end up in an infinite recursion to check the constraints of each other.
07:15 <cocreature> the part that’s slightly weird is the MonadError instance for IO
07:15 remyhr joined
07:15 <jle`> in fact i suppose you could even have both (MonadError e m, MonadCatch m) => m .., and MonadError would handle your "pure" exceptions (ExceptT e, Either e) and MonadCatch would handle your IO exceptions
07:16 <dminuoso> pdxleif: And strictly speaking you can't know whether that will always be the case. The open world assumption allows a third party user to later add it, and then loop the type checker.
07:16 AfonsoHenriques joined
07:16 yoneda joined
07:17 <jle`> if you had ExceptT e IO a, MonadError methods would work with your 'pure' e errors, and MonadCatch methods would work with the IO exceptions at the base
07:17 <jle`> but i don't think i'd recommend ever actually mixing both, heh
07:17 <jle`> that's just maybe a good illustration of the differences
07:17 <dminuoso> jle`: If Im not responding its because Im slowly reading and digesting this heap of knowledge =)
07:17 <cosmia> is there any article about ekmett/machines? the pdf on dropbox is no longer available
07:18 <pally> [ f x | x <- xs ]
07:19 <pally> I have a non-technical question: How would you read that in speech?
07:19 <opqdonut> f x for x in xs
07:19 <dminuoso> That sounds pythonish.
07:19 <opqdonut> that's how you read set notation in math
07:19 <cocreature> dminuoso: well python stole list comprehensions from Haskell iirc :)
07:19 <opqdonut> and list comprehensions are obviously inspired by that
07:19 reactormonk joined
07:20 <pally> and in math that's called the intentional description of a set
07:20 <pally> now, let's use Haskell parlance
07:20 davr0s joined
07:21 <pally> opqdonut, how you'd you read it in Haskell parlance?
07:21 <pally> that was for dminuoso, actually.
07:22 <opqdonut> TBH when talking about haskell I just usually grab a whiteboard or post-it note
07:22 <opqdonut> types are hard to read out loud too
07:22 <opqdonut> consider something like the type for >>=
07:22 Mysterious_Light joined
07:22 <opqdonut> or something like "f i . g (h j) $ k x
07:23 <pally> I am a newbie, I am not there yet :p , but I think it's the binding operator (Monad related)
07:23 <jle`> i usually don't translate the symbols directly, but rather the function or thing that the symbols are describing
07:23 <opqdonut> :t (>>=)
07:23 <lambdabot> Monad m => m a -> (a -> m b) -> m b
07:23 <opqdonut> ^ this type
07:23 <dminuoso> pally: I know it as set builder notation.
07:23 <jle`> like `f i . g (h j) $ k x`, it's describing applying f i composed with g of (h j) to k x
07:24 connrs joined
07:24 <jle`> for something like `putStrLn "hi" >> putStrLn "by"` i'd read >> as "and then" or "sequenced with"
07:24 <jle`> i'm not sure if i'm disproving or proving my point
07:24 <dysfun> i normally read do notation as 'and then' tbh
07:26 sytherax joined
07:26 <dminuoso> I dont read do notation allowed because I know it's just an abstract interface.
07:26 <dminuoso> *aloud.
07:27 jeltsch joined
07:28 <pally> jle` when you give your talks, do you ever get into hickups reading them out? heh
07:28 <pally> *aloud\
07:28 zenspider joined
07:29 <jle`> sometimes, but i do usually try to explain the idea of it instead of the notation
07:29 <jle`> unless it's a talk specifically about notation. then it gets weird
07:29 LikosX joined
07:29 xkapastel joined
07:30 hellozee_ joined
07:30 <zenspider> can I get a (gentle) code review? I implemented a concordance fn while poking a new book: https://gist.github.com/7cebc4b7f4f0c328da58f698b0b5be2d
07:30 <zenspider> I'm sure there are things I can improve. I'm just getting started
07:30 dddddd joined
07:31 fmixing joined
07:31 language_agnosti joined
07:32 <jle`> zenspider: instead of group + map, you can use a Map
07:32 dhil joined
07:32 connrs joined
07:32 <jle`> Map Int String and M.fromList instead of [(Int, String)] and map (\xs -> (..., head xs)) . group
07:32 <dminuoso> zenspider: also generally you'd rather use composition than a chain of $ in here: let top25 = take 25 $ sort $ concordance stops file
07:34 <zenspider> I'm not thrilled that I am passing down the stopwords set. My original version used one of the unsafe fns so I could make notStops a top level function that was prepopulated. Not sure if I've got the whole IO monad design thing down yet
07:34 <cocreature> what’s bothering you about having to pass it down? that seems perfectly fine
07:34 paraseba joined
07:34 <jle`> there is nothing wrong with parameterizing concordance on a stopwords set, heh
07:35 <cocreature> and definitely better than some unsafePerformIO newIORef if that’s what you mean by unsafe fns
07:35 <jle`> i wouldn't even call that unsafe, just absurd, heh
07:35 <jle`> zenspider: small things, putStrLn (printf "..." ...) is just printf "...\n" ...
07:36 <zenspider> well... it *worked*... :P yeah. I was using unsafePerformIO to make the set populate at the top
07:36 <cocreature> jle`: you’d be surprised by how often I’ve seen that to get global variables in Haskell :)
07:36 <jle`> printf can directly be IO
07:36 <dminuoso> zenspider: Also you probably might want to check out traverse_ over sequence_ for that last bit. :)
07:36 <jle`> cocreature: oh yeah, i mean, in this situation
07:36 <zenspider> I'm not sure I grok the Map suggestion above. I don't think I'm quite there yet
07:36 <jle`> zenspider: you're basically emulating a Map
07:36 <dminuoso> (or forM_ if you prefer)
07:36 <jle`> zenspider: are you familiar with Data.Map ?
07:36 jackdk joined
07:36 <zenspider> jle`: nope, not yet
07:37 <jle`> do you know any other languages besides haskell?
07:37 <zenspider> sequence_ is in my book. traverse_ isn't (yet?). But I'll poke at it.
07:37 <jle`> Map is a key-value store, like hashes from ruby, objects from javascript, dicts from python
07:37 <zenspider> jle`: yeah. I'm esp good w/ ruby and racket
07:38 <jle`> you're basically using [(Int, String)] as a "poor man's" version of a ruby hash
07:38 <* hackage> HNumeric - Haskell Numeric Library with pure functionality, R & MATLAB Syntax. http://hackage.haskell.org/package/HNumeric- (edeftg)
07:38 <jle`> but it's easier if you use the right data structure, Map from Data.Map
07:38 <jle`> you'd have `Map Int String` instead, a map of strings indexed by Int's
07:38 <dminuoso> :t traverse
07:38 <lambdabot> (Applicative f, Traversable t) => (a -> f b) -> t a -> f (t b)
07:38 betawaffle joined
07:38 <simon> how hard is it to compile a MacOS binary on Linux using GHC?
07:38 sytherax joined
07:39 <jle`> zenspider: oh hm, actually it might be slightly different
07:39 <jle`> i might have misread, Map might not be a direct translation of what you're using
07:39 <zenspider> I have it [(Int,String)] right now so that it is sortable
07:39 sytherax joined
07:39 <zenspider> it's really a Map String Int but I want the sort via the value
07:40 <zenspider> (well, both)
07:40 <jle`> ah i see. yeah it's not quite a direct translation then, since Map sorts internally by the key
07:40 <jle`> i suppose in that case this might be simpler, although i always feel weird seeing 'head'
07:40 <zenspider> if there is something like sortBy then it should be ok?
07:41 <zenspider> head is because of group. I didn't know how better to count occurances
07:41 DarkUnicorn_ joined
07:41 <jle`> oh, i see, you're just using that as a frequency map
07:41 <zenspider> exactly. there's probably something better for that tho
07:41 <jle`> yeah, the typical frequency map is made using Map
07:42 <dminuoso> zenspider: traverse f = sequenceA . fmap f
07:42 <jle`> :t M.fromListWith (+) . map (,1)
07:42 <lambdabot> (Num a, Ord k) => [k] -> M.Map k a
07:42 keep_learning joined
07:42 <jle`> that will build a frequency map of k's to their number of occurrences
07:42 <dminuoso> zenspider: So basically `sequence` is for collecting a list of effects in a foldable, while traverse allows you to map each element to an effect first.
07:42 <jle`> then you can just do M.toList to get the [(String, Int)] back and then sort how you like
07:42 <zenspider> ugh. I still don't get hoogle. I look up Map and I wind up with a page of 100% deprecetade stuff
07:42 <jle`> what hoogle are you using?
07:42 <dminuoso> zenspider: What you are doing with the list comprehension is exactly that: You take each element, replace it by an effect, and then sequence these effects. That is exactly traverse =)
07:42 <jle`> the 'official' hoogle is actually like five years out of date
07:43 <jle`> :t M.toList . M.fromListWith (+) . map (,1)
07:43 <lambdabot> (Num a, Ord k) => [k] -> [(k, a)]
07:43 <zenspider> https://hoogle.haskell.org/?hoogle=Map
07:43 <jle`> yup it's the first result :)
07:43 <jle`> > M.toList . M.fromListWith (+) . map (,1) $ "hello world"
07:43 <lambdabot> [(' ',1),('d',1),('e',1),('h',1),('l',3),('o',2),('r',1),('w',1)]
07:43 <zenspider> first result is 100% deprecated
07:43 <dminuoso> zenspider: forM_ top25 $ \(n, s) -> printf "%s -- %d\n" s (-n)
07:44 <zenspider> either I don't get hoogle, or I don't get the doco
07:44 <cocreature> zenspider: the docs are kind of confusing. the functions that are directly defined in Data.Map are deprecated but Data.Map reexports all of Data.Map.Lazy which is not deprecated
07:44 <jle`> https://hackage.haskell.org/package/containers-
07:44 <dminuoso> Or I suppose `for_` is sufficient *shrugs*
07:45 <zenspider> huh. that's a new error. Illegal tuple section?
07:45 <jle`> > sort . map swap . M.toList . M.fromListWith (+) . map (,1) $ "hello world"
07:45 <lambdabot> [(1,' '),(1,'d'),(1,'e'),(1,'h'),(1,'r'),(1,'w'),(2,'o'),(3,'l')]
07:45 <jle`> zenspider: yeah tuples can't be sectioned in vanilla haskell
07:45 <zenspider> guessing it's that (,1)
07:45 <jle`> the error message should give you a fix :)
07:45 <zenspider> use TupleSections... I'd rather stick to vanilla for now
07:46 <zenspider> I can figure it out tho
07:46 <cocreature> it’s just syntactic sugar for (\x -> (x,1))
07:46 <zenspider> yup
07:46 <jle`> zenspider: add {-# LANGUAGE TupleSections #-} to the top of your file
07:48 justaguest joined
07:48 language_agnosti joined
07:49 <zenspider> oh. sortBy isn't a schwartzian transformer... hrm
07:49 fmixing_ joined
07:49 exarkun joined
07:49 language_agnosti joined
07:49 <jle`> sortOn is, i believe
07:50 yeevy joined
07:50 <zenspider> how terrible is this?
07:50 <jle`> > sortOn (negate . fst) . map swap . M.toList . M.fromListWith (+) . map (,1) $ "hello world"
07:50 <zenspider> sortBy (\a b -> snd b `compare` snd a) $ Map.toList . Map.fromListWith (+) . map (\x -> (x,1)) $ "hello world"
07:50 <lambdabot> [(3,'l'),(2,'o'),(1,' '),(1,'d'),(1,'e'),(1,'h'),(1,'r'),(1,'w')]
07:51 <jle`> zenspider: sortOn swap ?
07:51 bertschneider joined
07:51 <cocreature> jle`: I don’t think that’s the same thing
07:51 <zenspider> > sortBy (\a b -> snd b `compare` snd a) $ Map.toList . Map.fromListWith (+) . map (\x -> (x,1)) $ "hello world"
07:51 <lambdabot> error:
07:51 <lambdabot> Not in scope: ‘Map.toList’
07:51 <lambdabot> Perhaps you meant one of these:
07:51 <cocreature> there’s a flip compare in there
07:51 <zenspider> BOOM
07:51 <jle`> oh i see
07:52 <jle`> sortOn snd
07:52 <jle`> but flipped
07:52 <cocreature> sortBy (flip compare `on` snd)
07:52 <jle`> `sortBy (negate . snd)` :)
07:52 <jle`> er, sortOn (negate . snd)
07:53 <jle`> > sortOn (negate . snd) . M.toList . M.fromListWith (+) . map (,1) $ "hello world"
07:53 <lambdabot> [('l',3),('o',2),(' ',1),('d',1),('e',1),('h',1),('r',1),('w',1)]
07:54 boccato joined
07:54 deepfire` joined
07:54 hphuoc25 joined
07:55 raichoo joined
07:56 WhatisRT joined
07:56 zero_byte joined
07:58 ru0mad joined
07:58 jfredett_ joined
07:58 WhatisRT joined
07:59 tzemanovic joined
08:02 nif joined
08:03 seveg joined
08:03 <zenspider> OK! THIS is the reason why I don't like pushing the stopwords stuff down ...
08:04 <zenspider> how do I poke at these new functions now that I basically need all of main to be redefined in my repl to even start poking?
08:04 Boomerang joined
08:04 <zenspider> eg. the sortOn isn't working but now I need to pull in and parse the stopwords instead of having that unsafe function that just works
08:05 <zenspider> what's the usual workflow for y'all?
08:05 <jle`> can't you just bind your stop words set?
08:05 language_agnosti joined
08:05 <jle`> if you're in ghci?
08:05 <jle`> stops <- makeTheStopWords
08:06 <zenspider> my basic rule: whenever a nerd uses the word "just", they're understating something.
08:06 tsaka__ joined
08:06 <zenspider> Yeah. I'm in ghci in emacs. flipping back and reloading and then running main
08:07 <zenspider> but I can't run my sub-fns because I need those binding that main has, over and over
08:07 gestone joined
08:07 <zenspider> that's why I said I'm not sure I have this IO monadic design thing down yet
08:07 <jle`> `makeTheStopWords :: IO S.Set String`
08:07 <jle`> makeTheStopWords would be an IO action
08:07 <jle`> * IO (S.Set String)
08:07 <jle`> and when you reload, you can do stops <- makeTheStopWords
08:07 <jle`> and stops is your stop words :)
08:08 <Axman6> Once you have that, ^R is your friend for reusing previous commands which use those bindings :)
08:09 keepLearning512 joined
08:09 <zenspider> huh. new error. Expecting one fewer arguments to IO Set.Set
08:09 <cocreature> you need parentheses around S.Set String
08:09 <zenspider> but parens there means tuple, doesn't it?
08:09 <Axman6> IO (Set.Set String)
08:09 <cocreature> no
08:09 <zenspider> oh. just ()
08:10 thc202 joined
08:11 keepLearning512 joined
08:12 language_agnosti joined
08:12 louispan joined
08:12 troydm joined
08:14 bertschneider joined
08:15 zar joined
08:15 sytherax joined
08:16 WhatisRT joined
08:17 curious_corn joined
08:17 tzemanovic joined
08:18 sytherax joined
08:18 <zenspider> is Foundation.Timing the right thing to be poking with?
08:20 <cocreature> whether foundation is the right thing for anything is at least up for debate :)
08:20 <zenspider> ok. how do I get simple timing info from my code?
08:20 <cocreature> I use the clock package
08:21 Laura joined
08:21 <Laura> hello
08:21 Linter joined
08:21 <jle`> zenspider: if you're in ghci you can also just do :set +t
08:21 <jle`> % :set +t
08:21 <yahb> jle`:
08:21 <jle`> % sum [1..1000]
08:21 <yahb> jle`: 500500; it :: (Num a, Enum a) => a
08:21 <cocreature> hey Guest5159 :)
08:21 <jle`> aw
08:22 boccato joined
08:22 <jle`> ah, :set +s
08:22 <jle`> % :set +s
08:22 <yahb> jle`:
08:22 <jle`> > sum [1..10000]
08:22 <lambdabot> 50005000
08:22 <jle`> % sum [1..100000]
08:22 <yahb> jle`: 5000050000; it :: (Num a, Enum a) => a; (0.17 secs, 16,267,160 bytes)
08:23 <cocreature> % :set -t
08:23 <yahb> cocreature: Some flags have not been recognized: -t
08:23 <Laulz> hi cocreature
08:23 <jle`> good thing Gauss as a 1st grader didn't have ghci
08:23 <cocreature> huh, is there no way to turn that off?
08:23 <zenspider> holy shit... am I really using that much memory?!?!
08:23 bergle joined
08:24 <dysfun> sounds like you've got a leak
08:24 <jle`> "how much memory does this haskeller use? the answer will shock you!"
08:24 <zenspider> my original map version is consistently faster... but they're both using absurd amounts of ram
08:24 <dysfun> https://wiki.haskell.org/Memory_leak
08:24 <cocreature> if you actually care about memory usage, you probably want to compile with -O and not use ghci for testing
08:25 <zenspider> .39s & 286mb vs 0.50s & 318mb
08:26 <zenspider> the compiled version only uses ~23mb
08:26 mnoonan_ joined
08:26 <cocreature> also make sure you are not confusing resident memory and total memory allocated
08:28 <zenspider> If I limit RTS to 11m it bombs out. Passes w/ 12m
08:29 <jle`> did i ruin yahb
08:29 <cocreature> can you show us the code?
08:29 bertschneider joined
08:29 <zenspider> https://gist.github.com/f9f956d31d83881f017254ab69fd8c82
08:30 <cocreature> how large are the files that you are reading?
08:30 hphuoc25 joined
08:30 <zenspider> it's literally pride and prejudice from gutenberg
08:31 <zenspider> ~700kb
08:31 sytherax joined
08:31 <zenspider> ~125 k words
08:31 <cocreature> 12mb don’t seem that unreasonable for representing a text file using String
08:31 <jle`> hm, does the memory go up or down if you use a larger or smaller file?
08:31 cloudhead joined
08:31 <cocreature> String is a linked list of characters so it’s not at all space efficient
08:31 <jle`> if not then it might just be the normal RTS doing its job
08:32 <ggVGc> jle`: the answer does shock me, every time
08:32 <jle`> oh yeah, String is indeed pretty awful in terms of memory usage, if you're using it as text
08:32 <jle`> it's basically the "i don't care about memory" type
08:32 <cocreature> you might also be able to safe some memory by using Data.Map.Strict
08:32 <zenspider> I usually don't either... it was the +s output that blew me away
08:32 <zenspider> that's taking it to another level
08:33 troydm joined
08:33 saurabhnanda joined
08:34 <dminuoso> What's the space requirement per character in String?
08:34 <dminuoso> (That is how large are boxes?)
08:34 louispan joined
08:34 boccato joined
08:34 lastmanstanding joined
08:35 <zenspider> is it really making a cons (or equiv) per char?
08:35 <dminuoso> zenspider: Yes.
08:35 ozzymcduff joined
08:35 <zenspider> huh. impressive
08:35 <dminuoso> zenspider: "foobar" is really 'f':('o':('o':('b':('a':('r':[])))))
08:35 <pdxleif> dminuoso: a byte per char, I think - same as in C?
08:35 nickolay_ joined
08:35 <dminuoso> pdxleif: absolutely no.
08:35 <zenspider> I figured it just emulated it that way
08:36 OnkelTem joined
08:36 <pdxleif> Just for the chars - that's not counting the list, or the references to those chars.
08:36 <dminuoso> zenspider: Text is the efficient packed version of it that you know about.
08:36 bertschneider joined
08:37 merijn joined
08:37 sytherax joined
08:37 <pdxleif> Int32, Char, Word32 are equivalent afaik
08:37 <cocreature> dminuoso: iirc tags and Char are 32bits. a cons cell will have a tag + 2 pointers
08:37 tzemanovic joined
08:38 <* hackage> wss-client - A-little-higher-level WebSockets client. http://hackage.haskell.org/package/wss-client- (igrep)
08:38 <dminuoso> cocreature: Ah I found an interesting article https://wiki.haskell.org/GHC/Memory_Footprint
08:39 <quicksilver> on 64bit architectures, all those 32 bit objects are 64 bits
08:40 <dminuoso> 5N words according to Johan Tibell
08:40 <dminuoso> So 10 characters cost 50 bytes.
08:40 <pdxleif> > Unsafe.Coerce.unsafeCoerce [1..10] :: String
08:40 <lambdabot> error:
08:40 <lambdabot> Not in scope: ‘Unsafe.Coerce.unsafeCoerce’
08:40 <lambdabot> No module named ‘Unsafe.Coerce’ is imported.
08:40 <zenspider> what's the current runtime flag equivalent to -xc ? should be printing out a stack trace when it blows?
08:40 <quicksilver> 10 characters cost 10 * 5 * 8
08:40 <quicksilver> 400 bytes
08:40 <quicksilver> (because a word is 8 bytes, on a modern arch)
08:40 <dminuoso> ohh right.
08:41 <dminuoso> quicksilver: Its really confusing to see them use the word "word" right.
08:41 <dminuoso> 2 years of assembly programming have ruined me.
08:41 <quicksilver> I thought it was 4N but Tibell is probably right.
08:41 Saulzar joined
08:41 sytherax joined
08:42 <merijn> In conclusion: Text rules, String drools! ;)
08:42 <dminuoso> Though the *real* price of String is not even the large memory footprint.
08:42 <dminuoso> But the poor cache characterstics.
08:43 <cocreature> hm, we get 3 from the cons cell, does the Char itself really take up 2 words?
08:43 <quicksilver> yes, one word for the thunk pointer and one for the Char itself
08:43 <merijn> cocreature: Char is boxed, so I'd say "probably"
08:44 <zenspider> do I need compile flags or something to get a stack trace when this thing blows up?
08:44 sytherax joined
08:44 <quicksilver> Strings which are streamed and consumed in a stream fashion have excellent cache characteristisc, of course.
08:44 Ariakenom joined
08:44 <dminuoso> quicksilver: do they?
08:44 AfonsoHenriquess joined
08:44 orphean joined
08:44 bertschneider joined
08:44 <merijn> quicksilver: Not nearly as great as chunks of Text would
08:44 <dminuoso> quicksilver: They evict horrible amounts of cache lines.
08:44 <cocreature> quicksilver: I don’t think there is a thunk pointer? you have "data Char = C# Char#" and afaik primitive types are stored unpacked
08:44 amar_ joined
08:44 <dminuoso> So while a streamed string might all be cached already, not much else will be left in your lower caches.
08:45 ammar2 joined
08:45 aramiscd joined
08:45 <cocreature> you have the pointer going to the Char but that’s one of the 3 in the cons cell
08:45 <quicksilver> and that pointer points to the code
08:45 <quicksilver> which is executed to produce the actual char value
08:45 zenspider left
08:46 <dminuoso> So I wouldn't say "excellent cache characteristics" at all
08:46 <quicksilver> dminuoso: maybe excellent is overstating it
08:46 <dminuoso> Does the GHC RTS have any cache color awareness?
08:46 <quicksilver> just 'not as bad as you'd expect from a strict intuition'
08:46 jchia_ joined
08:46 <quicksilver> lazily produced and consumed strings have good locality of access and the GC is also performed locally.
08:47 zenspider joined
08:47 <dminuoso> quicksilver: Right, but if you evict all the other cache lines in the process your program still suffers in all the other bits.
08:47 <zenspider> I *have* to be doing something terrible. My ruby code runs 33% faster than the complied haskell
08:47 orphean joined
08:47 <merijn> zenspider: Are you using "String"?
08:47 <dminuoso> zenspider: stop using String. =)
08:47 <merijn> dminuoso: High-five!
08:48 kefin_ joined
08:48 <merijn> zenspider: In general if you think "huh, this code is very slow" and you're doing anything involving a non-trivial amount of text, the answer is "whoops, you're probably using String and really shouldn't" (see past couple 100 lines for reasons why ;))
08:48 <zenspider> I thought I wandered into #emacs for a sec
08:49 Folkol_ joined
08:49 <merijn> zenspider: If that's *not* the case, then the next step would be "profile your code" probably there's a non-strict foldl or some similar memory leak slowing things down. Those are 2 most obvious problems in beginner code
08:49 <dminuoso> zenspider: In addition the RTS has profiling available (you need to recompile your code though)
08:49 <dminuoso> merijn: Here we go again!
08:50 <merijn> Also, did you compile with -O or -O2?
08:50 orphean joined
08:51 AfonsoHenriques joined
08:51 reactormonk joined
08:51 <zenspider> Apparently I can't profile. I'm using Data.List.Extra which apparently doesn't have profiling info and blows out the compile
08:51 <cocreature> how are you trying to compile?
08:51 pagnol joined
08:51 <merijn> zenspider: How are you building things? cabal-install or stack?
08:51 <cocreature> both stack and cabal new-build should take care of building your deps with profiling info
08:52 <zenspider> ghc -rtsopts -prof -fprof-auto golf.hs && ./golf +RTS -M11m -xc
08:52 orphean joined
08:52 <cocreature> I would recommend to turn that into a cabal package
08:52 <jle`> oh you are just using ghc directly
08:52 <merijn> I second that recommendation :)
08:53 orphean joined
08:53 language_agnosti joined
08:53 Guest13364 joined
08:53 jao joined
08:54 <merijn> Unrelatedly, a pox upon people who push to master with broken tests >.<
08:54 orphean joined
08:55 <dminuoso> Ive seen worse. People *force* pushing code onto master with broken tests.
08:55 zenspider left
08:55 <merijn> dminuoso: Yeah, but now I don't know if my PR is breaking things (probably not) or tests are just broken >.<
08:55 hphuoc25 joined
08:56 <cocreature> or both!
08:56 orphean joined
08:56 <merijn> cocreature: Relatedly, if you're feeling adventurous, I have an even more bleeding edge new-build for you ;)
08:56 freeman42x]NixOS joined
08:57 freeman42x]NixOS joined
08:57 <cocreature> not atm, sry :)
08:57 sytherax joined
08:57 orphean joined
08:57 tzemanovic joined
08:58 orphean joined
08:58 oish joined
09:00 knupfer joined
09:00 orphean joined
09:00 bertschneider joined
09:02 <* hackage> wss-client - A-little-higher-level WebSocket client. http://hackage.haskell.org/package/wss-client- (igrep)
09:02 louispan joined
09:02 orphean joined
09:03 rzp joined
09:04 orphean joined
09:05 sytherax joined
09:05 perspectival joined
09:08 knupfer joined
09:09 louispan joined
09:09 sz0 joined
09:12 boccato joined
09:13 tzemanovic joined
09:13 sytherax joined
09:15 remyhr joined
09:18 <dminuoso> If I want raw sockets in Haskell, do I have any other options than pcap?
09:18 <dminuoso> (Linux only)
09:18 <dminuoso> Im currently pondering about rolling some PPPoE client to provide cleaner automated testing of our PPPoE infrastructure
09:19 <merijn> dminuoso: You could just do some thin FFI to the C socket API? I mean network is already only a tiny thin shell over that anyway
09:20 <dminuoso> merijn: Mmm I guess that could work indeed.
09:20 alvinsj joined
09:21 <dminuoso> I mean I dont even want to send data ontop of PPP, just the raw handshake is enough. So I guess a thin wrapper is probably the easiest solution
09:22 catsup joined
09:22 drets joined
09:22 tzemanovic joined
09:22 hphuoc25 joined
09:23 catsup joined
09:24 <butterthebuddha> "class Monad m => MonadReader r m | m -> r where"
09:24 <butterthebuddha> What does the pipe in the definition mean?
09:25 cloudhead joined
09:25 <drets> Hye, https://lpaste.net/4617692650449928192 why to use record update with recordwildcards is bad, so it's disallowed?
09:25 hellozee_ joined
09:25 <drets> Hey*
09:26 <pavonia> butterthebuddha: It introduces functional dependencies on the type parameters https://wiki.haskell.org/Functional_dependencies
09:27 <dminuoso> It
09:28 remyhr joined
09:29 exarkun joined
09:29 <pavonia> drets: I think you can only use it in patterns and with data constructors
09:30 ZeuPiark joined
09:31 <cocreature> drets: that seems like asking for trouble. if you had a typo in the field name it would just silently not update the field
09:31 keepLear_ joined
09:31 <butterthebuddha> So the definition above is asserting that r is uniquely determined by m?
09:31 <ZeuPiark> hello
09:31 <dminuoso> butterthebuddha: Correct.
09:31 languag__ joined
09:33 <dminuoso> butterthebuddha: iow "if you know m, then we can figure out r based on that knowledge alone"
09:33 oish joined
09:34 tzemanovic joined
09:35 aramiscd joined
09:37 alexad joined
09:38 saurabhnanda joined
09:38 Guest13364 joined
09:38 lumm joined
09:39 encod3 joined
09:39 hphuoc25_ joined
09:39 knupfer joined
09:40 shafox joined
09:41 <reactormonk> I used to specify a ghc options to print me the number of coercions and a few more things on compliation - anyone got that information around?
09:42 tojoko joined
09:42 <shafox> How would I implement rose tree while parsing a text file ? Here are the relevant code and structure of the text that I am parsing. https://gist.github.com/shadow-fox/acd2ce8977e0c28c5f6fa31fe9445133
09:43 <shafox> Can someone help me in implementing the same ?
09:43 <dminuoso> reactormonk: https://downloads.haskell.org/~ghc/master/users-guide/using.html#verbosity-options there's -fprint-explicit-coercions listed there. Is that what you are looking for?
09:44 ijks joined
09:44 <dminuoso> butterthebuddha: It gives the type checker some freedom because it needs not infer/figure out `r` - it suffices to figure out `m` (since there can be only choice for `r` to go with some choice of `m`)
09:45 tsaka__ joined
09:48 language_agnosti joined
09:50 <Ariakenom> :t sin^2 + cos^2
09:50 <lambdabot> (Num (a -> a), Floating a) => a -> a
09:50 keepLearning512 joined
09:50 <reactormonk> dminuoso, more on a general number, to see the order of magnitude of coercions created
09:50 lumm_ joined
09:51 encod3 joined
09:52 <cocreature> reactormonk: there are various -ddump-*-stats flags
09:52 louispan joined
09:53 Folkol_ joined
09:53 davr0s joined
09:57 vonfry joined
09:57 dmiles joined
09:57 keepLear_ joined
09:58 lumm_ joined
09:58 hphuoc25 joined
09:59 progfun joined
10:00 crptck joined
10:01 keepLearning512 joined
10:01 encod3 joined
10:02 boccato joined
10:02 kmelva joined
10:04 simukis joined
10:04 amirpro joined
10:07 toovs joined
10:08 curious_corn joined
10:09 sytherax joined
10:09 tzemanovic joined
10:10 machinedgod joined
10:10 Rayben joined
10:10 __monty__ joined
10:10 hellozee_ joined
10:11 tzemanovic joined
10:11 beauby joined
10:12 Raybin joined
10:13 vurtz joined
10:14 <jle`> shafox: what parser combinator library are you using?
10:15 <shafox> jle`: I am using megaparsec.
10:16 vonfry joined
10:17 language_agnosti joined
10:17 louispan joined
10:18 sytherax joined
10:18 cosmia joined
10:19 mreh joined
10:21 dented42 joined
10:21 oish_ joined
10:22 muddywatt joined
10:23 tabaqui1 joined
10:24 keepLearning512 joined
10:25 winter joined
10:30 lumm_ joined
10:31 cloudhead joined
10:33 davr0s joined
10:35 matsurago joined
10:35 Yuras joined
10:36 language_agnosti joined
10:41 keepLearning512 joined
10:41 tzemanovic joined
10:43 sigma_ joined
10:43 <sigma_> what does this symbol means in haskell ?? ((->) e)
10:44 toovs joined
10:44 bertschneider joined
10:45 <Ariakenom> sigma_: The syntax is like this (a + b) = ((+) a b) so a partially applied function arrow (e -> x)
10:46 <Ariakenom> You can also think of partially applied either: (Either a)
10:46 <Ariakenom> ((->) e x) = (e -> x)
10:47 ijks joined
10:47 <Ariakenom> sigma_: Did this help?
10:48 <sigma_> Ariakenom : not really can you elaborate a bit ? i got the partially applied part but what exactly is this and where is it used
10:49 <cocreature> it’s used in things like the Functor instance declaration for ((->) e)
10:49 <Ariakenom> Do you understand partially applied Either? So instead of Either a b we have Either a
10:49 <sigma_> yep
10:50 <sigma_> cocreature : okay i was reading it in exact same context but how exactly do we define ((->) e)
10:51 Linter joined
10:51 <cocreature> sigma_: you can’t define it. functions are a primitive built into the compiler
10:51 <Ariakenom> When we write the Functor instance for Either we write (instance Functor (Either a)) right?
10:51 <sigma_> yes
10:51 WhatisRT joined
10:52 saurabhnanda joined
10:52 <Ariakenom> So we do the same for ((->)a b) = (a -> b)
10:52 noam joined
10:52 <Ariakenom> functions
10:52 <Ariakenom> The type parameter it accepts is what fmap maps.
10:53 TCZ joined
10:53 <Ariakenom> Where it is for example (Either a) or ((->) a)
10:54 <sigma_> does it have some name in haskell ?
10:54 <Ariakenom> What would you call (Either a)?
10:55 <sigma_> Type ?
10:55 <cocreature> (->) is called function arrow, the partially applied version is sometimes called Reader (but that might also refer to the newtyped version)
10:55 tzemanovic joined
10:56 ian_andrich joined
10:58 lumm joined
11:00 <* hackage> fay - A compiler for Fay, a Haskell subset that compiles to JavaScript. http://hackage.haskell.org/package/fay- (AdamBergmark)
11:00 saurabhnanda joined
11:02 Psybur joined
11:02 boccato joined
11:02 bertschneider joined
11:03 <Psybur> do the IRC browse logs stop at April 11th for anyone else?
11:03 <cocreature> Psybur: yes, irc browse has been dead for some time
11:04 <tdammers> Ariakenom: you might call it a partially applied type constructor
11:04 <tdammers> although arguably that doesn't make sense in the "everything is unary" paradigm
11:04 <tdammers> we also have this concept called "Kind", which is the "type of a type"
11:04 language_agnosti joined
11:05 HarveyPwca joined
11:05 <Ariakenom> I would probably go with "The function type applied to e"
11:05 <tdammers> so you could say Either a is a type of kind * -> *
11:05 lumm joined
11:05 <Ariakenom> Or Type -> Type if you have morals
11:05 <Psybur> How can I search through this channels logs without ircbrowse?
11:06 <Ariakenom> sigma_: You mean like a type? Then ((->) e) is also a type.
11:07 Chousuke joined
11:07 <lavalike> Reader e is also ((->) e)
11:07 <Psybur> nvm the tunes log is easy enough to search
11:09 exarkun joined
11:09 Folkol_ joined
11:09 asheshambasta joined
11:10 ozzymcduff joined
11:13 louispan joined
11:15 haskell_noob1 joined
11:15 keepLearning512 joined
11:15 cur8or joined
11:15 <haskell_noob1> Hi. If i run valgrind on a FFI bindings, does valgrind report the leaks correctly?
11:16 <haskell_noob1> https://lpaste.net/8262624102263554048
11:16 HZun joined
11:16 <cocreature> haskell_noob1: ime it does
11:16 <haskell_noob1> which tool should i be using to accurately determine that there are no leaks in the application?
11:17 curious_corn joined
11:17 <haskell_noob1> so if the output as in the paste, cocreature, says "definitely lost"..is that a good thing?
11:17 <cocreature> no :)
11:17 <cocreature> that’s a bad thing
11:17 <haskell_noob1> hmmm.
11:18 <cocreature> valgrind has a --leak-check=full option iirc (it should tell you about that at the end of the output)
11:18 <cocreature> if you compiled your C source with debug info you should get pretty decent info out of that
11:18 <haskell_noob1> here is the record: https://lpaste.net/208509667104522240
11:18 <mreh> is it possible to say, keep track of the branching factor when evaluating a search tree with the list monad?
11:18 keepLearning512 joined
11:19 <haskell_noob1> cocreature, so looks like there is an issue with the bindings.
11:19 HZun joined
11:19 saurabhnanda joined
11:19 <cocreature> or with the way you are using the bindings
11:19 ericsagn1 joined
11:19 sras joined
11:20 <haskell_noob1> it has to be the former, because i am writing this myself.
11:20 <haskell_noob1> :)
11:20 <cocreature> afaik some applications also do very weird stuff that confuses valgrind so it might be worth doing a quick check if you can find any reports of false positives for hdf5
11:20 <cocreature> heh
11:20 knupfer joined
11:21 <haskell_noob1> thanks for the tip. Makes sense. cocreature. I did a simple alloc/realloc in a loop and things seemed to work..but thats like a stretch.
11:22 andreabedini joined
11:24 <mreh> from Control.Monad.List: "this does not yield a monad unless the argument monad is commutative"
11:24 <mreh> anyone able to shed some light on that statement?
11:24 <cocreature> haskell_noob1: compiling with dwarf debug info can also be useful for getting more info out of tools like valgrind
11:24 <sras> I am using the Gloss library (http://hackage.haskell.org/package/gloss) to draw some graphs in my application. But when I run it from ghci, as long as I close the Gloss window, the ghci instance exits. Why is this?
11:24 zero_byte joined
11:24 `Guest00000 joined
11:25 logzet joined
11:25 <mreh> I just googled it: https://stackoverflow.com/questions/6089997/how-do-i-find-out-whether-a-monad-is-commutative
11:26 dented42 joined
11:29 saurabhnanda joined
11:30 amar_ joined
11:31 silver joined
11:34 <LikosX> /leave
11:34 LikosX left
11:35 curious_corn joined
11:35 cosmia joined
11:35 cur8or joined
11:35 Folkol_ joined
11:37 boccato joined
11:38 jimmyrcom joined
11:39 amirpro joined
11:39 curious_corn_ joined
11:40 dhil joined
11:43 language_agnosti joined
11:43 petermw joined
11:44 boccato joined
11:46 Arcaelyx_ joined
11:47 _vaibhavingale_ joined
11:48 achirkin left
11:48 curious_corn joined
11:49 whaletechno joined
11:50 achirkin joined
11:50 yuuki_ joined
11:51 kapil___ joined
11:54 osa1 joined
11:54 <sras> I am using the Gloss library (http://hackage.haskell.org/package/gloss) to draw some graphs in my application. But when I run it from ghci, as soon as I close the Gloss window, the ghci instance exits. Why is this?
11:55 <tdammers> my guess would be that gloss binds to some C function somewhere that simply calls exit() or something equivalent
11:56 ijks joined
11:56 sytherax joined
11:56 <tdammers> ghci doesn't run interactive expressions in a separate process, so if the guest code causes the process to end, it takes ghci down with it
11:57 KeyJoo joined
11:59 NotAChicken joined
11:59 <* hackage> base-compat-migrate - Helps migrating projects to base-compat(-batteries). http://hackage.haskell.org/package/base-compat-migrate- (AdamBergmark)
12:00 tsoernes joined
12:00 language_agnosti joined
12:03 ThomasLocke joined
12:06 KeyJoo joined
12:07 KeyJoo joined
12:09 tsaka__ joined
12:12 Snircle joined
12:13 aloiscochard[m] joined
12:13 sytherax joined
12:13 achirkin joined
12:14 knupfer joined
12:14 asheshambasta joined
12:15 mcmuru joined
12:16 mark721 joined
12:16 ericsagn1 joined
12:17 aloiscochard joined
12:19 hackebeilchen joined
12:20 achirkin joined
12:22 gonz_ joined
12:23 sytherax joined
12:23 altjsus joined
12:24 HarveyPwca joined
12:24 boccato joined
12:26 saurabhn_ joined
12:26 toovs joined
12:26 carlomagno joined
12:29 Mysterious_Light joined
12:29 kuribas joined
12:30 language_agnosti joined
12:31 Linter joined
12:33 progfun joined
12:33 ijks joined
12:35 curious_corn joined
12:35 <wagle> is coq suitable for proving things about haskell programs, or should I learn isabelle/HOL?
12:36 <wagle> is coq suitable for proving things about haskell programs, or should I learn isabelle/HOLCF?
12:36 pancets joined
12:36 mschr joined
12:36 dsh joined
12:37 <Ferdirand> wagle: maybe you want Idris ?
12:38 <wagle> hmm.. i was wondering about agda/idris
12:39 drbrule joined
12:40 language_agnosti joined
12:40 hphuoc25 joined
12:41 <wagle> Ferdirand: why Idris? (not disagreeing, just needed a heuristic for triaging my rampp up time
12:41 <wagle> )
12:43 <cocreature> it depends on what your goals are. if you want to prove things about existing Haskell code then liquid-haskell and hs-to-coq are probably your best options.
12:43 <cocreature> if you are writing something from scratch but want the end result to be Haskell code then Coq and Isabelle and their code extraction mechanisms might be worth a look
12:44 <cocreature> if you are just interested in proving things about programs in general, then you might also want to look at Agda or Idris
12:44 <wagle> i'm implementing from scratch
12:44 sighingnow joined
12:45 Rayben joined
12:45 Rayben left
12:45 <Ariakenom> cocreature: What was different about that last use case?
12:46 danthemyth joined
12:46 <Ariakenom> Oh proven code that doesn't have to be Haskell
12:46 <cocreature> right
12:46 Rayben joined
12:46 tabaqui1 joined
12:47 <* wagle> goes off chasing those leads
12:47 <cocreature> I guess Agda also compiles to Haskell so it probably also falls into category two
12:47 <cocreature> which of those tools is best also depends on the kind of code that you write
12:48 <cocreature> liquid-haskell is really good at linear arithmetic, e.g., proving that indices are in bound and whatnot
12:48 freeman42x]NixOS joined
12:48 Krisostoomus joined
12:48 <Krisostoomus> https://imgur.com/a/CLT64
12:48 freeman42x]NixOS joined
12:52 codesoup joined
12:53 <Krisostoomus> https://imgur.com/a/CLT64
12:53 <cocreature> @where ops
12:53 <lambdabot> byorgey Cale conal copumpkin dcoutts dibblego dolio edwardk geekosaur glguy jmcarthur johnw mniip monochrom quicksilver shachaf shapr ski
12:53 saurabhnanda joined
12:54 was kicked by dibblego: Krisostoomus
12:55 <cocreature> thanks
12:55 acarrico joined
12:58 daishi joined
12:58 ziyourenxiang_ joined
12:59 <wagle> tanks for pointers!
12:59 <wagle> thanks, even
13:00 pagnol joined
13:00 bertschneider joined
13:00 rasusto_ joined
13:00 language_agnosti joined
13:02 wlemuel joined
13:03 language_agnosti joined
13:04 louispan joined
13:04 AndreasPK_ joined
13:04 AndreasPK__ joined
13:05 astrofog joined
13:08 Cale_ joined
13:08 keepLearning512 joined
13:09 <* hackage> cassava-conduit 0.5.0 - Conduit interface for cassava package http://hackage.haskell.org/package/cassava-conduit-0.5.0 (domdere)
13:10 andyo joined
13:10 language_agnosti joined
13:10 crobbins joined
13:12 alex`` joined
13:12 djtyml joined
13:12 false joined
13:13 <* hackage> lucid-colonnade 1.0.1 - Helper functions for using lucid with colonnade http://hackage.haskell.org/package/lucid-colonnade-1.0.1 (andrewthad)
13:14 astrofog joined
13:14 yuuki_ joined
13:16 sytherax joined
13:16 curious_corn_ joined
13:16 keepLearning512 joined
13:21 ystael joined
13:21 iAmerikan joined
13:21 boccato joined
13:21 language_agnosti joined
13:21 dsh joined
13:23 codesoup joined
13:24 <sigma_> how to work with type synonyms with function
13:24 <sigma_> something like this type ConfigReader a = AppConfig -> a
13:27 <infinisil> sigma_: I don't understand your question
13:27 <sigma_> what does this mean 'type ConfigReader a = AppConfig -> a'
13:28 language_agnosti joined
13:28 djtyml_ joined
13:28 andreabedini joined
13:29 djtyml__ joined
13:29 daishi joined
13:29 <infinisil> sigma_: Wherever you put "ConfigReader a" will get translated into "AppConfig -> a"
13:29 <Boomerang> It means that wherever you see `ConfigReader a` you can replace it by `(AppConfig -> a)`, you could create a value of this type with a lambda that takes an AppConfig for example.
13:29 <infinisil> And the a can be anything e.g. `ConfigReader Int` = `AppConfig -> Int`
13:30 sytherax joined
13:30 <sigma_> an why is it useful
13:32 <infinisil> sigma_: Let's say you need to use the type `ReaderT (WriterT [String] (Env (Config [(Int, a, Bool)]))) IO` a lot
13:33 <infinisil> Instead of typing it out everytime, you can define `Foo a = ReaderT (WriterT [String] (Env (Config [(Int, a, Bool)]))) IO`
13:33 achirkin joined
13:33 <infinisil> And then use `Foo a` instead of that monstrosity
13:33 djtyml joined
13:34 tabaqui1 joined
13:34 <infinisil> Also can be used to have type synonyms to give them more meaning
13:34 <infinisil> E.g. type Username = String
13:36 <sigma_> infinisil : yeah that's the basic use i was aware of
13:36 <infinisil> sigma_: https://en.wikibooks.org/wiki/Yet_Another_Haskell_Tutorial/Type_advanced#Type_Synonyms
13:37 ozzymcduff joined
13:37 keepLearning512 joined
13:38 <osa1> do I have to recompile everything to install something that I've already build via cabal new-install?
13:39 sytherax joined
13:39 language_agnosti joined
13:40 ijks joined
13:42 mschr joined
13:43 dsh-1 joined
13:43 neoncontrails joined
13:43 keepLearning512 joined
13:43 fmixing joined
13:45 language_agnosti joined
13:45 <cocreature> osa1: by “install” you mean using regular “cabal install”?
13:45 camsbury joined
13:45 <osa1> cocreature: yes
13:45 <osa1> I ended up copying the bin but I don't know why I can't just cabal install, it's already built
13:45 trevorriles joined
13:46 carlomazzaferro joined
13:47 <__monty__> The classic cabal commands don't understand the new-* commands afaik.
13:47 saurabhnanda joined
13:47 <cocreature> osa1: there is no sharing between old build and new-build
13:47 <osa1> well there isn't a new-install so I don't know how to install otherwise
13:47 sytherax joined
13:47 <cocreature> there is a new-install in 2.2
13:48 <cocreature> but only for packages on hackage
13:48 amar_ joined
13:49 FreeBirdLjj joined
13:49 <lortabac_> hello, is there a way to abstract over Alternative Maybe and Semigroup (Either a b)?
13:49 Linter joined
13:49 <lortabac_> to get the behavior of "take the result of the first successful computation"
13:50 <cocreature> lortabac_: sounds like you might be looking for https://hackage.haskell.org/package/semigroupoids-5.2.2/docs/Data-Functor-Alt.html
13:50 AndreasPK_ joined
13:50 <cocreature> or the First newtype for Maybe
13:50 enzo-hauss joined
13:51 <lortabac_> cocreature: Data.Functor.Alt seems exactly what I was looking for
13:51 saurabhn_ joined
13:52 <lortabac_> cocreature: I think the First newtype would be a little harder to use in my particular case
13:52 lumm joined
13:52 <cocreature> I don’t know your usecase so it’s hard to comment on that :)
13:53 plutoniix joined
13:54 <lortabac_> cocreature: I am writing a function that deals with JSON, and I want it to be able to decode with decode or decodeEither according to the desired result type
13:54 eliasr joined
13:55 barcabuona joined
13:56 sytherax joined
13:58 justaguest joined
13:58 progfun joined
13:59 vukasink joined
14:03 Mysterious_Light joined
14:04 language_agnosti joined
14:04 language_agnosti joined
14:05 louispan joined
14:06 fxrs joined
14:06 curious_corn joined
14:08 desperek joined
14:08 lumm joined
14:09 lastmanstanding joined
14:09 ddellacosta joined
14:09 dibblego joined
14:09 dibblego joined
14:10 dhil joined
14:10 <* hackage> barbies - Classes for working with types that can change clothes. http://hackage.haskell.org/package/barbies- (DanielGorin)
14:10 sytherax joined
14:10 Snircle joined
14:11 boccato joined
14:12 Denommus joined
14:12 plugin joined
14:13 language_agnosti joined
14:14 Sampuka joined
14:14 language_agnosti joined
14:15 zero_byte joined
14:15 amar_ joined
14:17 alexteves joined
14:17 achirkin joined
14:19 <lyxia> this package... ^
14:20 _vaibhavingale_ joined
14:21 <Ariakenom> lyxia: I've always wanted a Barbie with a monoid structure
14:21 ddellacosta joined
14:21 <ventonegro> Profunctor Barbie
14:21 language_agnosti joined
14:23 <dminuoso> Ariakenom: You get a traversable Barbie at least.
14:24 Snircle_ joined
14:24 zzz joined
14:24 sytherax joined
14:25 <Ariakenom> dminuoso: Well you get a Barbie with a monoid structure at Last
14:25 mschr joined
14:26 achirkin joined
14:26 <dminuoso> "We get a container of a's for any Barbie-type when we make it wear a (Const a) . The Container wrapper gives us the expected instances for a container type."
14:26 zdenal joined
14:27 language_agnosti joined
14:27 Folkol_ joined
14:30 language_agnosti joined
14:30 <dmj`> lortabac_: this is the interface I had in mind https://gist.github.com/dmjio/a0710b26029c54785c72eccc38330310
14:31 osa1_ joined
14:32 FreeBirdLjj joined
14:33 sheyll joined
14:33 exarkun joined
14:34 <sheyll> hi, is there an ordered pair data structure with an ord instance that swaps the pair members before comparing the pairs?
14:34 <sheyll> in the standard lib
14:35 <infinisil> Um, just swap them yourself?
14:35 <orion> What's the current state-of-the-art for logging in large applications? I've heard good things about MonadLogger.
14:36 <sheyll> I am going to try logging-effect in production soon
14:37 Boomerang joined
14:38 hphuoc25 joined
14:40 mschr joined
14:41 <shapr> orion: works for me in scotty and spock
14:41 hyperisco joined
14:41 amar_ joined
14:43 <orion> "Unlike other logging libraries available on Hackage, MonadLog does not assume that you will be logging text information." <-- that sounds neat.
14:43 boccato joined
14:44 <exarkun> text logs, so bad.
14:44 <shapr> all my logs are thunks that are only evaluated when the user looks at them </joke>
14:44 <Ariakenom> yes. you should use String logs
14:45 sarna joined
14:45 <shapr> I am happy I switched all my web dev stuff to Text
14:46 <orion> shapr: What was a major pain point you encountered when not using Text?
14:46 <nshepperd> normally Tree logs are the strongest
14:47 <shapr> orion: I started out switching my parsing from String to Text, then I switched all my web dev stuff.
14:47 adjofun joined
14:47 <orion> Why did you switch your parsing?
14:47 <shapr> String is slow
14:48 <orion> Fair enough.
14:48 <shapr> orion: I mostly switched because I'm teaching my coworkers Haskell once a week, and they're all speed obsessed.
14:48 justaguest joined
14:48 <shapr> So even if I could clearly demonstrate that writing Haskell required less time to accomplish a task, they didn't care unless the resulting code was faster than Python/Ruby/etc
14:49 <Ariakenom> shapr: Speed obsessed pythonistas?
14:49 <shapr> know your audience when giving a talk or teaching, right?
14:49 <* shapr> shrugs
14:50 <Ariakenom> Doesn't sound hard to impress at least. Did you benchmark?
14:50 fujiy joined
14:50 <adjofun> Hello everyone! I'm searching for a paper, in which author explained away most arguments against functional programming by introducing parametrised types, and showed how they solve mentioned problems. I forgot the name of the paper, sadly =(
14:50 <shapr> Ariakenom: I did a comparison of Python Flask vs Haskell Spock, most people were only idly interested until I showed that Haskell Spock takes about a tenth of the time to do stuff.
14:50 <metalrain__> python/ruby seems quite low bar, but maybe runtimes are just so good
14:50 <shapr> Personally, I don't care much at all about the speed of the binary, I care about how quickly I can safely change the code to try new abstractions and data structures.
14:51 <shapr> I believe that changing the data structure or abstraction is always the best way to speed up a solution.
14:51 <ysangkok> what prompts your need for superlatives?
14:52 <Ariakenom> Sounds good. Are you gonna start with speed graphs next time? :p
14:52 <shapr> ysangkok: probably purely reactionary from what I perceive as the common programmer culture of speed of execution being the only important factor.
14:53 <shapr> yeah, I'd say it's frustration with speed obsessed coders who'd rather spend much more time writing a solution in C because they believe it will be faster to execute.
14:53 <adjofun> sharp: try C! Code is not always correct, but always fast =:)
14:53 zxzdfp joined
14:53 <shapr> ysangkok: what do you think about that?
14:54 remyhr joined
14:54 <metalrain__> yeah, speed of execution is hardly a factor unless you serve billions of users/requests.
14:54 <shapr> ysangkok: tror du att det är bra, eller?
14:54 <byorgey> "common programmer culture of speed of execution being the only important factor" --- https://www.cs.utexas.edu/users/EWD/ewd00xx/EWD32.PDF is a fun read =)
14:55 <zxzdfp> Just wondering why I can't use a constraint in a type synonym.
14:55 <zxzdfp> {-# LANGUAGE RankNTypes #-}
14:55 <zxzdfp> type Lens s a = Monad m => (a -> m a) -> s -> (a, m s)
14:55 <zxzdfp> This should work but
14:55 kmurphy4 joined
14:55 <zxzdfp> not in scope: type variable 'm'
14:55 rblaze joined
14:56 <dmwit> Add an explicit forall. `type Lens s a = forall m. Monad m => ...`
14:56 <byorgey> zxzdfp: needs more 'forall'
14:56 <orion> shapr: Oh wow, I find myself in a similar position. I too am serving as a mentor fo co-workers.
14:56 eschnett joined
14:56 <orion> for*
14:56 <zxzdfp> Oh, great.
14:57 <zxzdfp> Many thanks,
14:57 <shapr> Half this company has switched to Go because it's faster than Python, and has a type system.
14:57 kmurphy4 joined
14:57 <orion> shapr: Faster? As in the speed of the resulting executable or the development time?
14:58 amar_ joined
14:58 <metalrain__> I think some need for speed is really human factor, need to improve/succeed/make change even if it would total system (or company) more inefficient.
14:58 <shapr> orion: faster execution for Go, and the type system means fewer errors found in the code.
14:58 <shapr> metalrain__: what do you mean?
14:58 <shapr> oh, I see
14:58 <shapr> put your fingerprints on it.
14:58 <shapr> ?
15:00 fujiy joined
15:00 preyalone joined
15:00 <orion> shapr: What do you think about this quote from Rob Pike, the creator of Go?: http://nomad.uk.net/articles/why-gos-design-is-a-disservice-to-intelligent-programmers.html
15:01 trevorriles joined
15:02 mschr joined
15:02 <shapr> orion: PHP is popular because it's easy to learn and does html templating decently, I think that's the goal of Go as well.
15:02 davr0s joined
15:02 <shapr> I get that, and coworkers here say that fresh college graduates can pick up Go quickly and be productive on just about any project, whether it's new dev or maintenance.
15:03 <orion> shapr: Makes sense. How did you convince your co-workers that Haskell is worth learning?
15:03 <orion> Over Go.
15:03 <shapr> Mostly I haven't, I give free lunchtime classes once a week, and it started out with twenty people, now it's two regulars and sometimes up to five others.
15:03 <shapr> paul graham talked about the blub paradox, where you can't understand a more powerful programming language than you write, and I see that often.
15:04 <shapr> Two or three of the most enthusiastic Go coders here were unable to understand why I would want Functor or Monoid in a programming language.
15:05 drets_ joined
15:05 <shapr> The enthusiastic go coders here sometimes say "Go is a *productive* language" and it seems like they're implying it's just about getting stuff done, and not screwing around with programming language toys.
15:06 plugin joined
15:06 louispan joined
15:06 <* hackage> servant-dhall 0.1 - Servant Dhall content-type http://hackage.haskell.org/package/servant-dhall-0.1 (phadej)
15:07 zaquest joined
15:07 __monty__ joined
15:08 urodna joined
15:08 <infinisil> shapr: Whats the answer to the Functor/Monoid question? So that you can make your functions more generic, without requiring a specific instance?
15:08 <zxzdfp> When do I get " -Wdeferred-out-of-scope-variables " error?
15:09 fendor joined
15:09 <shapr> infinisil: Someone wrote a big pile of code to convert a deeply nested structure to protobuf, I tried to use that as a way to demonstrate the advantage of using fmap, but I don't think they understood.
15:09 agander joined
15:10 <drets_> I am using esqueleto, is it possible to return custom data type from `from`? Now I am returning the tuple: https://lpaste.net/526766138147733504 When I tried to use custom data type I faced the issue that the record has ,say, the type Text but ^. operation returns `expr (Value typ)` (I dunno how to “unwrap” expr).
15:10 <shapr> We have many singe-purpose big piles of code for traversing specific deeply nested values, and to me that's a problem.
15:10 <nshepperd> it's hard to explain the benefit of a whole ecosystem of generic functions by pointing to a single example
15:10 hellozee joined
15:10 <shapr> nshepperd: any other ideas?
15:11 <infinisil> shapr: Ah yes
15:11 <nshepperd> not really
15:11 <Ariakenom> shapr: I was gathering some simple "bullet point" features of Haskell. I'll try to find them if you'd like
15:11 <nshepperd> it's hard for me too :)
15:11 DSM joined
15:11 <Ariakenom> I'd love additions
15:11 language_agnosti joined
15:11 kefin_ joined
15:12 <nshepperd> i suppose i would compare fmap to arithmetic operators
15:12 fujiy joined
15:12 <Ariakenom> shapr: https://lpaste.net/365286 Think some aren't clear from what I wrote down but still
15:12 <nshepperd> it would be annoying if you had to import a different operator for every numeric type
15:13 <shapr> I'm finally starting to understand why Haskell looks like incomprehensible magic to most coders, they've never even considered thinking in these patterns. It's all about the Blub Paradox.
15:13 cschneid joined
15:13 johnw joined
15:13 Wuzzy joined
15:13 <Ariakenom> I mean it's also the syntax
15:13 <Ariakenom> Which is great. But different.
15:14 <nshepperd> that's the 'single example' point of view: having a single (+) lets you avoid importing operators for different numbers, which gets a 'huh, that's convenient I guess'
15:14 <shapr> purity means I have less to fill up my working memory when writing a function
15:15 <nshepperd> but the real benefit of (+) being (+) is that once you're familiar with it, reading any code that does arithmetic is natural
15:15 <nshepperd> regardless of the number type
15:15 <shapr> I think Go is trying to also reduce the amount of working memory required, but by cutting the language down.
15:15 niluje left
15:15 mschr joined
15:15 Folkol_ joined
15:15 <shapr> It's hard to describe how all the cool features are more than just the sum of their parts.
15:15 <Ariakenom> I made my list because I wanted blub resistant, easily explained points
15:15 cybai joined
15:16 <adjofun> Go assumes that language innovations stopped in 1970s, I feel
15:16 shaylew joined
15:16 <shapr> adjofun: it has some strange and interesting points like goroutines and 'methods' but mostly, I agree
15:16 <dstolfa> shapr: it's similar to the experience people have when thinking about denontational semantics in general. if you show them operational semantics of something, they instantly grok it if they're computer scientists, but denotational semantics can be counter-intuitive to people
15:16 <orion> Ariakenom: I like the separation of side effects.
15:17 <shapr> So I'm thinking of taking a Go position for six months so I have a deep understanding.
15:17 <orion> Ariakenom: Also, the very concept of a "Kind" is a nice feature.
15:17 <dstolfa> i.e. telling someone that natural numbers can be defined in terms of zero being a natural number and some function S which takes a natural number and returns a natural number is counter-intuitive to people because they suddenly think: but what is a natural number, it's defined recursively and S has no meaning in terms of what it does with a natural number!
15:17 <shapr> I'm also thinking of writing some Haskell code that detects variable shadowing in Go, since there aren't any tools to do that.
15:18 language_agnosti joined
15:18 <Ariakenom> orion: I'm looking for things that would take seconds to sway a Java/go programmer. I don't think kinds fit.
15:18 <shapr> Ariakenom: what about mapReduce in Control.Concurrent?
15:19 <shapr> https://hackage.haskell.org/package/async-2.2.1/docs/Control-Concurrent-Async.html
15:19 <shapr> I say things like "pure code lets me distribute computations on all my cores, where race conditions and deadlock are impossible"
15:20 <orion> Ariakenom: My understanding is that in Java, you can express certain specific Monads such as [], but the abstract concept of a Monad is literally unexpressable/
15:20 <Ariakenom> orion: Correct. But a Monad is also not explainable :p
15:20 <adjofun> Ariakenom: Easy concurrency is your go-to feature, I think. Show STM, and walk away with a smile =:)
15:20 <Ariakenom> (correct afaik)
15:20 <orion> Further, Monads are not expressable without Kinds.
15:20 <Ariakenom> adjofun: I've included it https://lpaste.net/365286
15:21 fujiy joined
15:21 <shapr> I agree that I've swayed people by saying "I have code that uses threads with provable lack of deadlock/livelock/race conditions"
15:21 <Ariakenom> Yes. It is my favourite example
15:22 <adjofun> I just said to my colleagues that CompletableFuture<T> is a monad, and that in Java 8 are 3 monads now, including Optional<T> and Stream<T>
15:22 sytherax joined
15:22 <Ariakenom> Although caveat -fno-omit-yields
15:22 <adjofun> They told me that "monad" is a curse word =\
15:22 <Ariakenom> on the livelock thing
15:23 <Ariakenom> Another example on my list that I found baffling when I started Haskell is maxBound
15:23 cur8or joined
15:24 keepLearning512 joined
15:24 altjsus_ joined
15:24 <Ariakenom> The maxBound of some type that has one. Type is inferred. Just great
15:24 mnoonan joined
15:24 zdenal joined
15:25 <int-e> adjofun: "monad" is far less scary than "java" :)
15:25 <orion> ha
15:25 ijks joined
15:25 achirkin joined
15:25 <Ariakenom> I guess my polymorphic max function doesn't apply much. Even Java can do that now that it has generics I guess
15:25 altjsus joined
15:25 fujiy joined
15:25 <adjofun> orion: There is a library for Java, callem cyclops-react, and they have something called AnyM, which allows to white monadic code without dependency on any particular monad. What do you mean by "unexpressible" then?
15:25 <jackhill> Speaking of benefits/disadvanteges of Haskell over other languages: I read http://blog.khinsen.net/posts/2017/11/16/a-plea-for-stability-in-the-scipy-ecosystem/ and also Rich Hickey's talk, "Spec-ulation" https://www.youtube.com/watch?v=oyLBGkS5ICk and became concerned that Haskell (or at least all of us who write Haskell) isn't conducive to that sort of stability.
15:26 <Ariakenom> I'd also like to be able to say this but it's to abstract. "Haskell is also a language without side effects. Haskell has effects they're just not _side_ effects."
15:27 skeet70 joined
15:28 <Ariakenom> For a sufficiently interested audience I guess it works.
15:28 <orion> Ariakenom: It's not part of the core language.
15:28 <orion> adjofun: ^
15:28 brandly joined
15:28 <Ariakenom> orion: No I mean they're not functions with side effects. It's IO with effects.
15:29 <Ariakenom> Oh
15:29 <jackhill> A smaller language sounds like it would be more conducive (althought I guess there is then the temptation to make your own DSLs anyways). Are there ways to think about Haskell that would make it more palatable for code that I don't won't be under constant maintenance?
15:29 progfun joined
15:30 <adjofun> orion: Are you implying that if something isn't part of the core language, then it is inexpressible in the "not core" language, whatever that means?
15:30 osa1 joined
15:30 sz0 joined
15:30 <adjofun> orion: Typeclasses are not part of the Haskell Core language afaik
15:30 <adjofun> But we have Monads nonetheless
15:31 <orion> adjofun: Yes. Typeclasses are syntactic sugar.
15:31 sytherax joined
15:32 <orion> I consider kinds in Haskell to be more fundamental to the language than typeclasses.
15:32 <shaylew> what's the canonical way to derive Eq1/Show1 etc?
15:32 hellozee_ joined
15:34 <cocreature> shaylew: the deriving-compat package
15:34 gestone joined
15:34 cur8or_ joined
15:35 language_agnosti joined
15:35 cjreynolds joined
15:36 <nshepperd> does AnyM really express Monads, or does it express a horrible kludge that kinda-sorta lets you write monad-generic code if you squint
15:36 DSM joined
15:36 remyhr joined
15:37 hphuoc25 joined
15:37 <cocreature> nshepperd: can you link me to AnyM? I can only find anyM in monad-loops which is probably not what you’re referring to
15:38 pfurla joined
15:38 <nshepperd> cocreature: some java thing https://github.com/aol/cyclops-react/tree/master/cyclops-anym
15:38 mounty joined
15:38 <cocreature> ah
15:38 raingloom joined
15:38 <adjofun> https://medium.com/@johnmcclean/a-type-safe-java-monad-api-part-i-with-vavrs-future-and-try-7beaea28d351
15:38 jimmyrcom joined
15:40 Luke joined
15:40 <adjofun> I use that library everythere in my Java code, my colleagues have an allergy to haskell, unfortunately
15:42 hellozee_ joined
15:42 <orion> 75% of my co-workers are excited enough about Haskell to read haskellbook.com *and* do the end-of-chapter problems.
15:42 valentinbuza joined
15:42 fujiy joined
15:45 codesoup joined
15:45 tzemanovic joined
15:45 <ventonegro> There was a bug opened about a stateful async handler and I said that would never happen in a pure language; they just ignored me
15:47 slaznick1 left
15:47 <adjofun> ventonegro: Yeah, I would also ignore that, that remark is not contributing to a problem solution, but trying to provoke a holywar =)
15:48 language_agnosti joined
15:48 <ventonegro> adjofun: Fair enough
15:49 emilypi joined
15:49 DSM joined
15:50 zdenal joined
15:50 <orion> sheyll: Have you ever had to create a Monad transformer which uses multiple LoggingTs?
15:50 <sheyll> @orion no.. not that I am aware of
15:50 <lambdabot> Unknown command, try @list
15:51 <orion> sheyll: I am currently faced with that.
15:51 sytherax joined
15:51 <orion> I am writing a library to interact with Microsoft Graph API. That library is its own Cabal package, and it needs logging. I am writing an application which uses this library, and it needs its own logging.
15:52 <AWizzArd> Let’s say I have data Term e = Lit Lit | Var String (e -> Term e) (ignoring what a Lit is). So I have Literals and Vars. And a Var should have a name (String) and a lookup function from some environment to a Term.
15:52 <AWizzArd> The idea is that Vars can be looked up at runtime to see what they stand for. Now what if I wanted to use a Data.Map.Strict as a backend store for vars that goes from Strings to Terms? Is it possible to specify a type signature for this case?
15:52 <AWizzArd> I am having difficulties to see how this can be done. I can not introduce a varmap of type: varmap :: M.Map String Term because here `Term` does not include the `e` environment. But this very map is the environment. So it looks like an infinite recursion. Does that make sense?
15:52 ski joined
15:53 <infinisil> This `Term` type looks very weird, why e -> Term e?
15:53 language_agnosti joined
15:54 <infinisil> Oh, I see, that's the environment, hmm
15:54 <sheyll> orion what do you compose, like this: LoggingT (BlahT (BlubT IO)) ?
15:54 darjeeling_ joined
15:54 <AWizzArd> infinisil: should an existential type be used here?
15:54 <orion> My Microsoft Graph API library defines a Monad transformer: LoggingT GraphLog (ReaderT GraphEnv m) a.
15:54 <infinisil> AWizzArd: I'd separate the term from the environment
15:55 <infinisil> AWizzArd: Have a type that represents a term, have one that represent the env (a Map), then have a function `eval` that takes a term and an env and evaluates it
15:55 enterprisey joined
15:55 <orion> So the question is: Will this compose nicely when an application wishes to define something like: AppT = LoggingT AppLog (GraphT m) a?
15:55 <orion> I *think* it'll work OK.
15:55 <AWizzArd> infinisil: yes I want that. So what would your Term declaration look like?
15:55 achirkin joined
15:55 <adjofun> AWizzArd: If I were to define `x = Var "foo" (M.lookup env)`, would I need to define every Var with a same (M.lookup env)?
15:55 <infinisil> Well what does your language look like?
15:56 <sheyll> isnt there a mapLoggingT or something?
15:56 <infinisil> AWizzArd: If my language is just + and numbers, I'd have `data Term = Lit Int | Sum Term Term`
15:56 philippD joined
15:57 <sheyll> in logging-effect there is a mapLogMessage :: MonadLog message' m => (message -> message') -> LoggingT message m a -> m a
15:57 <orion> sheyll: There is. I haven't actually finished the library yet. My question is an act of planning ahead.
15:57 <orion> I don't want to code myself in to a box.
15:57 <sheyll> so you are using LoggingT from logging-effect, right?
15:57 language_agnosti joined
15:57 <orion> Yes. As of 20 minutes ago.
15:57 <AWizzArd> adjofun: yes, probably one hashmap for all vars that were introduced.
15:57 <sheyll> lol
15:58 <orion> Literally based (in part) on your recommendation my company is going to use this library.
15:58 <AWizzArd> infinisil: I would not want to limit the lang by making Sum explicit. Instead it has a Fn (or Lambda) and an App for application.
15:59 <adjofun> AWizzArd: what does "Vars can be looked up at runtime to see what they stand for" mean?
15:59 phreedom joined
15:59 <AWizzArd> adjofun: I may want to compare x with 10. I.e. x == 10. I don’t know what x is before I run this.
16:00 <adjofun> so, Var "x" (M.lookup env) == Lit 10?
16:01 <AWizzArd> adjofun: yes, something like that right.
16:01 trevorriles joined
16:01 <adjofun> are you sure you don't just want `Var String Term`?
16:01 fendor joined
16:01 <infinisil> AWizzArd: `data Term = Var String | App Term Term | Lambda String Term`?
16:01 <AWizzArd> adjofun: I am not sure. Possibly this can work.
16:01 <infinisil> Var is a variable reading, App is function application, lambda is lambda
16:01 lastmanstanding joined
16:02 davr0s joined
16:02 <shaylew> AWizzArd: if you want to go down the mutual recursion path you can make it work with a newtype VarMap = VarMap (M.Map String (Term VarMap)) -- it's only type synonyms that can't be self-referential. but I don't know enough about what you're trying to do to tell whether this is a good idea
16:03 <AWizzArd> infinisil: Fn String (Term -> Term) | App Term Term
16:03 sytherax joined
16:03 obi_jan_kenobi__ joined
16:03 <infinisil> Ah
16:03 <AWizzArd> shaylew: thx for the hint, I can consider this too and look into it.
16:03 kritzefitz joined
16:04 <chindy> Is it possible/good practice to transform Maybe String to IO String ? if so how?
16:04 <adjofun> AWizzard: I think you are trying to substitute type recursion with a map lookup
16:04 <infinisil> AWizzArd: Wait no, Fn String Term should work
16:04 <infinisil> Or I just don't get it
16:04 <AWizzArd> infinisil: an example: equal = Fn "==" (\(Lit (I arg1)) -> Fn "==" (\(Lit (I arg2)) -> (Lit (B $ (arg1 == arg2))))) and prog = (App (App equal (Lit (I 33))) (Lit (I 33)))
16:04 <adjofun> chindy: of cource, everything is possible, but what semantics do you need?
16:04 <kritzefitz> chindy: What would the result be when the Maybe String is Nothing?
16:04 connrs joined
16:05 <chindy> Then I do not want to write into a file kritzefitz
16:05 borkr joined
16:05 <kritzefitz> The you probably want mapM
16:05 <kritzefitz> Like mapM whateverYouWantToDo yourMaybeString
16:08 <AWizzArd> It’s just if I don’t want to compare two Int literals but a var with an Int literal. I am not sure how to best model this.
16:08 djbeau joined
16:09 <* hackage> asn - asn type and encoding/decoding http://hackage.haskell.org/package/asn- (chessai)
16:09 <adjofun> chindy: when (isJust x) (write (fromJust x))
16:09 sgraf joined
16:10 <chindy> adjofun: whats this when construct?
16:10 <adjofun> :t when
16:10 <lambdabot> Applicative f => Bool -> f () -> f ()
16:10 <chindy> Anyways, thanks i think I got what I wanted
16:10 <chindy> when happens if Bool is false?
16:10 <adjofun> nothing
16:11 <kritzefitz> chindy: when False _ = return ()
16:11 <chindy> ah thanks
16:11 pio_ joined
16:11 <orion> Does anyone have a good example of how to define an instance for MonadTrans? GHC is unable to automatically derive one.
16:11 <orion> (even with cunning GeneralizedNewtypeDeriving)
16:11 <kritzefitz> chindy: Did you see my answer above? It basically does the same, but with less typing.
16:11 <cocreature> orion: have you linked at the existing instances?
16:12 <adjofun> :t mapM
16:12 <lambdabot> (Monad m, Traversable t) => (a -> m b) -> t a -> m (t b)
16:12 <adjofun> :t fmap
16:12 <lambdabot> Functor f => (a -> b) -> f a -> f b
16:12 Np-Harda` joined
16:12 fujiy joined
16:12 <adjofun> hm
16:12 <Np-Harda`> hello everybody
16:12 <chindy> kritzefitz: yea, thanks
16:13 adkron joined
16:13 dented42 joined
16:14 exarkun joined
16:14 Immune joined
16:14 dsantiago joined
16:14 Immune left
16:14 <orion> cocreature: You're correct, that is where I should have looked before formulating my question.
16:14 <Np-Harda`> can you hear me? dI dont know if my emacs-client is conetcted the right way
16:15 <cocreature> Np-Harda`: yes
16:15 <Np-Harda`> fine thats nice
16:15 ozzymcduff joined
16:16 <* hackage> multihashmap - hashmap from keys to hashsets http://hackage.haskell.org/package/multihashmap- (chessai)
16:17 <Np-Harda`> I just started learning haskell and started a project. What resources do you recommend learning some best practice in haskell?
16:18 Linter joined
16:18 jchia joined
16:19 keepLearning512 joined
16:19 <sm> https://haskell-lang.org/get-started
16:20 <sm> https://leanpub.com/haskell-cookbook/read
16:21 <cocreature> jasper’s talk is pretty good https://www.youtube.com/watch?v=-X1vrxQUETM but it’s probably something to watch once you’ve played around with Haskell for a bit not in your first week
16:21 <metalrain__> Np-Harda`: there are quite good books http://haskellbook. com and http://learnyouahaskell.com
16:21 <cocreature> I wouldn’t worry too much about best practises at the beginning tbh
16:21 codesoup joined
16:21 <sm> https://wiki.haskell.org/Haskell
16:22 <Np-Harda`> ahh thanks a lot
16:22 Thra11 joined
16:23 <Np-Harda`> I did some functional programming before, so I am familiar with it and i basicaly understand monads
16:23 justaguest joined
16:24 <cocreature> I would recommend to just find some small toy project to work on and then ask for feedback on that
16:24 pfurla joined
16:24 <cocreature> or improve it yourself by taking a look at how other people have solved similar problems
16:24 <Np-Harda`> thats what I am currently doing
16:24 <Np-Harda`> I am working on a small server communicating with bitcoind
16:24 enterprisey joined
16:25 boccato joined
16:25 <Np-Harda`> is it normal that most of my function signatures are polluted with the IO monad? is this considered normal?
16:26 <sm> Np-Harda`: if they're doing IO, then yes
16:26 <cocreature> heavily depends on your program. if your program mostly communicates with some other server then having a lot of that be in IO is not that unreasonable
16:27 <sm> often you can convert them to non-IO by restructuring
16:28 ttoe joined
16:28 lumm joined
16:29 <Np-Harda`> sm: do you mean restructuring the project?
16:29 <Np-Harda`>
16:29 <sm> just the code
16:29 detrumi joined
16:29 <sm> sometimes you have IO functions that can be made pure
16:30 <Np-Harda`> yeah I am try that
16:30 <cocreature> what happens more often ime is that your IO stuff stays in IO but you can extract some pure functions from those IO functions
16:31 machined1od joined
16:31 <cocreature> you might have something like "do input <- fetchData; let output = processInput input; sendOutput output"
16:31 <cocreature> fetching and sending data will require IO but process the input might not
16:31 <cocreature> so you can separate that out into a separate definition
16:31 <Np-Harda`> another question, I have a function which returns eigther Data or IO Data. Can I construct the case in which it returns just the Data into something such that the whle function just returns IO Data?
16:32 <Np-Harda`> cocreature: I am already trying to do that
16:32 <cocreature> you can use "pure" for that
16:32 <cocreature> :t pure
16:32 <lambdabot> Applicative f => a -> f a
16:32 <cocreature> :t pure @IO
16:32 <lambdabot> error:
16:32 <lambdabot> Pattern syntax in expression context: pure@IO
16:32 <lambdabot> Did you mean to enable TypeApplications?
16:33 <Np-Harda`> ahhh ok thank you I will try that
16:34 amar_ joined
16:34 kol joined
16:34 keepLearning512 joined
16:35 pie_ joined
16:35 vurtz joined
16:35 <Np-Harda`> cocreature: works well thank you
16:36 <pie_> not really a haskell specific question just thought someone here might be well equipped to answer; ive been meaning to get into UI development since it seems like an area that could use a lot of improvement, but i havent really been able to figure out how to get started
16:36 <pie_> * for native apps, not web stuff
16:37 ttoe_ joined
16:37 keepLearning512 joined
16:38 shannow joined
16:39 <Np-Harda`> whats the difference between pure and return?
16:39 <dminuoso> Np-Harda`: historical reaasons.
16:39 danthemyth joined
16:39 <dminuoso> Np-Harda`: return incurs a Monad constraint, pure incurs only Applicative
16:39 <glguy> pure works in more contexts, but the two should behave the same
16:39 <dminuoso> Np-Harda`: For any instance Monad it is required that `pure = return` behaviorwise
16:39 <Np-Harda`> ok which one should I use then?
16:40 <gonz_> Np-Harda`: `pure`
16:40 <dminuoso> Np-Harda`: If you are unsure use `pure`
16:40 <Np-Harda`> ok perfect thank you
16:40 <Np-Harda`> I never thought this, but haskell is quite fun to programm in
16:40 <Np-Harda`> much more than what I am used to do :D
16:40 fmixing joined
16:41 zdenal joined
16:42 fujiy joined
16:42 AndreasPK_ joined
16:43 <gonz_> Np-Harda`: I felt the same way when I started getting into it. I think the lore surrounding Haskell (largely retold by people who never bothered to learn it) scares a lot of people
16:43 keepLearning512 joined
16:44 <Np-Harda`> I am currently doing my M.Sc in computer sience and have compiler construction as a main field, which is why I got into type theory a little bit. Thats why i thought haskell would be fun to learn and it fuckin is
16:45 <orion> Is it possible that return will be deprecated?
16:45 <cocreature> orion: probably not. what is planned (or was planned at some point, I haven’t kept track) is to move return out of Monad so you can no longer overwrite it and will be guaranteed that return = pure
16:46 <dminuoso> orion: https://ghc.haskell.org/trac/ghc/wiki/Proposal/MonadOfNoReturn
16:46 osa1 joined
16:46 chessai joined
16:46 hphuoc25 joined
16:46 <dminuoso> Np-Harda`: Sadly there are very few languages that admit the advancements of the past 20 years and incorporate them into their design.
16:47 agander joined
16:47 fmixing joined
16:47 <gonz_> dminuoso: But new language features get in the way of being practical, you know ;)
16:49 <dminuoso> gonz_: One common argument of some mainstream languages is that many such features are "complicated" and require training to utilize. While I admit that it is a reasonable argument to make, it tends to introduce other issues.
16:49 <Np-Harda`> The "new" languages we see like rust, go, scala are pretty decent I think
16:49 obi_jan_kenobi joined
16:50 <Np-Harda`> and at least most of them having nice functional features
16:50 t7 joined
16:50 <Np-Harda`> scala even has the for expressions for monads
16:50 <orion> dminuoso: Thanks.
16:50 fujiy joined
16:51 <gonz_> dminuoso: I agree completely. I was honestly shocked by how ergonomic Haskell is when I got into it. To me it seems like Haskell is one of the most practically inclined languages out there, because of the ease and possibility of abstraction.
16:51 <gonz_> But I honestly think that OCaml, for example, has more of a reputation of being "practical" even though the ergonomics clearly are not there, mostly because it doesn't stress lack of effects
16:52 <gonz_> At least that's my perception of the development community
16:52 <gonz_> And it doesn't match what I think from using both languages
16:54 <kuribas> dminuoso: when I program in another language, I am amazed how hard it is.
16:55 cosmia joined
16:55 <pie_> "i find programming in every languge hard but haskell is the least hard"
16:56 <Np-Harda`> I am not at this point tbh I hope to get there as well
16:57 t8 joined
16:58 <dminuoso> kuribas: What I mean by that, is that it takes time to study and learn abstractions. Go is designed to take someone out of high school and have them write driver code within a week.
16:58 <kuribas> dminuoso: yes, same thing with python
16:58 <kuribas> dminuoso: easy to learn, very hard to program in.
16:58 lambda-11235 joined
16:58 brocoli joined
17:00 R0b0t1 joined
17:00 <Np-Harda`> I do all my machine learning and AI stuff in python
17:00 <kuribas> dminuoso: the mental effort for writing in haskell is much lower than in other languages IMO
17:00 <Np-Harda`> I hate the dynamic type system
17:00 <kuribas> Np-Harda`: sure, for small(ish) scripts it's fine.
17:01 hiratara joined
17:01 <kuribas> but anything more complex, it becomes a big mess easily.
17:01 <dminuoso> Np-Harda`: There is no such thing as a dynamic type system.
17:01 silver joined
17:02 <Np-Harda`> dminuoso: I hate that python is dynamicaly typed :D
17:02 <Np-Harda`> better? :D
17:02 <monochrom> Aw please don't argue wording.
17:03 <cocreature> monochrom++
17:03 <ddellacosta> cocreature++
17:03 <sm> python is runtime-typed rather than compile-time-typed ?
17:03 <monochrom> Also if you're going down that philosophical route, you may as well remind all of us "temperature does not exist, only velocities of gas particles exist"
17:04 <* sm> can't help inquiring
17:04 <geekosaur> molecular vibration, actually :p
17:04 <kuribas> ddellacosta++
17:04 <ddellacosta> kuribas: now the question is when all of these get evaluated
17:05 <monochrom> IOW the Bob Harper "no dynamic typing, it's static unitype" is a reductionist stance that ignores an emergent phenomenon.
17:06 lumm joined
17:06 zdenal joined
17:06 <dminuoso> monochrom: It's not about ignoring the emergent phenomenon - it's comparing two orthogonal things.
17:06 <kuribas> a static unitype with mostly non-total functions
17:07 danso joined
17:07 <dminuoso> monochrom: When a type system becomes a method to have automated proofs of the abscence of certain program behaviors according to some operational model, then in what possible sense does comparing it with python runtime tag checking make sense?
17:07 <dminuoso> It would imply there's some fundamental similarity between the two.
17:08 <monochrom> That starts with the premise that "type" is machine-checked data invariant.
17:09 <dminuoso> If I take the definition from TaPL, then types are just some tags I decorate terms with. It's a syntactic method
17:10 <monochrom> And it becomes revisionist history. Because "type" began as set/class/whatever-collection of values mutually compatible in terms of operations.
17:10 zzz joined
17:10 lumm joined
17:10 <geekosaur> .oO { porqué no los dos? }
17:11 perspectival joined
17:13 ozzymcduff joined
17:13 <dminuoso> monochrom: But isn't it reductionistic to only consider the "collection of values mutually compatible in terms of operations" because that's all that Python can do?
17:13 <monochrom> It's OK to say that the very original origin is outdated and we should move on to a more modern notion. I agree, I do that too.
17:13 troydm joined
17:13 <dminuoso> I mean one of the guarantees that Haskells type system gives you, is the absence of segfaults (ignoring certain choices of backdoors). Python gives you that same guarantee.
17:13 <dminuoso> But that's about the extend of it.
17:14 <monochrom> And instead of TaPL, I take my definition from a formal methods paper that makes "type" data invariant (not necessarily machine-checked).
17:14 cybai joined
17:15 boccato joined
17:15 Gurkenglas joined
17:15 <__monty__> Then python still doesn't have types. Since the type is a field of the objects.
17:15 <monochrom> No, reductionist means what my example says, "there is no temperature, you only have vibrating molecules"
17:16 fendor joined
17:16 <monochrom> Bob Harper's is reductionish because dynamic typing (a high-level idea) is implemented by static unitype with runtime tag checks.
17:16 <orion> Temperature is defined as average kinetic energy.
17:16 <geekosaur> there's multiple definitons of temperature
17:16 <Np-Harda`> ok guys :D i build my project with `cabal install -j` on my x64 machine and then copied the binary over to my x64 server. when I run the binary I get [1] 4767 illegal hardware instruction ./FirstHaskellProject
17:16 pagnol joined
17:16 <geekosaur> they interact in odd and not always understood ways
17:16 Luke joined
17:16 <monochrom> Reductionism means you say that the high-level thing doesn't exist, only the low-level implementation detail exists.
17:17 <dmwit> Np-Harda`: Nice! Any fun FFI stuff in it?
17:17 <dminuoso> monochrom: Ah I see what you are on about.
17:17 <dmwit> Np-Harda`: How small of a program can you make and still reproduce that problem?
17:17 <geekosaur> or libs using some sse / avx / hatever that the server's cpu doesn't support
17:17 <geekosaur> *whatever
17:17 fendor_ joined
17:17 <dminuoso> monochrom: So first let me agree that conceptually there's nothing wrong with talking about the "high-level idea" of "dynamic typing" as you put it. It's not what I have an issue with.
17:18 cryptocat1094 joined
17:18 knupfer joined
17:18 <Np-Harda`> actualy I dont know if any of my libs is using SSE, but could be the case, because I use some SHA256 hashing
17:18 <dminuoso> monochrom: But the wording suggests that, on some level, it's comparable with what a type system does. The mere comparison of "type system" vs "runtime tagging checking" is fruitless because it's essentially comparing two orthogonal things.
17:19 <geekosaur> even worse, yes, you may be dependent on something having detected hardware SHA
17:19 <orion> monochrom: Would you provide a link to the paper?
17:19 bbrodriguez joined
17:19 <Np-Harda`> any chance building the binary without SSE command?
17:19 <orion> "a formal methods paper"
17:19 <monochrom> orion: I read it on physical paper.
17:19 <Np-Harda`> or other hardware specific instructions?
17:19 <orion> monochrom: Oh, I see.
17:20 <monochrom> But I bet searching for "type data invariant" may find it.
17:20 <geekosaur> you'll likely hve to check what libs you are using. ghc itself doesn't do things like this for the most part, math or crypto libs may contain FFI hackery that does
17:20 <dmwit> monochrom: That does not a priori prevent you from providing a link to the paper.
17:20 <geekosaur> in which case look for build flags for those libs
17:20 <monochrom> Err, no, that won't find it.
17:20 <cocreature> dminuoso: the thing is you are not going to win a fight trying to eliminate the word “dynamic typing” so instead of telling people they’re wrong to call it that you can just accept that the word “type” does not mean the same thing to everyone and make it clear which definition you are using if that’s not clear from the context
17:20 bbrodriguez joined
17:20 <dmwit> monochrom: (Or at least the title and maybe some author info...)
17:21 <Np-Harda`> geekosaur: i am building some http connection in the programm so there is definitly some crypto stuff involved
17:22 <Np-Harda`> daaammmn that sucks ...
17:22 <dmwit> Np-Harda`: Step 1 is produce a minimal test case.
17:22 replay joined
17:22 <phaazon> quickie: in PVP, 1.2.3 has which semantics?
17:22 <phaazon> major.minor.patch?
17:22 <phaazon> or super-major.major.minor?
17:22 enterprisey joined
17:22 <sm> ma.jor.minor
17:23 <glguy> https://pvp.haskell.org
17:23 <phaazon> that’s what I thought, thanks :)
17:23 <Np-Harda`> dmwit: I will try to do so
17:23 DSM joined
17:23 <Np-Harda`> but its already pretty minimal
17:24 <monochrom> Perhaps dminuoso just objects to "dynamic type system" because it has no system to speak of.
17:24 bbrodriguez joined
17:26 nitrix joined
17:26 <monochrom> But people still say "the latest programming technology" even when it has no technology to speak of.
17:26 shafox joined
17:27 <monochrom> Oh and "software engineering"
17:27 <orion> monochrom: What do you mean by "software engineering" (in quotes)?
17:27 <EvanR> "interpretive folk logic"
17:27 <geekosaur> orion, I think that's the point
17:28 alexteves joined
17:28 <geekosaur> nobody means the same thing by it. like nobody necessarily means the same thing by "type"
17:28 <geekosaur> or "type system"
17:28 <dmwit> Therefore we should all stop trying to talk to each other in the first place.
17:29 ian_andrich joined
17:29 <geekosaur> there've been times when it's seemed futile… but that's why someone mentioned setting out definitoons up front instead of assuming everyoen uses yours
17:29 zdenal joined
17:29 <cocreature> dmwit: talking considered harmful!
17:29 <* geekosaur> thinking of something coupel months ago in here that was brain-breaking until it came out they were talking about vhdl
17:30 <shafox> Repost:: How do I create a rose tree while parsing a text file using megaparsec/attoparsec etc ? Related code and text file example is here in this gist https://gist.github.com/shadow-fox/acd2ce8977e0c28c5f6fa31fe9445133
17:30 <monochrom> haha
17:30 osa1 joined
17:30 <orion> geekosaur: What are the two most common uses of "software engineering"?
17:31 <orion> I guess I should direct that question to monochrom.
17:31 rihards joined
17:31 <geekosaur> 1. copying someone else. 2. reaching for something that sounds better than "programmer"
17:31 <monochrom> I believe that when people write "dynamic type system", with the "system" word there, they're just doing it out of habit, they don't really mean it.
17:31 <geekosaur> (note absence of what you might expect to find in there...)
17:31 <monochrom> What geekosaur says
17:32 AndreasPK_ joined
17:32 <dmwit> shafox: There are several parser combinator tutorials out there. I recommend you work your way through one. Nothing about the data you've showed or the structure you intend to parse it into looks particularly difficult once you know the basics.
17:32 <EvanR> is talking about talking futile, harmful
17:33 wchresta joined
17:33 <EvanR> also talking about the previous statement is forbidden
17:33 ttoe_ joined
17:33 <geekosaur> russell's paradox in natural language?
17:33 <shafox> dmwit: I am just not sure how do I insert at the correct level.
17:34 <dmwit> You don't insert at all. You just write a recursive parser.
17:34 <nitrix> Does GHC/C-- ultimately monomorphize every type during compilation by generating a unique data structure per polymorphic variant, or the runtime has additional logic to handle those?
17:35 <dmwit> Neither. Everything has a uniform representation (pointer) so neither of those things is needed.
17:35 <nitrix> Interesting.
17:35 <shafox> dmwit: alright. lemme try.
17:35 xkapastel joined
17:35 remyhr joined
17:35 <dmwit> I can prove that it does not monomorphize by producing a program with an infinite set of possible types at runtime (determined by user input which ones get used).
17:36 <orion> geekosaur: If you are paid to architect and write code for large scale systems, what job descriptor would you use instead of "software engineer"?
17:36 <geekosaur> nitrix, in polymorphic situations either it is ignoring the polymorphism (e.g. length :: [a] -> Int, it doesnt need to care about the a at all) or using a passed record containing the appropriate mehcnaisms for the actual type (typeclasses)
17:36 <dmwit> I cannot prove that it doesn't do the latter by experiment. You'll have to just believe me, or check the source yourself.
17:37 <geekosaur> orion, I feel like you're misfocused. it is not that "software engineering" is in and of itself a bad term; it is that it gets overused
17:37 <geekosaur> for things that arguably are not
17:37 pfurla joined
17:37 bbrodriguez joined
17:37 <exarkun> Most people involved with don't engineer software, they only write it.
17:37 <nitrix> dmwit: I like that approach. How does one create infinite set of types at runtime? Don't you need dependent types for that?
17:37 <geekosaur> the problem is that the term is also used for writing a 5-line program
17:38 <orion> geekosaur: Ah. Is it a term worth saving?
17:38 <geekosaur> only if you can figure out how to save it.
17:38 <geekosaur> (good luck with that. people will do what people will do.)
17:39 <orion> I wonder what a good replacement term would be, given that saving it is probably futile.
17:39 <dmwit> nitrix: No, polymorphic recursion is enough. I have some SO writing on the topic that I will give you a link to, one moment please.
17:39 edmundnoble joined
17:39 <exarkun> orion: Computer Programmer
17:39 <orion> ha
17:39 <exarkun> or even more accurate, Computer Toucher
17:40 <geekosaur> there's little point. semantic drift will happen
17:40 <ddellacosta> my problem with "software engineer" is that in other fields, "engineer" has much more rigorous requirements before anyone can call themselves an engineer
17:40 <* geekosaur> forgets the exact formal term atm
17:40 <dmwit> nitrix: https://stackoverflow.com/a/11422333/791604
17:40 <geekosaur> people use language as they will
17:40 <exarkun> geekosaur: mostly
17:40 <dminuoso> ddellacosta: and equivalently "programmer" has usually no requirements before you can call yourself a programmer. =)
17:40 <exarkun> geekosaur: although if you call yourself a civil engineer, there are certain penalties if you mean something different by that than the State means.
17:41 <dminuoso> "Never wrote a line of code in your line? Feel free to call yourself a programmer"
17:41 <nitrix> dmwit: checking
17:41 <exarkun> So, you could save "software engineer" by legislating a meaning.
17:41 <exarkun> And fining/jailing people who misuse it.
17:41 <geekosaur> exarkun, sure. and as always, pressures to change that.
17:41 <orion> I should create an elitist programming society.
17:41 <ddellacosta> dminuoso: ...which suits me fine. I think it's simply disingenuous for people--such as myself--who have no qualifications past experience in the field to call themselves by a term that in every other usage is pretty regulated
17:42 alexteves_ joined
17:42 <__monty__> Computer science isn't a science so software engineering can't be engineering ; )
17:42 <ddellacosta> and let's acknowledge that the entire reason anyone wants to call themselves a software _engineer_ is exactly to create an association with the gravitas that term holds
17:42 justanotheruser joined
17:42 <phadej> what's "civil" is in civil engineering?
17:43 <ddellacosta> sorry I fear I've helped get us pretty far offtopic
17:43 <monochrom> bridges, roads, apartments, etc
17:43 <phadej> monochrom: courteous and polite.
17:43 <phadej> "they were comparatively civil to their daughter"
17:43 <geekosaur> upon a time, it meant stuff used by normal folks instead of specialists
17:44 <geekosaur> "civilians"
17:44 <monochrom> I hate non-dead languages.
17:44 <geekosaur> these days, given the amount of electronic, RF, etc. engineering that goes into a modern cellphone, that definition's kinda lost
17:44 <__monty__> Pretty sure it was to distinguish from military engineering.
17:44 <phadej> I guess, it's original meaning is "non-military"
17:44 dsantiago joined
17:44 <phadej> __monty__: me too
17:44 <phadej> but that's the point, meaning of terms change.
17:44 <johnw> civil means "Pertaining to a city or state, or to a citizen in his relations to his fellow citizens or to the state; within the city or state."
17:44 <opqdonut> definitely not "non-military"
17:44 <opqdonut> yeah, what johnw said
17:45 <phadej> opqdonut: but in "civil aviation"
17:45 <johnw> being civil comes from "acting like a citizen"
17:45 <phadej> johnw: talking about "civil engineering"
17:45 <johnw> "Having the manners of one dwelling in a city, as opposed to those of savages or rustics; polite; courteous; complaisant; affable."
17:45 <geekosaur> yes
17:45 <opqdonut> I think "civil engineering" is "city engineering", right?
17:45 <geekosaur> and civil engineering can be seen as city ... that
17:45 <glguy> Which Haskell package are we talking about?
17:45 <johnw> yeah, building things needed by the city
17:45 <johnw> glguy: philology gets me every time
17:45 <johnw> ok, back to Haskell!
17:46 brocoli joined
17:46 <ddellacosta> geekosaur: civil-recursion-schemes, I think
17:46 <geekosaur> did you mean glguy ?
17:46 <ddellacosta> er, glguy, yes sorry
17:46 <opqdonut> hmm, military-recursion-schemes
17:46 fendor_ joined
17:46 zachk joined
17:47 <phadej> anyway, I don't really seen anyone distinguish "software engineer, software developer, software programmer". Software architect somehow stands out.
17:47 <geekosaur> for now
17:47 <__monty__> Here everything from computer science and electronics over mechanical and chemical engineering is known as "civil engineering" as opposed to military engineering.
17:47 <geekosaur> ah, right, semantic treadmill, euphemism treadmill
17:47 <johnw> civilCata?
17:47 zachk joined
17:48 <phadej> OTOH, loaning a lot of analogies (via terms) from civil engineering isn't always good :(
17:48 <geekosaur> "software architect" is still young, it'll spread out the same way over time
17:48 <ddellacosta> ugh I hope not
17:48 <* ddellacosta> shivers
17:48 <geekosaur> deal. it *always* happens
17:48 fujiy joined
17:49 <geekosaur> unless enfoced by e.g. law, at its own price
17:49 iAmerikan joined
17:49 <geekosaur> (potentially including said law being so widely ignored as to have no real meaning)
17:49 <ddellacosta> geekosaur: you say that as though we, the people working in the industry, have absolutely no will to exert in relation to the matter
17:49 hellozee_ joined
17:49 <phadej> yet, I heard people having job titles (vs. degree titles) as "integrator",
17:49 <ddellacosta> but, sorry, way offtopic now--let's take it to #haskell-offtopic
17:49 lumm joined
17:49 <phadej> maybe in near future it won't be as general as software developer, but rather "AI programmer"
17:49 <geekosaur> we have some will. butt (a) you say :we" as if it's a monolith with a single intent (b) you ignore what people outside it say of insiders
17:50 <chessai> sanity check: is the following safe?
17:50 <chessai> aToAny2 :: forall f a. (f a -> f a) -> (f Any -> f Any)
17:50 <chessai> aToAny2 = unsafeCoerce
17:50 replay joined
17:50 <johnw> not if a is Void
17:50 <geekosaur> and one way that slide happens is someone in e.g. HR reaching for something that sounds good so it'll attract "the right people", with no real undrrstanding of intent
17:51 <chessai> johnw: ah! good point
17:51 Solonarv joined
17:51 <phadej> and if f is GADT
17:51 <nitrix> dmwit: I see. So big lambda, \T -> (T, T). Applied recursively to itself, the codomain blows up. You can monomorphize the (T, T) but you end up needing a uniform representation, where the T becomes pointers to another monomorphic type, or possibly, itself (creating the recursion).
17:52 paidnode joined
17:52 ski joined
17:52 <chessai> phadej: how so
17:52 <nitrix> dmwit: Looks like recursive types in general is the implementation challenge, not really polymorphism.
17:52 <edmundnoble> chessai: Because if it's a GADT and you match on `f Any` to get an `f Int`, you have a proof that `Any ~ Int`.
17:53 <edmundnoble> Which is very not good.
17:54 exarkun joined
17:54 bbrodriguez joined
17:54 dsantiago joined
17:56 <chessai> edmundnoble: that makes sense
17:56 <nitrix> dmwit: Thanks.
17:57 ttoe_ joined
17:57 inad922 joined
17:57 keepLearning512 joined
17:59 valentinbuza joined
18:01 Unhammer joined
18:02 DTZUZO joined
18:02 lumm joined
18:03 <Unhammer> is there already a package which gives "(RealFrac a, Integral b) => a -> Maybe b" (to avoid NaN → 2.203912183e18) for round/ceiling/truncate/floor? I don't find them in https://hackage.haskell.org/package/safe
18:03 wildlander joined
18:04 altjsus joined
18:04 dpyro joined
18:05 boccato joined
18:07 mszczygiel joined
18:09 qtfy joined
18:09 oisdk joined
18:10 klntsky joined
18:10 raingloom joined
18:11 cloudhead joined
18:11 sytherax joined
18:12 iAmerika1 joined
18:15 Welkin joined
18:15 <johnw> i think TypeApplications is my favorite new feature
18:15 detrumi left
18:16 <nitrix> johnw: Have they added it to lambdabot yet?
18:17 <osa1> it gets better with https://arxiv.org/abs/1806.03476
18:17 curious_corn joined
18:17 <geekosaur> no. think there's some updates to libs needed
18:17 <* hackage> expressions 0.1.7 - Expressions and Formulae a la carte http://hackage.haskell.org/package/expressions-0.1.7 (jakubdaniel)
18:17 <nitrix> :t map @Int @Bool
18:17 <lambdabot> error: parse error on input ‘@’
18:17 <johnw> the only problem is that I'm lazier about writing things so that inference happens nicely
18:17 <geekosaur> currently it parses it in many circumstances because it reads @ as a normal operator, but that can go wrong since what follows is a type instead of a term)
18:17 lortabac_ joined
18:17 <geekosaur> yahb does speak it
18:18 <geekosaur> % :t map @Int @Bool
18:18 <yahb> geekosaur: (Int -> Bool) -> [Int] -> [Bool]
18:18 fujiy joined
18:18 <nitrix> https://github.com/lambdabot/lambdabot/pull/147
18:19 <nitrix> Haha, on my I created that PR long time ago :)
18:19 <nitrix> I think I'll revisit it. There must be a way to check if @ is used as an operator in the context :/
18:20 <geekosaur> you need to use an updated version of haskell-src-exts, and verisons of hint and mueval that support it
18:20 <nitrix> I guess that'd need to be a change to the GHC extension rather than lambdabot.
18:20 <geekosaur> at minimum
18:21 <geekosaur> which still leaves the collision with @ in patterns, and potentially @ as an actual operator, but those indeed require changing the extension and at this point I suspect that won;t fly
18:22 <geekosaur> and ASCII doesn't have enough characters not already used as Haskell syntax
18:22 dsantiago joined
18:24 twandy joined
18:25 otto_s joined
18:26 zar joined
18:26 dpyro joined
18:26 agander joined
18:27 reactormonk joined
18:28 agander_ joined
18:29 curious_corn joined
18:29 connrs joined
18:30 nnplv joined
18:30 zdenal joined
18:31 sz0 joined
18:31 <dmwit> osa1: Thanks, before this paper I was never super clear on why pattern signatures required ScopedTypeVariables. Now it's obvious, even though they didn't explicitly about it: the signature could mention a variable, and there's no reason to connect that variable to any particular variable in the whole function's signature.
18:32 oisdk joined
18:32 orbisvicis joined
18:33 <orbisvicis> can I run haddock via cabal without building or configuring ?
18:33 <orbisvicis> ie with missing dependencies
18:33 initiumdoeslinux joined
18:34 <sclv> No
18:34 <sclv> It needs to compile to compute type info
18:34 hphuoc25 joined
18:34 <orbisvicis> oh, and that makes sense
18:35 <orion> I'm designing a monad transformer with ResourceT. Should it be closer to the base monad, further, or does it not matter?
18:35 Boomerang joined
18:35 knupfer joined
18:36 <glguy> if it matters depends on the monad transformer, there's no generic answer. same pertains to the level you should put it at
18:36 <cocreature> orion: iirc ResourceT is basically ReaderT which tends to commute which pretty much everything
18:36 <ski> dmwit : it used to be a pattern signature could bind a tyvar, for later use in a defining equation (or `case' branch or ...)
18:36 <orion> cocreature: Great, thanks.
18:36 <geekosaur> but resource lifetimes don't necessarily so commute
18:36 <* ski> misses result signatures
18:37 <dmwit> ski: I think it still can. Do you think otherwise/
18:37 <dmwit> ?
18:37 <dmwit> > let f :: [a] -> [a]; f ((x :: b) : xs) = [y] where y :: b; y = undefined in f []
18:37 <orion> geekosaur: What do you mean?
18:37 <lambdabot> *Exception: <interactive>:3:22-72: Non-exhaustive patterns in function f
18:38 <dmwit> Oops, I didn't actually check what I wanted to check.
18:38 <dmwit> > let f :: [Int] -> [Int]; f ((x :: b) : xs) = [y] where y :: b; y = 3 in f []
18:38 <lambdabot> error:
18:38 <lambdabot> • Couldn't match expected type ‘Int’ with actual type ‘b’
18:38 <lambdabot> • When checking that the pattern signature: b
18:38 <dmwit> Oh, interesting.
18:38 rcdilorenzo left
18:39 <geekosaur> orion, you could for example "lose" the resource if you put the ResourceT in the wrong place. or handle exceptions at the wrong level (the MonadBaseControl problem)
18:39 mnoonan joined
18:39 <Welkin> lose the reference to it?
18:39 <geekosaur> which is why neither ResourceT nor MonadBaseControl can be automated, you must carefully think through resource lifetimes to figure out how to put an instance together
18:39 <Welkin> does that cause a memory leak?
18:40 fujiy joined
18:40 <geekosaur> it can if it goes completely out of scope, because a resource is a handle on something external to Haskell (e.g. a datbae handle received from FFI)
18:40 <geekosaur> *database
18:40 <dmwit> ski: Weird. GHC's behavior does not seem to match the behavior described in this paper, which does claim that pattern signatures can bind type variables just by mentioning a variable that's not currently in scope.
18:40 <orion> geekosaur: Do you know of any good reading material which can help me gain intuition for how to do that?
18:41 <geekosaur> dmwit, wonder if it's worth testing that in ghc 6.4 or some other version that had standalone PatternSignatures
18:41 <orion> (that = think carefully about the instance)
18:42 <orion> I'm trying to compose LoggingT, ReaderT, and ResourceT. The order is what I'm currently working through.
18:42 <geekosaur> there's some School of Haskell stuff
18:42 <dmwit> geekosaur: Oh, it turns out that (even in this paper) they mention there is a restriction: pattern signatures may only bind variables *to other variables*.
18:42 <geekosaur> not sure if any of it talks about how to build your own as opposed to using existing ones, though
18:42 <dmwit> So binding `b` to `Int` as in my test above is ruled out. =(
18:43 <geekosaur> I have seen discussion, but it's ….complex
18:43 keepLearning512 joined
18:43 shannow joined
18:44 <geekosaur> http://blog.ezyang.com/2012/01/monadbasecontrol-is-unsound/ (note that the actual title is now "…is tricky") hits some of the issues
18:44 <geekosaur> and "tricky" is indeed the problem
18:44 <geekosaur> but the problem it wants to solve isequally tricky
18:44 raichoo joined
18:44 <geekosaur> not to say downright nasty at times
18:45 Np-Harda` joined
18:46 DSM joined
18:46 mkoenig joined
18:46 <phadej> for LoggingT ReaderT and ResourceT order doesnät matter
18:46 <phadej> they are all readers
18:47 <orion> phadej: geekosaur says that the placement of ResourceT does matter.
18:48 enkeyz joined
18:48 <geekosaur> it can matter. I was speaking generally
18:48 <phadej> it does in general, but not with these trnasformers
18:48 <phadej> geekosaur: +1
18:48 <geekosaur> if all three are ultimately readerT then they may well commute safely
18:48 fujiy joined
18:48 hellozee_ joined
18:49 <geekosaur> you hadn't mentioned which ones and I can;t claim familiarity with some of them, so not safe for me to make assertions there
18:49 Linter joined
18:49 <glguy> even if they commute it some might have instances that others don't
18:49 <geekosaur> (yes, you did mention later)
18:50 leaf__ joined
18:52 <Guest56485> Hey everyone, I was wondering if there's a group actively working on developing stats with Haskell
18:53 <Guest56485> I couldn't seem to find anything super current
18:53 <srk> stats?
18:53 <Guest56485> yea, like how R has a ton of tools for working in statistics
18:53 <enterprisey> any ideas on debugging infinite loops in megaparsec
18:53 <srk> right. not sure
18:54 <enterprisey> specifically, I have a simple parser with (some constructors) <$> alphaNumChar and I get a <<loop>>
18:54 pounce joined
18:54 <orion> geekosaur: You mentioned MonadBaseControl being tricky. Does the same apply to MonadUnliftIO?
18:55 <Welkin> Guest56485: http://www.datahaskell.org/
18:55 <geekosaur> I haven't looked into MonadUnliftIO so can't say
18:55 <dmwit> enterprisey: A good first step, as with any other debugging endeavor, is to produce a minimal test case (here minimal means both "small thing to pass to the parser" and "small amount of code to define the parser").
18:55 <geekosaur> enterprisey, one thing I look for in that case is any rule that immediately reduces to application of itself
18:55 <Guest56485> Welkin: thank you!
18:55 <Welkin> Cale mentioned that MonadUnliftIO has the same problems
18:56 <orbisvicis> if I want to link (haddock) to an external function of a different module in the same package, I either have import the module (ghc error with -Werror) or refer to it fully qualified. Is there any alternative ?
18:56 <geekosaur> foo = foo mumble <|> ... -- will <<loop>>
18:56 <geekosaur> left recursion is bad in recursive descent parsers
18:57 <phadej> orion: monadunliftio is conceptually much simpler, if you can get away with it, than it's good
18:57 <phadej> (you can write instances only for readers, thus it's easy, but also limiting)
18:57 ars23 joined
18:59 agander__ joined
19:01 <enterprisey> yeah I have no recursion of any sort
19:02 xpycm joined
19:02 Amras joined
19:02 <enterprisey> in fact, it's so short I can paste it here
19:02 agander joined
19:02 <enterprisey> I have a ByteString, and I'm trying to parse it to a String
19:03 curious_corn joined
19:03 <enterprisey> so imagine f converts [Word8] to a String; then my parser is f <$> some alphaNumChar
19:06 <dminuoso> geekosaur: what is the solution to the MonadBaseControl problem though? Ditching such `(T -> IO a) -> IO a` implementations for manual resource management with bracket?
19:06 Peaker joined
19:06 <geekosaur> dminuoso, the "problem" is there is no way to build "generic" instances; you have to carefully design them
19:07 <geekosaur> MBC works, but you have to think about it, not have the compiler roll it for you
19:07 <Amras> Are there any non-platform-dependent solutions for non-blocking reads from pipes/sockets/files? Some generalized solution that will compile properly on POSIX/non-POSIX systems?
19:07 <Peaker> hey, in https://github.com/simonmar/alex/blob/master/examples/haskell.x there's $graphic # ... what does the # mean? It seems like it might mean exclusion? But I can't find that anywhere. Where does # come from?
19:07 yuuki_ joined
19:08 <Amras> short of forkIO + MVars + wait,checkMVar
19:09 DSM joined
19:09 initiumdoeslinux joined
19:09 <cocreature> Amras: the standard IO operations are all implemented in terms of non-blocking reads. just spawn a thread using forkIO
19:10 Deide joined
19:10 <phadej> Peaker: it's difference operator, yes.
19:11 <geekosaur> Peaker, https://www.haskell.org/alex/doc/html/charsets.html
19:11 <Peaker> thanks
19:11 <geekosaur> set0 # set1
19:11 Tesseraction joined
19:11 refold joined
19:11 remyhr joined
19:12 boccato joined
19:12 <Peaker> Is alex the fastest way to tokenize? It seems like such an archaic way to work
19:12 mkoenig joined
19:13 initiumdoeslinux joined
19:13 <geekosaur> the same can be said of lex / flex in C; I punted to hand-written lexers years ago there
19:14 <geekosaur> but it's not about fastest way to tokenize; it's largely about maintainability and modifiability.
19:14 <geekosaur> programmer time and "brain space"
19:14 <Amras> cocreature, would you mind writing up a quick example of what you mean? something that'll return Just String from a getLine if data is immediately available or Nothing if it isn't
19:14 lambda-11235 joined
19:14 <Amras> I'm not following how forkIO would help here
19:15 Kacia joined
19:15 <geekosaur> Amras, the usual design here is ot have a dedicated read thread that can send a message to another one when there is input
19:15 <geekosaur> via a Chan or etc.
19:15 <geekosaur> rather than trying to micromanage it
19:16 <* hackage> cookies - web cookies http://hackage.haskell.org/package/cookies- (chessai)
19:18 <cocreature> yeah geekosaur phrased it pretty well
19:19 <geekosaur> which? :p
19:19 language_agnosti joined
19:19 <shapr> I found blaze-to-html, is there anything like that for lucid?
19:20 <geekosaur> (notably,micromanagement plays really badly if someone uses your code in a multithreaded program later)
19:20 Math22232 joined
19:20 <cocreature> geekosaur: all of it :)
19:21 <cocreature> shapr: what do you mean by blaze-to-html? I don’t see it on hackage
19:21 curious_corn joined
19:21 <shapr> I think it's part of the blaze package, it 'decompiles' html into blaze source
19:22 <shapr> (though it does not handle ARIA or other offbeat things)
19:22 <Welkin> so you mean html-to-blaze
19:22 <Welkin> there are tools like that for elm as well
19:22 <cocreature> shapr: do you mean blaze-from-html?
19:22 <Welkin> I've never used them before though
19:23 <Amras> geekosaur, not clear on how multithreading could break a non-blocking read. Also, assuming a straight-up MVar would be preferable to a Chan in this case since readChan blocks too.
19:23 epsilonhalbe joined
19:23 <geekosaur> (and re lex in C, the main thing there was I had lex on AT&T UNIX but nothing yet for e.g. linux, so little choice there other than pregenerating elsewhere. Yes, I am that old.)
19:23 <geekosaur> Amras, race conditions if multiple threads end up running the same code with the same non-blocking read
19:23 <Amras> ah, right
19:24 <geekosaur> and TVars are probably preferable here because you get retry stuff
19:25 <cocreature> shapr: https://github.com/alogic0/lucid-from-html
19:27 <dmwit> Does the GHC API expose Z encoding/decoding somewhere?
19:28 bertschneider joined
19:29 exarkun joined
19:30 rcdilorenzo joined
19:31 iAmerika1 joined
19:31 <* hackage> haskell-tools-ast, haskell-tools-backend-ghc, haskell-tools-builtin-refactorings, haskell-tools-cli, haskell-tools-daemon, haskell-tools-debug, haskell-tools-experimental-refactorings, haskell-tools-prettyprint, haskell-tools-refactor, haskell-tools-rewrite, haskell-tools-demo (lazac)
19:34 Denommus` joined
19:34 <shapr> cocreature: oh wow! thanks!
19:35 <shapr> cocreature: right, sorry for the typo, I meant html-to-blaze
19:35 <cocreature> shapr: no you meant blaze-from-html, at least that’s the name of the package on hackage :)
19:35 mtjmullen joined
19:35 <shapr> oh, ok
19:36 <shapr> In any case, I have some html pages that need to be templates
19:37 orbisvicis left
19:38 danso joined
19:39 davr0s joined
19:40 dxld joined
19:41 exarkun_ left
19:43 hololeap joined
19:45 asheshambasta joined
19:46 jakub_ joined
19:46 <hololeap> anyone know of a library/mechanism to dole out jobs from a central server to any number of clients? some way to serialize a closure and a function maybe?
19:46 <geekosaur> sounds vaguely like cloud haskell?
19:47 <geekosaur> which doesn't actually serialize functions etc., just references to them (which must already exist in the client)
19:47 tzemanovic joined
19:47 <geekosaur> actually serializing functions is … difficulr
19:47 <geekosaur> -r+t
19:47 <Welkin> hololeap: erlang
19:47 <dmwit> actually setializing functions is ... difficulr
19:48 <Welkin> I bet distributed haskell has a way to do it, since it is erlang implemented in haskell
19:48 <dmwit> Sorry, sorry. I couldn't help it.
19:49 lambda-11235 joined
19:49 <geekosaur> !-2:s/lr/lt/ # bah humbug
19:49 Luke joined
19:50 <jakub_> Hi, suppose I have a type that corresponds to numbers but I could care for it to have abs, signum and the like as otherwise required of instance of, but I would still really like to use the number literals instead of more complicated constructors for values of my type, is there something like OverloadedNumbers (in spirit of OverloadedStrings) or is there some easy TemplateHaskell way to achieve this? (I
19:50 <jakub_> would still wish to use normal numbers occasionally, I am fine with having to provide type signatures at some level to help compiler infer what the real intention is when a literal is used)
19:50 <hololeap> is distributed haskell is the same project as cloud haskell; just a different name? that's what it seems like.
19:50 <jakub_> *couldn't
19:50 dxld joined
19:51 <jakub_> *instances of Num
19:51 Unhammer joined
19:51 Destol joined
19:51 phreedom joined
19:52 fujiy joined
19:52 klntsky joined
19:52 tombusby joined
19:53 LiaoTao joined
19:53 <geekosaur> jakub_, no way to separate fromInteger from Num, no. if you really want this you could have a dummy Num instance with everything but fromInterger = undefined
19:53 <Welkin> hololeap: yes
19:53 <geekosaur> or maybe quasiquotes, althoughthat still requires extra syntax (oxford brackets)
19:53 <Welkin> the name changed to distributed haskell
19:55 DSM joined
19:56 <lyxia> jakub_: RebindableSyntax makes numerals desugar to whatever "fromInteger" is in scope, instead of Prelude.fromInteger.
19:56 <* hackage> taffybar 2.1.2 - A desktop bar similar to xmobar, but with more GUI http://hackage.haskell.org/package/taffybar-2.1.2 (eyevanmalicesun)
19:58 keegans joined
20:00 <jakub_> geekosaur, lyxia: thanks a lot, that helped
20:02 sarna joined
20:02 DarkUnicorn joined
20:03 JimmyRcom_ joined
20:03 fishythefish joined
20:04 piark_ joined
20:04 fishythe_ joined
20:05 <hololeap> how come Network.Socket is not "safe" under Safe Haskell?
20:06 replay joined
20:07 altjsus joined
20:07 <shapr> I *think* Safe Haskell started with Don Stewart's Haskell interpreter inside lambdabot, so the point was "things that can't eat your system or affect the outside world"
20:07 <shapr> but now I have to go look up Safe Haskell and see if that's still what it means.
20:08 <shapr> Finding ways to get the /etc/shadow off the machine running dons' haskell interpreter was a multi-year fun hobby.
20:09 dented42 joined
20:09 <cocreature> shapr: did you ever succeed? :)
20:09 <shapr> Many of us succeeded in a many different ways.
20:09 <cocreature> nice :)
20:09 <shapr> ddarius found a cute trick where Template Haskell could still do IO even though IO was not allowed at all
20:10 <shapr> I think it's all in the logs, it was a blast
20:10 <hololeap> System.IO is considered "trustworthy"
20:12 <* shapr> reads https://downloads.haskell.org/~ghc/8.4.3/docs/html/users_guide/safe_haskell.html
20:12 <geekosaur> I'd be looking in the docs for the network package
20:12 oisdk joined
20:12 <* hackage> servant-nix 0.1 - Servant Nix content-type http://hackage.haskell.org/package/servant-nix-0.1 (AlpMestanogullari)
20:12 <geekosaur> but I think part of the reason is that it can't be inferred trustworthy and nobody has audited it
20:13 <geekosaur> since it uses a lot of FFI and a certain amount of jiggery-pokery related to marshaling and unmarshaling socket FFI data
20:13 <hololeap> is that the de-facto way to do low-level network stuff (connect to a TCP port, for instance) in haskell?
20:13 <geekosaur> yes
20:13 <hololeap> ok
20:13 <geekosaur> if you re working at low level, at least
20:13 <geekosaur> these days for a bit higher level stuff conduit or pipes is preferred
20:13 KeyJoo joined
20:14 <geekosaur> the Network module is deprecated
20:14 hphuoc25 joined
20:14 JimmyRcom_ joined
20:14 <hololeap> hmmm... well Data.Conduit is "safe"
20:16 iAmerika1 joined
20:16 trevorriles joined
20:16 lumm joined
20:22 fujiy joined
20:23 ijks joined
20:24 ninegrid joined
20:25 blender joined
20:25 lumm joined
20:25 <orion> "Note that, in order to meet the laws given below, the intuition is that a monad must have no monadic state, but may have monadic context." https://www.stackage.org/haddock/lts-11.13/unliftio-core-
20:26 <orion> What is the difference between "state" and "context"?
20:26 nathan joined
20:27 <blender> hello, does anyone have a working vim setup that shows types with ghc 8.2.2 ?
20:27 <cocreature> orion: context doesn’t change
20:27 <cocreature> orion: so Reader has context but no state
20:27 <maerwald> blender: stick to 8.0.2
20:27 ijks_ joined
20:28 <blender> maerwald: I switched to lts 11.13 and I think it requires 8.2.2 ?
20:28 <* hackage> uom-plugin - Units of measure as a GHC typechecker plugin http://hackage.haskell.org/package/uom-plugin- (AdamGundry)
20:28 <orion> cocreature: I see, thanks
20:28 <maerwald> I don't know what lts 11.13 is
20:28 <blender> stack LTS 11.13
20:28 <maerwald> I don't use stack, no idea
20:29 kapil___ joined
20:29 <blender> but in general there is nothing working with 8.2.2 :( ? I believe haskell-ide-engine does not show type information?
20:30 kmelva joined
20:30 <maerwald> only for functions/identifiers, not for arbitrary expressions
20:31 pranz joined
20:31 fujiy joined
20:31 <blender> ok, thanks :(
20:32 <geekosaur> and some things won;t work with 8.2+ because they just don't work. typed holes in ghci have been broken since 8.2 which means anything using that to get type info will fail
20:32 <geekosaur> no fix yet, has to be fixed in ghc
20:32 pranz1 joined
20:32 <suzu> typed holes have been working for me
20:33 <Rembane> geekosaur: Are typed holes working in 8.4, or not at all?
20:33 <suzu> though i've only been using it with simple cases
20:33 <suzu> usually i just toss in `()` and read the error as that's more illuminating
20:33 <suzu> :/
20:33 <cocreature> I think they are only broken in combination with -fdefer-type-errors?
20:33 aarvar joined
20:33 <geekosaur> "[12 21:44:21] <mpickering> bgamari: Did Andres tell you about the bug with holes? There were some situations where the compilation would fail but no error message would appear when using a hole." is what I know
20:33 <Rembane> suzu: Have you tried using _ ?
20:33 <geekosaur> although that sounds like it might be something else than the one I'm thinking of
20:33 <suzu> yes. _ works but () gives me better results
20:34 <geekosaur> where ghci would panic if it hit a hole in some circumstances
20:34 <Rembane> geekosaur: Cool. The thrill is gone. :)
20:34 <suzu> ok no never seen a panic
20:34 <Rembane> suzu: That's fun, I need to use that trick. Thank you!
20:34 <suzu> yeah it is better. np!
20:34 brocoli joined
20:35 KeyJoo joined
20:35 DSM joined
20:36 <blender> holes are working for me. That is how I have been getting along but it sets me back a lot compared to haskell-vim-now :(
20:36 KeyJoo joined
20:36 <geekosaur> cocreature, yeh, forgot to metnion that, but that's used a lot by editor shims so they can try to type things that aren't working
20:36 <geekosaur> also sometimes -fdefer-all-errors which is the main reason it exists
20:38 omefire joined
20:38 Mysterious_Light joined
20:38 <glguy> emacs+dante gives types of expressions
20:39 fujiy joined
20:44 KeyJoo joined
20:44 merijn joined
20:44 darjeeling_ joined
20:44 chaosmasttter joined
20:44 chat_ joined
20:45 KeyJoo joined
20:45 raek left
20:47 <suzu> emacs+intero too
20:47 language_agnosti joined
20:48 <maerwald> yes, and Go works on vim, maybe switch to Go
20:48 <blender> ahahaah :) well I could use spacemacs but I like vim.
20:48 bendo joined
20:49 <blender> with evil mode
20:49 <suzu> i switched from vim to spacemacs actually
20:49 <suzu> haskell was a factor in this decision
20:49 ru0mad joined
20:49 <blender> yeah but vim :( I might consider evil mode as I said.
20:49 <suzu> hs integration just works and i can move on with my life
20:49 <suzu> i do use evil mode
20:50 lambda-11235 joined
20:50 jbalint joined
20:50 jbalint joined
20:50 <blender> what do I need? spacemacs and then? how do I install what I need for intero?
20:50 <suzu> spacemacs and nothing else
20:50 <suzu> it will set everything up for you out of the box
20:50 <glguy> intero locks you into stack, so be aware of that. That's one of the advantages of dante
20:51 <suzu> spacemacs lets you use intero or dante
20:51 <suzu> i left it as intero but it can be changed
20:51 <glguy> did that make it into master yet?
20:52 <glguy> last time I played around with that it was only in develop
20:52 <blender> ok so I install spacemacs and then just do `stack install intero` ?
20:52 <suzu> i..think so
20:52 <suzu> blender: no
20:52 <suzu> you install spacemacs, install the haskell intero layer, and then it will take over the rest when you load a stack project
20:52 <blender> ok
20:52 <* hackage> distributed-process-extras 0.3.5 - Cloud Haskell Extras http://hackage.haskell.org/package/distributed-process-extras-0.3.5 (AlexanderVershilov)
20:52 <blender> I'll try.
20:52 <suzu> including installing the correct intero into your project
20:53 <suzu> the biggest motivation i had for using spacemacs was the idea that the only reason i use vim is simply because it was the first tool i learned
20:53 <suzu> and that is a bad reason
20:53 <maerwald> intero works with neovim too
20:53 <maerwald> I would rather switch to that instead of emacs
20:53 <maerwald> that sounds unreasonable for a vim user
20:53 <dyl> I should play with spacemacs.
20:53 <dyl> Looks handy.
20:53 <maerwald> blender: https://github.com/parsonsmatt/intero-neovim
20:53 <dyl> I just don't have time to configure emacs in general.
20:54 <suzu> dyl: no need
20:54 <suzu> spacemacs comes batteries-included with defaults that i still use
20:54 <dyl> "intero locks you into stack" ← boo
20:54 <maerwald> you can use a custom backend
20:54 <suzu> whats with all the recent stack hate
20:54 <suzu> is cabal new-build that good?
20:55 <sclv> its pretty good
20:55 <dyl> stack is just one more thing to learn and I had minor issues using it initially.
20:55 <blender> maerwald: thanks I'll look at that too. Evil mode in spacemacs lets you use vi bindings to it's not that bad if you overlook the fact that your using emacs as a vi fan :D
20:55 <dyl> cabal had its own issues, but the new stuff fixes all of them I remember.
20:55 <sclv> idk if that should induce hate of anything else
20:55 <dyl> Nah, I don't hate stack.
20:55 <sclv> but it should induce some satisfaction :-)
20:55 <dyl> I just prefer using the new-* subcommands.
20:55 <maerwald> blender: I don't like unstable editors
20:55 <sclv> the main issues are just that its a bit incompete
20:55 <suzu> stack solved my hair-ripping cabal meltdowns
20:55 <sclv> but we have lots of ongoing gsoc work driving it forward
20:55 ozzymcduff joined
20:55 <suzu> so it will always have that one special place in my heart
20:55 <suzu> for letting me actually get things done
20:56 <dyl> I forget what the issue I had was, but it was just generally confusing.
20:56 <dyl> stack seems good for application people, cabal new-* for library people.
20:56 <dyl> I also didn't like that I couldn't figure how to have a library+executable in stack easily.
20:56 <dyl> stack ghci didn't work right.
20:57 <dyl> sclv in the end a better cabal means a better stack too :).
20:57 <Peaker> is it customary for "alex" to generate "Whitespace" tokens? If not, what technique is used to make sure whitespace is significant in token separation?
20:57 <Peaker> a regexp word boundary around token keywords?
20:58 <gonz_> Stack has never not worked for me
20:58 <glguy> Peaker: What are you trying to enforce whitespace around?
20:58 <edmundnoble> And stack has also never worked for others
20:58 <glguy> Peaker: Generally you forget about whitespace after the alex phase
20:58 <Peaker> glguy, e.g: include <filepath> where "include" is a keyword
20:58 <koala_man> Peaker: isn't the fact that it tokenizes as two separate tokens enough?
20:58 <dyl> stack seems to fit a certain sort of user.
20:58 <Peaker> I don't want it to accidentally allow includefilepath
20:59 <geekosaur> ^ whitespace tokens are for indentation sensitive parsing.
20:59 <glguy> Peaker: alex uses a longest match
20:59 <sm> you are all fools, everything but pier is trash
20:59 <glguy> so if you have another rule for identifiers that would have matched includefilepath that would be prefered to lexing that as two tokens
20:59 <suzu> lmao
20:59 <geekosaur> do we have #haskell-square-ring yet?
20:59 <gonz_> dyl: You would still configure library + executable in your cabal file, though, no? Why would this be more of an issue with stack?
20:59 brocoli joined
20:59 <dyl> no, you are the fool: not using gulp from the node.js ecosystem and only pulling packages as strings in single file npm packages?
20:59 <Peaker> glguy, I see
21:00 <dyl> hah!
21:00 <dyl> You peons.
21:00 <dyl> gonz_ stack ghci didn't work.
21:00 <glguy> Peaker: Alex also has the ability to specify a following pattern
21:00 <dyl> Which is a dealbreaker for me.
21:00 remyhr joined
21:00 dented42 joined
21:00 plugin_ joined
21:00 <glguy> so if you didn't have some longer match that would have helped with this you can say that include shouldn't be followed by an alpha
21:00 <dyl> And I want cabal new-repl for various reasons.
21:00 fujiy joined
21:00 <dyl> (which doesn't mix with stack)
21:01 <Peaker> glguy, I am trying to describe lexing of (extended) makefiles.. someone made a prototype in alex but it's not really correct.. and very ugly. I'm very new to alex
21:01 fmixing joined
21:01 <glguy> Peaker: It's trickier to actually look for whitespace because often you'd tolerate whitespace or a { or [, etc
21:01 <Peaker> makefiles are hairy -- they have the <tab>-<random string> part that shouldn't be tokenized normally
21:01 <glguy> include<stuff> might have been OK
21:02 <sbrg> does anyone know what could cause stack to think dependencies are missing when they *definitely* are not missing and are declared correctly in the cabal file and so on? Everything build just fine, but trying to load my project in ghci(stack ghci via emacs) complains about missing dependencies
21:02 <sm> sbrg: how do you know emacs is running stack ghci inside your project directory
21:03 epsilonhalbe left
21:03 <sbrg> sm: the name of the session is correct, but i have my suspicions something along those lines is happening. it's just so strange because it actually worked a couple of days ago.
21:04 <sbrg> also worth noting is that the flycheck checker haskell-stack-ghc also seems to be borked
21:04 Welkin joined
21:04 <sbrg> which also worked previously
21:04 <sbrg> this is a "monorepo" consisting of a library, two other libraries that depend on it, and an executable that depends on all three, so maybe it's picking up some other package.yaml or something.. but it shouldn't
21:04 <sm> none of this seems strange to me, sadly
21:04 <sm> ye'll have to debug yer tools
21:05 <sbrg> :!pwd prints the correct directory
21:06 <Peaker> the alex documentation uses the alex descriptions of its own syntax, apparently, making it very hard to understand which parts are examples and which are definitions of alex in alex
21:06 <sbrg> and even `:set -package <missing packages>` fixes the problem.. so clearly it knows about these packages? O.o
21:06 <sbrg> god i hate having to debug my tools instead of my code -_-
21:06 shannow joined
21:06 <Peaker> reading https://www.haskell.org/alex/doc/html/alex-files.html#rules in I am very lost about how I am supposed to read left_ctx := ... what am I reading? An example of left ctx use? The definition of it in alex?
21:07 <dminuoso> sbrg: when you run `stack ghci` from a terminal while inside the project directory, do you get the same issue still?
21:07 kaictl joined
21:07 <Peaker> I guess it's the alex-in-alex definition, but then an example of use of ^ and "set ^" would be really useful
21:08 KeyJoo joined
21:08 ingenthr joined
21:08 <dsal> Does anyone happen to know why the .&. operator exists in QuickCheck? It's a sort of half-conjunction operator where you want to test input against two properties that both should pass, but it only tries one of them somewhat arbitrarily.
21:08 <glguy> Peaker: set is defined in 4.2
21:08 <glguy> "Syntax of character sets"
21:09 KeyJoo joined
21:10 <Peaker> glguy, so foo^ bar would make sure "foo" precedes (but some other token consumed it [potentially as a suffix])?
21:10 kmurphy4 joined
21:10 louispan joined
21:10 ijks joined
21:10 <glguy> foo isn't a character set
21:10 <Peaker> $foo ^ bar then
21:11 <sbrg> dminuoso: no, but it seems to think it's the wrong project, so i guess that's a clue
21:11 <sbrg> that is, it doesn't give me access to the modules in that project
21:11 <glguy> Yeah, the left-context matches the end of the previous match
21:12 <sbrg> but trying to load the module in question gives me the same errors
21:12 nwf joined
21:12 <Peaker> glguy, great, thanks :-) I think "char" would have been much less confusing to me than "set" :)
21:12 <Peaker> (it's not a set there, but a char *from* the set)
21:13 <glguy> well, that part of the documentation is describing the syntax
21:13 <Peaker> or I guess, it depends on what level of abstraction you're working in
21:13 <glguy> so it wouldn't make sense to show char there
21:13 <geekosaur> it's thinking in regex. [a-z]
21:13 fujiy joined
21:13 <Peaker> yeah, so I guess "chardesc" would be less confusing for me, though "set" is more concise for something this frequent
21:14 i0-dfn joined
21:14 <geekosaur> (icon? cset)
21:15 plugin joined
21:16 Foritus joined
21:16 iAmerikan joined
21:17 language_agnosti joined
21:18 fujiy joined
21:18 <jle`> are there any "inductive" types to represent grids (2d lists)?
21:19 <jle`> so i can inductively prove theorems about entire rows and columns
21:20 Linter joined
21:20 <jle`> searching for "inductive grid" gives me electrical engineering topics
21:20 <__monty__> dsal: Does it pick the same one every pass?
21:20 danthemy_ joined
21:21 <dsal> __monty__: It's supposed to arbitrarily pick one. Like, perhaps it's meant for performance?
21:21 <* dsal> can't figure out how to get lambdabot to quickCheck anymore
21:22 <jle`> @check \x y z -> (x + y) + z == x + (y + z)
21:22 <lambdabot> +++ OK, passed 100 tests.
21:22 <dsal> ah
21:22 <dsal> @check \x -> x > 0 .&. x > 0
21:22 <lambdabot> :-1:-1:Ambiguous infix expression
21:23 Ariakenom joined
21:23 <__monty__> dsal: Quickcheck tests non-deterministically so this seems to fit with the modus operandi. It doesn't need to test both every time because it'll likely test either with enough cases?
21:23 dstolfa joined
21:23 <dsal> I guess? Just seems not sufficiently different from .&&.
21:23 <lyxia> It might be useful with recursive properties to avoid the combinatorial explosion
21:24 dstolfa joined
21:25 <Ariakenom> What's the terminology around these things. Does deterministic but randomised make sense?
21:26 mizu_no_oto joined
21:27 amirpro joined
21:28 <dsal> It's a seeded random sequence so it's reproducible, but arbitrary.
21:28 iAmerika1 joined
21:29 <__monty__> Ariakenom: I think it does actually, monte carlo sampling comes to mind.
21:30 <lyxia> pseudorandom
21:30 <pounce> Is there a way to flatten a [[Int]] to an [Int] ?
21:30 <typedrat> jle`: not like "known", but `data InductiveGrid a = IGCons { igNextCol :: InductiveGrid a, igNextRow :: InductiveGrid a, igValue :: a } | IGNil` should at least be a starting place
21:30 <EvanR> jle`: Vect m (Vect n a) right
21:30 <geekosaur> :t conat
21:30 <lambdabot> error:
21:30 <lambdabot> • Variable not in scope: conat
21:30 <lambdabot> • Perhaps you meant one of these:
21:30 <geekosaur> er
21:30 <geekosaur> :t concat
21:30 <lambdabot> Foldable t => t [a] -> [a]
21:30 <geekosaur> % :t concat @[]
21:30 <yahb> geekosaur: [[a]] -> [a]
21:31 <pounce> ty
21:31 fujiy joined
21:31 <EvanR> typedrat: that has the issue of a particular grid not having a unique representation
21:31 <__monty__> Calling pseudorandomness deterministic is cheating imo. And the question was about the determinism and randomness, not pseudorandomness specifically.
21:31 <EvanR> like inductive graphs
21:31 fendor__ joined
21:32 <dyl> chaotic = random but deterministic, stochastic = random but not deterministic.
21:32 <lyxia> __monty__: I thought determinism was the main point of pseudorandomness?
21:32 <dyl> __monty__ it's not cheating at all.
21:32 <EvanR> dunno dyl sounds specious
21:32 <typedrat> EvanR: nextRow would point to the thing in the correct column to line up, etc. It's a horrible pain to construct
21:33 <dyl> EvanR "not deterministic" does generate some philosophical questions :p.
21:33 <typedrat> but sometimes the trivial solution is what you want
21:33 <dyl> Think logistic map vs brownian motion.
21:33 <__monty__> lyxia: Main point of pseudorandomness is getting as close as possible to randomness imo.
21:33 <dyl> Also: generators like /dev/urandom are NOT pseudorandom. They use pseudorandom algorithms as well, but also work from a pool of "true randomness".
21:33 <dyl> From things like fluctuations in temperature readings, or key presses.
21:34 nyberg joined
21:34 <EvanR> /dev/urandom might be deterministic on some systems
21:34 <dyl> Yes.
21:34 <dyl> *might be*.
21:34 <EvanR> yeah so factor in the random choice of unix :)
21:34 <dyl> Usually, /dev/random blocks when there's not enough entropy left, /dev/urandom just uses pseudorandom, BUT
21:34 <dyl> in a lot of cases they are exactly the same and it's a bit more complex.
21:35 <EvanR> ah youre talking about linux
21:35 <merijn> dyl: What makes you say that chaotic is deterministic?
21:35 <dyl> Chaotic = deterministic in the short term.
21:35 <dyl> Meaning you can predict the next outcome based on the current one.
21:35 <merijn> EvanR: No it's not, that's nonsense
21:35 <dyl> (which, inductively, means it's deterministic)
21:35 <geekosaur> mathematical chaos theory
21:35 <mreh> @hoogle :: [Either a b] -> (a -> c) -> [c]
21:35 <lambdabot> Control.Error.Safe foldr1Err :: e -> (a -> a -> a) -> [a] -> Either e a
21:35 <lambdabot> Control.Error.Safe foldl1Err :: e -> (a -> a -> a) -> [a] -> Either e a
21:35 <lambdabot> Control.Error.Safe foldl1Err' :: e -> (a -> a -> a) -> [a] -> Either e a
21:36 <EvanR> what
21:36 <merijn> EvanR: The meaning of urandom isn't defined anywhere and there's not a single OS that does that
21:36 <dyl> But you can't predict an outcome N ahead based on the current one with some closed form.
21:36 <dyl> https://www.2uo.de/myths-about-urandom/
21:36 <mreh> shame that doesn't exist
21:36 <dyl> ^ relevant
21:36 KeyJoo joined
21:36 <* hackage> hs-bibutils - Haskell bindings to bibutils, the bibliographyconversion utilities. http://hackage.haskell.org/package/hs-bibutils- (wilx)
21:36 <EvanR> i can't be sure were talking about the same thing
21:37 KeyJoo joined
21:37 <dyl> Chaotic means that sufficiently far in the future outcomes are not *predictable* from the current/past outcomes.
21:37 <dyl> But it's still based on a deterministic process, so you can predict the next one, and so forth.
21:37 <dyl> Stochastic behavior is closer to what crypto would call "true random".
21:37 <jle`> EvanR: you can only prove row theorems that way though, right?
21:38 <pie_> edwardk, just found some random logs, you ever do anything imgui related in haskell?
21:38 <Ariakenom> dyl: I think you're missing precision in your chaos.
21:38 <EvanR> jle`: i dont think so
21:38 zero_byte joined
21:38 <EvanR> you can talk about columns
21:38 <dyl> I'm coming from mathematical definitions. Both "chaotic" and "stochastic" are overloaded to hell and back in most areas
21:38 <Ariakenom> That chaos means you can predict close things well, not perfect. And far away things bad.
21:38 <jle`> er, just one or the other, right
21:38 <dyl> Ariakenom for a statistician yes
21:38 kefin_ joined
21:39 tzemanovic joined
21:39 <dyl> Chaotic systems are deterministic, but not predictable.
21:40 <Ariakenom> simulation is fine prediction in this context?
21:40 <dyl> Simulation is simply obtaining the next outcome. Since it's not a statistical process, the meaning of "prediction" breaks down.
21:40 <Ariakenom> Anyway I threw this off topic
21:41 <dyl> 👍
21:41 WhatisRT joined
21:42 <EvanR> what do you call the weather forecast for tomorrow
21:42 <ClaudiusMaximus> found 2 bugs (1x performance, 1x correctness)
21:42 <EvanR> how about "meaningless"
21:42 <ClaudiusMaximus> Prelude> (1e100000000 :: Double, 1e1000000000 :: Double)
21:42 <ClaudiusMaximus> (Infinity,0.0)
21:42 <ClaudiusMaximus> (75.32 secs, 68,432 bytes)
21:43 pagnol joined
21:43 <ClaudiusMaximus> ghci-8.4.3 on amd64 linux (self-compiled on debian buster)
21:44 Darkyen joined
21:44 WhatisRT joined
21:46 plugin joined
21:47 epsilonhalbe joined
21:48 spektrum_ joined
21:49 <EvanR> ClaudiusMaximus: thats wacky, same here
21:49 plugin joined
21:51 plugin joined
21:52 youtmon joined
21:53 hiratara joined
21:53 sdothum_ joined
21:53 <EvanR> i guess that answers the question of ghc precompiling constant numbers of known type
21:54 LiaoTao joined
21:55 <geekosaur> not like that's not already true of other types
21:55 <geekosaur> > 100000000000000000000000 :: Int
21:55 <lambdabot> 200376420520689664
21:55 <geekosaur> and always has been
21:55 <EvanR> that one makes sense and isnt slow
21:56 rcdilorenzo left
21:56 amar joined
21:58 <* hackage> slack-web - Bindings for the Slack web API http://hackage.haskell.org/package/slack-web- (EmmanuelTouzery)
21:59 Maxdamantus joined
21:59 <ClaudiusMaximus> without a type signature it takes longer and allocates loads
22:00 plugin joined
22:01 plugin joined
22:02 philippD joined
22:03 sdothum joined
22:03 <glguy> 1e100000000 gets converted to a call to fromRational, right?
22:03 ahihi2 joined
22:04 <glguy> so that Integer it getting created in GHCi
22:04 oisdk joined
22:04 <glguy> is getting*
22:04 <geekosaur> yes
22:06 sdothum_ joined
22:09 Gurkenglas joined
22:09 oisdk joined
22:09 <EvanR> gross
22:10 hcarr joined
22:11 dxld joined
22:11 alexteves_ joined
22:12 <hcarr> I have a type: Bloom (n :: Nat) (h :: Nat) = ... --- but it is easy to accidently swap the nats when creating. Is there anything like `newtype` at the type level?
22:12 sdothum joined
22:13 Tops2 joined
22:15 sdothum_ joined
22:17 AndreasK joined
22:17 mkoenig_ joined
22:18 ck joined
22:18 lortabac_ joined
22:18 mikecheck joined
22:24 dan_f joined
22:26 oisdk joined
22:31 hiratara joined
22:31 Sose joined
22:32 tnks joined
22:33 hamishmack joined
22:33 <lyxia> have you tried newtype
22:34 <edmundnoble> Explicitly: `newtype N (n :: Nat) = N Nat`, `Bloom (n :: 'N)`
22:36 codesoup joined
22:37 tzemanovic joined
22:39 plugin_ joined
22:39 fujiy joined
22:40 <ClaudiusMaximus> how worried should i be about warnings for unticked promoted types with -XDataKinds ? is support for that going away and code will break in the future?
22:40 <ClaudiusMaximus> s/promoted types/promoted constructors/
22:40 novaskell joined
22:41 int-index joined
22:41 Yuras joined
22:41 crobbins joined
22:42 Arcaelyx joined
22:42 <lyxia> It looks like the kind of thing we're stuck with on the very long term
22:43 xcmw joined
22:47 kav joined
22:50 pavonia joined
22:53 <centril> phaazon: get to work ;)
22:54 <phaazon> I am I am!
22:54 <phaazon> centril: were you at ZuriHac btw?
22:54 <phaazon> I didn’t find you there! :)
22:54 <centril> phaazon: no :)
22:54 <phaazon> (:
22:54 <centril> phaazon: I never leave the Church of Haskell.
22:54 chao-tic joined
22:55 <phaazon> :D
22:55 <centril> phaazon: == Chalmers University of Technology
22:57 son0p joined
23:03 <blender> since now runResourceT requires m to be instance of MonadUnliftIO, if there a point to a constraint (MonadUnliftIO m, MonadIO m) rather than just IO ?
23:05 <hpc> IdentityT IO :D
23:05 UnChallengeD joined
23:06 <glguy> blender: m could be ReaderT
23:06 <glguy> blender: m could be (ReaderT e m)
23:06 <glguy> with the m not shadowed .. and.. whatever
23:07 <dminuoso> Im trying to build a stack project inside a docker container using fpco/stack-build on a macOS host. It's sometimes crashing while building the RTS with "no space left on device" errors which I dont understand how could occur.
23:07 <dminuoso> Does anyone have any guidance for me?
23:08 <int-index> increase the size of your /tmp?
23:08 <int-index> could be one reason
23:08 <dminuoso> int-index: https://gist.github.com/dminuoso/af727c458ed4f1c0efc91beaa22d2622
23:09 <dminuoso> And the docker vm is configured to have 80GiB of disk space...
23:09 <dminuoso> (With 20GiB in usage)
23:11 <dminuoso> Okay something is up.. now I cant even stream anything to the docker daemon anymore
23:12 Linter joined
23:13 connrs joined
23:13 boccato joined
23:16 plugin joined
23:17 <blender> I have a ExceptT stack that before the MonadUnliftIO requirement from runResourceT used to work just fine. What am I supposed to use now? Just turn this into (MonadError e m) ?
23:18 ck joined
23:19 errst joined
23:19 gestone joined
23:25 errst_ joined
23:26 <lyxia> put ExceptT outside ResourceT
23:29 <Peaker> in happy, the syntax Foo $$ for %token works for a single field in a constructor. Any way to capture 2 fields inside the cons?
23:30 <sm> cabal get -s is nice, thanks cabal!
23:30 <blender> lyxia: well the signature is already ExceptT e m r, you're suggesting ResourceT where m is ExceptT ?
23:32 argent0 joined
23:34 <argent0> hi, if I do `forkIO $ forever $ return ()` i get only one thread. Right? as in this is not a fork bomb.
23:34 <lyxia> blender: I don't think so, but I'd like to see the problematic code to be more specific.
23:35 <hpc> argent0: correct
23:35 <hpc> argent0: the computation you are forkIO-ing is (forever $ return ())
23:35 <Peaker> $$ in happy seems to lose the token itself (e.g: the position)! :-(
23:35 <argent0> hpc, thanks!
23:35 <hpc> argent0: forever $ forkIO $ return () is a forkbomb, but not a very good one
23:35 <hpc> because every thread exits immediately
23:35 rprije joined
23:35 <blender> lyxia: https://github.com/blender/Rome/blob/ea65f24c208f1ec13692e9823e4cb9bfb5f90493/src/Caches/Local/Downloading.hs#L288
23:36 <hpc> in practice, i think you just end up with an infinite loop that makes your cpu slightly warmerer
23:36 <blender> `saveBinaryToFile` uses runResourceT
23:37 <blender> lyxia: from the correct branch: https://github.com/blender/Rome/blob/9ea72bab372fcdf3320d05e50e28109322a194cb/src/Caches/Local/Downloading.hs#L288
23:37 Jesin joined
23:37 <lyxia> blender: ah, that looks like a trickier case than I thought
23:38 <lyxia> I think generalizing to MonadError will only delay the problem to the point where you call runExceptT
23:38 NotLokathor joined
23:38 <NotLokathor> just installed a fresh copy of 64 bit stack on windows 10
23:39 <NotLokathor> and stack is trying to use ANSI escape codes to color my terminal
23:39 <NotLokathor> :(
23:39 language_agnosti joined
23:39 <blender> lyxia: also I have no idea how to write this: https://github.com/blender/Rome/blob/feature/lts-11.13/src/Caches/Local/Downloading.hs#L281
23:39 jackdk joined
23:39 habbah joined
23:40 fujiy joined
23:40 <hpc> NotLokathor: i bet it's the bash stuff they added recently
23:40 <NotLokathor> into cmd.exe?
23:40 <NotLokathor> or into stack?
23:40 <hpc> cmd
23:40 <blender> lyxia: but I also I can't use the ExceptT stack anymore and I have to run it everywhere now which kidn of defeats the purpsoe
23:41 <blender> I'm pretty lost :(
23:41 <NotLokathor> hpc: wild stuff
23:41 <NotLokathor> it's shockingly hard to just get a few lines of haskell to execute
23:42 <NotLokathor> the browser based repl was broke so i had to get stack, then stack is partly broke too
23:42 <NotLokathor> also i told it to install to the D drive and it seems to be using the C drive anyway ;_;
23:42 dogweather joined
23:43 <hpc> NotLokathor: if you're lucky, the sharks won't notice you until you're close to shore
23:43 <lyxia> blender: what's the error message?
23:44 <NotLokathor> i just want it to print some slightly formatted text stuff out of two lists
23:44 <NotLokathor> hpc, here's a wild time, _some of the colors do work_
23:44 <lyxia> blender: is there an error message?
23:45 <blender> The error message is that it wants me to unwrap the except computation an run it
23:45 <NotLokathor> hpc, https://imgur.com/a/Vu225RR
23:45 <blender> which I don't want to do beucase the whole point was to propagate the failure upwards
23:45 <blender> using the properites of the stack
23:46 <hpc> ugh, what the hell do i have to do so noscript lets me look at imgur crap
23:46 <hpc> interesting
23:46 <hpc> maybe it does color but not bold?
23:46 <blender> so basically because I'm using using a conduit somewhere down I have to give up my entire error propagation?
23:46 zariuq joined
23:47 <hpc> NotLokathor: another silly idea, get putty and ssh into localhost
23:47 <hpc> and run it from there
23:47 <NotLokathor> well i've got my output
23:47 <NotLokathor> time to uninstall stack
23:47 <hpc> haha
23:47 pfurla joined
23:48 <blender> just seems like ExceptT and runResourceT can't go together anymore to me and this affects my entire program
23:48 <hpc> guess what, it was cookies
23:48 <blender> which is based on ExceptT for the most past
23:48 <blender> part*
23:48 <NotLokathor> imgur was messed up because of cookies?
23:48 <hpc> yep
23:49 <hpc> web2.0
23:49 <NotLokathor> call me back for web 2.2
23:50 <hpc> web 3.11 for workgroups
23:51 ingenthr joined
23:53 Np-Harda` joined
23:53 <NotLokathor> how'vya been hpc
23:53 <NotLokathor> how has the web treated you
23:54 <hpc> heh
23:54 pranz2 joined
23:56 <* hackage> bits-extra - Useful bitwise operations http://hackage.haskell.org/package/bits-extra- (GeorgeWilson)
23:58 louispan joined
23:59 <jackdk> where does haddock document the instances of associated types to a typeclass? I'm trying to find out what the instances are for Reflex's `Event t`/`Behavior t`/`Dynamic t`, but this is relevant elsewhere too
23:59 YongJoon joined