<    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 20 21 _2_2 23  
24 25 26 27 28 29 30
00:00 <glguy> You can do something like: foldr (\x next seen -> if Set.member x seen then True else next (Set.insert x seen)) (\_ -> False) xs Set.empty
00:00 <hpc> how are the lists generated?
00:00 <dysoco> alright there must be some other way not involving repeated elements or something, I'll keep thinking, I just wanted to know if this was a dead end
00:00 codesoup joined
00:00 <hpc> dysoco: one last thing because it's pretty neat
00:00 <hpc> dysoco: if you know the busy beaver number that your program lives in
00:01 <hpc> dysoco: you can determine if it halts in finite time by running it for BB(n) steps
00:01 <hpc> dysoco: and if it hasn't terminated, it's never going to
00:01 <hpc> because busy beaver "computes" that upper bound
00:02 ianf_[m] joined
00:02 <hpc> (it also grows faster than any computable function though, so good luck actually using it)
00:02 dogweather joined
00:02 <dysoco> hm I'm not familiar with busy beaver but I'll read a bit on that see if it helps, thanks
00:02 iAmerikan joined
00:02 <hpc> it won't help you, but it's a funny bit of trivia for later
00:02 <glguy> dysoco: The code I pasted does what you're asking for
00:02 <hpc> glguy: what if the list is infinite and never repeats?
00:02 <glguy> hpc: then it's not a list dysoco cares about
00:02 <dysoco> glguy, I'll analize it a bit but this is for a code I'm writing for class and we aren't allowed anything we haven't seen in class. Should've thought of something simpler.
00:02 <hpc> oh right
00:03 <hpc> oh!
00:03 <* hpc> is stupid
00:03 <glguy> dysoco: The other thing to do is zip the list with the list where you drop every other element
00:03 <hpc> dysoco: glguy is right, i keep forgetting to exclude non-repeating infinite lists when thinking about the problem
00:03 <glguy> then you just need to compare each pair of elements for uniqueness
00:04 <hpc> it's like the opposite of happy path blindness
00:04 <dysoco> glguy, can you drop on an infinite list though? how do you know the element is going to be there or not at position 1 million or something?
00:05 <glguy> if the list has an infinite loop you'll eventually get a pair that match
00:05 <dysoco> yes
00:05 <glguy> and that happens relatively quickly in the length it takes to get to the repeat
00:06 <dysoco> yeah it's probably going to be in the first 10 elements but I never know for sure
00:06 <mniip> is this by chance at all related to decimal expansions of rationals?
00:07 <dysoco> I don't get "the list where I drop every other element"
00:07 <glguy> ?let hasLoop xs = go xs (drop 1 xs) where go (y:ys) (z:_:zs) = y == z || go ys zs; go _ _ = False
00:07 <lambdabot> Defined.
00:07 <glguy> > hasLoop (1 : 2 : 3 : cycle [10..20])
00:07 <lambdabot> True
00:07 <dysoco> humm ok let me analyze it for a while
00:08 kvda joined
00:08 <glguy> we can knock out the drop part with: hasLoop xs = go xs xs where go (y:ys) (_:z:zs) = y == z || go ys zs; go _ _ = False
00:08 <dysoco> oh snap
00:09 <dysoco> I think I know the boundary where the element must repeat
00:09 beauby joined
00:10 andromeda-galaxy joined
00:11 <mniip> dysoco, is this by chance at all related to decimal expansions of rationals?
00:12 tdjones joined
00:12 <hpc> glguy: can't you just use tail instead of drop 1, too?
00:12 <dysoco> mniip, No it's not
00:12 <hpc> i guess that makes it error on short lists
00:13 <mniip> ok
00:13 jpgarcia_ joined
00:15 gazgraz joined
00:15 moei joined
00:17 abhiroop joined
00:19 ammazza joined
00:19 conal joined
00:21 dodong joined
00:23 <dysoco> ok I think I solved but just because I found a boundary M such that if there is any repetition it should happen before the Ms element in the list
00:23 <dysoco> so I just check in take M list
00:23 <dysoco> though I'm not entirely sure of that boundary but let's hope it works
00:24 halogenandtoast joined
00:24 nyberg joined
00:25 pavonia joined
00:25 jackdk joined
00:27 <orion> https://gist.github.com/centromere/6d914917f0fe38a796b4f885dddeb509 <-- The error says, "Non type-variable argument in the constraint", but there clearly is a type variable in the constraint ("m"). What does this error mean?
00:32 dogweather joined
00:33 antsanto joined
00:33 <jackdk> orion: It means the `FooLog`, not the `m`
00:33 <jackdk> Just set `FlexibleContexts`, it's a pretty safe extension
00:34 <jackdk> http://dev.stephendiehl.com/hask/#the-benign
00:34 <orion> Thanks
00:36 andyhuzhill joined
00:36 obi_jan_kenobi__ joined
00:38 vks_ joined
00:42 mpahrens joined
00:43 andromeda-galaxy joined
00:46 FreeBirdLjj joined
00:53 DSM joined
00:53 dodong joined
00:54 diwo joined
00:54 ericsagn1 joined
00:55 contiver joined
00:55 Linter joined
00:55 comerijn joined
00:56 <contiver> If I wanted help with an exercise from Lawvere's conceptual mathematics, would it be appropriate to ask here?
00:59 lykrysh joined
00:59 twopoint718 joined
00:59 twopoint718 joined
01:00 dexhunter joined
01:02 cjwelborn joined
01:02 darjeeling_ joined
01:02 pykello joined
01:02 eschnett joined
01:02 Guest25 joined
01:02 andreabedini joined
01:03 <* hackage> ztar 0.0.3 - Creating and extracting arbitrary archives http://hackage.haskell.org/package/ztar-0.0.3 (brandonchinn178)
01:05 Axman6 joined
01:07 giraffe joined
01:07 nowhere_man joined
01:10 blonkhart joined
01:10 mpahrens joined
01:11 <nowhere_man> I just want to test something using Control.Lens, but I don't understand how to use a cabal package for just a test file
01:12 <nowhere_man> or with Stack, I don't care
01:12 sdothum_ joined
01:14 <lyxia> nowhere_man: stack install lens; stack ghc -- MyTestFile.hs -my-ghc-option1 -my-ghc-option2
01:14 lambda-11235 joined
01:14 zori joined
01:15 connrs joined
01:17 Kundry_Wag joined
01:17 phreedom joined
01:18 <byorgey> contiver: ##categorytheory might be a better place
01:19 <dmwit> nowhere_man: For old-style cabal, `cabal install lens` will make it available to GHC. For new-style cabal, you can `cabal unpack lens` to get a copy, then run `cabal new-build` in the directory it creates. Afterwards ghc and ghci executed from within that directory will have access to it (but not from outside).
01:19 <dmwit> The latter needs a newish GHC. 8.2 and greater, I think.
01:22 fmixing joined
01:23 woodson joined
01:23 slack1256 joined
01:24 patlv joined
01:24 sdothum joined
01:26 Noldorin joined
01:27 MoarSpaceFi joined
01:27 <monochrom> Oh w00t, Haskell Platform caught up to GHC 8.4.3 last week (I was too busy to check)
01:29 huxing joined
01:30 dpn` joined
01:33 dbmikus joined
01:33 FreeBirdLjj joined
01:34 taumuon joined
01:40 xpycm joined
01:42 mpahrens joined
01:43 <* hackage> backprop - Heterogeneous automatic differentation http://hackage.haskell.org/package/backprop- (jle)
01:45 <glguy> hvr's cabal-env script has been handy for getting one-off new-build based ghci sessions with particular packages loaded
01:48 dodong joined
01:49 darjeeling_ joined
01:49 progfun joined
01:51 andreabedini joined
01:52 pfurla_ joined
01:53 andreabedini joined
01:54 siraben joined
01:55 merijn joined
01:55 chao-tic joined
01:56 mpahrens joined
01:57 StoneToad joined
01:58 xlei joined
01:59 johnvonneumann joined
02:00 hucksy joined
02:01 conal joined
02:01 tabemann joined
02:02 dogweather joined
02:02 iAmerikan joined
02:04 cschneid joined
02:06 vks_ joined
02:08 lortabac_ joined
02:09 Kundry_Wag joined
02:09 adkron_ joined
02:10 cschneid joined
02:11 diwo joined
02:14 obi_jan_kenobi_ joined
02:14 mizu_no_oto_work joined
02:17 banc joined
02:23 MoarSpaceFi joined
02:24 serendependy joined
02:25 oisdk joined
02:29 sebastian joined
02:31 taumuon joined
02:33 nighty- joined
02:38 mpahrens joined
02:41 sebastia2 joined
02:41 pfurla joined
02:41 MRd1 joined
02:42 fmixing joined
02:43 darjeeling_ joined
02:43 cschneid joined
02:44 AetherWind joined
02:45 serendependy joined
02:45 language_agnosti joined
02:46 Kundry_Wag joined
02:47 dfeuer joined
02:50 woodson joined
02:52 juhp joined
02:57 andromeda-galaxy joined
02:59 louispan joined
03:01 theDon joined
03:04 dogweather joined
03:05 cschneid joined
03:05 Jesin joined
03:06 chao-tic joined
03:06 acertain joined
03:08 otto_s joined
03:08 enterprisey joined
03:11 obi_jan_kenobi__ joined
03:15 eminhi joined
03:15 connrs joined
03:18 reactormonk joined
03:21 vks_ joined
03:22 <nowhere_man> lyxia: stack is perfect, thanks
03:22 sword865 joined
03:23 kapil___ joined
03:24 lassulus_ joined
03:25 <* hackage> status-notifier-item - A wrapper over the StatusNotifierItem/libappindicator dbus specification http://hackage.haskell.org/package/status-notifier-item- (eyevanmalicesun)
03:29 <* hackage> gtk-sni-tray - A standalone StatusNotifierItem/AppIndicator tray http://hackage.haskell.org/package/gtk-sni-tray- (eyevanmalicesun)
03:32 fmixing joined
03:34 argent0 joined
03:37 mud joined
03:37 fmixing joined
03:40 fmixing joined
03:40 mpahrens joined
03:40 dogweather joined
03:41 hphuoc25 joined
03:42 mizu_no_oto_work joined
03:42 sword865 joined
03:42 pchiusano joined
03:42 bgyss joined
03:43 altjsus joined
03:43 pykello joined
03:44 siraben joined
03:45 fnurglewitz joined
03:45 mikedlr joined
03:45 exit70 joined
03:45 progfun joined
03:45 dexhunter joined
03:45 hsiktas joined
03:46 eruditass joined
03:46 Argorok joined
03:46 rann joined
03:46 redcedar joined
03:46 trig-ger_ joined
03:46 Bengi_ joined
03:46 benl23 joined
03:46 stephe joined
03:46 NemesisD joined
03:46 coot joined
03:46 JSharp joined
03:46 DarkUnicorn joined
03:46 kapil___ joined
03:46 simony joined
03:46 Chadtech joined
03:46 gonz_ joined
03:46 cdornan_ joined
03:46 znack joined
03:46 jetpack_joe joined
03:46 capicue joined
03:46 bbielsa joined
03:46 Tallenz joined
03:46 caw________ joined
03:46 lopex joined
03:46 pasukon joined
03:46 grandy______ joined
03:46 customminer joined
03:46 marcel_ joined
03:46 OliPicard_ joined
03:47 Linter joined
03:48 andyhoang joined
03:49 cschneid joined
03:53 Kacia joined
03:55 enterprisey joined
03:56 gnossos_ joined
03:56 banc joined
03:56 MarcelineVQ joined
03:56 SPoF95 joined
03:56 nyberg joined
03:57 yazmir8azyr joined
03:57 dejanr joined
03:59 <dminuoso> Stephen Diehl considers AllowAmbigiousTypes a dangerous extension. For what reason? Does it make the type system unsound?
04:01 dxld joined
04:02 <reactormonk> dminuoso, I don't think you can get to unsound, because it still has to typecheck in the end.
04:05 gnossos joined
04:05 <geekosaur> it might permit the compiler to go into an infinite loop in pathological cases?
04:07 <glguy> dminuoso: You told *us* that he considers it as such. Next you're supposed to tell us why.
04:07 <glguy> or ask him..
04:08 altjsus_ joined
04:09 rofl_ joined
04:09 mpahrens joined
04:09 <glguy> Left to guess what he means I think its that more often than not when GHC is telling you that you'd need that extension that you made a mistake, one once you fix the mistake you won't need that any more
04:10 <glguy> But if you're intentionally designing something to be used with TypeApplications then you're fine
04:10 MRd2 joined
04:10 j2j joined
04:13 justan0theruser joined
04:15 dan_f joined
04:19 pio_ joined
04:20 chao-tic joined
04:25 fishythefish joined
04:25 mariatsji joined
04:33 mac10688 joined
04:33 agander joined
04:33 <cocreature> I feel like AllowAmbiguousTypes should also be something that you turn on for a specific definition rather than a whole module
04:33 itsmepotato[m] joined
04:36 nyberg joined
04:36 cschneid joined
04:36 gnossos left
04:38 mpahrens joined
04:39 itsmepotato[m] left
04:45 dogweather joined
04:47 <dminuoso> glguy: Does Stephen Diehl come here often?
04:47 <cocreature> dminuoso: I don’t think I’ve ever seen him here?
04:47 <glguy> I don't know
04:48 patlv joined
04:49 <dminuoso> Ah fair enough, Ill ask him via mail
04:49 darjeeling_ joined
04:51 _bo joined
04:52 dogweather joined
04:52 dogweather joined
04:53 Scip joined
04:53 alexad joined
04:54 eminhi joined
04:57 ian_andrich joined
05:01 vks_ joined
05:02 <simon> what are people's preferences towards tasty and hspec? I've used hspec and quite like it.
05:02 Ukari joined
05:07 <cocreature> simon: I’ve used hspec in the past and mostly switched to tasty these days because I’ve found it to be sightly more flexible and I don’t use a lot of the features that hspec provides
05:07 <cocreature> but I don’t really have strong feelings either way. use whatever works for you
05:07 conal joined
05:08 takuan joined
05:10 tabemann joined
05:13 hexfive joined
05:14 language_agnosti joined
05:14 MoarSpaceFi joined
05:15 agander_ joined
05:17 agander__ joined
05:17 <simon> cocreature, I think I like the output format of tasty better.
05:18 ozzymcduff joined
05:18 Hazurl joined
05:20 <cocreature> then go for tasty :)
05:21 thoradam joined
05:21 chriswk joined
05:21 iphy joined
05:22 rizary joined
05:22 grandy______ joined
05:22 DarkUnicorn joined
05:22 oh_lawd joined
05:22 bradparker joined
05:22 darthThorik joined
05:22 DrAwesomeClaws joined
05:22 sclv joined
05:22 Wizek joined
05:22 spinda joined
05:23 banjiewen joined
05:23 sunra joined
05:23 xkapastel joined
05:23 etrepum joined
05:23 dmj` joined
05:23 dessmm joined
05:23 jkachmar joined
05:23 posco joined
05:23 srid joined
05:23 joedevivo joined
05:23 JanBessai joined
05:24 paf31_ joined
05:24 systemfault joined
05:24 bs338 joined
05:24 lexi-lambda joined
05:24 thi_ joined
05:24 Guest82928_ joined
05:24 Peter_Storm joined
05:24 murtaught joined
05:24 milessabin joined
05:24 AlainODea joined
05:24 rjungemann joined
05:24 reem_ joined
05:24 dpren joined
05:25 blackrain joined
05:25 strugglingming joined
05:25 mankyKitty joined
05:25 ryanponce joined
05:25 ghuntley joined
05:25 tarcwynne__ joined
05:25 dashed joined
05:26 jml joined
05:26 ocharles_ joined
05:26 mbrock_ joined
05:26 kuno joined
05:26 gareth__ joined
05:26 amatecha__ joined
05:26 xplat|work__ joined
05:26 georgew joined
05:26 johs joined
05:26 unsymbol joined
05:26 sclltr_ joined
05:26 ancarda joined
05:26 elvishjerricco joined
05:26 yaroot joined
05:26 solidsnack joined
05:27 higherorder joined
05:27 pchiusano joined
05:27 ryanbooker joined
05:27 d3z joined
05:27 alasi joined
05:27 tismith joined
05:27 mindtree joined
05:27 randallbr joined
05:28 gluegadget joined
05:28 Youmu joined
05:28 sword865 joined
05:28 acln joined
05:28 ebutleriv_ joined
05:28 mgttlinger joined
05:28 thoughtpolice joined
05:28 wedens joined
05:28 peschkaj joined
05:28 bigs joined
05:28 heyj joined
05:29 libbyk joined
05:29 mkurkov__ joined
05:29 oldsnakey joined
05:29 Xorlev joined
05:29 fnurglewitz joined
05:29 oharvey_ joined
05:29 cdornan_ joined
05:29 badzergling joined
05:29 mikedlr joined
05:30 zmanian joined
05:30 dukedave joined
05:30 Guest32087 joined
05:30 gornikm joined
05:30 Capattack77 joined
05:30 si14 joined
05:30 vks_ joined
05:30 kipd joined
05:30 kyagrd joined
05:30 wizonesolutions joined
05:30 feltnerm joined
05:31 jameshaydon joined
05:31 billstclair joined
05:31 bytesighs joined
05:31 hansihe joined
05:31 verlet64 joined
05:31 gleber_ joined
05:31 cstrahan_ joined
05:31 prizim joined
05:31 Tritlo joined
05:31 carter joined
05:32 u-ou joined
05:32 vks_ joined
05:32 msmorgan joined
05:32 ajmccluskey joined
05:32 mbeidler joined
05:32 edofic joined
05:32 nksegos_ joined
05:32 jzelinskie joined
05:32 zph joined
05:32 MrIndigo joined
05:33 zgrepc joined
05:33 monad_cat joined
05:33 wavewave joined
05:33 fingerzam joined
05:33 kapil___ joined
05:34 Kamuela joined
05:34 shans__ joined
05:34 S11001001 joined
05:34 typetetris joined
05:34 dsal joined
05:34 brocoli joined
05:35 vikram__________ joined
05:35 andrew_n_ joined
05:35 jmct joined
05:35 angerman joined
05:35 robstr joined
05:36 bgyss joined
05:36 qazi joined
05:36 avdi joined
05:36 pranaysashank joined
05:36 CARAM____ joined
05:36 dstockwell joined
05:36 kazi joined
05:38 vks_ joined
05:38 lastmanstanding joined
05:38 benjamin-l joined
05:39 taktoa[c] joined
05:39 <pranaysashank> I have a library with it's own stack.yaml, inside another folder, with multiple libraries, with it's own stack.yaml. stack build in inside folders isn't picking up changes in the libraries that are outside.
05:39 Zipheir joined
05:40 stephe joined
05:40 simony joined
05:40 exit70 joined
05:41 pasukon joined
05:41 slomo joined
05:41 slomo joined
05:42 OliPicard_ joined
05:42 hsiktas joined
05:42 Argorok joined
05:43 trig-ger_ joined
05:43 customminer joined
05:43 eruditass joined
05:44 mpahrens joined
05:44 Tallenz joined
05:44 xtreak joined
05:44 coot joined
05:44 Ariakenom joined
05:45 mad_villain joined
05:46 progfun joined
05:47 znack joined
05:47 NemesisD joined
05:47 Linter joined
05:47 rann joined
05:47 merijn joined
05:47 mad_villain joined
05:47 eruditass joined
05:48 vmandela joined
05:50 jetpack_joe joined
05:50 bbielsa joined
05:50 msmorgan joined
05:50 JSharp joined
05:50 grandy______ joined
05:50 exit70 joined
05:50 rizary joined
05:51 howdoi joined
05:51 pranaysashank joined
05:51 pranaysashank left
05:51 Argorok joined
05:51 capicue joined
05:51 sword865 joined
05:52 kazi left
05:53 mbrcknl_ joined
05:53 ianconnolly_ joined
05:53 dogweather joined
05:53 jorendorff joined
05:53 changyj_ joined
05:53 rodarmor joined
05:53 parseval joined
05:54 cgag joined
05:54 Cir0X joined
05:54 nbouscal joined
05:54 slaznick joined
05:54 osa1 joined
05:55 louispan joined
05:58 kayvan joined
06:00 thaumavorio joined
06:01 tomphp joined
06:01 ManDay[m] joined
06:01 errst joined
06:05 _vaibhavingale_ joined
06:05 sakalli_ joined
06:06 _vaibhavingale_ joined
06:06 khilan joined
06:07 slomo_ joined
06:07 slomo_ joined
06:08 <ManDay[m]> Morning, I'm having trouble understanding what makes monads semantically different from any other function. For example, given things like IO, I'd expect it to be done by just another polymorphic function readFromStdIn :: ([Char] -> Anything) -> Anything - to my understand that is exactly what monads do, but I don't understand what makes them special, semantically.
06:09 Argorok joined
06:09 marcel_ joined
06:09 howdoi joined
06:10 sword865 joined
06:10 eruditass joined
06:10 exit70 joined
06:10 rizary joined
06:10 capicue joined
06:10 danvet joined
06:10 kapil___ joined
06:11 hsiktas joined
06:11 takuan joined
06:11 rjungemann joined
06:11 <c_wraith> ManDay[m]: there is nothing special. It's like asking what makes Iterator in java so special. It's a simple pattern that has a bit of compiler support.
06:11 edofic joined
06:11 oldsnakey joined
06:12 Capattack77 joined
06:12 fnurglewitz joined
06:12 randallbr joined
06:12 znack joined
06:12 dsal joined
06:12 khilan_ joined
06:12 stephe joined
06:12 bgyss joined
06:12 ajmccluskey joined
06:12 customminer joined
06:13 sunra joined
06:13 cdornan_ joined
06:13 JSharp joined
06:13 <ManDay[m]> c_wraith: Ah, okay. I misunderstood that then. I thought it essentially implied that IO (etc.) couldn't possibly be done in a functional-compatibly way without the definition of monads. Thanks.
06:13 <Axman6> monads are a very simple abstraction that turn out to exist everywhere in programming, and provide a very powerful interface for things which look like imperative programming (though it's more general than that)
06:14 terrorjack joined
06:14 <c_wraith> ManDay[m]: Nope. The special part is that IO is a real type. IO values represent reified effects.
06:14 <geekosaur> ManDay[m], the only thing monads do here is provide sequencing, by making outputs depend on inputs so they can't be reordered.
06:14 <dminuoso> ManDay[m]: Monad is just an interface supporting 2 functions following some laws. =)
06:14 <ManDay[m]> c_wraith: i'm afraid that statement shoots above my head, I've just started looking at Haskell (coming from Scheme)
06:14 exit70 joined
06:15 <c_wraith> ManDay[m]: as opposed to effects being something that's just in the environment all the time in most languages.
06:15 caw________ joined
06:15 Chadtech joined
06:15 <geekosaur> What makes IO work is that a value of type IO a represents a sequence of actions, not the result of those actions. In effect, we build a pure value which consists of "instructions" to the runtime, and produce that sequence of instructions as the "result" of main.
06:15 exit70 joined
06:15 <geekosaur> And then an impure runtime evaluates them
06:15 eruditass joined
06:16 Tallenz joined
06:16 trig-ger_ joined
06:16 pasukon joined
06:16 bs338 joined
06:16 coot joined
06:16 iphy joined
06:16 OliPicard_ joined
06:16 sclv joined
06:16 grandy______ joined
06:17 <jackdk> the IO type is what the command pattern in OOP wishes it could be
06:17 <ManDay[m]> Let me try to (based upon my purely intuitive understanding of what you just said) rephrase that: The catch with, say, the IO monad is that it guarantees an order of the side-effects w.r.t. the code from which they resulted?
06:17 language_agnosti joined
06:17 llinguini joined
06:17 <dminuoso> ManDay[m]: Yes.
06:17 <ManDay[m]> Is that what you mean, in essence?
06:17 <cocreature> ManDay[m]: remove the word "monad" and replace it by "type"
06:17 <c_wraith> ManDay[m]: but being a monad is not an important part of IO
06:17 verlet64 joined
06:17 NemesisD joined
06:17 <dminuoso> ManDay[m]: Monad is just an abstract interface, it has no meaning of its own. We dont *need* it for anything.
06:17 tismith joined
06:17 bbielsa joined
06:17 jetpack_joe joined
06:17 <geekosaur> the monad itself, yes. the monad has nothing to do with IO as such, though, all it does is enforce sequencing. You could do that yourself, it's just annoying
06:17 pchiusano joined
06:17 <c_wraith> ManDay[m]: IO could do everything it does without the concept of a monad existing in the language
06:17 oharvey_ joined
06:17 <dminuoso> It just happens to be a useful interface.
06:18 <ManDay[m]> Aha! Okay, I kind of get it! :)
06:18 v0d1ch joined
06:18 <geekosaur> basiucally take something as a parameter and return it tupled with the actual result
06:18 <dminuoso> ManDay[m]: In fact Haskell didnt have Monad until a while ago.. so clearly we dont need Monad to do IO. :-)
06:18 Bengi_ joined
06:18 <geekosaur> so now the output depends on the input, so it can't be reordered so it (say) reads before prompting.
06:18 <c_wraith> ManDay[m]: from another point of view: IO is *not* a flag of some sort. IO is a real type with real values. Types like (IO (IO Int)) or (IO Int -> IO Bool) exist and make perfect sense.
06:18 <Axman6> being a monad means you get to reuse a lot of already written code - replicateM :: Monad m => Int -> m a -> m [a] only needs to be written once but I can use the same function to read 100 lines from stdin as I use to parse 100 instances of some parser combinator
06:19 pie_ joined
06:19 akhileshs joined
06:19 gonz_ joined
06:19 mad_villain joined
06:19 lopex joined
06:19 cgag joined
06:19 kaychaks joined
06:19 kuno joined
06:19 posco joined
06:19 <dminuoso> And being a monad means you get to develop intuition regarding laws without knowing their concrete implementations.
06:19 rodarmor joined
06:19 <ManDay[m]> Yes, these are apparently two separate issues: The purpose of a monad (and nessecity of it) on one hand, and the constraints on side-effects on the other
06:19 <geekosaur> meanwhile you can think of IO as being a collection of primitive constructors GetChar, PutChar, etc. --- which don;t actually do those operations, they just add an instruction to a sequence. and a Haskell program generates this sequence of instructions as the result of main
06:19 metalrain__ joined
06:19 drbean_ joined
06:20 peschkaj joined
06:20 ericbmerritt_ joined
06:20 <dminuoso> ManDay[m]: There's no necessity for monad. Its just darn useful. :)
06:20 dmj` joined
06:20 solidsnack joined
06:20 jkachmar joined
06:20 srid joined
06:20 thoughtpolice joined
06:20 blackrain joined
06:20 joel135 joined
06:20 Meow-J___ joined
06:20 milessabin joined
06:20 systemfault joined
06:20 paf31_ joined
06:20 Guest82928_ joined
06:20 wedens joined
06:20 reem_ joined
06:20 Xorlev joined
06:20 vikram__________ joined
06:20 jml joined
06:20 AlainODea joined
06:20 <c_wraith> geekosaur: a haskell program *is* the sequence of instructions. :) (main :: IO ())
06:20 nksegos_ joined
06:20 jameshaydon joined
06:20 sclltr joined
06:20 etrepum joined
06:20 mankyKitty joined
06:20 zpconn__________ joined
06:20 mbrock_ joined
06:20 spinda joined
06:20 pagoda_5b joined
06:20 <geekosaur> yes
06:20 d3z joined
06:20 Cir0X joined
06:21 mbeidler joined
06:21 fuziontech joined
06:21 wavewave joined
06:21 oh_lawd joined
06:21 carter joined
06:21 spacebug joined
06:21 tjpeden_ joined
06:21 <Axman6> (that definition gets a little murky once you add concurrency imo)
06:21 gluegadget joined
06:21 dstockwell joined
06:21 zph joined
06:21 monad_cat joined
06:21 ryanbooker joined
06:21 jorendorff joined
06:21 rodarmor joined
06:21 parseval joined
06:21 libbyk joined
06:21 joedevivo joined
06:21 ghuntley joined
06:21 ebutleriv_ joined
06:21 Guest85232 joined
06:21 jmct joined
06:21 taktoa[c] joined
06:21 <Axman6> though, that also somewhat depends on the interpreter you use, the GHC RTS isn't the only possible interpreter for IO
06:21 heyj joined
06:21 mbrcknl_ joined
06:21 <geekosaur> lots of things become murky when you add concurrency. this is no worse, arguably.
06:21 zmanian joined
06:21 typetetris joined
06:21 murtaught joined
06:21 dessmm joined
06:21 dmijic joined
06:21 mikedlr joined
06:21 PotatoGim joined
06:21 Peter_Storm joined
06:21 xplat|work__ joined
06:21 ryanponce joined
06:21 tarcwynne__ joined
06:21 xplat|work__ joined
06:21 bradparker joined
06:21 Tritlo joined
06:21 banjiewen joined
06:21 ocharles_ joined
06:21 redcedar joined
06:21 MrIndigo joined
06:21 prizim joined
06:21 cansis joined
06:21 bitonic joined
06:21 lynn joined
06:21 georgew joined
06:21 bytesighs joined
06:21 amatecha__ joined
06:21 noobst joined
06:22 adamse joined
06:22 Tritlo joined
06:22 bradparker joined
06:22 banjiewen joined
06:22 amatecha__ joined
06:22 nbouscal joined
06:22 redcedar joined
06:22 cansis joined
06:22 MrIndigo joined
06:22 lynn joined
06:22 adamse joined
06:22 bitonic joined
06:22 prizim joined
06:22 georgew joined
06:22 bytesighs joined
06:22 lexi-lambda joined
06:22 <Axman6> agreed
06:22 noobst joined
06:22 adamse joined
06:22 lexi-lambda joined
06:22 eacameron joined
06:22 feepo_ joined
06:22 Wizek joined
06:22 wizonesolutions joined
06:22 iravid joined
06:22 vlatkoB joined
06:22 ratschance joined
06:22 ammazza joined
06:22 Kamuela joined
06:22 dashed joined
06:22 <jackdk> this is why I say it's what OOP's command pattern wishes it was
06:22 eruditass joined
06:22 bigs joined
06:22 angerman joined
06:22 feltnerm joined
06:22 yaroot joined
06:22 gornikm joined
06:22 machinedgod joined
06:22 kyagrd joined
06:22 jzelinskie joined
06:22 angular_mike_ joined
06:22 alasi joined
06:22 billstclair joined
06:22 fingerzam joined
06:22 <jackdk> because it's a representation of commands-as-values, with an awesome toolkit for composing them (Functor,Applicative,Monad)
06:22 S11001001 joined
06:22 mkurkov__ joined
06:22 dreamer_ joined
06:22 shans__ joined
06:22 andrew_n_ joined
06:22 mounty joined
06:22 ReinH joined
06:23 jbetz joined
06:23 si14 joined
06:23 peteretep joined
06:23 zgrepc joined
06:23 xtreak_ joined
06:23 cstrahan_ joined
06:23 rodarmor joined
06:23 thi_ joined
06:23 Youmu joined
06:23 u-ou joined
06:23 dukedave joined
06:23 CARAM____ joined
06:23 bitonic joined
06:23 avdi joined
06:24 ocharles_ joined
06:24 hansihe joined
06:24 kipd joined
06:24 connrs joined
06:24 Meow-J___ joined
06:24 feltnerm joined
06:24 Guest85232 joined
06:24 Kamuela joined
06:24 acro joined
06:24 acro joined
06:24 Wizek joined
06:24 <cocreature> depending on how you build your OOP command pattern it does allow you inspecting the commands so you can’t always substitute it with IO in Haskell
06:24 elvishjerricco joined
06:24 mrd joined
06:24 mrd joined
06:24 alasi joined
06:24 wizonesolutions joined
06:24 msmorgan joined
06:25 bitonic joined
06:25 dpren joined
06:25 angular_mike_ joined
06:25 rann joined
06:25 oh_lawd left
06:25 <c_wraith> ManDay[m]: anyway, you are definitely correct. Monad is one thing that's new to most new Haskell programmers and more abstract than they're used to. IO is another thing that's new to most new Haskell programmers and more abstract than they're used to. They're distinct, but you often run into them at the same time, and that adds complexity.
06:25 chriswk joined
06:25 dukedave joined
06:25 CARAM____ joined
06:25 ianconnolly_ joined
06:25 nwf joined
06:25 sveit joined
06:25 strugglingming joined
06:25 mindtree joined
06:25 cstrahan_ joined
06:25 zgrepc joined
06:25 thoradam joined
06:25 gleber_ joined
06:25 hansihe joined
06:25 darthThorik joined
06:25 changyj_ joined
06:26 higherorder joined
06:26 gareth__ joined
06:26 SpinTensor joined
06:26 DarkUnicorn joined
06:26 feltnerm joined
06:26 simony joined
06:26 acln joined
06:26 johs joined
06:26 unsymbol joined
06:26 mgttlinger joined
06:26 Guest32087 joined
06:26 badzergling joined
06:26 alasi joined
06:27 dogweather joined
06:27 ancarda joined
06:27 brent80_plow joined
06:27 Kamuela joined
06:27 johnw joined
06:28 SPoF95 joined
06:29 hphuoc25 joined
06:29 sakalli_ joined
06:29 <ManDay[m]> Well, what I take away from this discussion is that a monad is just syntactic sugar for a very elegant (I take your word for it) concept, which could equally well be realized without explicitly specifying it as part of Haskell
06:29 <ManDay[m]> The real thing here (semantically) that I was missing was about IO being a "real type"
06:30 <ManDay[m]> (though I still have to understand what that means quantitatively)
06:30 Kamuela joined
06:30 <cocreature> sounds like you got the gist!
06:31 <c_wraith> what I meant by that is really just "It's treated the exact same way as any other type constructor with the same kind - there's no special meaning for it in the type system at all"
06:32 <mniip> and while you may not have access to its actual definition, you can still operate on IO values using its Monad instance
06:32 <c_wraith> or its many other instances, or any number of pre-existing library functions that manipulate them, and so on. :)
06:33 <Axman6> ManDay[m]: IO being a type whose implementation is hidden and is only accessible by a certain interface means you can't lie about the existance of effects. the fact that part of that interface is using the Monad class isn't particularly interesting to IO being a useful thing
06:34 <mniip> iirc back when the idea of a monadic IO interface was conceived haskell didn't even support instances
06:34 jchia joined
06:34 <ManDay[m]> This question might be asked around here a million times (sorry), but is there a good online start-up ressource for learning Haskell (preferably for someone coming from functional programming) which explains things like that notation you use (the "=>" and the "->" and the "::" and "a (b)" and so on)?
06:34 <ManDay[m]> (explains that among other things)
06:35 diwo joined
06:35 language_agnosti joined
06:35 <mniip> ManDay[m], what sort of functional programming experience do you have?
06:36 <ManDay[m]> Axman6: Ok, good point. So Monads being part of the language allows for IO to be provided as a "black box" in the first place
06:36 <ManDay[m]> mniip: I come from Scheme. So basically Haskell without the sugar and with a sometimes unreadable (and unwritable) syntax
06:36 <cocreature> ManDay[m]: no, you could just provide the functions that the Monad typeclass gives you as ordinary functions specialized to IO
06:36 <mniip> ManDay[m], Monad isn't "part of the language" either, it's an ordinary class defined in a standard library
06:37 <mniip> ManDay[m], sounds like you might need to learn much more than just notation then
06:37 <ManDay[m]> cocreature: right, i let my mind slip there for a second ;-/
06:37 <cocreature> what the Monad typeclass allows you to abstract over different Monad instances but if all you care about is IO then that is mostly useless
06:37 <Axman6> ManDay[m]: I wouldn't necessarilly say monads are provided as part of the language - we have syntax sugar (which is desugared before any type checking happens, it's a very early process) which makes working with them easier, because they are amazingly, generally useful
06:38 <ManDay[m]> mniip: Yes, sure. But notation should be among it ;)
06:39 <mniip> Axman6, uhhh desugaring is very late in the pipeline
06:39 lastmanstanding joined
06:40 <mniip> unless do blocks are handled during renaming?
06:40 phenoble joined
06:41 Ariakenom joined
06:41 <Axman6> my understanding it was very early, which is why things like do {True} typecheck, becaus ethat desugars to True, and happens before there's any type checking for whether the contents of a do block are actually monadic
06:41 <Axman6> > do {True;}
06:41 <lambdabot> True
06:41 <mniip> yes but
06:42 <mniip> > do (); ()
06:42 <lambdabot> error:
06:42 <lambdabot> • Couldn't match expected type ‘m a0’ with actual type ‘()’
06:42 <lambdabot> • In a stmt of a 'do' block: ()
06:42 <cocreature> I’m not sure that has something to do with desugaring. that’s just how typechecking for do blocks is defined
06:42 <mniip> the error message mentions the do block, suggesting that the typechecker sees it
06:42 language_agnosti joined
06:42 <cocreature> afaik all typechecking happens before desugaring to produce good error messages
06:42 <mniip> yes
06:42 <mniip> cocreature, the problem with "typechecking for do blocks" is rebindable syntax
06:44 <cocreature> I guess it kind of depends on what you mean by “desugaring”. you haven’t eliminated do notation from the AST when typechecking but in some sense typechecking desugars the do syntax on the fly
06:45 <mniip> how
06:45 <mniip> 'do x; y' -> 'x >> y'
06:46 <mniip> GHC.Base.>> might be wired-in,
06:46 <mniip> but if RebindableSyntax is enabled, this warrands an identifier lookup
06:46 <cocreature> sure but what’s the problem with doing an identifier lookup?
06:46 <mniip> that's renamer's job
06:47 [Leary] joined
06:47 <cocreature> ah that’s where you going
06:48 <cocreature> no idea how GHC handles this, I guess you could always have the renamer perform a single lookup for (>>) for each do block and attach that to the do block
06:49 <mniip> but what if none is in scope
06:50 <mniip> I guess the renamer will have to check which operations are used in a given do block
06:50 acidjnk joined
06:50 <dreamer_> how do I generate a function body from a string in template haskell ?
06:50 agander__ joined
06:51 <dysfun> parse it?
06:51 <cocreature> dreamer_: take a look at the haskell-src-meta package
06:52 <c_wraith> yeah, there's no magic for that in template haskell.
06:52 andromeda-galaxy joined
06:53 encod3 joined
06:53 benl23 joined
06:54 mitchellsalad__ joined
06:54 mpahrens joined
06:54 <mniip> doesn't look like HsExpr stores anything other than a list of statements
06:54 ogrady joined
06:55 gridaphobe joined
06:55 danza-cloud joined
06:55 yaknyasn_ joined
06:55 ranberry joined
06:55 isaac_ joined
06:56 runde joined
06:56 mpickering joined
06:56 essent joined
06:56 codedmart joined
06:56 <dreamer_> think there's a better way to do what I want I think
06:56 <dreamer_> ye
06:57 spicydonuts_ joined
06:58 <dreamer_> seriously that monadic onion maze
06:58 <dreamer_> how do I convert Clause into ClauseQ
06:58 <cocreature> probably using "pure"?
06:58 RegEchse joined
06:59 runeks joined
06:59 dgpratt joined
06:59 alexknvl joined
06:59 jonrh joined
06:59 <dreamer_> I want to cry a bit. Okay time to learn this
06:59 edwardk joined
06:59 <dreamer_> I love haskell but I 'm really not a fan of monads
07:00 <dysfun> i would say when using TH, monads are the least of your problems
07:00 <dreamer_> ominous.
07:00 <* dysfun> has been TH free for over a year now
07:01 <mniip> TH is cool
07:01 MRd2 joined
07:01 <jackdk> Agreed, though I don't understand why that lib has a labyrinth of type synonyms - why have Foo and type FooQ = Q Foo and sometimes even type Foos = [Foo] and type FoosQ = Q Foos
07:01 cur8or joined
07:02 <nshepperd> If I set RebindableSyntax and write (>>) = (+), I get this: No instance for (Num ()) arising from a do statement
07:02 <c_wraith> I do agree that all the FooQ type aliases for Q Foo are annoying. why?
07:02 <dreamer_> dysfun tell us about your use of TH and why you renounced it.
07:02 <jackdk> the helper functions in Language.Haskell.TH.Lib help a lot
07:03 <nshepperd> so I guess it works as expected, even though I don't know how
07:03 <dysfun> dreamer_: well, what i was doing isn't that interesting, but i renounced it because it was just painful and confusing
07:03 <dysfun> haskell is much nicer if you never TH
07:04 <MarcelineVQ> ymmv
07:04 vks_ joined
07:05 zakora joined
07:05 <dysfun> also these days, there's less need than ever to use TH
07:05 <Ariakenom> nshepperd: what did you write, do{1;2}?
07:06 <nshepperd> Ariakenom: do{();()}
07:07 chele joined
07:07 lortabac_ joined
07:08 xtreak joined
07:08 <quicksilver> on the bright side 'FoosQ' sounds like something Chandler would say, so you can always pretend you're in Friends.
07:08 <mniip> nshepperd, yeah I've verified that it works
07:08 <dysfun> quicksilver: doesn't sound right in my head.
07:10 sakalli_ joined
07:10 <nshepperd> i can kind of see how you could do the lookup of (>>) and unify everything in the do block with it 'manually' without your head exploding
07:10 <nshepperd> but then I wonder how it interacts with ApplicativeDO
07:11 aisqwe joined
07:11 <aisqwe> how can i get the name of the list Cons in template haskell? something like lookupValueName "(:)"?
07:11 <nshepperd> btw, setting RebindableSyntax in an empty file then trying to write something involving strings apparently results in error: Not in scope: ‘fromString’
07:12 Linter joined
07:12 <mniip> ah
07:12 <mniip> I see
07:12 <mniip> HsDo contains a list of StmtLR
07:13 <nshepperd> oh wait that might just be because of my .ghci
07:13 <nshepperd> nvm
07:13 <mniip> % :i HsDo
07:13 <yahb> mniip: type role HsExpr nominal; data HsExpr p = ... | HsDo (HsStmtContext Name.Name) (SrcLoc.Located [ExprLStmt p]) (HsExtension.PostTc p TyCoRep.Type) | ...; -- Defined in `HsExpr'
07:13 <mniip> % :i ExprLStmt
07:13 <yahb> mniip: type ExprLStmt id = LStmt id (LHsExpr id) -- Defined in `HsExpr'
07:13 <dreamer_> https://lpaste.net/4394237725515972608
07:13 <dreamer_> whats wrong with this
07:14 <mniip> and constructors in StmtLR have an additional field:
07:14 <mniip> % :i LastStmt
07:14 <yahb> mniip: type role StmtLR nominal nominal representational; data StmtLR idL idR body = LastStmt body Bool (SyntaxExpr idR) | ...; -- Defined in `HsExpr'
07:14 <dreamer_> when I call it like that $(loadPiece "w" "b") (for white bishop, basically it gets the image for a chess piece)
07:14 <mniip> SyntaxExpr
07:14 <dreamer_> I get
07:14 <dreamer_> Couldn't match type `Language.Haskell.TH.Syntax.Dec' with `[Language.Haskell.TH.Syntax.Dec]'
07:14 <dreamer_> ??
07:15 jchia joined
07:15 <mniip> so when a do block is parsed, the parser sticks in a simple ">>=" in there,
07:16 <mniip> then the renamer either renames it to GHC.Base.>>= or if RebindableSyntax is on, the right identifier
07:16 <mniip> then the typechecker typechecks the do-block filling in the type of this specific SyntaxExpr
07:16 <aisqwe> how can I get the name of the cons operator of List type in template haskell?
07:17 <Ariakenom> For no particular reason, what are the ways to include a binary file into my program?
07:17 <mniip> aisqwe, '(:)
07:17 incomprehensibly joined
07:17 Scorchin joined
07:17 prefork joined
07:17 <mniip> Ariakenom, convert the binary into an object file and then ffi-import it as a char array
07:18 trcc joined
07:19 <cocreature> file-embed also works for binary data
07:21 <cocreature> dreamer_: can you show us the full error?
07:21 <aisqwe> mniip: could you elaborate a little on the '(:), i see promotedCons in the Type section but how do i get the name?
07:23 <cocreature> dreamer_: the problem is probably that top level splices must have type Q [Dec] whereas you have a Q Dec
07:23 <mniip> % :t '(:)
07:23 <yahb> mniip: Language.Haskell.TH.Syntax.Name
07:24 <dreamer_> uh
07:24 <dreamer_> so how would I go around resolving that
07:24 <dreamer_> the full error is indeed that
07:25 cur8or joined
07:25 <dreamer_> https://lpaste.net/8878976532287062016
07:25 <cocreature> you can use "fmap (\x -> [x])" to go from Q Dec to Q [Dec]
07:26 <mniip> return <$> loadPiece
07:26 <dysfun> fmap (:[]) should work too
07:26 Lokathor joined
07:26 <mniip> :[]
07:26 <cocreature> dreamer_: btw what is your underlying goal here? it seems like you are still fairly new to Haskell so it seems kind of surprising that you are already reaching for TH. maybe there is a better solution here?
07:27 <Lokathor> oh my gosh i open #haskell for the first time in ages and two of my favorite #haskell pals are right here
07:27 <aisqwe> mniip: thanks , i got it now
07:27 <Lokathor> (a "haskell pal" is here defined as any username i recognize at all)
07:28 chocopuff joined
07:28 <Ariakenom> :t fmap pure
07:28 <lambdabot> (Functor f2, Applicative f1) => f2 a -> f2 (f1 a)
07:28 dddddd joined
07:28 <mniip> is "favourite haskell pal" an atomic notation too
07:28 <Lokathor> yes
07:28 <Lokathor> Friends, how can i force stack to keep all of its files not in my APPDATA directory on windows?
07:28 dexhunter joined
07:29 m0rphism joined
07:29 <Lokathor> this is the first time i've seriously tried to install stack in like 2 years, i did the other day and it dumped all sorts of files in APPDATA instead of the D drive i tried to tell it to use
07:30 hphuoc25 joined
07:31 fmixing joined
07:31 <dreamer_> cocreature : my goal is to create values wp wb wr bp bb br etc... that contain the chess picture instead of doing it by hand
07:31 vks_ joined
07:32 <dreamer_> I'm.. not so new to haskell. but I never touched template haskell before. so I 'm trying to use it
07:32 <dreamer_> chess piece pictures*
07:32 <cocreature> how many of those values are there?
07:32 <dysfun> dreamer_: however, do you need it? generics are very powerful these days
07:33 <dreamer_> want to learn anyway, but if there's a better way do show me
07:33 <dreamer_> not so many.
07:34 <cocreature> then I wouldn’t bother trying to use TH for his
07:34 <cocreature> *this
07:34 <dreamer_> twelve
07:34 <dreamer_> yes but then how would I know how to use it later huh
07:34 <cocreature> chances are that the boilerplate for the TH is larger than the boilerplate of defining these manually
07:34 Linter_ joined
07:34 <dreamer_> I m proceeding in a need to learn priority not in a need to use
07:35 raichoo joined
07:35 Synthetica joined
07:36 zdenal joined
07:36 <cocreature> ah ok, if your goal is learning TH then avoiding it is obviously not going to cut it :)
07:36 <* hackage> hmatrix-backprop - hmatrix operations lifted for backprop http://hackage.haskell.org/package/hmatrix-backprop- (jle)
07:37 <dreamer_> anway, it works ! I didn' t think of using fmap rly %)
07:37 bergle2 joined
07:40 <dreamer_> interested in generics tho dysfun, what did you mean ?
07:40 connrs joined
07:41 ozzymcduff joined
07:42 <* hackage> DOH - Complete API bindings for DigitalOcean API V2 http://hackage.haskell.org/package/DOH- (yigitozkavci)
07:43 thc202 joined
07:44 Linter joined
07:44 <dysfun> dreamer_: it depends upon your problem, but i find often people reach for TH when generics would do
07:44 paolino joined
07:45 yeevy joined
07:46 <cocreature> generics can’t eliminate the boilerplate of defining multiple top-level definitions. they can however shorten the individual definitions
07:47 mpahrens joined
07:47 dhil joined
07:47 progfun joined
07:48 DTZUZO joined
07:54 <khilan> Hello! I'm trying some basic functions with images and am facing some difficulties in slicing an image. I want to implement the function as in psudocode <https://lpaste.net/2158638283658100736> and have tried <https://lpaste.net/8637509115809103872> . I'm facing some runtime errors (mostly becoz of line 59). Can someone plz help me figure out how can I do it better?
07:54 philippD joined
07:55 <dreamer_> how do you concat Monaded lists
07:56 <dreamer_> my problem now is that the top level splice is too nested
07:57 <cocreature> :t liftA2 (++)
07:57 <lambdabot> Applicative f => f [a] -> f [a] -> f [a]
07:57 <dreamer_> I tried this lol fmap (\[x] -> x)
07:58 <dminuoso> dreamer_: That doesn't exactly concat it, it just extracts the first element. It's equivalent to `fmap head`
07:58 <[exa]> dreamer_: why not 'fmap concat' ?
07:58 <dreamer_> oh RIGHT
07:59 <cocreature> dreamer_: it’s not, it crashes for non-singleton lists
07:59 <dreamer_> yeah noticed
07:59 <dreamer_> WHEW
07:59 <dreamer_> ok
07:59 <cocreature> eh that was for dminuoso
07:59 <dminuoso> cocreature: Oh right, its even worse heh
07:59 <dreamer_> ok it works fine now
08:00 <dreamer_> my issue is not TH really just lack of knowledge about monads
08:00 <dreamer_> because I usually go out of my way to sidestep them
08:00 <* hackage> DOH - Complete API bindings for DigitalOcean API V2 http://hackage.haskell.org/package/DOH- (yigitozkavci)
08:00 <cocreature> that’s not going to get you very far in Haskell :)
08:00 Boomerang joined
08:01 <dreamer_> Yeah, I noticed..
08:01 <cocreature> luckily, they are also not nearly as scary or complicated as you might think!
08:01 <dminuoso> You're learning TH before you grasped monads?
08:01 <dminuoso> One of these is scary. The other is not. :<
08:02 nowhere_man joined
08:02 henriksod joined
08:02 alowaniak joined
08:03 kuribas joined
08:03 <dreamer_> I swear I look at monadic code I want to curl up
08:04 <alexad> So, just out of curiosity, what's the general practice if a package on hackage is going unmaintained and one wants to fork and update it?
08:04 <Boomerang> Mmmh, how do you use TH without using the Q monad?
08:05 <cocreature> alexad: https://wiki.haskell.org/Taking_over_a_package
08:06 <cocreature> dreamer_: that feeling goes away once you stop trying to avoid them :)
08:06 <dminuoso> Monads make me feel warm and fuzzy.
08:06 <dminuoso> I dream of them from time to time..
08:06 <[exa]> monads are like blankets, nice for wrapping
08:07 <* [exa]> avoids burritos!
08:07 <cocreature> l
08:07 <cocreature> ups
08:07 <cocreature> [exa]: but they can also make you hot and sweaty? :)
08:07 mreh joined
08:08 zariuq joined
08:09 mpahrens joined
08:09 <[exa]> mmmmmm :]
08:09 <alexad> cocreature, thanks as always
08:09 <alexad> it's nowhere near the "take over" period, but it's good to know there's a way to do it if I find I need to maintain this thing a fair bit
08:10 <alexad> for now I'm using git submodule instead of the hackage copy :(
08:10 guessWHo joined
08:10 <cocreature> well if you do intend to take it over start by sending the maintainer an email
08:10 <guessWHo> when i run this https://lpaste.net/8532562311485849600 i get Statsd.hs: getCurrentDirectory:getWorkingDirectory: resource exhausted (Too many open files in system)
08:11 <gonz_> dreamer_: Monads will allow you to control exactly which scary actions you/people can execute. It's an opportunity for safety and much clearer specifications for what functions can do.
08:12 <[exa]> guessWHo: what's Statsd? Does it have any reason for not closing file descriptors?
08:12 <guessWHo> [exa] : it
08:12 Cogitabundus joined
08:12 mpahrens joined
08:12 <guessWHo> [exa] : it's a haskell lib to send metrices to statsd server https://github.com/tibbe/ekg-statsd
08:13 <kuribas> gonz_, dreamer_: not only that, they also apply to many domains, like non-deterministic programming, parsers, etc...
08:13 mpahrens joined
08:13 freyr joined
08:14 mpahrens joined
08:14 lumm joined
08:14 <kuribas> not just simulating effectful programming.
08:15 mpahrens joined
08:15 freeman42x]NixOS joined
08:15 <[exa]> guessWHo: you can try to bump the limit a bit using ulimit (some systems have fd limit ridiculously low now)
08:15 danso joined
08:16 <guessWHo> [exa] : i think i got it i was using the exposed function in a wrong manner
08:16 <[exa]> guessWHo: otherwise forking new sockets every second without checking if the previous one has terminated can DoS you quite easily
08:18 fvr joined
08:19 <alexad> cocreature, yeah, we'll see. if I end up adding a bunch more to the fork I'll poke the guy if he doesn't start accepting PRs
08:19 <cocreature> gonz_: Monads don’t allow you to do that, IO does. the fact that IO is an instance of Monad is mostly orthogonal to that
08:19 obi_jan_kenobi__ joined
08:20 zar joined
08:20 tomphp joined
08:20 perspectival joined
08:20 fujiy joined
08:20 mpahrens joined
08:21 <gonz_> cocreature: Creating your own monad stacks most definitely will let you do something akin to that.
08:22 <dminuoso> gonz_: Monad is just an abstract interface, like Monoid.
08:22 <cocreature> gonz_: sure but the fact that you can isolate effects still has only little to do that the resulting type will be an instance of Monad
08:22 <dminuoso> It doesn't have any instrinstic meaning other than the laws it requires.
08:22 <* mniip> . o O ( technically a monad *is* a monoid)
08:22 sakalli_ joined
08:23 connrs joined
08:24 <ventonegro> gonz_: The IO type makes side-effects possible. A monad is a good way of combining functions that return IO types
08:24 language_agnosti joined
08:24 tomphp joined
08:24 tsaka__ joined
08:25 agander joined
08:25 <gonz_> I was giving dreamer_ an example of something he could do if he stopped avoiding/sidestepping monads in practice all the time
08:25 <dreamer_> what other way to do IO are there in haskell besides monads tho
08:25 <gonz_> The fact is if he learns how to use them he'll then be set to use something like mtl to make these things possible
08:26 <dreamer_> I want to learn how to use them ofc
08:26 slomo joined
08:26 <dreamer_> but the fact remains that I have been a monadcoward for a long time
08:26 <cocreature> dreamer_: you don’t “do IO with monads”. you use the IO type which happens to be an instance of Monad
08:26 diwo joined
08:26 <dreamer_> ok, do side effects then if you prefer.
08:27 zero_byte joined
08:28 <ventonegro> dreamer_: If you manually thread the state through pure functions to enforce sequencing in a pure functional languages, you will invent monads again
08:28 <ventonegro> language*
08:29 <ventonegro> dreamer_: Don't try to "learn monads" at first
08:29 <dreamer_> I'm not trying to learn monads it's more like
08:29 <ventonegro> First try to sequence functions that return Maybe types
08:29 <dreamer_> I want to do this
08:29 <dreamer_> ok you need to use this monadic lib
08:29 <dreamer_> ok I will
08:29 <ventonegro> Then try to sequence functions that return Either types
08:30 <ventonegro> Eventually you will see a pattern
08:30 <ventonegro> This pattern is what you want to learn
08:31 <kuribas> IMO monadic bind, apply and fmap are just generalisations of function application.
08:31 <kuribas> With different use-cases
08:31 <[exa]> you mean specializations
08:31 <dminuoso> dreamer_: Monad is just an abstract interface like Functor or Monoid. Again, it has no intrinsic meaning like "side effects" or anything. It's just an interface of two functions with some laws.
08:31 <kuribas> [exa]: no generalisations
08:32 <* hackage> HNumeric - Haskell Numeric Library with pure functionality, R & MATLAB Syntax. http://hackage.haskell.org/package/HNumeric- (edeftg)
08:32 <kuribas> [exa]: function application is fmap or (=<<) over the identity monad.
08:33 <cocreature> that seems like a weird way to look at it given that using fmap involves function application
08:33 <kuribas> cocreature: well, upto isomorphism :)
08:33 <dreamer_> I understand that dminuoso
08:34 tzemanovic joined
08:34 <dreamer_> ventonegro I will follow your advice
08:34 <[exa]> it's certainly a very different view from the type-systemish one
08:34 <[exa]> kuribas: but yeah makes sense that way
08:34 <kuribas> ($) :: (a -> b) -> a -> b
08:35 <kuribas> fmap :: Functor f => (a -> b) -> f a -> f b
08:36 encod3 joined
08:36 <dminuoso> And applicative generalizes to multi arg functions =0
08:36 <cocreature> you definitely have a point here. I just feel slightly uneasy about using the word “generalization”
08:37 <dminuoso> :t liftA2 (,)
08:37 <lambdabot> Applicative f => f a -> f b -> f (a, b)
08:37 <[exa]> de-special-case-ization
08:37 language_agnosti joined
08:37 <kuribas> cocreature: superset?
08:37 <cocreature> kuribas: not sure, still thinking about what I would call it :)
08:38 <[exa]> parametrization maybe
08:38 <kuribas> expansion
08:38 <kuribas> it expands the capabilities of pure functions
08:38 jchia joined
08:38 tomphp joined
08:40 <Ariakenom> Pure functions can express any computation though.
08:40 <dminuoso> kuribas: not sure how (=<<) fits into this though
08:41 <dminuoso> although I suppose in a way
08:41 <dminuoso> :t (.)
08:41 <lambdabot> (b -> c) -> (a -> b) -> a -> c
08:41 <dminuoso> :t (<=<)
08:41 <lambdabot> Monad m => (b -> m c) -> (a -> m b) -> a -> m c
08:41 <Ariakenom> And "Applicative f => f a -> f b -> f (a, b)" is a special case of "a->b->c"
08:41 <kuribas> dminuoso: that's composition
08:42 <dminuoso> kuribas: Yeah
08:42 <kuribas> :t (=<<)
08:42 <lambdabot> Monad m => (a -> m b) -> m a -> m b
08:43 <kuribas> :t ($)
08:43 <lambdabot> (a -> b) -> a -> b
08:43 dexhunter joined
08:43 <kuribas> dminuoso: substitute Identity for m, and you get application
08:43 <dminuoso> kuribas: thats just not symmetric anymore.
08:43 <dminuoso> mmm
08:43 andyhuzhill joined
08:44 hphuoc25 joined
08:44 valentinbuza joined
08:45 Kacia joined
08:46 xtreak joined
08:46 taumuon joined
08:48 jchia1 joined
08:49 encod3 joined
08:49 raingloom joined
08:49 encod3 joined
08:53 vks_ joined
08:53 tomphp joined
08:54 language_agnosti joined
08:55 hphuoc25 joined
08:55 dogweather joined
08:57 philippD joined
08:57 tomphp joined
09:00 rzp joined
09:00 sgflt joined
09:02 m0rphism joined
09:02 zdenal_ joined
09:06 MRd1 joined
09:06 taumuon joined
09:07 WhatisRT joined
09:07 agander_ joined
09:08 youtmon joined
09:09 hph^ joined
09:11 sakalli_ joined
09:11 agander__ joined
09:12 SpinTensor joined
09:14 oish joined
09:15 MRd1 left
09:15 hph^ joined
09:16 dogweather joined
09:18 encod3 joined
09:18 ijks joined
09:19 technocracy[m] joined
09:21 bo joined
09:21 encod3 joined
09:27 andromeda-galaxy joined
09:28 emilypi joined
09:29 catsup joined
09:30 <ongy> Is it cheaper to store an IO () with `pure ()`, or Maybe (IO ()) Nothing when I want to potentially (most of the time) execute nothing?
09:30 cloudhead joined
09:31 catsup joined
09:32 <AWizzArd> Is it common to have one single file Types.hs in which one adds all type declarations for the whole project?
09:32 fmixing joined
09:32 <ongy> It can be necessary, if you have cyclic data structures
09:32 <ongy> I'd try to avoid it, since it's a bit annoying to work with, but it's not too uncommon IME
09:33 <AWizzArd> ongy: if you would have such a file would you also add implementations of type classes in there, such as a hand-baked implementation of Show?
09:33 <AWizzArd> Or should those implementations go into different files, style-wise?
09:33 osa1 joined
09:34 <ongy> if you put them into other files you get orphan instances, so I generally place them in the same file.
09:34 <Taneb> AWizzArd: I'd say the instances should live with the types as much as possible
09:34 MRd1 joined
09:35 theelous3_ joined
09:37 <thblt> With recent Stack, which are the files I need to have in version control? I assume package.yaml and stack.yaml (for the resolver), MyPackage.cabal being just a byproduct? Or do I even need stack.yaml?
09:37 <dminuoso> thblt: The stack.yaml contains information for stack, such as the the resolver/packages/extra-deps and other things.
09:38 <MRd1> Hello
09:39 hamishmack joined
09:39 vks_ joined
09:39 <thblt> dminuoso: thanks, so I need these two, but not the .cabal, right?
09:39 agander joined
09:39 <dminuoso> thblt: Correct.
09:40 <thblt> dminuoso: thank you!
09:40 <dminuoso> thblt: I think the package.yaml is just a different format used by hpack to generate the .cabal file from.
09:41 fendor joined
09:41 AfC joined
09:42 Insanity1 joined
09:42 locallycompact joined
09:42 dogweather joined
09:43 mpahrens joined
09:45 taumuon joined
09:45 encod3_ joined
09:45 <thblt> That's what I assumed indeed.
09:46 <thblt> (minus the hpack, I thought it was stack's idea :)
09:47 language_agnosti joined
09:47 <AWizzArd> ongy and Taneb: good, thx for the feedback.
09:48 progfun joined
09:48 simukis joined
09:49 <Taneb> :)
09:49 ThomasLocke joined
09:50 rotcev joined
09:51 <dminuoso> thblt: Stack has hpack builtin so.. :)
09:52 nitaigao joined
09:53 danvet joined
09:56 akegalj joined
09:57 language_agnosti joined
09:58 WhatisRT joined
09:59 dogweather joined
10:02 cur8or_ joined
10:03 hphuoc25 joined
10:04 language_agnosti joined
10:07 sakalli_ joined
10:08 yeevy joined
10:09 zdenal joined
10:10 vlatkoB_ joined
10:10 zdenal joined
10:11 ZZZzz__ joined
10:11 errst_ joined
10:11 zdenal joined
10:12 zdenal joined
10:12 WhatisRT joined
10:13 <cocreature> stack has hpack builtin but hpack works perfectly fine without stack. stack just calls hpack for you if the package.yaml has changed to automatically regenaret the *.cabal file
10:13 zdenal joined
10:13 <cocreature> and you also don’t need to use a package.yaml with stack. stack is perfectly happy working with a cabal file
10:14 <dreamer_> stack is cool
10:14 zdenal joined
10:14 Linter joined
10:15 matsurago joined
10:15 <thblt> Is there an example somewhere of having common options with subcommands in optparse-applicative (like what Stack does). Eg myprogram [ --verbose ] [ --simulate ] COMMAND [options]?
10:15 hphuoc25 joined
10:16 <cocreature> thblt: you can use something like liftA2 (,) commonOptions (hsubparser (command … <> command …))
10:17 RegEchse joined
10:18 <thblt> cocreature: thanks, looking into this
10:19 dhil joined
10:19 amar_ joined
10:20 <* hackage> relational-query-HDBC - HDBC instance of relational-query and typed query interface for HDBC http://hackage.haskell.org/package/relational-query-HDBC- (KeiHibino)
10:21 SolidState_ joined
10:21 taumuon joined
10:24 kvda joined
10:24 language_agnosti joined
10:25 MindlessDrone joined
10:25 SPoF95 joined
10:27 gghpo joined
10:27 <gghpo> @ty foldr ($)
10:27 <lambdabot> Foldable t => a -> t (a -> a) -> a
10:28 language_agnosti joined
10:29 taktoa joined
10:29 Reisen joined
10:30 __monty__ joined
10:31 voooza joined
10:32 mnoonan joined
10:32 knupfer joined
10:37 Franciman joined
10:37 <Franciman> Hi
10:37 <Franciman> https://lpaste.net/978541477292408832 <- I'm using Pipes.Network.TCP
10:37 pykello joined
10:38 <Franciman> but this code doesn't compile because ghc doesn't support impredicative polymorphism
10:38 <Franciman> what is wrong?
10:39 mpahrens joined
10:39 <Franciman> (I put the error message in the paste above)
10:41 <wz1000> Franciman: Just use Producer instead of Producer'
10:42 <Franciman> oh thank you!
10:45 jchia_1 joined
10:46 cloudhead joined
10:48 amar_ joined
10:51 amirpro joined
10:51 <dminuoso> "GHC doesn't yet support impredicative polymorphism"
10:51 <liste> will it ever?
10:52 <dminuoso> That was exactly my thought :p
10:52 <cocreature> you can enable an extension called ImpredicateTypes!
10:52 HarveyPwca joined
10:54 fmixing joined
10:57 phenoble joined
10:57 vurtz joined
10:59 wc211 joined
11:00 cloudhead joined
11:01 ziyourenxiang joined
11:01 <cocreature> sometimes I really hate the module hierarchy in base …
11:01 Sampuka joined
11:02 <liste> cocreature: any specific bad apples?
11:02 <cocreature> "guard" is in Control.Monad and not in Control.Applicative even though it has nothing to do with Monad
11:02 <cocreature> (I know that this is due to historic reasons but that doesn’t make it better)
11:03 <dminuoso> cocreature: Go wild, clean up base, make a diff and hope bgamari doesn't notice the failing tests left and right?
11:03 Ktak_007 joined
11:03 knupfer joined
11:03 <maerwald> yeah and thanks for breaking everyone elses imports
11:03 <maerwald> because we don't have enough breaking API already
11:03 <cocreature> dminuoso: the problem is that I hate the bikeshedding that acompanies changes in base way too much for me to even attempt improving something :/
11:04 <Ariakenom> While you're at it could you remove the pointless prefixes? Control, Data?
11:04 <dminuoso> Ariakenom: Where would Functor reside in?
11:04 <barrucadu> Just merge Control and Data
11:04 <dminuoso> ^- this I agree with :)
11:04 <dminuoso> Especially as a beginner I found it incredibly confusing why some things were in Control and others in Data..
11:05 <Ariakenom> I'm just starting to guess right
11:05 hphuoc25 joined
11:05 Tesseraction_w joined
11:06 louispan joined
11:06 <Ariakenom> dminuoso: What do you mean? Don't remove the modules, just remove their prefixes.
11:07 <dminuoso> Ariakenom: So that you would have `import Functor.Contravariant` for example?
11:08 agander joined
11:08 <Ariakenom> Seems reasonable.
11:08 cloudhead joined
11:10 deepfire` joined
11:11 agander_ joined
11:11 <Profpatsch> Does fromIntegral incur a performance cost?
11:11 language_agnosti joined
11:12 <cocreature> Profpatsch: depends on the types that you are converting between?
11:12 <Profpatsch> Int -> Double
11:12 <Profpatsch> I hope not. :)
11:13 silver joined
11:13 <Profpatsch> urgs
11:13 <Profpatsch> -- | general coercion from integral types
11:13 <Profpatsch> {-# NOINLINE [1] fromIntegral #-}
11:13 <Profpatsch> fromIntegral :: (Integral a, Num b) => a -> b
11:13 <Profpatsch> fromIntegral = fromInteger . toInteger
11:13 <Profpatsch> No rules for Int -> Double as far as I can see.
11:14 hphuoc25 joined
11:14 <cocreature> https://github.com/ghc/ghc/blob/master/libraries/base/GHC/Float.hs#L1248
11:15 <Profpatsch> Ah, I was browsing GHC.Real
11:15 <cocreature> I just looked at what ghc -O2 spat out and grepped for the module that was in :)
11:15 <Profpatsch> Huh, that’s interesting.
11:16 <Profpatsch> Did you provide another flag?
11:16 <cocreature> no idea how efficient int2Double is but it does seem to use to some int2Double# primop which is hopefully pretty good
11:16 hphuoc25 joined
11:16 <cocreature> -ddump-simpl
11:16 <cocreature> to see the core
11:16 <Profpatsch> I have to remember that.
11:16 <cocreature> on a file containing f :: Int -> Double; f = fromIntegral
11:16 <cocreature> learning to read core is pretty useful if you want to see how GHC optimizes your code
11:16 davr0s joined
11:17 language_agnosti joined
11:17 <Profpatsch> I have to admit that I never had the desire to look at how my code optimized so far, it was pretty much just always fast enough from the start. :)
11:18 <cocreature> heh, good for you :)
11:18 xtreak joined
11:19 Ariakenom left
11:20 UnChallengeD joined
11:20 Ariakenom joined
11:20 ericsagn1 joined
11:20 davr0s joined
11:20 <Profpatsch> int2double seems to map on a C-- prim-op.
11:21 <cocreature> that’s what I said above :)
11:21 <Profpatsch> So I suspect it is mapped to a x86 primitive or at least pretty close to that.
11:21 <cocreature> https://github.com/ghc/ghc/blob/master/compiler/nativeGen/X86/CodeGen.hs#L3129 should be the relevant part in the code generator
11:22 <Profpatsch> Ah, I wasn’t making the reference to Cmm from int2double# primop
11:22 <cocreature> sry should have been more clear :)
11:22 <Profpatsch> Are primops always related to symbols in Cmm?
11:22 <cocreature> although I think int2Double# isn’t actually implemented in cmm?
11:23 <cocreature> it seems to be converted to Int2DoubleOp which is then converted to MO_SF_Conv which is handled by the part of the code generator that I just linked to
11:25 <Profpatsch> Ah, and that maps to GITOD, which is an x86 float operation.
11:25 <Profpatsch> Nice. :)
11:25 <cocreature> or the sse2 stuff
11:25 <cocreature> not sure when that is enabled
11:26 <Profpatsch> I like that the comment above the x86 codegen starts with the words: “Intel, in their infinite wisdom”
11:26 <cocreature> apparently always on x86_64 if I read the code corerctly
11:26 <cocreature> *correctly
11:26 <Franciman> I'm trying to parse irc messages using attoparsec, and I wanted to use conduit to wire things up. But I get the results only after the connection is closed. How can I get the parse result at each parsed object?
11:26 <Franciman> parsed message*
11:27 <Franciman> get in the sense of printing, for example
11:30 shutdown_-h_now joined
11:30 <cocreature> Franciman: sounds like it might be a buffering issue?
11:30 sdothum joined
11:30 <Franciman> maybe
11:31 <cocreature> maybe try using line buffering
11:31 <Franciman> ah you mean buffering of the output
11:31 <Franciman> stdoutput*
11:31 <cocreature> no of the input
11:31 <Franciman> let me try
11:31 <Franciman> thanks
11:32 rcdilorenzo joined
11:34 <cocreature> Franciman: I’m just guessing here though. if you show us the code, someone might be able to provide more information
11:34 <Franciman> sure
11:34 <Franciman> 1 second
11:36 drbrule joined
11:36 andreabedini joined
11:37 abhiroop joined
11:37 <Franciman> cocreature, https://github.com/Franciman/bouncer/blob/master/src/Main.hs
11:37 <Franciman> here's the main
11:37 <Franciman> and here's the parte regarding sockets: https://github.com/Franciman/bouncer/blob/master/src/ClientListener.hs
11:37 cur8or joined
11:38 mr_robot8886 joined
11:39 fizbin joined
11:40 <cocreature> Franciman: the problem is that you are not using a parser that emits the items one by one but instead you parse a list and then emit all elements of that list at once
11:40 <Franciman> ah
11:40 <Franciman> ok
11:40 <cocreature> Franciman: try using sinkParser and remove the call to "many"
11:40 ammazza joined
11:40 <cocreature> eh no conduitParser is correct, sry
11:41 Psybur joined
11:41 <cocreature> but remove the "many"
11:41 <Franciman> ah so it automatically calls it again
11:41 <Franciman> I thought that it stopped when the parser finished
11:41 pykello joined
11:41 <Franciman> thanks it works perfectly!
11:42 zdenal__ joined
11:44 tomphp joined
11:44 WhatisRT joined
11:44 ozzymcduff joined
11:44 tsaka__ joined
11:45 logzet joined
11:46 mpahrens joined
11:46 xtreak joined
11:47 bhiliyam` joined
11:48 Novitsh joined
11:49 progfun joined
11:49 jao joined
11:49 carmack joined
11:49 dfeuer joined
11:50 jzl joined
11:50 jzl joined
11:51 ccomb joined
11:56 locallycompact joined
11:57 danso joined
12:00 Quora joined
12:01 <iron_houzi> Can someone please help me with my parser monad (https://github.com/ironhouzi/hstib/blob/tib_monad/src/Main.hs) - when I do `vowel A`, it works, but when I try to use `bind` like: `rago [Ra, Ga]`, I get the error: https://bpaste.net/show/fce6a459520d
12:02 <iron_houzi> It seems like I'm not able to get the data out of the Monad context ..
12:02 <lyxia> rago is not a function.
12:03 <lyxia> its type is Parser
12:03 <lyxia> use "parse"
12:03 <iron_houzi> I am expecting the output: [([Ra,Ga],[])]
12:03 <iron_houzi> ah indeed
12:04 AfC joined
12:04 <bwe> How can I cache stack dependencies with bitbucket pipelines?
12:04 <iron_houzi> lyxia: Wow! It was so close, I almost had it.. Thank you!
12:05 pykello joined
12:05 plugin joined
12:06 osa1_ joined
12:06 tomphp joined
12:07 ijks joined
12:09 <iron_houzi> If Monads wraps your data in some context and represents that as an object. Do you always need an "unwrapper" function at the end of a bunch of monadic functional computation to kind of get your actual data from inside your Monad context? I know this question is a bit vague .. but please bear with me as I'm trying to learn and get an intuition for monads
12:10 <locallycompact> iron_houzi, more or less
12:10 <iron_houzi> locallycompact: appreciate you input .. what's the common way to get your Just value from a Maybe monad?
12:10 hphuoc25 joined
12:11 <Entroacceptor> iron_houzi: no, there are monads where there is no "wrapped value"
12:11 <Entroacceptor> what is the value of putStrLn?
12:11 <kuribas> iron_houzi: a parser has no wrapped value.
12:11 <kuribas> iron_houzi: you run the parser
12:12 <kuribas> Entroacceptor: ()
12:12 <kuribas> :-)
12:12 <locallycompact> iron_houzi, there are a coupleo f ways depending on if you want to handle the error case or just let it explode
12:12 <locallycompact> iron_houzi, so the maybe function is one http://hackage.haskell.org/package/base-
12:12 <Entroacceptor> kuribas: :P
12:12 <locallycompact> iron_houzi, where you supply a default value in the case of the Nothing
12:12 <locallycompact> iron_houzi, or fromJust if you just want a runtime explosion when a Nothing occurs
12:12 <iron_houzi> kuribas: .. but isn't running the parser in effect unwrapping the value from its parser context .. of course triggering the lazy evaluation ..
12:13 <kuribas> iron_houzi: no, there may be no value, for example a parser error
12:14 <kuribas> iron_houzi: It makes more sense thinking about what you can do with a Monad rather than what they are.
12:14 <iron_houzi> locallycompact: Thanks .. this is very helpful!
12:15 WhatisRT joined
12:15 jpgarcia__ joined
12:15 <iron_houzi> kuribas: At some point I'll expand from what I'm trying to establish right now .. I'll keep that in mind
12:15 <kuribas> iron_houzi: a monad is like a functor, but it can remove the extra layer
12:16 <kuribas> :t \f -> join . fmap f
12:16 <lambdabot> Monad m => (a1 -> m a2) -> m a1 -> m a2
12:16 <kuribas> iron_houzi: do you know what a Functor is?
12:17 Wuzzy joined
12:17 <iron_houzi> kuribas: I have some intution on what a Functor is .. and I think I'm mixing that with what a Monad is ..
12:18 <kuribas> why do people want to learn about monads before knowing functors?
12:18 <dminuoso> kuribas: I blame bitemyapp :P
12:18 <locallycompact> because it's a meme at this point
12:18 <iron_houzi> kuribas: Hey .. now you're just making a lot of assumptions ..
12:19 <kuribas> iron_houzi: no offense :)
12:19 <dminuoso> kuribas: When I was looking around to learn Haskell I saw his book and saw the note: "Perhaps you were just looking for the 18 billionth* monad tutorial, certain that this time around you will understand monads once and for all."
12:19 <dminuoso> I felt challenged by that..
12:19 bbrodr joined
12:20 <kuribas> iron_houzi: The concept of a monad is easier to understand if you know what a functor is.
12:21 <ventonegro> and functors are more pervasive than monads, so should be learned first...
12:21 <dminuoso> though I think in some way Monoid is more useful than Functor
12:21 <dminuoso> Functor is far too often explained in terms of "containers" which is not helpful to learn Monad from
12:22 <kuribas> iron_houzi: in fact, monadic bind is just unpeeling a layer after calling fmap.
12:22 <dminuoso> "just" heh
12:23 <kuribas> dminuoso: right, the container analogy isn't great, but it's popping up a lot now.
12:23 <dminuoso> kuribas: In some ways its a useful intuition, but when learning Monad it's just in the way :(
12:23 <dminuoso> At least thats my experience
12:24 <kuribas> dminuoso: it should be made clear that a container can be a functor, but it isn't the other way around.
12:24 <kuribas> :t fmap putStrLn getLine
12:24 <lambdabot> IO (IO ())
12:25 hphuoc25 joined
12:25 twandy joined
12:25 <ventonegro> :t words <$> getLine
12:25 <lambdabot> IO [String]
12:26 <ventonegro> :t length . words <$> getLine
12:26 <lambdabot> IO Int
12:26 <Ariakenom> bind = \m f -> join $ fmap f m
12:26 <dminuoso> :t asum (many getLine)
12:26 <lambdabot> error:
12:26 <lambdabot> • No instance for (Foldable IO) arising from a use of ‘asum’
12:26 <lambdabot> • In the expression: asum (many getLine)
12:26 <ventonegro> You can do a lot just with the Functor interface
12:27 <kuribas> iron_houzi: monad is a meaningless pattern, which happens to have many interesting applications.
12:27 <kuribas> iron_houzi: containers being one of them.
12:28 <Ariakenom> :t fmap words $ many getLine
12:28 <lambdabot> error:
12:28 <lambdabot> • Couldn't match type ‘[Char]’ with ‘Char’
12:28 <lambdabot> Expected type: IO String
12:28 <Ariakenom> needs more fmap
12:29 <dminuoso> :t asum (repeat getLine)
12:29 <lambdabot> IO String
12:29 <dminuoso> @let first = asum . repeat
12:29 <lambdabot> Defined.
12:29 <Ariakenom> :t fmap concat (many getLine)
12:29 <lambdabot> IO [Char]
12:29 <kuribas> iron_houzi: the same way the number 5 is a meaningless symbol, but it gets meaning because we assign to it. You can say a number represents the count of objects, but it can represent countless other things.
12:29 andromeda-galaxy joined
12:29 <dminuoso> Mmm. asum.repeat might be a cool combinator...
12:30 <Profpatsch> trans :: (PositionAbs -> k -> v) -> (Int -> k -> v)
12:30 <Profpatsch> trans f = \i -> f (PositionAbs i)
12:30 <Profpatsch> I’m missing a combinator, right?
12:30 <Ariakenom> dminuoso: Why did you name it first
12:31 Rayben joined
12:31 <Profpatsch> The currying aspect is a bit confusing, but I want to transform a f given to Vector.imap
12:31 <dminuoso> Ariakenom: yeah okay maybe more like..
12:31 reactormonk joined
12:32 <Profpatsch> lmap from profunctors should do the trick, right? Is there something like that in base?
12:32 <kuribas> :t asum
12:32 <dminuoso> Ariakenom: annoying = msum.repeat
12:32 <lambdabot> (Alternative f, Foldable t) => t (f a) -> f a
12:32 Linter joined
12:32 <dminuoso> Ariakenom: naming things is hard.
12:32 <dminuoso> but I think it should be msum
12:33 <dminuoso> :t (msum . repeat)
12:33 <lambdabot> MonadPlus m => m a -> m a
12:33 minopret joined
12:33 twandy joined
12:33 <mniip> that doesn't...
12:34 <kuribas> why is IO an alternative?
12:34 tomphp joined
12:34 <mniip> kuribas, it is alternative wrt exceptions
12:34 <electrocat> kuribas: i think because of IO exceptions
12:34 <kuribas> ah right!
12:34 <mniip> % evaluate undefined <|> pure ()
12:34 <yahb> mniip: *** Exception: Prelude.undefined; CallStack (from HasCallStack):; error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err; undefined, called at <interactive>:15:10 in interactive:Ghci1
12:34 <mniip> maybe
12:35 danthemyth joined
12:35 <dminuoso> Ariakenom: `last` might be a good name perhaps
12:35 <Ariakenom> mniip: only IOException
12:35 <mniip> ah
12:35 dsh joined
12:35 tsoernes joined
12:35 <* hackage> radius - Remote Authentication Dial In User Service (RADIUS) http://hackage.haskell.org/package/radius- (erick)
12:35 <Ariakenom> I've been posting ":t many getLine" unprompted for a few weeks :p. Tends to get a few looks
12:36 <minopret> Is a monad a "conjugacy class" as in group theory?
12:36 <dminuoso> Ariakenom: yeah except `many getLine` is a bit misleading isnt it?
12:36 louispan joined
12:36 <dminuoso> Ariakenom: shouldnt it be `repeat getLine`?
12:36 <dminuoso> oh wait..
12:36 <dminuoso> I didnt say that.
12:36 <dminuoso> Lets pretend I just observed in silence.
12:36 <Ariakenom> say what *wink*
12:36 <mniip> ah, error is ErrorCall
12:37 <mniip> while empty is IOError
12:37 AfC joined
12:37 WhatisRT joined
12:37 <Ariakenom> :t msum
12:37 <lambdabot> (MonadPlus m, Foldable t) => t (m a) -> m a
12:37 <minopret> Is the name Haskell as in Haskell Curry derived from the word in the Hebrew language השכל, "understand"?
12:37 pipahask joined
12:38 <mniip> google tells me it stands for "intelligence"
12:38 <Taneb> minopret: it could be Norse "Asketill" meaning God kettle
12:38 <minopret> Thanks @mniip
12:38 <Profpatsch> Oh man, it’s just f . PositionAbs
12:38 <Profpatsch> What am I doing.
12:39 twandy joined
12:40 cur8or joined
12:40 dfeuer joined
12:40 Purlox joined
12:43 mpahrens joined
12:44 daishi joined
12:45 <* hackage> require 0.3.2 - Scrap your qualified import clutter http://hackage.haskell.org/package/require-0.3.2 (NickSeagull)
12:46 kyru68bu joined
12:47 mitch_ joined
12:47 knupfer joined
12:47 locallycompact joined
12:50 Ktak_007 left
12:50 Folkol_ joined
12:51 RyanGlScott joined
12:51 <RyanGlScott> Hey all. Does anyone have examples on hand of large, gnarly, hand-written instances for GADTs that you wish could be replaced with GHC.Generics?
12:52 andyhoang joined
12:53 chat joined
12:54 ijks_ joined
12:54 perspectival joined
12:55 minopret joined
12:57 pfurla joined
12:57 emilypi joined
12:59 <minopret> I don't know about handwritten GADTs. I have generated GADTs from a Coq proof. Nicer as GHC
12:59 <RyanGlScott> minopret: Those sound pretty interesting!
13:03 fmixing joined
13:04 <Taneb> RyanGlScott: we have some at work but it's not code I can share...
13:04 fmixing joined
13:04 ssarah joined
13:04 mizu_no_oto joined
13:05 osa1 joined
13:05 <gentauro> Question with regard of nested modules in ML/OCaml vs Modules in Haskell: In "ML" I can see the parent module alegraic types (+constructors) from each of the submodules, but I can't in Haskell (unless I'm doing it wrong). What's the reason for this? Thx
13:06 language_agnosti joined
13:06 <Taneb> gentauro: in Haskell you'd have to explicitly import them from the parent modules
13:07 <gentauro> Taneb: which means that I need to make constructors explicitly exposed (which I really don't want)
13:07 agander_ joined
13:07 <Taneb> In Haskell, the modules Foo.Bar and Foo.Bar.Baz don't have anything to do with each other other than their names
13:07 <Taneb> They're not really "nested" in the same sense at all
13:07 <gentauro> Taneb: Thx, that's what I wanted to know
13:08 <cocreature> gentauro: you need to expose them from the module but you don’t need to expose that module.
13:08 <gentauro> Taneb: Next question, is there a way to create nested modules like in ML (in Haskell) :)
13:08 hackebeilchen joined
13:08 <Taneb> gentauro: no, sadly
13:09 <Taneb> One thing you can do is create a module with all your types, and then not expose that module in the library
13:10 <gentauro> Taneb: I would still be able to import Foo.Bar.Baz right?
13:10 <Taneb> Yes
13:10 language_agnosti joined
13:10 <gentauro> then it's not good
13:10 <gentauro> for example my type is limited to 5 star ratings
13:10 <Taneb> Well, you would from Foo.Bar, but you can make it so I can't from X.Y in a different library
13:10 <cocreature> you can import Foo.Bar.Baz but that won’t give you access to the definition of the ADT
13:10 <gentauro> if you can go around "this logic" and create a rating with 2000 stars ...
13:11 iAmerikan joined
13:11 <ysangkok> but you can have only three stars on hackage
13:11 <gentauro> cocreature: but then you don't expose anything from that module or how?
13:12 <gentauro> ysangkok: it's not stars, they are lambdas ... but it's not related to that, it's just an example
13:12 <cocreature> gentauro: I’m a bit confused. so you have two modules A and B. A defines some datatype that you use in B. and you don’t want to give users of your library access to the definition of A right?
13:12 <cocreature> s/definition of A/definition of the ADT defined in A/
13:14 pykello joined
13:14 minopret joined
13:15 bblfish joined
13:15 <mizu_no_oto> gentauro: A fairly standard practice in Haskell is to make Foo.Bar.Internal that's imported by Foo.Bar and Foo.Bar.Baz
13:15 <gentauro> cocreature: I'm used to OCaml where I can have nested modules
13:16 <cocreature> gentauro: I’m not used to OCaml and we don’t have nested modules in the sense that you want as Taneb explained, so you are going to have to explain your goal in Haskell terms :)
13:16 <gentauro> I can define ADT on the parent module and limit exposure (constructors) but from my nested modules I have access to them
13:16 <* hackage> firebase-database 0.0.1 - Google Firebase Database SDK http://hackage.haskell.org/package/firebase-database-0.0.1 (NickHamilton)
13:16 <gentauro> cocreature: well the problem is if the language doesn't support this feature, I can't ... obviously
13:17 <cocreature> is your goal to limit access to the ADT to external users of your library or to other modules in the same library?
13:17 carlomagno joined
13:17 <gentauro> and If I have to explain your the solution, why even ask?
13:17 <cocreature>
13:17 <gentauro> cocreature: nevermind ...
13:18 <mizu_no_oto> You don't guarantee anything about Foo.Bar.Internal remaining stable or even being a good idea for people to use, but it's at least open to library consumers if they absolutely need it.
13:19 ystael joined
13:19 tomphp joined
13:19 sakalli_ joined
13:20 <butterthebuddha> Anybody here use intero with emacs?
13:20 RyanGlScott left
13:20 <gentauro> butterthebuddha: yeah
13:20 <gentauro> butterthebuddha: I have an issue everytime I open a project (it looks for an old project and crashes)
13:21 <butterthebuddha> It doesn't recognize new packages until I restart Emacs
13:21 <cocreature> butterthebuddha: you can use M-x intero-restart iirc
13:21 <dminuoso> Better get used to restarting intero..
13:21 <Athas> Core workflow.
13:22 <gentauro> dminuoso: you can "hook" up if the package.yaml changes, then restart intero ;)
13:22 cur8or joined
13:22 minopret_ joined
13:23 <dminuoso> gentauro: I might actually do that on every source file change.
13:23 <butterthebuddha> gentauro: How do you do that?
13:25 <minopret_> RyanGlScott: I wrote up my Coq-generated Haskell code: https://stackoverflow.com/questions/13334863/can-i-extract-a-coq-proof-as-a-haskell-function
13:26 vonfry joined
13:27 <mizu_no_oto> gentauro: edwardk gave a lightning rant at Boston Haskell about the module thing a few years back: https://youtu.be/yFXzuCFeRGM?t=1h36m50s
13:27 gabiruh joined
13:28 <* hackage> barbies - Classes for working with types that can change clothes. http://hackage.haskell.org/package/barbies- (DanielGorin)
13:30 gabiruh joined
13:30 dwat3r joined
13:30 sdothum_ joined
13:30 vonfry_ joined
13:30 language_agnosti joined
13:32 languag__ joined
13:32 hphuoc25 joined
13:34 fendor joined
13:34 language_agnosti joined
13:34 osa1_ joined
13:35 sighingnow joined
13:35 WhatisRT joined
13:35 WhatisRT left
13:36 WhatisRT joined
13:36 blankhart joined
13:37 p0lyph3m joined
13:38 p0lyph3m joined
13:39 reactormonk joined
13:39 lastmanstanding joined
13:39 mpahrens joined
13:40 patlv joined
13:41 <edwardk> mizu_no_oto: hah i'd forgotten i gave that talk
13:42 <butterthebuddha> "badChar = getAll . ((All . (/= '-')) <> (All . (not . isDigit)))" <- can I get rid of the "All ."s in that code?
13:42 cur8or joined
13:42 WhatisRT joined
13:43 saml joined
13:43 gabiruh joined
13:44 davr0s joined
13:44 polux36 joined
13:45 <barrucadu> badChar c = c /= '-' && not (isDigit c)
13:46 <butterthebuddha> Well, I was trying to make it point-free...
13:46 AndreasPK_ joined
13:47 <barrucadu> But look how much clearer it is with a variable!
13:47 dbmikus joined
13:48 <AfC> "edwardk gave a rant..." we need someone to cut those into a movie. I'd buy popcorn to watch that.
13:48 <edwardk> =)
13:49 <liste> > let badChar = (&&) <*> (/= '-') <*> (not . isDigit) in badChar 'X'
13:49 <lambdabot> error:
13:49 <lambdabot> • Couldn't match type ‘Bool’ with ‘Bool -> b1’
13:49 <lambdabot> Expected type: Bool -> Bool -> Bool -> b1
13:49 <liste> > let badChar = (&&) <$> (/= '-') <*> (not . isDigit) in badChar 'X'
13:49 <lambdabot> True
13:49 <liste> > let badChar = (&&) <$> (/= '-') <*> (not . isDigit) in badChar '5'
13:49 <* edwardk> wants quantified constraints so badly. the code i'm writing right now cries out for them
13:49 <lambdabot> False
13:50 progfun joined
13:50 tsoernes joined
13:50 <DigitalKiwi> edwardk lambdabot called you out on your lies!
13:51 vonfry joined
13:51 <edwardk> fair
13:51 pykello joined
13:52 <mniip> edwardk, quantified in what sense
13:52 <mniip> forall c. (C c, c a) => T a ?
13:52 <edwardk> class (forall m. Monad m => Monad (t m)) => MonadTrans t where lift :: Monad m => m a -> t m a
13:52 <mniip> ah
13:52 dbmikus_ joined
13:53 <mniip> forall to the left of =>
13:53 <edwardk> in the current setting i have some class constraint "Evident t a" that is definitely implied by (ToJSON a, FromJSON a) but may well be weaker
13:53 <edwardk> but using the constraints package to open the proof all the time gets really tedious on the code i have
13:53 <mniip> is there a sound type theory behind this? and a typechecking algorithm
13:53 camsbury joined
13:53 <edwardk> yes and yes
13:54 <edwardk> simon already has a patch for ghc for it
13:54 <mniip> so how is that going to work
13:54 <mniip> an instance of MonadTrans will have to offer a function of type 'forall m. Monad m -> Monad t m' ?
13:55 <mniip> (in Core I mean)
13:55 <mniip> ooo
13:55 <mniip> initial object in the constraint category
13:56 <mniip> class (forall c. c) => Never
13:56 <mizu_no_oto> https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0018-quantified-constraints.rst
13:57 <cocreature> QuantifiedConstraints is even merged in HEAD by now iirc
13:57 <edwardk> cocreature: did he ever get around to fixing the relaxation of the calling context stuff?
13:57 <edwardk> without that its kinda useless
13:58 <cocreature> edwardk: no idea, I only know that something™ will be in 8.6 :)
13:59 <edwardk> authenticated data structures in normal haskell https://www.irccloud.com/pastebin/bOBRfcEM/Authenticated.hs
14:00 <edwardk> This is the thing I'm experimenting with. I have a version that uses backpack and I have this one and i started a version using quantifiedconstraints which causes all the nonsense to melt away
14:00 <edwardk> There you get something like
14:00 <mniip> oh I see
14:00 <mniip> much like 'Eq a => Eq [a]' is a global dictinary
14:01 <mniip> it can be a local one
14:01 <DigitalKiwi> is edwardk streaming soon :D
14:01 <edwardk> class (forall a. (Show a, Read a) => Evident t a, forall a. Evident t (t a)) => Authenticated t where type Evident t a :: Constraint; auth :: Evident t a => a -> t a
14:01 <edwardk> DigitalKiwi: I'm in California through this coming weekend, but my travel schedule relaxes starting next weekend
14:02 <DigitalKiwi> ok
14:02 <edwardk> with the quantified constraints version, ideally i'd be able to state that thing directly, and 'authauth' and 'auths' and the unauth equivalents just vanish from that code
14:05 UnkDevE joined
14:05 <nshepperd> we could also make all those Eq1/Show1/etc typeclasses be properly related to the normal ones, that would be good
14:05 <edwardk> the code there is basically the stuff from http://www.cs.umd.edu/~mwh/papers/gpads.pdf implemented as a library in the spirit of bob atkey's implementation in ocaml
14:06 <edwardk> technically Eq1, Show1, etc. aren't quite the same as type Eq1 f = forall a. Eq a => Eq (f a)
14:06 <edwardk> they aren't strong and they aren't weaker, they are incomparable.
14:06 tsaka__ joined
14:07 merijn joined
14:07 <edwardk> Eq1 lets you supply the comparison yourself, but with Eq1 as a quantified constraint you'd have to be capable of fmapping to do the same.
14:07 codesoup joined
14:07 <nshepperd> hmm
14:07 ddellacosta joined
14:07 raichoo joined
14:07 <nshepperd> well, Eq1 lets you write Eq
14:08 <nshepperd> so doesn't that make it stronger?
14:08 <AWizzArd> I have a sum type and want to derive Eq. This would work perfectly with the exception of one data constructor, which takes a function argument. How can I specify: „Dear GHC, please derive Eq for all constructors with the exception of Foo where I do this manually”?
14:08 <edwardk> :t Data.Functor.Classes.liftEq
14:08 <lambdabot> Data.Functor.Classes.Eq1 f => (a -> b -> Bool) -> f a -> f b -> Bool
14:09 <edwardk> Data.Functor.Classes.Eq is 'stronger' in the sense that it can use a heterogeneous equality check and doesn't require you have a functor instance to substitute in a type with the equality you want
14:09 <edwardk> on the other hand
14:09 <edwardk> Eq1 as a quantified constraint gets you a real Eq instance
14:10 desperek joined
14:10 <edwardk> hence both of them are stronger in different ways, meaning neither properly subsumes the other
14:10 <nshepperd> instance (Eq1 f, Eq a) => Eq (f a) where { (==) = liftEq (==) }
14:10 <edwardk> nshepperd: my point is that both of these are valuable things, and having one doesn't give you the other
14:11 tsoernes joined
14:11 <edwardk> you can then debate forever which is "more useful" but there are scenarios in which each one is individually indispensible
14:11 <nshepperd> I don't understand
14:12 mreh joined
14:12 sdothum joined
14:12 <nshepperd> based on teh above instance, I should be able to write 'class (forall a. Eq a => Eq (f a)) => Eq1 f where { ... }'
14:12 lykrysh joined
14:12 <nshepperd> without invalidating any instances of Eq1
14:12 <nshepperd> and get both of these things for free
14:12 <edwardk> instance (Eq1 f, Eq a) => Eq (f a) where { (==) = liftEq (==) } -- says that _every_ Eq instance for anything that takes a parameter is formed that way.
14:13 <edwardk> that isn't the case
14:13 Novitsh left
14:13 <edwardk> instances only look at the right hand side to decide, irrevocably what to do
14:13 iAmerikan joined
14:13 <* [exa]> wishes the qualification separator wasn't arrow
14:14 <edwardk> if you say instance (Applicative f, Num a) => Num (f a) -- that works pointwise then you completely destroy the ability to make some other Num instance, like data Poly a = Poly [a] -- instance Num a => Num (Poly a) that does so in a different manner
14:14 <nshepperd> edwardk: well, I wouldn't actually write that instance
14:15 <nshepperd> edwardk: treat f as a metavariable
14:15 <nshepperd> irl you'll write your instances for Eq and Eq1 at the same time
14:15 <nshepperd> for the same f
14:15 twopoint718 joined
14:15 twopoint718 joined
14:15 <mniip> 1529503938 [17:12:18] <nshepperd> based on teh above instance, I should be able to write 'class (forall a. Eq a => Eq (f a)) => Eq1 f where { ... }'
14:16 <mniip> wrong
14:16 <mniip> you can't write liftEq
14:16 <* hackage> stackage2nix 0.7.1 - Convert Stack files into Nix build instructions. http://hackage.haskell.org/package/stackage2nix-0.7.1 (typeable)
14:16 <UnkDevE> is there a way of mixing IO and non-IO functions without using unsafePerformIO?
14:16 <edwardk> my point is that (forall a. Eq a => Eq (f a)) is weaker then Eq1 f in the sense that i can't build the functionality of liftEq from it. On the other hand, Eq1 as it exists today is weaker than (forall a. Eq a => Eq (f a)) in that i can't use it to get an Eq instance for (f a) from Eq1 f, and Eq a
14:16 <nshepperd> mniip: er, that class definition does the reverse
14:17 <edwardk> we _could_ extend Eq1, Show1, Read1, etf.
14:17 <edwardk> to carry around an extra member
14:17 <Ariakenom> UnkDevE: Just use let bindings
14:17 <edwardk> eq1 :: Eq1 f => Eq a :- Eq (f a)
14:17 <mniip> edwardk, like uhhh
14:17 <edwardk> or something like that
14:17 <nshepperd> yeah, that's what I mean, we could make Eq1 not weaker, once we have Quantified constraints
14:17 <mniip> observe :: ((forall a. Eq a => Eq (f a)) => r) -> r
14:17 <edwardk> or we could use quantified constraints to make a superclass for Eq1
14:17 Saukk joined
14:18 <edwardk> mniip: you need proxies or AllowAmbiguousTypes to use your version
14:18 <mniip> sure
14:18 <edwardk> with the constraints package the eq1 above is how i'd write it today probably
14:18 <Ariakenom> [exa]: What would be good? dots forall m. Monad m. a -> m a
14:18 <mniip> oh superclass for Eq1 sounds cool
14:19 Saukk joined
14:19 <mniip> what methods would it have?
14:19 Folkol_ joined
14:19 Rayben joined
14:19 <mniip> other than require (forall a. Eq a => Eq (f a))
14:19 <edwardk> mniip: what i mean is the (forall a. Eq a => Eq (f a)) is the 'superclass' context of Eq1
14:19 <nshepperd> the superclass can be (forall a. Eq a => Eq (f a))
14:19 <mniip> right
14:20 <edwardk> class (forall a. Eq a => Eq (f a)) => Eq1 f where liftEq :: (a -> b -> Bool) -> f a -> f b -> Bool
14:20 Rayben joined
14:20 hph^ joined
14:20 <UnkDevE> Ariakenom: Thanks, but in what way would you use the let bindings?
14:20 <edwardk> it also means things like the "Lifting" class in constraints can become trivial.
14:21 <AWizzArd> Is it possible to derive Eq for a sum type but for one constructor specify my own implementation? Or will I have to write out the whole implementation by myself, where for seven cases I will in the end just do x == y?
14:21 <nshepperd> right and that would make Eq1 a lot more usable imo
14:22 <edwardk> type Lifting p f = forall a. p a => p (f a)
14:22 <Ariakenom> UnkDevE: You could use do {print "hi"; let s = "world"; print s; return ();}
14:22 <edwardk> nshepperd: yeah i think we're in violent agreement there =)
14:22 Saukk joined
14:22 <edwardk> AWizzArd: factor out the one constructor you want to make magic into its own data type, then you can derive for the thing that just delegates out to that
14:23 <AWizzArd> edwardk: yes okay, that could work.
14:23 nicht joined
14:23 <Ariakenom> UnkDevE: do{} is also an expression. do {print ""; let s = "" in do {print s; return ()}}
14:23 nicht_ joined
14:23 <Taneb> :t eq1 elem
14:23 <lambdabot> error:
14:23 <lambdabot> • Variable not in scope: eq1 :: (() -> [()] -> Bool) -> t
14:23 <lambdabot> • Perhaps you meant ‘eqT’ (imported from Data.Typeable)
14:23 <Taneb> :t liftEq elem
14:23 <lambdabot> error:
14:23 <lambdabot> • Variable not in scope: liftEq :: (() -> [()] -> Bool) -> t
14:23 <lambdabot> • Perhaps you meant one of these:
14:24 <edwardk> :t Data.Functor.Classes.liftEq elem
14:24 <lambdabot> (Eq a, Foldable t, Data.Functor.Classes.Eq1 f) => f a -> f (t a) -> Bool
14:24 <Logio> UnkDevE: what kind of functions are you trying to combine?
14:24 <nshepperd> :O what if we could also have 'class (forall a. MonoFoldable (f a)) => Foldable f'
14:24 <edwardk> nshepperd: good luck getting that one into base any time soon ;)
14:25 sdothum joined
14:25 <edwardk> Prelude tends to be pretty conservative
14:25 dogweather joined
14:25 <UnkDevE> Ariakenom: Im thinking the other way round a IO function to a pure function e.g. f = do {putStrLn "hello world"; return 1;} g = f + 1`
14:25 amirpro_ joined
14:26 <UnkDevE> Logio: IO a and a
14:26 <edwardk> Data.Functor.Classes is kinda off in niche territory and could justify getting away with functionality on the bleeding edge that doesn't rule out any of the standard instances. MonadTrans could also kinad justify it as every legit transformer passes the test as well
14:26 <Taneb> > Data.Functor.Classes.liftEq elem "abc" ["aej", "banana", "oxford"]
14:26 <edwardk> but i'm guessing both of those will be a big fight when we go to do them
14:26 <lambdabot> error:
14:26 <lambdabot> Not in scope: ‘Data.Functor.Classes.liftEq’
14:26 <lambdabot> No module named ‘Data.Functor.Classes’ is imported.
14:26 <nshepperd> and then we'll move all the methods of every Prelude class into the corresponding Mono class
14:26 <Taneb> :|
14:27 <edwardk> nshepperd: and shortly thereafter i'll give up and become a hermit ;)
14:27 <nshepperd> :)
14:27 <Ariakenom> UnkDevE: No. g should become IO Int. g = do {x <- f; return (x+1)}
14:28 <edwardk> @let import Data.Functor.Classes
14:28 <lambdabot> Defined.
14:28 <edwardk> > Data.Functor.Classes.liftEq elem "abc" ["aej", "banana", "oxford"]
14:28 <lambdabot> False
14:28 <Taneb> > Data.Functor.Classes.liftEq elem "abc" ["aej", "banana", "cambridge"]
14:28 <lambdabot> True
14:28 <Logio> UnkDevE: the main point of the IO type is that you can never escape it (without using unsafeFunctions; that's why they're unsafe)
14:28 <UnkDevE> right ok
14:29 quobo joined
14:29 <jchia_1> Is there a library that lets me query in-memory data (e.g. lists or vector of records) like i would a RDBMS with SQL or SQL-like constructs performing joins, groupbys, aggregation etc without actually using a SQL engine talking to a server.
14:29 <UnkDevE> you see I have one pattern constructor that returns a and another that returns IO a, how do I get both to return IO a?
14:30 <Logio> :t return
14:30 <lambdabot> Monad m => a -> m a
14:30 <Logio> IO is a monad, so you can use return
14:30 <edwardk> jchia_1: tables used to kinda offer that functionality, but then there was a bug and i never fixed it and deprecated it
14:31 <nshepperd> like a blanket, monads make me feel warm and protect me from the RealWorld
14:31 tomphp joined
14:31 <Logio> UnkDevE: for instance, if I have f x = x + 1 of type Int -> Int, defining g = return . f gives me Int -> IO Int (if I specify the type)
14:32 <UnkDevE> oh cool, thank you!
14:32 language_agnosti joined
14:32 juri_ joined
14:32 zori joined
14:32 omilu joined
14:33 <Logio> you'll probably want to take a look at the Applicative typeclass actually
14:34 Solonarv joined
14:34 <merijn> jchia_1: SQLite?
14:34 <Taneb> edwardk: I still take a look at tables every few months
14:34 <merijn> jchia_1: That has both an in-memory and on disk option
14:34 <Logio> there they define pure (which is exactly the same as return), but also a ton of nice operators for combining functions and values in certain ways
14:35 enterprisey joined
14:35 <merijn> jchia_1: All the benefits of SQL, without having to invest the effort to run a server :p
14:36 RegEchse joined
14:36 <Ariakenom> I suppose SQLite is too much effort.
14:37 dan_f joined
14:37 <nshepperd> select :: (Ord k, Monoid v, Foldable f) => (a -> k) -> (a -> v) -> f a -> Vector (k, v) -- i've used this before for quick sql-like hacking on data
14:38 codesoup joined
14:38 <jchia_1> merijn: That should work. I haven't written the code so it's hard to say whether sqlite will make the code simpler or more complicated.
14:39 <jchia_1> one tradeoff is the use of IO
14:40 <mniip> edwardk, are you saying T2893 is in master now?
14:41 simon1 joined
14:41 amar_ joined
14:42 simon1 left
14:42 gsingh93_ joined
14:43 ElCambur joined
14:44 alx741_ joined
14:44 <edwardk> mniip: somebody else said it, not me
14:44 jmcarthur joined
14:45 <quicksilver> jchia_1: there is this - https://hackage.haskell.org/package/HaskRel
14:45 <edwardk> jchia_1: if you just need to do a few joins there is support for linear time joining in the discrimination package
14:45 <quicksilver> which I haven't heard of
14:45 <mniip> edwardk, looks like it is
14:45 <mniip> I see tests in the repo
14:45 webstrand joined
14:46 dfeuer joined
14:46 alexteves joined
14:47 <jchia_1> edwardk: I'm looking for something to make the code clearer. I have ad-hoc code that does aggregation, grouping and joining of different record types all over the place that I think can expressed more clearly using SQL.
14:47 <* hackage> htoml-megaparsec - Parser for TOML files http://hackage.haskell.org/package/htoml-megaparsec- (vmchale)
14:47 mpahrens joined
14:47 dfeuer joined
14:48 <jchia_1> quicksilver: Have you used HaskRel?
14:50 plugin joined
14:50 <jchia_1> edwardk: Does discrimination do aggregation (sum and max)?
14:50 FreeBirdLjj joined
14:51 <maerwald> was there ever a discussion to port mtl to type families?
14:51 <quicksilver> jchia_1: nope :)
14:53 gentauro joined
14:53 <edwardk> joining :: Discriminating f => f d -> ([a] -> [b] -> c) -> (a -> d) -> (b -> d) -> [a] -> [b] -> [c] -- is pretty general. f there can be Grouping or Sorting. d is the type of the part you want to join on, the ([a] -> [b] -> c) is given the lists of things you are trying to cross product together -- and can be used to compute inner/outer/left/right, etc. joins
14:54 <edwardk> maerwald: yes. monads-tf exists. its a trashfire
14:54 plugin joined
14:54 <edwardk> it really needs to use separate module names, but basically caused a pretty big mess when it was released. mind you at the time there was a fight between mtl, monads-fd and monads-tf splitting the community 3 ways all supplying the same module names with incompatible APIs
14:55 HarveyPwca joined
14:55 <edwardk> monads-fd and mtl merged back together to give us the current story
14:55 <edwardk> monads-tf was left to die
14:55 <maerwald> because I just read a rant about UndecidableInstances and mtl obviously makes quite some use of it
14:56 <edwardk> in theory if monads-tf was moved so that its modules were in a new space, like Control.Monad.Family.* or whatever then it could continue to exist alongside the monads-fd that was renamed to mtl
14:56 gsz joined
14:56 <edwardk> maerwald: the cure is kinda worse than the disease there. the subset of UndecidableInstances used by the mtl are really decidable
14:56 <edwardk> its just that ghc isn't smart enough to check that
14:56 <maerwald> I see
14:56 progfun joined
14:57 <electrocat> smart enough? it's not decidable :p
14:57 <mniip> edwardk, rank2 inference when
14:58 <edwardk> electrocat: sure it is. In MonadState s m the 's' is _determined_ by m, due to the fundep and we're doing recursion shrinking the parameter that determines the other.
14:58 <electrocat> edwardk: in those cases sure, but not in the general case i mean
14:58 <edwardk> the basic decidable instances check doesn't know anything about fundeps because it predates the idea of MPTCs entirely
14:58 <edwardk> yes, like i said "_the subset of UndecidableInstances used by the mtl_ are really decidable"
14:58 <electrocat> but ofcourse, more refined termination conditions are always welcome :p
14:59 <edwardk> i started a ghc proposal a few months back when this came up last time. i just haven't had time to go back and flesh it out
14:59 <electrocat> yes i remember
14:59 hphuoc25 joined
15:00 <electrocat> have you found any concrete refined conditions?
15:00 <edwardk> yeah, basically use the paterson conditions in general, then you can do the sort of thing i mentioned in the proposal only when you recurse through the same typeclass in the manner specified.
15:00 <edwardk> that covers the mtl
15:00 <edwardk> its a matter of specifying that correctly
15:01 <electrocat> ok, i should read that sometime
15:01 <electrocat> maybe try them out
15:01 muddywatt joined
15:01 <dmwit> For mtl specifically, you can probably just use the Paterson conditions directly, but only on those arguments which are not to the right of a fundep arrow.
15:02 <edwardk> MonadState s m => MonadState s (ReaderT e m) -- works because its recursing through the same type parameter m, and m determines all the remaining type parameter.
15:02 <dmwit> But that probably relies on mtl not having any cyclic fundeps.
15:02 DSM joined
15:02 <edwardk> on the other hand the paterson conditions allow you to recurse through any typeclass you want at all
15:02 tsoernes joined
15:03 Linter joined
15:03 dogweather joined
15:03 <edwardk> dmwit: yeah the trick is handling all the multiple fundep situations which is the thing i was trying to cover with the proposal
15:03 <dmwit> yeah
15:03 <dmwit> That does seem tricky.
15:04 <edwardk> in the end the proposal i have can probably be tweaked slightly to work, the tweak is the thing i didn't have time to work out, as i immediately got stuck traveling for 2-3 months
15:04 <dmwit> Just pondered it for the last 30s and haven't solved it yet. ;-)
15:04 Boomerang joined
15:05 <edwardk> its a lot like totality checking in something like agda, etc. except you can't just infer an argument ordering, so its weaker
15:05 sgraf joined
15:05 <edwardk> the paterson conditions can be seen as an obvious sufficient condition for soundness, but they aren't the largest generally sound condition
15:06 lanelet joined
15:06 <dmwit> Of course. The largest sound condition isn't computable.
15:06 <edwardk> jchia_1: anyways that joining type signature i mentioned can do aggregation pretty easily.
15:07 <edwardk> dmwit: sure, just looking for better approximations than what we have that work in an open world situation
15:07 <edwardk> if we had a closed world situation then basically the agda style totality checker would be fine
15:07 <jchia_1> edwardk: Seems that I need to read the linked papers to grok this library. The links are broken. Do you have the titles?
15:07 <edwardk> google "fritz henglein discrimination"
15:07 __monty__ joined
15:08 cschneid joined
15:08 <edwardk> https://www.youtube.com/watch?v=cB8DapKQz-I might also be informative
15:08 <edwardk> the category theory flies fast and furious for a while but then it settles down into code
15:08 <jchia_1> I was referring to links on the github: https://github.com/ekmett/discrimination/
15:08 <jchia_1> Yeah, I saw the youtube link, too
15:08 Destol joined
15:09 <jchia_1> Oh, that's a different video
15:09 <edwardk> the 'fritz henglein discrimination' thing should get you 2-3 papers by fritz
15:09 <edwardk> the video i linked was a talk i gave on this particular library from before i solved the productive stable unordered discrimination problem i posed at the end of the talk
15:09 <jchia_1> Is this library easier or harder to understand than lens?
15:09 <dmwit> edwardk: Ah, got it. Here's what I think makes it hard.
15:09 xtreak joined
15:10 <dmwit> edwardk: Given any collection of variables that, by the fundeps, determines them all, applying the Paterson conditions consistently to that collection for all instances is going to work.
15:10 antsanto joined
15:10 <dmwit> edwardk: But a given collection of fundeps may have multiple possible such collections. So you need a heuristic for choosing one.
15:10 <dmwit> edwardk: But perhaps it's not hard to identify the conditions in which there's exactly one such collection.
15:11 <edwardk> actually even with multiple collections you can check them all, its just possibly expensive
15:11 <dmwit> So e.g. for no fundeps at all, the sole collection is all the variables.
15:11 <dmwit> edwardk: Oh, sure, you could check them all.
15:12 <dmwit> But that's also too strong.
15:12 <dmwit> (Still weaker than what we have now, of course.)
15:12 <dmwit> edwardk: Perhaps we could push this onto the class declaration to say which collection (if any) is the one which can be checked.
15:12 <edwardk> the problem is the open world assumption makes doing something weaker dangerously unsound
15:13 webstrand joined
15:13 <dmwit> edwardk: Why? If I choose collection "a b c" and the fundeps say that this determines all the remaining variables, then in every instance I check the Paterson conditions for "a b c" (and never choose a different collection to check), how is that unsound?
15:14 <edwardk> so the approach you're starting to take is the approach i took in https://github.com/ekmett/ghc-proposals/blob/decidable-instances/proposals/0000-decidable-instances.rst
15:14 <dmwit> Instead of "a b c", let me say "first argument, second argument, third argument".
15:14 <edwardk> the issue is more that you can recurse through other classes that have their own fundeps
15:14 gsz left
15:14 <edwardk> and you don't know what those things will be in advance
15:15 fizbin joined
15:16 <edwardk> the issue i had was the 2. Compute the set of structurally recursive parameters P. -- differs from the way the paterson condition checks it. in my case i have to loop through something that 'agrees' with my fundep structure in a nice way, trivially, i can always do so by recursing through the same class, but there may be others that i want to do the same for.
15:16 dogweather joined
15:16 <dmwit> I'll give it a read and see how my thoughts mesh with yours.
15:16 <edwardk> the paterson condition is sound regardless of fundeps, hence why i said it makes a viable fallback when i don't know anything about the fundeps of the other stuff i'm recursing through
15:17 markus1189 joined
15:17 <edwardk> https://github.com/ghc-proposals/ghc-proposals/pull/114 <- in there AntC raised a pile of issues mostly around these funny recursive cases
15:17 conal joined
15:17 <dmwit> brilliant
15:17 revprez_stg joined
15:18 bas080 joined
15:18 plugin joined
15:19 <edwardk> anyways once i incorporate the 'oh crap recursion can be through any class' which isn't a concern for the mtl-like usecase, then my step 2 needs some considerable refinement
15:20 language_agnosti joined
15:20 urodna joined
15:20 <edwardk> i just haven't had a chance to go through and completely rephrase the construction i wound up with in the terms i'd need to have to make that change, and then worked through how much of the simple algorithm i have remains sound
15:21 <jchia_1> Does this function exist in a commonly-used library? Lens' s a -> (a -> a -> a) -> s -> s
15:21 jfredett joined
15:21 <Taneb> jchia_1: what is that doing
15:21 <Taneb> :t \l f -> modify (join f)
15:21 <dmwit> Did you intend to have another -> s on the end, there?
15:21 <lambdabot> MonadState s m => p -> (s -> s -> s) -> m ()
15:22 <Taneb> :t \l f -> l %~ join f
15:22 <lambdabot> ASetter s t a b -> (a -> a -> b) -> s -> t
15:22 DSM joined
15:22 <edwardk> jchia_1: what are the two 'a's you want? the lens only gives you one
15:23 <jchia_1> Taneb: Actually, it wasn't very well thought out. I didn't say what to do with thou non-a parts of s
15:23 <jchia_1> Well, I'm trying to combine two s values by combining the individual parts, some with (+), some with max.
15:24 <edwardk> jchia_1: lens isn't going to be super helpful there, as it doesn't know how to break things into disjoint bits and pieces
15:24 humanoyd joined
15:24 <edwardk> unless you want to define an Iso between your s and some type that happens to be a monoid
15:25 <__monty__> edwardk: Any streams coming up in the near future?
15:25 <jchia_1> edwardk: That's what I'm doing now. I made two monoid wrappers, on that does (+) and one that does max.
15:25 <quicksilver> edwardk: was going to say, there are various things you can do with an Iso or a Lens to simple sum types
15:25 <quicksilver> which enable Lens to 'see' that your stuff breaks into disjoint components
15:26 philippD joined
15:26 <edwardk> __monty__: i get back to boston the 25th, but i may have to go down to new yrk the 28-29th, which would leave me kinda wiped out to do a stream on the 30th if it happens, if i don't have to then i can probably stream on the 30th, and regardless on the 7th, i'm definitely back and relaxed though
15:27 <__monty__> edwardk: Thanks, looking forward to it : )
15:27 <edwardk> jchia_1: Data.Semigroup and Data.Monoid should already have Sum and Min/Max
15:27 skeet70 joined
15:28 <mniip> goddammit gcc
15:28 <mniip> why is --enable-default-pie a thing now
15:29 <__monty__> mniip: To make code less exploitable?
15:30 <mniip> ASLR is just treating a symptom but that's beside the point
15:30 <mniip> it breaks compilation every so often
15:30 djbeau joined
15:30 pio_ joined
15:31 <jchia_1> Basically, I have this code for defining two ways for combining two Foo values, and I find it too verbose for a simple idea: https://gist.github.com/jchia/7daa8f4800748ed643c17646e8f7677c
15:33 pera joined
15:33 dogweather joined
15:34 jollygood2 joined
15:34 woodson joined
15:34 <NemesisD> i'm trying to debug a stack overflow. i can repro it by setting the stack size to something really small. however, when trying to compile for profiling i get an error "cannot load -prof objects when ghc is built with -dynamic". what do i do?
15:34 <jollygood2> hi
15:35 xkapastel joined
15:35 amar__ joined
15:35 merijn joined
15:36 <jollygood2> I have a single cabal file with two programs defined. when I type stack repl I get "The main module to load is ambiguous. Candidates are:" error. I can then pick which main module to use. but is there a way to specify that module in cabal or stack.yaml file?
15:37 codesoup joined
15:37 <dmwit> edwardk: I believe my proposal does not require computing the "structurally recursive" parameters at all.
15:37 <jollygood2> (my issue is that the emacs haskell mode that I am using doesn't let me pick main module)
15:37 mpahrens joined
15:38 <dmwit> edwardk: So may not fall to the same trap wrt recursing through multiple classes that yours does.
15:38 <mniip> so, -optl -no-pie
15:38 <mniip> but where do I stick that in configure
15:39 <edwardk> dmwit: the concerns i'd have are to make sure that things like class Foo s t a b | s -> a, t -> b, s b -> t, t a -> s -- don't break
15:39 diwo joined
15:40 amirpro joined
15:41 lainon joined
15:41 <dmwit> edwardk: I would expect that class to behave exactly the same way with what I'm proposing. (So no benefit, sadly, but no break.)
15:41 keepLearning512 joined
15:42 <dmwit> edwardk: Here's my proposal in a slightly more concrete way. Every class has a new piece of data attached to it (say, in the interface files).
15:42 tsoernes joined
15:42 diwo joined
15:42 <dmwit> edwardk: The new info is a collection of argument positions. (I'll talk about how this collection is chosen in a moment.)
15:43 dogweather joined
15:43 <dmwit> edwardk: The compiler is in charge of checking that the collection of argument positions is large enough that, together with the fundeps, all positions of the class are determined if you know the ones in the collection.
15:43 <edwardk> the info is giving you the order for the totality check?
15:43 <edwardk> ok, i know where you're going
15:43 <dmwit> yeah
15:44 <dmwit> Then you just apply the Paterson conditions, but only to the positions specified by each class.
15:44 <edwardk> its one of the early versions i had for the proposal here, it is sufficient for handling the simple mtl style version
15:44 <edwardk> its kinda annoying that you have to put the annotations in though
15:44 <dmwit> I think in many cases the annotations can be omitted.
15:44 <dmwit> So this is the part I deferred above.
15:44 <Solonarv> jchia_1: you could try using HKD, as in https://gist.github.com/Solonarv/913b0dd293f076a996cea4e9ce3a2224 -- not that much shorter though
15:45 <dmwit> In almost all situations, there is a *minimal* collection (as in a subset of all other determining collections).
15:45 <dmwit> In those situations, the compiler chooses the minimal collection with no annotation required.
15:45 <dmwit> (Otherwise, yeah, for `Foo` e.g. you would need an annotation, or fall back to the default collection which is "all the positions".)
15:46 <dmwit> In mtl in particular there is a minimal determining collection.
15:46 DTZUZO joined
15:46 <dmwit> I haven't worked out how the coverage check needs to be modified. Probably it has to stay exactly the same?
15:47 <edwardk> a potential middle ground is to just infer it when there is a minimal set, and leave everything else to UndecidableInstances and not even bother coming up with a syntax for the annotation
15:47 <dmwit> sure
15:47 <edwardk> that'd get you something larger than the current case, but smaller than my goal
15:47 <dmwit> But I think the annotation can be pretty syntactically cheap. e.g.
15:47 tauta joined
15:47 <dmwit> class Foo s t a b | s -> a, t -> b, s b -> t, t a -> s | s t -> a b -- or something
15:48 <edwardk> it just increases the "syntactic attack surface" of the proposal ;)
15:48 <edwardk> i'd expect it to be a pragma of some sort actually
15:49 <jollygood2> showText on Data.Text.Internal.Text giving me Text [<list of numbers>] 0 3158 instead of actual string. what can I use instead? (read . show) worked, but isn't there a more straightforward way?
15:49 <dmwit> Oh, this wouldn't account for the `class (Foo a, Bar a) => Baz a; instance (Foo a, Bar a) => Baz a` thing, though.
15:49 <dmwit> That would still need UI.
15:49 <edwardk> yeah that is already kind of ailing though. since they decided to make that require MonoLocalBinds to use now all of a sudden
15:49 mpahrens joined
15:49 <edwardk> it rather drastically damaged a bunch of my APIs
15:50 <Solonarv> jollygood2: what are you trying to do?
15:50 <dmwit> jollygood2: unpack
15:50 <Solonarv> if you want to convert a Text into the equivalent String, use Data.Text.unpack
15:50 <jollygood2> Solonarv get a String that contains actual text from Data.Text.Internal.Text
15:50 <dmwit> jollygood2: But generally you should try to stay within Text for your operations and never go to String at all.
15:50 <jollygood2> oh right, I remember now
15:51 tsoernes joined
15:51 <dmwit> jollygood2: Right, we understand you want a String. But why do you want a String? Who's going to consume that String?
15:51 <Solonarv> I've definitely found myself having to use pack/unpack because of APIs using String (grr)
15:51 <jchia_1> Solonarv: Yeah, neat idea, expresses the combination in a more general way but still needs boilerplate.
15:52 <jollygood2> dmwit all the string functions I ever wrote use String. so do many Prelude functions. and since parsing the little text I have is not performance critical, I'll just use String
15:52 adLucem joined
15:52 <adLucem> hey people
15:52 <adLucem> I'm trying to find an off-the-shelf NLP library in haskell
15:53 <adLucem> Something like, say, python's NLTK, or even better, python's spacy library- in haskell
15:53 <adLucem> (dependency parsing- of english- is the particular task I want to do)
15:53 <adLucem> is there a library like this?
15:54 conal joined
15:54 amirpro_ joined
15:56 dogweather joined
15:56 <jchia_1> adLucern: I'm not familiar with this field in Haskell, but have you checked out the NLP category on hackage? https://hackage.haskell.org/packages/#cat:Natural%20Language%20Processing
15:58 Quora joined
16:00 <adLucem> @jchia_1 not what I was looking for. Thanks anyway :)
16:00 <lambdabot> Unknown command, try @list
16:00 <adLucem> I think I'll write a haskell wrapper for an existing dependency parsing tool then?
16:01 FreeBirdLjj joined
16:01 vikaton joined
16:01 keepLearning512 joined
16:03 <paraseba> I'm trying to optimize a function that uses mutable vectors. If I let ghc deduce the function signature, I look at the generated core and it's all nice and fast, using primitive arithmetic. If I copy the deduced type signature from the generated core, and I add it verbatim to my code, the generated code is slow, using boxed arithmetic.
16:03 <paraseba> what am I doing wrong?
16:03 fmixing_ joined
16:03 amar_ joined
16:03 <paraseba> this is the type of the function in question: Data.Vector.Generic.Mutable.MVector v Int8 => [Op] -> v RealWorld Int8 -> Int -> IO Int
16:04 allenj12 joined
16:05 karlguy joined
16:07 Gurkenglas joined
16:08 reactormonk joined
16:10 Forlorn_ joined
16:11 philippD_ joined
16:12 oisdk joined
16:12 Noldorin joined
16:14 <cocreature> paraseba: sounds like you are hitting the monomorphism restriction which will cause GHC to not use the most general type when you don’t declare it
16:14 nitaigao left
16:14 <NemesisD> uhh, is replicateM_ known to leak space or something? i took some code that was previously running replicateM_ 1000000000 doSomething and it blew the stack, but let go n = if n < 1000000000 then doSomething >> go (n + 1) else return () and it ceases to blow the stack
16:15 roconnor joined
16:15 <Taneb> NemesisD: that's odd... that should be exactly what replicateM_ is doing
16:15 nitaigao joined
16:15 <paraseba> cocreature: the thing is I'm copying the function's type from what the generated core shows. I'm explicitly writing the type ghc deduced, and that changes completely the generated code. Anyway, any idea how I could test your hypothesis ?
16:16 <cocreature> paraseba: what do you mean by “the type ghc deduced”? how are you getting this type? you won’t see that exact same type in core since core has a different type system than Haskell
16:16 <cocreature> NemesisD: which Monad?
16:16 <mnoonan> NemesisD, it looks like replicateM_ uses (*>), any change that might have issues for your monad?
16:17 <NemesisD> Taneb: looking at the source of replicateM_ it looks pretty much the same except it is counting down instead of up and it uses *> instead of >>
16:17 <cocreature> NemesisD: my guess would be that you are using an older version of transformers which has broken definitions for (*>)
16:17 <NemesisD> right now the monad is KatipT IO, which is just a newtype over a ReaderT, i can see if it persists if i reduce that to just IO
16:18 hololeap joined
16:18 <cocreature> try replacing >> by *> in your manual loop
16:18 <NemesisD> i'm on stackage lts 10.10 which uses
16:18 epsilonhalbe joined
16:18 epsilonhalbe left
16:18 rihards joined
16:19 bblfish joined
16:19 <NemesisD> cocreature: bingo
16:20 <cocreature> NemesisD: iirc the fixes are in 5.3
16:20 <cocreature> eh 0.5.3
16:20 <NemesisD> i see in transformers- a changelog of Defined explicit method definitions to fix space leaks
16:20 <cocreature> huh right, I might be mixing up versions here
16:21 <Taneb> cocreature: I'm trying to look at the history of the files of transformers and (>>) and (*>) for ReaderT were added in the same commit
16:21 <Taneb> (looking at a git mirror because darcshub is down)
16:21 <NemesisD> yiikes, lts is still on
16:21 <paraseba> cocreature: the generated core has type signatures that look just like the haskell ones, at least with all the -dsupress- options I'm using
16:21 <cocreature> stackage can’t upgrade transformers because it depends on ghc
16:21 <cocreature> paraseba: can you show us the relevant core?
16:22 <NemesisD> this seems like it would have widespread consequences
16:22 <paraseba> definitely, let me put it in a gist
16:22 <[exa]> how's (*>) semantically different from (>>)?
16:22 <Taneb> [exa]: they should be identical if (>>) is defined
16:22 <[exa]> like, wondering what difference triggered the problem
16:22 <cocreature> [exa]: it’s not. the problem is that a bunch of functions in base got switched over to use (*>) instead of (>>) and the default implementation of (*>) can have space leaks
16:22 <Taneb> But I think they have different (but provably equivalent) default implementaitons
16:23 <[exa]> cocreature: oh so, thanks
16:23 <NemesisD> we've been having mysterious space leaks in production for some time, maybe this is to blame
16:23 <Taneb> Aaah, the fix was in 0.5.3 as cocreature said
16:23 <NemesisD> time to go to nightlies i guess
16:23 <cocreature> just add it to extra-deps
16:24 oisdk joined
16:25 <cocreature> https://www.reddit.com/r/haskell/comments/7xqfy8/space_leak_with_nested_strict_statet/dud4oqt/ has some information on the problem for StateT
16:26 twopoint718 joined
16:27 pipahask joined
16:28 <NemesisD> @cocreature but i thought it was linked to the ghc version. so why would i be able to use a ghc old enough to be stuck with and use >=
16:28 <lambdabot> Unknown command, try @list
16:28 Nakaori joined
16:29 mizu_no_oto joined
16:29 unyu joined
16:29 <cocreature> NemesisD: stackage provides a consistent snapshot so there can be only one version of each package. that snapshot always includes the "ghc" package which has a dependency on "transformers" and can’t be reinstalled so stackage has to stick to the transformers version shipped with GHC. however, if your project doesn’t depend on the "ghc" package then you can use a newer version of transformers
16:30 <cocreature> note that “depending on the ghc package” also includes things like "doctests" which use the GHC API
16:30 <NemesisD> i guess we'll see, haha
16:30 <EvanR> nested StateT...
16:31 <EvanR> on one hand, that is the point of the Ts, to nest them
16:31 <EvanR> on the other hand... why would you want nested states
16:31 doyougnu joined
16:32 <NemesisD> reinstalling 211 packages
16:32 <maerwald> EvanR: well, not nested, but multiple
16:32 <cocreature> maybe you should stop depending on acme-everything :)
16:32 <NemesisD> tell me about it, lol
16:32 Destol joined
16:33 <paraseba> cocreature: here https://gist.github.com/paraseba/bee7e8d2f26efbbffc18a027434f9824
16:33 <EvanR> yeah you want multiple states
16:33 <EvanR> but doing it by nesting sounds masochistic, given the interface
16:33 <maerwald> that's the nature of transformers :>
16:34 <maerwald> masochism
16:34 <EvanR> class MonadMasochism
16:34 keepLearning512 joined
16:35 kritzefitz joined
16:35 keepLearning512 joined
16:35 son0p_ joined
16:36 louispan joined
16:36 takuan joined
16:36 <cocreature> paraseba: is the "mutableEval" definition actually the one that is being used?
16:36 hphuoc25 joined
16:37 <cocreature> paraseba: anyway, I don’t think it’s too helpful to mess with core here. try giving a more specific type signature where you fix the vector type and see if it performs the same as the one without the type signature
16:37 <paraseba> It has a couple more cases for other Op constructors, but the behavior is the same if I comment out those other cases and leave only MRight
16:38 <paraseba> I'll give that a try, I did try using SPECIALIZE pragma, but I'll be more specific in the type signature
16:38 <cocreature> no I meant is that definition the one that is being used at the usesite
16:38 diwo joined
16:39 <paraseba> hmm I'm not sure what you are asking. If I don't have some other function with similar name somewhere else and getting confused? In that case no, very small code base, just this function is relevant in this module
16:39 nerdboy1990[m] joined
16:40 <cocreature> paraseba: no I mean the usesite could already inline that function, use a specialized version of this function, …
16:40 ccomb joined
16:41 <AWizzArd> Is there some function similar to `maybe` which implicitly returns a Just value, so that I can save using `id` here? maybe Foo id (M.lookup name vars)
16:41 <paraseba> cocreature: it does, when I'm not giving the type signature it does inline it, with the primitive arithmetic, and using something that looks like the ByteBuffer under the vector
16:41 <paraseba> cocreature: giving the function the type signature: mutableEval :: [Op] -> UV.MVector (RealWorld) Int8 -> Int -> IO Int
16:41 <cocreature> paraseba: alternatively try enabling NoMonomorphismRestriction and see if that makes the version without the type signature as slow as the one with the type signature
16:41 <Solonarv> @hoogle fromMaybe
16:41 <lambdabot> Data.Maybe fromMaybe :: a -> Maybe a -> a
16:41 <lambdabot> Distribution.Compat.Prelude.Internal fromMaybe :: () => a -> Maybe a -> a
16:41 <lambdabot> Data.Strict.Maybe fromMaybe :: a -> Maybe a -> a
16:41 mpahrens joined
16:41 <AWizzArd> That’s it, thx!
16:42 dogweather joined
16:42 <paraseba> cocreature: still getting non primitive arithmetic with that type signature
16:42 <paraseba> cocreature: nice!! I'll give that a try
16:42 <cocreature> hm if the explicit type signature doesn’t help something weird is going on
16:42 jfredett joined
16:42 <cocreature> paraseba: is your full project public somewhere?
16:43 <paraseba> cocreature: no, but I could make it public tonight, it's a stupid BrainFuck evaluator anyway. It's just driving me crazy that the generate code is so slow, and i wanted to learn how to optimize it
16:43 <woodson> can anyone explain this syntax for me somefunc :: forall e. Eff (console :: CONSOLE, random :: RANDOM | e). I see it being used in puresript. I get that its just passing a tuple but the vertical bar and the type variable e is throwing me off. I kinda have a sense of whats happening just want someone to explain to me whats actually happening under the hood
16:44 <cocreature> paraseba: are you calling this function from another module?
16:45 <paraseba> cocreature: I am calling a different one that calls this one, I played with different export lists to no avail
16:45 <cocreature> woodson: it seems like you’ll have a better luck asking about purescript syntax in a purescript channel :)
16:45 <cocreature> paraseba: ah! maybe try adding an INLINABLE pragma
16:45 <paraseba> cocreature: {-# LANGUAGE NoMonomorphismRestriction #-} didn't help
16:45 <paraseba> I have that cocreature
16:46 <cocreature> then I’m out of ideas :/
16:46 <paraseba> I think I have it down to the native/non-native arithmetic generated, that makes the code twice as fast, and seems independent of almost everything else except adding the signature or not
16:47 <paraseba> cocreature: I'll push the project tonight and ping you, in case you want to give it a look
16:47 <woodson> cocreature: Oh ok, I thought that it was some haskell extension thats why I though I'd ask here first
16:48 enterprisey joined
16:49 Ariakenom joined
16:49 amar_ joined
16:49 kuttifunk1 joined
16:49 ijks joined
16:50 gabiruh joined
16:53 oisdk joined
16:54 connrs joined
16:55 ijks_ joined
16:55 lumm_ joined
16:56 __monty__ joined
16:59 <NemesisD> @cocreature updating transformers did the trick. thank you!
16:59 <lambdabot> Unknown command, try @list
16:59 DSM joined
16:59 superguest joined
17:01 <superguest> is Haskell lazy and strict with the 2nd parameter of (||) ?
17:01 <superguest> > True || "hello"
17:01 <lambdabot> error:
17:01 <lambdabot> • Couldn't match expected type ‘Bool’ with actual type ‘[Char]’
17:01 <lambdabot> • In the second argument of ‘(||)’, namely ‘"hello"’
17:03 <Solonarv> it's lazy, but your example has nothing to do with laziness - that's a type error
17:03 <Solonarv> > True || error "boom" -- this doesn't throw an error
17:03 <lambdabot> True
17:03 <Solonarv> > False || error "boom" -- this does
17:03 <lambdabot> *Exception: boom
17:04 amar_ joined
17:04 pfurla joined
17:04 <superguest> :t error "boom"
17:04 <lambdabot> a
17:04 <Solonarv> > True || _
17:04 dpyro joined
17:04 <lambdabot> error:
17:04 <lambdabot> • Found hole: _ :: Bool
17:04 <lambdabot> • In the second argument of ‘(||)’, namely ‘_’
17:04 Franciman left
17:05 <Solonarv> this tells you that the second argument of (||) must be a Bool
17:05 <Solonarv> :t "hello"
17:05 <lambdabot> [Char]
17:05 <Solonarv> but "hello" is [Char], which is a different type than Bool
17:05 <superguest> Why is `error "boom" ` okay? lambdabot tells us it's `a`
17:06 conal joined
17:07 oreigu joined
17:07 fragamus joined
17:07 <Solonarv> `a` is a type variable, which means it can be replaced with any other type
17:08 <dmwit> I suppose there's two questions you might be thinking. One is "why is `error`'s return type so polymorphic?"; one is "why can we use a polymorphic value as a Bool?". Or maybe it's yet a third question.
17:08 Nakaori left
17:09 replay joined
17:09 <superguest> the application of `error boom` returns something of type `a` (a type variable)
17:10 nnplv joined
17:10 <geekosaur> consider that a type signature is a contract between a function and its caller. here, "error" promises to produce any type the caller asks for
17:10 <superguest> dmwit, both
17:11 <geekosaur> (which it does by throwing an exception, because there are no values that fit)
17:11 <dmwit> superguest: Okay. I have a garden path I want you to walk down, but it's a few steps long.
17:11 <dmwit> superguest: So bear with me.
17:12 S3ri0usMiah joined
17:12 <dmwit> superguest: First: are you comfortable with giving infinite loops the type `a`? That is, are you happy believing that no matter what type you pick, I can write an infinite loop that, were it to finish, would produce a value of that type?
17:13 pera joined
17:14 Azel joined
17:16 sakalli_ joined
17:16 huxing joined
17:17 davr0s joined
17:18 youtmon joined
17:20 andyhoang joined
17:20 Purlox joined
17:21 <superguest> so `error boom` is basically "Trust me for now"
17:22 lumm_ joined
17:23 <dmwit> I don't think so. But then I don't know what you mean by "trust", so...
17:23 Martin_Yorith joined
17:25 <superguest> Tells the caller that it'll get the type it's looking for
17:25 mitch_ joined
17:25 <dmwit> (I'm still happy to walk down my garden path with you, by the way; but I do want to check in occasionally that we're still walking together, which motivates the question I asked above.)
17:25 DSM joined
17:26 <dmwit> Well, yes, that is what the type of `error` says.
17:26 <dmwit> I don't see that knowing the type answers your question, though, which I understood to be "why does it have that type?" not "what does that type mean?".
17:26 vurtz joined
17:26 fds joined
17:28 <superguest> dmwit, I think I understoood geekosaur answer more. "error" _promises_ to produce any type the caller asks for.
17:29 nyberg joined
17:29 <superguest> it didn't keep its promise, and then the error?
17:29 <geekosaur> part of the trick here is that types are compile time, but exceptions are run time
17:29 <dmwit> Okay. If you are satisfied with this, then I am happy.
17:29 <dmwit> If I were you I would not be satisfied. But I am not you, so anything follows from that condition. =)
17:29 <geekosaur> it kept its promise by thinking outside the box
17:30 slack1256 joined
17:30 <geekosaur> because whether it actually keeps it or not doesn't matter if that computation doesn't exist any more
17:30 freeman42x]NixOS joined
17:30 <* hackage> ztar 0.1.0 - Creating and extracting arbitrary archives http://hackage.haskell.org/package/ztar-0.1.0 (brandonchinn178)
17:30 raingloom joined
17:31 conal joined
17:31 <slack1256> How applicable are GHC notes documentation for other projects? I don't see why it isn't more popular
17:32 <slack1256> I guess it has the same problem of documentation getting out of sync with code it represents
17:32 Linter joined
17:32 <geekosaur> a shortcoming of it is indexing
17:33 <slack1256> the lack of a global index?
17:33 <slack1256> Or the cross references?
17:33 <geekosaur> both to some extent
17:33 woodson joined
17:33 <geekosaur> there've been multiplle "oh, that shold reference this note over here that you didn't know about" on the ghc devs list the past couple weeks, for example
17:35 <slack1256> I see, indeed it is annoying
17:35 <slack1256> those two are then the main problems
17:35 bendo joined
17:37 psychicist__ joined
17:38 nyberg joined
17:38 allenj12 joined
17:38 mpahrens joined
17:40 osa1 joined
17:40 <dmwit> superguest: For what it's worth, I read `error "boom"` not as "trust me for now", but more like "you knew what you were getting into using a Turing complete language, now you get to suffer the consequences". Sort of the opposite of trust.
17:42 <dmwit> Specifically: every type has all the usual values of that type, plus an extra one (usually called "bottom") which represents infinite loops. So any time you have a term of a given type, you have to admit that it might eventually succeed at that type or it might loop forever.
17:43 <dmwit> `error` just hijacks that and forces you to admit that you'd be okay with the term failing before an infinite amount of resources have been wasted on looping.
17:43 danso joined
17:43 conal joined
17:45 <Ariakenom> dmwit: "But I am not you, so anything follows from that condition." I'm amused.
17:45 darkJedi joined
17:46 malorie joined
17:47 conal_ joined
17:47 <malorie> is there a preferred/recommended regex package for haskell? I'm working with Text, and I'm trying to match some unicode strings
17:48 mad_villain joined
17:49 humanoyd joined
17:49 bas080 joined
17:51 <Ariakenom> malorie: Are you sure you want regex, and have you considered a parser library?
17:51 jsomedon joined
17:52 ozzymcduff joined
17:52 <superguest> does Haskell do type-checking at compile time?
17:52 <Cale> superguest: Only, yes.
17:52 encod3 joined
17:52 <Cale> superguest: Types don't exist at runtime.
17:53 doomrobo joined
17:53 doomrobo joined
17:53 <Cale> (though e.g. Typeable provides a way to keep around and make use of type information at runtime)
17:53 <doomrobo> Is there a way to define a type family that takes on kinds that aren't * ? In particular, I have type-level integers that I'd like to have an LCM type family for
17:54 <doomrobo> otherwise, a dummy class with an associated type works for me
17:54 nowhere_man joined
17:54 lainon joined
17:55 <dmwit> malorie: I've enjoyed regex-tdfa for traditional uses and regex-applicative for parser-combinator-style uses.
17:55 <malorie> Ariakenom: well, my problem only requires the power of simple regular expressions. so I haven't considered a parser library yet.
17:55 <dmwit> doomrobo: Yes, you may declare the kind of a type family when you create it. You need some extension or other, but the compiler should tell you which one if you haven't already got it on.
17:55 <dmwit> KindSignatures, I think? I never bother to remember them all.
17:56 <Ariakenom> malorie: Allright good. I'm unfortunately not familiar with any
17:57 <superguest> Cale, can you explain the idea of bottom (⊥) " a value that represents infinite loops". what's its purpose really?
17:57 <geekosaur> any time you have laziness, you have the potential for something to be infinitely lazy (i.e. never produce a value)
17:57 pfurla joined
17:57 <doomrobo> thansk dmwit !
17:58 <geekosaur> bottom represents that condition. you don't normally worry about it in a strict context because if it can happen it will happen; but with laziness, it only *might* happen.
17:58 <superguest> geekosaur, thanks for being a straight-forward with your answers. :-)
17:58 <Solonarv> that doesn't require laziness, it'll happen in any turing-complete language
17:58 <Ariakenom> Or an exception? Why are we only talking about nontermination.
17:58 <geekosaur> for example, ([1..]) never terminates, but (take 3 [1..]) does. so it's not enough to look at a subpart.
17:59 <dmwit> Exceptions are just fancy observable nonterminations. ;-)
17:59 <geekosaur> (in a strict language, both never terminate)
17:59 <superguest> and thanks providing those examples, they really help
18:00 <Ariakenom> A reason for not talking about it is that statements don't have types in many other languages
18:00 <malorie> dmwit: thanks. googling for regex packages for haskell, I stumbled upon this: https://github.com/Gabriel439/slides/blob/master/regex/regex.md it basically claims to be way faster than regex-applicative, but hasn't been made into a package unfortunately, afaics
18:00 <geekosaur> so we do have to be able to reason about this, therefore we speak of "bottoms". (which term has to do with "definedness", which … is a bit complex. "bottom" is shorthand for "least defined value".)
18:00 bodisiw joined
18:02 <geekosaur> Haskell's type system doesn't know about nontermination or bottoms, except insofar as if anything claims to be able to produce a value of *any* type (like undefined or error do), it must produce bottom i.e. some form of nontermination
18:02 brandly joined
18:02 <geekosaur> :t forever
18:02 <lambdabot> Applicative f => f a -> f b
18:02 <geekosaur> another form of nontermination
18:03 <johnw> @src forever
18:03 <lambdabot> forever a = let a' = a >> a' in a'
18:03 <geekosaur> that one just keeps repeatedly applying an Applicative, with no way to stop (except something throwing an exception)
18:03 <johnw> guess that should be *> these days
18:03 <geekosaur> yes
18:04 <geekosaur> the @src database is manually curated, nobody's updated ut
18:04 <geekosaur> it
18:04 <* johnw> summons the great Curator
18:05 <geekosaur> anyway. one of the tricks here is that "bottom" isn't necessarily permanent in Haskell. it refers to *any* laziness that hasn't been forced. Bottoms that aren't forced don't cause loops or exceptions, which is why (take 3 [1..]) terminates
18:05 vukasink joined
18:06 <johnw> i.e., undefined isn't a problem if you never need the definition?
18:06 nicht_ joined
18:06 <geekosaur> at any given time, the value of [1..] is a list whose final element is bottom, and as long as you don't try to completely enumerate the list this is not a problem
18:07 <geekosaur> first it's ⊥, then 1:⊥, then 1:2:⊥, then … extending by one item each time a value is demanded from it. so (take 3) never goes beyond demanding a third value, and the final ⊥ never "explodes"
18:07 KeyJoo joined
18:08 acertain joined
18:08 <dmwit> uh
18:08 <dmwit> [1..] is not bottom, and never is.
18:09 seveg joined
18:09 <dmwit> There are no bottoms in [1..] at any time.
18:09 webstrand joined
18:09 <dmwit> (Barring some stupid Num instance, since that is completely beside the point being made here.)
18:09 <geekosaur> at type Integer, its limit is available memory. which is outside your program
18:09 knupfer joined
18:11 <glguy> I've never heard of bottom being used ot refer to an unevaluated expression
18:11 <geekosaur> ghci does so, for one
18:11 <Cale> dmwit: Well, there's a way of looking at evaluation in terms of producing an increasing sequence of values in the type, starting from _|_ and going upward as each constructor is discovered. I think that's what geekosaur is getting at.
18:11 <geekosaur> yes
18:11 danthemy_ joined
18:11 <geekosaur> and conceptually [1..] is an infinite list
18:12 <geekosaur> at type Integer at least
18:12 <glguy> geekosaur: What do I need to type into GHCi to get it to do that?
18:12 <dmwit> glguy: :strace will print _ in place of thunks; this is probably what geekosaur is referring to.
18:12 <glguy> OK, but _ isn't bottom
18:13 <geekosaur> sorry, yes. I think it was one of the visualizers that used _|_ instead of _\
18:13 <geekosaur> but ghci uses hole syntax
18:13 <dmwit> glguy: Yes, this is my point, too. =)
18:13 <geekosaur> never mind, I see pointless pedantry wins yet again
18:13 <geekosaur> let's cause as much confusion as possible!
18:13 <glguy> The place I've seen _|_ used incrementally like that is when trying to show how many different ways a particular type can have undefined values
18:13 <glguy> but not simply to represent thunks
18:16 rootkea joined
18:16 amar joined
18:17 fishythefish joined
18:18 asheshambasta joined
18:19 nowhere_man joined
18:20 abhiroop joined
18:21 albertus1 joined
18:21 <nowhere_man> I'm reading the documentation of Control.Lens.Fold and Control.Lens.Indexed by I don't get how I'm supposed to use lenses to change a specific index in a list…
18:22 acidjnk joined
18:22 <Gurkenglas> > ix 2 +~ 1 $ [1..5]
18:22 <lambdabot> [1,2,4,4,5]
18:24 lortabac_ joined
18:24 fmixing joined
18:25 enterprisey joined
18:25 dogweather joined
18:25 fmixing joined
18:26 eschnett joined
18:27 FreeBirdLjj joined
18:27 fmixing joined
18:28 GodotMisogi joined
18:28 mnoonan joined
18:29 fishythefish joined
18:30 ozzymcduff joined
18:30 conal joined
18:31 ian_andrich joined
18:31 <johnw> i often can't figure out how to use indexed lenses without trial and error either
18:33 <glguy> nowhere_man: You can make lenses with 'at' and traversals with 'ix' for manipulating various things. Perhaps take a look through the instance lists in Control.Lens.At 's documentation to see what all those can be used with
18:33 Kacia joined
18:33 fmixing_ joined
18:33 <glguy> johnw: Yeah, once you start mixing in <. , .> , <.> , etc. things start to get quite fussy
18:34 <* hackage> non-empty-containers - http://hackage.haskell.org/package/non-empty-containers- (andrewthad)
18:34 <johnw> and the errors you get when you do it wrong... my goodness
18:36 UnChallengeD joined
18:37 lambda-11235 joined
18:38 fmixing joined
18:39 <nowhere_man> thanks, I'll look there
18:40 mpahrens joined
18:42 raichoo joined
18:44 mariatsji joined
18:45 bblfish joined
18:46 wildsebastian joined
18:47 oisdk joined
18:48 zachk joined
18:48 zachk joined
18:48 keepLearning512 joined
18:48 rahulr joined
18:48 Destol joined
18:49 wildsebastian joined
18:49 <* hackage> language-docker 6.0.2 - Dockerfile parser, pretty-printer and embedded DSL http://hackage.haskell.org/package/language-docker-6.0.2 (lorenzo)
18:49 vaibhavsagar joined
18:50 andyhoang joined
18:50 earldouglas left
18:50 plugin_ joined
18:55 otulp joined
18:56 paidnode joined
18:57 agander_ joined
18:59 alexteves_ joined
18:59 <lukelau> Is it possible to derive MonadUnliftIO?
19:01 diwo joined
19:02 cybai joined
19:03 raynold joined
19:04 Solonarv joined
19:05 justan0theruser joined
19:07 <Solonarv> lukelau: not in general, but it's possible with GeneralizedNewtypeDeriving
19:08 enterprisey joined
19:08 <nowhere_man> previously to importing Control.Lens, I didn't have access to ix
19:08 <nowhere_man> where is it defined?
19:09 <Gurkenglas> http://hayoo.fh-wedel.de/?query=ix says Data.Ix
19:09 <Gurkenglas> Wait, that's the wrong Ix :x
19:09 <Taneb> nowhere_man, Control.Monad.At
19:09 <Taneb> s/Monad/Lens
19:09 <Gurkenglas> says Control.Lens.At too
19:09 merijn joined
19:09 <nowhere_man> ha yes, At does the trick too
19:09 <nowhere_man> thx
19:10 amirpro joined
19:10 <nowhere_man> I didn't know Hayoo
19:10 toovs joined
19:11 agander joined
19:12 <cocreature> nowhere_man: you can also use the new hoogle https://hoogle.haskell.org/?hoogle=ix
19:12 UnChallengeD joined
19:13 <nowhere_man> I was using https://www.haskell.org/hoogle
19:13 <nowhere_man> not as useful as your one
19:15 amirpro joined
19:15 pikajude joined
19:15 <nowhere_man> Hmmm, the alpha version lacks type highlighting, that was a very useful feature
19:16 iAmerikan joined
19:17 blankhart joined
19:20 rootkea left
19:24 DSM joined
19:24 sid2k joined
19:26 raingloom joined
19:29 acertain joined
19:30 darjeeling_ joined
19:37 drbrule joined
19:38 <cocreature> yeah the typesearch in the new hoogle is pretty bad but if you are just looking for an identifier, it is definitely the better choice
19:40 lainon joined
19:41 iAmerikan joined
19:42 <maerwald> hayoo is better
19:44 detrumi joined
19:44 danso joined
19:44 lumm joined
19:45 jao joined
19:46 mpahrens joined
19:48 enterprisey joined
19:49 dogweather joined
19:50 davr0s joined
19:50 Deide joined
19:52 andyhoang joined
19:52 knupfer joined
19:53 abhiroop_ joined
19:54 mnoonan_ joined
19:56 gehmehgeh joined
19:56 hongminhee joined
19:57 <superguest> > data Fruit = Apple | Banana | Cherry deriving (Eq, Ord, Show)
19:57 <lambdabot> <hint>:1:1: error: parse error on input ‘data’
19:57 sns joined
19:58 cur8or joined
19:58 abhiroop joined
19:58 Bob joined
19:58 tomphp joined
19:59 <superguest> Anyway, my question is `..` is only for arithmetic sequences, right?
19:59 <fr33domlover> :t (..)
19:59 <lambdabot> error: parse error on input ‘..’
19:59 <superguest> i.e., [Apple .. ] is wishful (silly thinking)
19:59 <fr33domlover> superguest, it's for types that are Enum instances
19:59 <dmwit> superguest: No, it is for any instance of `Enum`.
19:59 plugin joined
20:00 <fr33domlover> superguest, it can be your Fruit type too
20:00 <dmwit> ?let data Fruit = Apple | Banana | Cherry deriving (Show, Enum)
20:00 <lambdabot> Defined.
20:00 <dmwit> > [Apple ..]
20:00 <lambdabot> [Apple,Banana,Cherry]
20:00 <dmwit> > [Apple..] -- fun and common failure mode
20:00 <lambdabot> <hint>:1:9: error: parse error on input ‘]’
20:00 <superguest> derived instance is a fantastic creation
20:01 <superguest> just like that. ^^
20:01 <dmwit> > enumFrom Apple
20:01 <lambdabot> [Apple,Banana,Cherry]
20:01 <dmwit> (There is also `enumFromTo` and `enumFromThenTo`.)
20:01 <* hackage> self-extract 0.3.0 - A Haskell library to make self-extracting executables http://hackage.haskell.org/package/self-extract-0.3.0 (brandonchinn178)
20:02 Linter joined
20:03 <dmwit> [a ..] -> enumFrom a; [a .. b] -> enumFromTo a b; [a, b ..] -> enumFromThen a b; [a, b .. c] -> enumFromThenTo a b c
20:03 <Zipheir> Hi all. If I'd like to have long and short formats for displaying a type, is there any elegant Show magic to do this?
20:04 <johnw> Zipheir: for any type, no; for your type, you could write long and short functions
20:04 enterprisey joined
20:04 <Zipheir> johnw: Right.
20:05 <dmwit> ?hackage ipprint Zipheir
20:05 <lambdabot> http://hackage.haskell.org/package/ipprint Zipheir
20:05 sdothum_ joined
20:06 <Cale> Zipheir: usually I tend to stick to the convention that Show instances should pretty much always be the derived ones, since it's useful for debugging that the result is valid Haskell code.
20:06 beauby joined
20:06 <Cale> But nothing is stopping you from writing other functions for converting things into text of course :)
20:07 keepLearning512 joined
20:07 <Zipheir> Cale: That does seem like a good practice.
20:08 <Zipheir> dmwit: Looks useful, thanks.
20:09 slack1256 joined
20:11 patlv joined
20:12 darjeeling_ joined
20:12 theelous3 joined
20:13 chaosmasttter joined
20:14 iAmerikan joined
20:15 Kacia joined
20:15 <superguest> dmwit, just a small question. When you showed: enumFrom a; [a .. b]
20:15 diwo joined
20:16 <superguest> shouldn't it be enumFrom a; [a .. a] ?
20:16 <superguest> since elements of a list must be of the same type?
20:16 <superguest> and that `a` denotes `b` I presume to be a different type
20:17 <glguy> superguest: a isn't intended to be a type variable in that
20:17 <glguy> Those are both value-level variables
20:17 <glguy> :t enumFrom
20:17 youtmon joined
20:17 <lambdabot> Enum a => a -> [a]
20:17 fizbin joined
20:17 <glguy> :t enumFromTo
20:17 <lambdabot> Enum a => a -> a -> [a]
20:18 <glguy> but the syntax [a .. b] desugars to the expression (enumFromTo a b)
20:18 bblfish joined
20:18 conal joined
20:19 <glguy> :t \a b -> [a .. b]
20:19 <lambdabot> Enum a => a -> a -> [a]
20:19 <glguy> the 'a' in the expression and the one in the type are different 'a's
20:19 drbrule joined
20:20 <glguy> :t \x y -> [x .. y]
20:20 <lambdabot> Enum a => a -> a -> [a]
20:20 abhiroop joined
20:20 jameseb joined
20:21 ozzymcduff joined
20:22 oisdk joined
20:22 chessai joined
20:23 iAmerikan joined
20:25 <nowhere_man> I got a <<loop>> issue with my program, I'm not sure how to get around it
20:25 <nowhere_man> the cleanest way, at least
20:25 <fishythefish> nowhere_man: probably by eliminating the loop, but it's hard to say more without seeing code
20:25 <nowhere_man> I'm building an array for a dungeon map (doing Code of Kutulu on CodinGame)
20:26 <nowhere_man> I transform an Array of chars to an Array of Cells (data Cell = Cell CellType [Cell])
20:27 <nowhere_man> I use array with a list comprehension for all possible indices
20:27 <nowhere_man> and for each couple of coordinates, I create a Cell with the 4 adjacent cells
20:27 <nowhere_man> up to that point, it works
20:28 <nowhere_man> but if instead I create each cell as Cell type $ filter isNotWall adjacents, then I get <<loop>>
20:28 <glguy> nowhere_man: You can use a profiling build to get some stack trace information when your program loops
20:29 <glguy> running it afterward with: ./YourProgram +RTS -xc
20:29 <nowhere_man> I guess I can build the Array twice, first with all 4 connections, then twice with filtering, is there a better way?
20:32 <fishythefish> nowhere_man: can you provide the actual code? right now, we're guessing at how you've defined/implemented everything
20:32 reactormonk joined
20:32 <fishythefish> @where lpaste
20:32 <lambdabot> http://lpaste.net/
20:34 dogweather joined
20:35 lanelet joined
20:35 initiumdoeslinux joined
20:37 <statusfailed> I found this library ixset-typed, which is a bit like a Map with multiple indexes - does anyone know of similar/alternative libraries?
20:38 <nowhere_man> fishythefish: https://lpaste.net/344124749829373952
20:38 mpahrens joined
20:39 <nowhere_man> glguy: I tried -O t GHC
20:39 <nowhere_man> ha, crap
20:39 <nowhere_man> I typed +RTC, not +RTS
20:40 bblfish joined
20:40 <nowhere_man> glguy: what is -xc supposed to be?
20:40 <nowhere_man> the runtime doesn't know about it
20:41 <glguy> It won't know about it unless you use a profiling build
20:41 tomphp joined
20:42 <nowhere_man> ha, sorry, it says I didn't use -prof
20:42 <glguy> e.g.: cabal new-run --enable-profiling YourProgram -- +RTS -xc
20:43 <nowhere_man> yeah, now I'm missing the profiling-enabled Prelude
20:43 <glguy> Maybe you installed GHC through your package manager and your package manager splits that out
20:43 <glguy> It's better not to use the package-manager provided packages for your own development
20:44 <fishythefish> nowhere_man: the issue is that in charGridToCells, in order to define `map`, you call `mkCell` on each pair of coordinates, but `mkCell` is defined in terms of `passages`, which looks up cells in `map`, which is defined in terms of `mkCell`, ...
20:45 <nowhere_man> fishythefish: do you know any tutorial on how to do this kind of thing properly? I'm guessing it's a common enough idiom with immutable data structures
20:46 <nowhere_man> I had identified the culprit but I don't know how to fix it
20:46 abhiroop_ joined
20:46 toovs joined
20:47 fizbin joined
20:47 <lukelau> Is it possible to have a timeout for awaiting in a ConduitT?
20:48 <lukelau> I tried using unliftIO + system.timeout, but as it turns out UnliftIO can’t operate on transformers with continuations
20:49 amirpro joined
20:50 bblfish joined
20:51 iAmerika1 joined
20:53 drewr joined
20:55 amirpro joined
20:58 simukis joined
21:00 danthemyth joined
21:03 valentinbuza joined
21:03 simukis joined
21:04 dogweather joined
21:05 dfeuer joined
21:07 <glguy> lukelau: I'd expect that you'll need to make a custom conduit source that can respond to requests for a certain number of bytes along with a timeout
21:09 <pdxleif> Kinda wondering why this CSV library is in terms of ByteString, and comments like "Uses UTF-8 encoding." on http://hackage.haskell.org/package/cassava- weird me out. What is CSV if not text?
21:09 brocoli joined
21:12 <superguest> I remember there being a way (a function? something along the lines of upperBound? ) to check the max value of a numeric type
21:12 <dminuoso> :t maxBound
21:12 <lambdabot> Bounded a => a
21:13 dmiles joined
21:14 asheshambasta joined
21:16 <superguest> geekosaur, For `[1..3]` "first it's ⊥, then 1:⊥, then 1:2:⊥, then … extending by one item each time a value is demanded from it. so (take 3) never goes beyond demanding a third value, and the final ⊥ never "explodes"
21:17 <superguest> So does it explode after `maxBound :: Int` ?
21:17 <superguest> opps
21:17 <superguest> I meant for `[1..]`
21:18 <geekosaur> no, because most CPUs don't provide a good way to check for that; it wraps.
21:18 <geekosaur> (Nasty practicalities getting in the way of a nice mathematical construct…)
21:18 <geekosaur> by default it'll use type Integer… which will explode by running out of memory
21:19 <geekosaur> (It could check it manually, but then every math operation on Integer has to do so. But the whole point of Int as opposed to Integer is speed.)
21:19 iAmerika1 joined
21:19 <geekosaur> er, on Int has to do so
21:20 tomphp joined
21:21 <dminuoso> superguest: What is ⊥ supposed to denote in there? Thunks?
21:21 <geekosaur> yes
21:21 <geekosaur> ghci represents that as _ instead
21:22 dfeuer joined
21:22 <superguest> geekosaur, so the idea is really if you try to approach bottom, your machine will explode (or wraps) before you reach there.
21:22 <superguest> ?
21:22 tomphp joined
21:22 andyhoang joined
21:23 <geekosaur> at that point it *has* reached therer. bottom is any form of nontermination: the expresson doesn;t produce a result, instead something else happens.
21:23 <dminuoso> superguest: In Haskell a function is a referentially transparent mapping between values right?
21:23 <geekosaur> exception, infinite loop, system starts thrashing because it's out of memory, whatever
21:24 davr0s joined
21:24 <dminuoso> superguest: But if a function always maps a value to another, then what does `length [1..]` map to?
21:24 <dminuoso> Or what does `[1] !! 5` map to?
21:25 <superguest> it'll through an out-of-bounds exception?
21:25 <superguest> err, throw
21:25 amar_ joined
21:25 <superguest> but I didn't answer your question: "what does it map to"
21:25 <superguest> ?
21:25 <superguest> I don't know heh
21:25 <superguest> :p
21:27 <glguy> dminuoso: those map to bottom
21:27 <geekosaur> nontermination via exception, hence bottom
21:27 <dminuoso> glguy: That was a rhetorical question for superguest =)
21:28 sid2k joined
21:28 valentinbuza joined
21:29 sid2k joined
21:31 <superguest> Yet another newbish follow up question: If these enumerables, how do you determine non-termination ? It just keeps going until you pull the plug right?
21:31 <superguest> these are* enumerables
21:31 <dminuoso> superguest: You can't, that's the halting problem.
21:31 <dminuoso> Which is why you cant test for bottom.
21:32 MRd1 joined
21:32 wchresta joined
21:33 brocoli joined
21:33 asdfjkljkl joined
21:34 oisdk joined
21:35 dexhunter joined
21:36 mpahrens joined
21:37 <wchresta> So I see a lot of newtypes defined in this runA fashion: newtype A = A { runA :: B }. What's up with that? Why is runA a good idea?
21:38 <lyxia> it's shorter than declaring a separate function
21:38 <* hackage> alarmclock - Wake up and perform an action at a certain time. http://hackage.haskell.org/package/alarmclock- (dcturner)
21:38 <MRd1> ...
21:38 Reisen joined
21:39 <dminuoso> wchresta: `run` is freque
21:39 <dminuoso> ops.
21:40 <mpahrens> A lot of monad transformers are written that way, where `to run` means to evaluate to something in the inner context. newtype FooT m a = Foo { runFoo :: (m a) }. Maybe it is carried over from that where the `m` in this case is an implicit Identity?
21:41 louispan joined
21:42 yrid[m] joined
21:44 dogweather joined
21:44 mpahrens joined
21:45 mpahrens joined
21:45 plugin joined
21:45 mpahrens joined
21:46 kvda joined
21:46 brocoli joined
21:50 son0p joined
21:50 iAmerika1 joined
21:50 drewr joined
21:52 Arcaelyx joined
21:54 <hexagoxel> ConnectionFailure (hackage.fpcomplete.com/package/hspec-expectations-0.8.2.tar.gz) .. is there some outage i should be aware of?
21:57 iAmerika1 joined
21:58 mpahrens joined
21:58 DSM joined
22:00 detrumi left
22:00 <* geekosaur> has no idea what, if any, monitoring fpco has
22:01 <hexagoxel> nevermind, the restarted job ran through, even though the automatic retries failed before.
22:02 TCZ joined
22:06 akegalj joined
22:06 niklasl2 joined
22:06 roconnor joined
22:08 asheshambasta joined
22:10 dxld joined
22:10 philippD_ joined
22:11 philippD joined
22:12 cynapse joined
22:15 fmixing joined
22:15 MRd1 joined
22:17 jao joined
22:20 fizbin joined
22:22 <nowhere_man> I do `case something of Entity {bar=foo} -> True
22:22 <nowhere_man> _ -> False
22:22 seveg joined
22:22 <nowhere_man> why is the second pattern redundant?
22:22 <nowhere_man> the first wouldn't match every Entity
22:25 lortabac_ joined
22:25 jao joined
22:25 <butterthebuddha> Is there a Map-like type where the value type is allowed to be different for each entry?
22:25 <geekosaur> yes it does, you captured the bar field of an Entity into local binding foo
22:26 <zachk> butterthebuddha, either use a algebraic sum type, or something like Dynamic
22:27 <geekosaur> there's at least one dependent map package on hackage iirc
22:27 xtreak joined
22:27 ttoe joined
22:27 jmcarthur joined
22:27 dented42 joined
22:28 <nowhere_man> it worked when foo was a string, not a variable
22:28 <nowhere_man> how can I filter records based on a value of a field, then?
22:28 <geekosaur> yes. constructors and literals match. variables capture and bind
22:28 <geekosaur> use a guard
22:29 dan_f joined
22:30 <nowhere_man> ha yes, I see
22:30 <glguy> butterthebuddha: There's also DMap from http://hackage.haskell.org/package/dependent-map- if you're doing something particularly complicated, but the sum-type like zachk mentioned is the straight-forward solution
22:30 conal joined
22:31 <butterthebuddha> I'm gonna try and see if there is a simpler way of doing what I'm trying to do; if I can't figure anything out I'll ask you peeps later
22:31 <zachk> you could use lens and prisms from the lens package to access and mutate the values in your Data.Map if you use a sumtype
22:31 <ttoe> Hey there. in for-loops i can include print statements (e.g. to show progress) ... is there a 'map'like that can print something on every iteration?
22:31 <butterthebuddha> ttoe: I'm not sure what you're trying to do, but take a look at trace
22:32 <geekosaur> mapM / mapM_ or traverse / traverse_
22:32 dogweather joined
22:32 Jesin joined
22:33 Linter joined
22:34 <zachk> ttoe, mapM_ print [1..10] will print 1-10, I use mapM_ quite a bit
22:34 <hexagoxel> or for/for_
22:34 <ttoe> butterthebuddha: basically... for x in longlist: print("processing " ++ x); doheavylifting(x)
22:34 <Cale> forM_ [1..10] $ \n -> do
22:34 <Cale> print n
22:35 <Cale> Or indeed, you can lose the _ and the results of each action will be collected into a list, which will be the result of the entire forM
22:36 <hexagoxel> so many ways of doing the same thing, thanks to the AMP :)
22:36 <ttoe> Cale: would the IO be collected somehow into the result?
22:36 hamishmack joined
22:36 <ttoe> i would not want that :D
22:37 <boj> ttoe: the _ version drops what is collected
22:37 <ttoe> I have many options to look at, as it seems. Thank you all!
22:38 kuttifunk1 joined
22:38 <boj> > mapM return [1..10]
22:38 <lambdabot> error:
22:38 <lambdabot> • Ambiguous type variable ‘m0’ arising from a use of ‘show_M388769049369...
22:38 <lambdabot> prevents the constraint ‘(Show (m0 [Integer]))’ from being solved.
22:38 <boj> ah yeah
22:39 DSM joined
22:39 slackman joined
22:40 m0rphism joined
22:41 valdyn joined
22:41 mpahrens joined
22:42 tzemanovic joined
22:43 <hexagoxel> ttoe: really, there are only the two, traverse and traverse_. All other are either flipped versions of that or more specific (Monad instead of Applicative) (and mostly artefacts of pre-AMP times).
22:43 Excureo joined
22:44 amar joined
22:44 bergle joined
22:47 dxld joined
22:49 <ttoe> hexagoxel: Alright! I'll have a look in the source!
22:49 fragamus joined
22:50 cschnei__ joined
22:50 patlv joined
22:52 <Cale> ttoe: actually, let's have a quick look at something more basic than that
22:52 <Cale> ttoe: There's a function called sequence (actually, if you look at it now it'll have a slightly more general type, but I'll describe the one for lists)
22:52 <Cale> sequence :: [IO a] -> IO [a] -- in fact, let's specialise it to IO as well
22:53 <Cale> Its job is to take a list of IO actions then, and produce a single IO action which when executed, will run each of the actions in the list, and collect up a list of their results.
22:53 andyhoang joined
22:53 <Cale> sequence [] = return [] -- if the list of actions is empty, we'll just produce the action which does nothing, except to produce an empty list as its result
22:54 <Cale> sequence (x:xs) = do ... -- if the list is nonempty
22:54 elfets joined
22:54 <Cale> sequence (x:xs) = do v <- x; ... -- we'll execute the first action in the list, getting some result v
22:54 dogweather joined
22:54 ttoe joined
22:54 chao-tic joined
22:55 <Cale> sequence (x:xs) = do v <- x; vs <- sequence xs; ... -- and then execute the remainder of the actions in the list, getting some list of results vs
22:55 <Cale> sequence (x:xs) = do v <- x; vs <- sequence xs; return (v:vs) -- and produce the combined list (v:vs) as our result
22:56 gabiruh joined
22:56 <Cale> ttoe: sequence is like a primordial loop of sorts: if we can decide ahead of time what's to be done on each iteration of a loop, and produce a list of those actions, it will glue them together into a single action
22:56 <Cale> So with that, we can write mapM:
22:56 lykrysh joined
22:56 <Cale> mapM f xs = sequence (map f xs)
22:56 <Cale> and forM is just mapM with the arguments flipped
22:57 connrs joined
22:57 ziyourenxiang joined
22:57 <ttoe> that's cool
22:57 <ttoe> thanks!
23:00 louispan joined
23:00 <butterthebuddha> Which of the Except monad and the Either monad is preferred for error handling?
23:01 <ttoe> Cale: does this then have the "foldl-problem" of building up a huge list of ..hmm don't know the name... list of unevaluated stuff until 'xs' is empty?
23:02 asheshambasta joined
23:03 <nowhere_man> I wrote a quick `annotate f x = (x, f x)`
23:03 <nowhere_man> doesn't that exist already in the base libraries?
23:04 <hpc> :t \f -> id &&& f
23:04 <lambdabot> (b -> c') -> b -> (b, c')
23:05 <Cale> ttoe: Well, it's not going to build up unevaluated expressions, because all the expressions it's constructing are built out of data constructors (specifically the (:) constructor for lists)
23:05 <Cale> Of course, it will be constructing that list, but you probably wanted it to
23:05 ericsagn1 joined
23:06 <hpc> nowhere_man: (&&&) is from Control.Arrow, so it's simple enough to compose from other things that it doesn't need its own definition
23:06 <Cale> If you don't want it to build a list, that's what the underscored versions are for -- there's a sequence_ which simply ignores the result of the actions, and produces () regardless.
23:06 XenOmega joined
23:06 Linter joined
23:06 <XenOmega> \x -> \y -> ?x
23:07 <XenOmega> the type would be a->b -> (c->a) ?
23:07 <hpc> :t \x -> \y -> ?x
23:07 <lambdabot> (?x::t) => p1 -> p2 -> t
23:07 <Solonarv> sequence_ also doesn't require Traversable, Foldable is enough
23:07 <Solonarv> :t sequence
23:07 <lambdabot> (Monad m, Traversable t) => t (m a) -> m (t a)
23:07 <Solonarv> :t sequence_
23:07 <lambdabot> (Monad m, Foldable t) => t (m a) -> m ()
23:07 <Cale> Did you mean to put that question mark there? That's an implicit parameter?
23:08 <XenOmega> the question ? is something that takes x as argument!
23:08 <Cale> ahh
23:08 <hpc> you're thinking of const, probably
23:08 <hpc> > const x y :: Expr
23:08 <lambdabot> x
23:08 <hpc> :t const
23:08 <lambdabot> a -> b -> a
23:09 <Cale> Well, it'll be hard to tell what the type of that lambda expression is without knowing the type of ? then
23:09 <hpc> :t \x -> \y -> const x
23:09 <lambdabot> a -> p -> b -> a
23:09 <ttoe> Cale: i understand... thanks. i have a mwe running, so thanks for all the help
23:09 <XenOmega> trying to find the answer for my ,mock exam :(
23:09 <XenOmega> for example : [?, 1], ? is int
23:09 <hpc> oh
23:10 <Cale> XenOmega: Ohhh, you want the type of the thing which would go in place of the question mark?
23:10 <Cale> XenOmega: do you know what type the lambda itself ought to have?
23:10 <XenOmega> yeah
23:10 <XenOmega> no undefined
23:10 <XenOmega> which is why im using a generic type of a!
23:10 <Cale> XenOmega: we know that the ? must be of some function type
23:11 <hpc> does lambdabot have holes?
23:11 <XenOmega> yeah. And since we defined x as "a" type, then something a -> ?
23:11 <Cale> and that its domain type matches the type of x
23:11 lazyinitialized joined
23:11 <Cale> yeah
23:11 <Cale> We don't know anything at all about the type of its result
23:12 <Cale> :t \f -> (\x -> \y -> f x)
23:12 <lambdabot> (t1 -> t2) -> t1 -> p -> t2
23:13 <Cale> :t \x -> \y -> ?f x
23:13 <lambdabot> (?f::t1 -> t2) => t1 -> p -> t2
23:13 <Solonarv> \x -> y -> _hole x
23:13 <Solonarv> @let foo = \x -> y -> _hole x
23:13 <lambdabot> Parse failed: Parse error: ->
23:13 <Solonarv> @let foo = \x -> \y -> _hole x
23:13 cschneid joined
23:13 <lambdabot> .L.hs:167:21: error:
23:13 <lambdabot> • Found hole: _hole :: t -> t1
23:13 <lambdabot> Where: ‘t’ is a rigid type variable bound by
23:13 <Solonarv> THERE
23:14 <lukelau> Is it possible to create an exception that sometimes takes in a type argument? Something like this: https://lpaste.net/2082178296602165248
23:15 <hpc> lukelau: that always needs a type signature
23:15 <hpc> it's not taking a type argument, you're just saying what type A has in that particular use
23:16 <lukelau> hpc: Is there any known pattern for dealing with this?
23:16 mpahrens joined
23:17 <lukelau> I don’t want to have to make an alias like `A = (A’ :: Foo ())
23:17 <hpc> in this case, GADTs if you know A is always going to have the type Foo ()
23:17 <hpc> data Foo a where
23:17 <hpc> A :: Foo ()
23:17 <hpc> B :: a -> Foo a
23:18 <hpc> not sure if that can still derive Show though
23:19 <hpc> there's a few other options, but for the most part you don't want to be wildly polymorphic in places where you're affected by class constraints
23:19 <hpc> instance resolution has requirements that make that infeasible most of the time
23:19 dogweather joined
23:20 <lukelau> I don’t care what type A ends up with
23:21 <hpc> hmm
23:21 <lukelau> But GADTs seemed to do the trick
23:21 <hpc> that should still work yeah
23:21 <hpc> oh yeah
23:22 <hpc> i forget, are GADTs in haskell2010?
23:22 <electrocat> hpc: nope
23:22 <hpc> they should probably get folded in with the next standard revision imo
23:22 <hpc> or at least GADTSyntax
23:23 <hpc> i am increasingly convinced that it's a strictly better syntax than standard for defining data types
23:23 <hpc> even for new users
23:23 <hpc> especially for new users
23:23 <electrocat> sure, but the limits of ADTs are clearer with their syntax
23:23 <hpc> hmm, yeah
23:23 <mniip> what a dilemma
23:24 <hpc> but on the other other hand, teaching GADTs is even easier
23:24 <mniip> in 8.6.0 TypeOperators implies NoStarIsKind
23:24 <electrocat> hpc: look, their basically functions
23:24 patlv joined
23:25 <electrocat> i would agree putting GADTs in the language, but their inference can be weird at times
23:25 <lukelau> Is there any sticking point/reason why GADT syntax is an extension and not in haskell2010 already?
23:25 <hpc> i guess ADT syntax translates a bit more cleanly into algebraic notation
23:25 <lukelau> hpc: Yeah, it makes it more obvious the sum and product types
23:25 <hpc> electrocat: hmm, i guess that's a good reason to keep them out
23:25 gsingh93_ joined
23:26 <hpc> it just about automatically requires the (~) constraint
23:26 <geekosaur> lukelau, the language committee was … conservative. And eventually fell apart.
23:27 <geekosaur> I wouldn't expect full GADTs to go in, as just discussed, but I think GADT syntax for ADTs could make it into the next standard.
23:27 <hpc> yeah, that makes sense
23:28 <electrocat> i doubt that would happen, i don't think that many people purely use the syntax, it doesn't add any significant power
23:28 <electrocat> or convenience
23:28 <geekosaur> quite a few people think it's clearer than H'98 synytax
23:28 ttoe joined
23:30 <electrocat> were there some plans for making a new standard?
23:30 <lukelau> hpc: Ok this is starting to get hairy, getting more typeable errors when using `anyFoo` exception handlers. I think I’ll just use concrete types…
23:31 gabiruh joined
23:32 youtmon joined
23:32 <hpc> anecdotally, when i was first learning haskell it took me a few hours to get past "data Maybe a = Nothing | Just a"
23:33 <hpc> i couldn't get myself to read it as "data <type> <type> = <value> | <value> <type>"
23:34 <hpc> but "data <type> <type> where <value> :: <type>" you see all the time
23:34 <mniip> that feel when you don't need to google the git repository for a package
23:34 <hpc> :t id -- if you can read this, you can learn the GADTSyntax definition of Maybe
23:34 <mniip> because the package name is contrived enough you know it's ekmett
23:34 <lambdabot> a -> a
23:35 <hpc> er, id :: a -> a
23:35 seizo joined
23:35 <hpc> mniip: hackage links to project homepages
23:35 <mniip> yes but that requires changing to another window
23:36 <geekosaur> electrocat, yes, there's a new language committee working on Haskell2020
23:36 <butterthebuddha> Can I get guarantees regarding the constructor of the returned value of a function?
23:37 <electrocat> geekosaur: is there some way to follow their progress?
23:37 <zachk> butterthebuddha, what do you mean? a specific constructor from a sum type?
23:37 <butterthebuddha> zachk: Yes
23:38 <geekosaur> electrocat, http://mail.haskell.org/pipermail/haskell-prime/
23:38 <zachk> that would require subtyping and it's not supported
23:38 <electrocat> geekosaur: tnx
23:38 <butterthebuddha> Okay :(
23:38 <zachk> also some forms of subtyping iirc break type inference
23:38 <butterthebuddha> Is this something that could be added to GHC in the future?
23:38 danso joined
23:39 louispan joined
23:39 <zachk> probably not, but I don't know enough of the theory of type inference and subtyping to say for sure, if dependent types ever make it into haskell you might be able to do it, but that also breaks type inference
23:40 <geekosaur> there is some work toward a DependentHaskell. it won't be happening soon.
23:40 <dyl> butterthebuddha: you could use phantom types and tagging with GADTs
23:40 <dyl> Just have a phantom type per constructor :p
23:40 <dyl> But that’s rather silly.
23:40 <hpc> DataKinds!
23:41 <dyl> Oh, yeah, you could also use kinds.
23:41 <hpc> data Foo = A Int | B String | C Bool
23:41 <hpc> data FooToken = AToken | BToken | CToken
23:41 <hpc> data BetterFoo token where A :: Int -> BetterFoo AToken; ...
23:41 <hpc> add in a kind signature somewhere, /me is sleepy
23:42 lektrik joined
23:43 <butterthebuddha> This looks cool
23:43 <butterthebuddha> I'll take a look at it
23:45 <hpc> butterthebuddha: i suggest considering if you need that level of guarantee before you go implementing it, since it adds a type parameter to BetterFoo
23:46 <hpc> so you'll have lots of function :: BetterFoo a -> BetterFoo b -> BetterFoo c floating around
23:46 <hpc> or god forbid, [forall a. BetterFoo a]
23:46 <butterthebuddha> hpc: it's not essential, so if the boilerplate becomes too excessive, i might just not do it
23:46 <hpc> cool
23:46 patlv joined
23:47 NiceTry5 joined
23:49 plutoniix joined
23:50 WhatisRT joined
23:51 YongJoon joined
23:52 blankhart joined
23:52 sevensidedmarble joined
23:52 <mniip> so I've updated yahb to 8.6 which is supposed to bring new typesystem tricks :D
23:53 tabemann joined
23:53 eschnett joined
23:53 <* hackage> wasm 1.0.0 - WebAssembly Language Toolkit and Interpreter http://hackage.haskell.org/package/wasm-1.0.0 (irezvov)
23:54 Tops2 joined
23:55 <* hackage> riak - A Haskell client for the Riak decentralized data store http://hackage.haskell.org/package/riak- (lambda_foo)
23:56 <butterthebuddha> so https://lpaste.net/3608359564770017280
23:56 <butterthebuddha> Any suggested improvements to that code? I can provide more context if needed
23:56 asheshambasta joined
23:57 fragamus joined
23:58 <mniip> while I'm at it does anyone have any suggestions on what extra packages I could install
23:58 mpahrens joined
23:58 jackdk joined
23:58 <fishythefish> butterthebuddha: personally, I find that amount of indentation hard to read
23:59 <fishythefish> I would also handle the yss stuff via pattern matching all at once rather than checking the length and then indexing repeatedly