<    March 2017    >
Su Mo Tu We Th Fr Sa  
          1  2  3  4  
 5  6  7  8  9 10 11  
12 13 14 15 16 17 18  
19 20 21 22 23 _2_4 25  
26 27 28 29 30 31
00:01 anuxivm joined
00:05 max3 joined
00:07 Fairy joined
00:07 theDon_ joined
00:09 <tnks> ski: actually, I was just thinking about the Functor constraint.
00:10 <tnks> but the good part is that our vocabulary of what it means to be "bigger" is consistent.
00:10 raynold joined
00:11 raycoll joined
00:11 Rizy joined
00:12 augur joined
00:12 sid_fules joined
00:13 wtetzner joined
00:13 roboguy` joined
00:15 jutaro joined
00:15 epsilonhalbe joined
00:15 epsilonhalbe left
00:15 Myrl-saki joined
00:16 agjacome joined
00:19 <johnw> ski: I meant functor, but forgot to say it
00:19 <johnw> ski: to quote the Kmett reference in question: "Note, Yoneda f is in some sense smaller than Codensity f, as Codensity f a is somewhat 'bigger' than f a, despite providing an embedding, while Yoneda f a is isomorphic."
00:20 <johnw> from http://comonad.com/reader/2011/free-monads-for-less-2/
00:21 Mikulak joined
00:22 romanandreg joined
00:22 <* ski> realizes they're tired enough to read `Coyoneda' when `Codensity' was said
00:22 araujo joined
00:22 araujo joined
00:23 <johnw> I'm tired too
00:23 <johnw> and avoiding a paper I must be writing
00:24 ystael joined
00:27 bsmt joined
00:29 loupgaroublond joined
00:29 AleXoundOS joined
00:30 slumshady joined
00:31 buglessdr joined
00:31 Rodya_ joined
00:40 jao joined
00:43 soLucien joined
00:43 eacameron joined
00:44 aarvar joined
00:45 Heasummn joined
00:46 marcopullo joined
00:51 Bob8989 joined
00:51 nakal joined
00:52 magneticduck joined
00:54 jmcarthur joined
00:56 Heasummn joined
00:56 markus1209 joined
00:56 markus1219 joined
00:58 Rodya_ joined
01:01 wtetzner joined
01:02 ziocroc2 joined
01:06 Heasummn joined
01:07 Fairy joined
01:08 tmtwd joined
01:08 minn joined
01:10 louispan joined
01:10 lithie joined
01:11 Rodya_ joined
01:11 Swizec joined
01:12 danthemyth joined
01:13 Rodya__ joined
01:16 Heasummn joined
01:16 asthasr joined
01:19 k0001_ joined
01:20 wei2912 joined
01:20 fizruk joined
01:22 jgt joined
01:24 ystael joined
01:25 bjz joined
01:26 Heasummn joined
01:29 jgt joined
01:30 manjaro-kde5 joined
01:30 marsam joined
01:32 wkoiking joined
01:32 wkoiking left
01:33 oish joined
01:34 wkoiking joined
01:35 wkoiking joined
01:36 Heasummn joined
01:39 benjic joined
01:39 mathieudarse joined
01:41 pleax joined
01:44 Textmode joined
01:45 moth joined
01:45 <Myrl-saki> Building Cabal in a 512 MB droplet is like witnessing a crime scene.
01:46 <Myrl-saki> Mem[||||||||||||||||||||||||||||||||||||||||436M/493M]
01:46 MP2E joined
01:46 <Myrl-saki> Swp[|||||||||||||||||||||||||||||| 939M/1.50G]
01:47 Heasummn joined
01:47 jvliwanag joined
01:51 <jvliwanag> when using with a writer monad, which data structure is best to use for just storing a log of events? esp when most most of the writes are just single element entries. are lists good enough?
01:52 marsam left
01:53 <lyxia> use state and put them in a list.
01:53 faberbrain joined
01:56 <jvliwanag> ah. is that better? use state and just cons to that list as needed instead of using the writer monad?
01:56 systadmin joined
01:57 Heasummn joined
02:01 eacameron joined
02:01 lambda-11235 joined
02:01 michael4 joined
02:02 wtetzner joined
02:03 <johnw> jvliwanag: http://comments.gmane.org/gmane.comp.lang.haskell.libraries/18980
02:03 <ezyang> ahoy haskell, for a data type intended to represent indexes into arrays, do you like Index/Size/SizeT/Pos/Position/what?
02:04 <johnw> yes
02:04 <Myrl-saki> ezyang: A typeclass.
02:04 <johnw> there's also Offset
02:04 <ezyang> I need to pick only one name :)
02:05 <johnw> how would you say it in English?
02:05 <johnw> "As you see, we have this gigantic array, and at _____ 113, we find the value X."
02:05 <ezyang> index
02:06 <ezyang> ...offset?
02:06 <ezyang> haha
02:06 <johnw> position!
02:06 <johnw> haha
02:06 <johnw> i don't know either
02:06 <johnw> ask someone who hasn't heard the question yet
02:06 Heasummn joined
02:06 <Myrl-saki> johnw: index.
02:06 coot joined
02:07 <Myrl-saki> Offset is relative.
02:07 <Myrl-saki> While index is locally absolute.
02:07 <Myrl-saki> If that makes sense.
02:07 <ezyang> yes it's true
02:09 <johnw> good point
02:09 <johnw> I'd say Index then
02:09 structuralist joined
02:10 <barrucadu> When I have such a variable, I typically call it "idx". Index is a good name for the type.
02:12 <johnw> Inductive Context a := C : seq a -> a -> seq a -> Context a.
02:12 <johnw> wrong window
02:13 <Myrl-saki> [Ind]uctive Cont[ex]t
02:13 <Myrl-saki> Index is the best type name.
02:14 gmhafiz joined
02:15 <johnw> haha
02:16 Rizy joined
02:17 michael1 joined
02:17 infinity0_ joined
02:17 infinity0_ joined
02:20 conal joined
02:21 infinity0 joined
02:21 <wkoiking> I often write the code like: case a of pat1 -> Just b1; pat2 -> Just b2; _ -> Nothing
02:23 <wkoiking> or more generally: case a of pat1 -> return b1; pat2 -> return b2; _ -> fail
02:23 infinity0 joined
02:23 <wkoiking> isnt threre nicer way to write these expression?
02:24 <Myrl-saki> wkoiking: Depends?
02:25 <Myrl-saki> wkoiking: For one, case statements are already the nicer way.
02:25 ystael joined
02:26 <wkoiking> something like: caseM a of pat1 -> b1; pat2 -> b2
02:26 sam2 joined
02:26 <wkoiking> return and fail case seems redundant
02:26 infinity0 joined
02:27 <Myrl-saki> wkoiking: Ah.
02:28 <Myrl-saki> wkoiking: I don't think there's a generaly way to do it.
02:29 dan_f joined
02:29 sid_fules joined
02:29 <Myrl-saki> wkoiking: But in some cases, there's a specifc way to do it.
02:29 eacameron joined
02:29 infinity0 joined
02:29 <Myrl-saki> wkoiking: Do you have an example where you used that pattern?
02:29 harfangk joined
02:31 nemorichard joined
02:32 infinity0 joined
02:32 s3mi0 joined
02:32 eacamero_ joined
02:33 <geekosaur> doesn't case already throw when a pattern doesn't match? (granted this is different from fail, because it has to work in pure code)
02:34 <wkoiking> hmm, I use that pretty much every where when Im in monad..
02:35 <aarvar> wkoiking: prisms?
02:35 yaya joined
02:35 Vibor joined
02:35 <Vibor> Hi
02:35 <Myrl-saki> geekosaur: The first code. `case a of pat1 -> Just b1; pat2 -> Just b2; _ -> Nothing`
02:36 doomlord joined
02:36 <Myrl-saki> aarvar: I'm curious. How can prisms help?
02:36 nemorichard left
02:36 <Vibor> Does not this line work? > factorial (n+1) = (n+1) * factorial n
02:37 <geekosaur> not any more
02:37 <geekosaur> N+K patterns were in haskell98, removed in haskell2010
02:37 <geekosaur> but you can reactivate them with -XNPlusKPatterns
02:37 <geekosaur> (the reason they were removed is that they can lead to some ugly edge cases)
02:38 the|auriscope joined
02:39 <geekosaur> http://stackoverflow.com/questions/3748592/what-are-nk-patterns-and-why-are-they-banned-from-haskell-2010 they can give you unexpectedly partial functions as shown here, although there are more subtle examples of it around
02:39 <tswett> Hey folks. What are my options for calling into Python from Haskell? Looks like this is the most popular Haskell library for doing it: https://github.com/jmillikin/haskell-cpython
02:39 nemorichard joined
02:40 <Vibor> geekosaur: Can I compile lhs file written in haskell 98 with ghc of version 8.0.1 , I found it's not just pattern, there are tons of errors while I'm trying to compile it
02:40 <tswett> Seems to be dormant since 2015, though.
02:41 <geekosaur> Vibor, you could run into a lot of problems, I'm afraid
02:42 <geekosaur> since haskell 98 there have been a number of changes, not just n+k pattern removal but Num changes (no more Show/Eq implicit), Monad change (must provide an Applicative instance), Foldable/Traversable (can introduce unexpected type confusion), ...
02:42 pleax joined
02:42 <Vibor> geekosaur: actually here is the source code, a module written for a book : http://www.cs.ou.edu/~hougen/classes/Spring-2011/cs2603/materials/Stdm.lhs
02:43 eacameron joined
02:43 <Vibor> It's a math proof checker
02:43 <geekosaur> also haskell98 only specified flat modules but haskell2010 (and an addendum to 98) added hierarchical modules, and you can't use the old flat-namespace names any more
02:46 <tswett> geekosaur: Monad must provide an Applicative instance? Maybe I'm misunderstanding this page, because Monad doesn't seem to require Applicative there: https://www.haskell.org/onlinereport/haskell2010/haskellch9.html
02:46 marcopullo joined
02:46 dmiles joined
02:46 <geekosaur> that's as of ghc 7.10 (AMP)
02:46 <the|auriscope> I'm currently reading something that says that foldr "forces the first bit of the spine."
02:46 <the|auriscope> so this blows up:
02:46 <the|auriscope> foldr (\_ _ -> 1) 0 undefined
02:47 <geekosaur> the only major differences between h98 and h2010 were removal of n+k, hierarchical modules standard, and ffi no longer an addendum
02:47 <geekosaur> the other changes are ghc specific
02:47 segmond joined
02:47 <the|auriscope> but how would something other than the "first bit" of the spine be, uh, is bottom the word I'm looking for?
02:47 <geekosaur> Vibor, the big problem you are seeing is from the Foldable-Traversable thing I mentioned. "traverse" is now defined in the Prelude
02:47 <Myrl-saki> the|auriscope: ` "forces the first bit of the spine."` sounds like some complicated medical procedure.
02:47 <the|auriscope> ^
02:48 <the|auriscope> I don't want to be in the room when a doctor says he's about to "force the first bit of my spine"
02:48 <geekosaur> and the other is the old weird Prelude "catch" went away; you need to import the real one from Control.Exception
02:48 <geekosaur> so, 2 lines to add after the "> module StdM where":
02:48 <geekosaur> "> import Prelude hiding (traverse)"
02:49 <geekosaur> hm, wait, I bet you also hit the exception hierarchy changes too
02:49 <geekosaur> so just importing catch won't be enough (and tbh something like this should not use catch, generally...)
02:49 <geekosaur> ok
02:50 <geekosaur> "> import Control.Exception"
02:50 <geekosaur> and at the top of the file: "{-# LANGUAGE ScopedTypeVariables #-}"
02:50 <tswett> the|auriscope: are you saying you're expecting "foldr (\_ _ -> 1) 0 undefined" to do something else?
02:50 tripped joined
02:51 <aarvar> Myrl-saki: was thinking you could use them to construct a [a -> Maybe r]
02:51 <geekosaur> and then the uses of catch need to be changed from having "\_ ->" to "\(e :: SomeException) ->"
02:51 <tswett> Nb that I don't actually know what "spine" means here.
02:51 <aarvar> and actually you'd only need Folds, not Prisms
02:51 <geekosaur> Haskell moves kinda fast; if you can get it to build, you might be better off using hugs like the text says
02:52 <the|auriscope> tswett: the literature that I'm reading uses "spine" to refer to (in the context of lists, but I assume it has a more general definition for Foldables) the series of conses that bind the list elements together.
02:52 anuxivm left
02:52 <geekosaur> yes
02:52 Rizy joined
02:53 <tswett> Well, I guess (3 : undefined) would have "something other than the first bit of the spine" as bottom, right?
02:53 <Vibor> geekosaur: thanks a lot for the great explainations and quick solutions :)
02:53 <tswett> The first bit of the spine is just a cons, but the *second* bit is bottom.
02:53 <geekosaur> so forcing the spine forces evaluation of the next (:) (and will crash if there isn't one, as with '1':'2':undefined)
02:53 <the|auriscope> so, for instance, this isn't bottom: foldr (\_ _ -> 1) 0 [undefined, undefined]
02:53 <the|auriscope> since the lambda doesn't force any of the list elements
02:53 <geekosaur> right, with [] format your spine is always well formed
02:54 <the|auriscope> oh, gotcha.
02:54 <geekosaur> but with explicit (:) you can build a list which terminates in undefined
02:54 chlong_ joined
02:54 <the|auriscope> tswett geekosaur: Thank you.
02:54 <tswett> Hey, does GHC represent String as something a little "smarter" than a linked list of 32-bit characters, at run time?
02:54 <geekosaur> nope
02:55 <the|auriscope> this was the punchline for me: <geekosaur> right, with [] format your spine is always well formed
02:55 <geekosaur> although it tries very hard to fuse lists, including String-s, so some or all of them may not even be in the program
02:55 <tswett> *nod*
02:56 <tswett> So if I *do* keep a 1,000,000-character String around, that's going to be at least... oh... 8,000,000 bytes or so, on a 32-bit system?
02:56 louispan joined
02:56 <tswett> *shrug* I guess GHC can't implement every possible feature.
02:56 <pacak> tswett: Yes.
02:57 <geekosaur> if you keep the whole thing, yes
02:57 <pacak> Strings are not very efficient for big chunks of data.
02:57 <geekosaur> this is one reason we tend to recommend Text for larger strings
02:57 <pacak> But for very short ones it can be faster than text/bytestring.
02:57 <geekosaur> but also note that String cn do something (strict) Text can't: you may be holding the spine but the characters themselves get gc-d. or only holding part of the spine
02:58 <geekosaur> also Strings can fuse away, as I said; this is much harder for Text
02:58 <geekosaur> (although it does try)
02:58 <tswett> Aha.
02:58 <the|auriscope> can values in a list be forced without their corresponding spine part being forced?
02:59 <geekosaur> no becauseyou need to go through the spine to reach the value
02:59 <the|auriscope> yeah, that was my assumption
02:59 <the|auriscope> but was open to some sort of magic being possible
02:59 <geekosaur> well. normally. there are tricks where the value can actually be referenced from multiple places (see "tying the knot"; this is less than useful with, say, Char)
03:00 hucksy_ joined
03:00 <tswett> Are Text and ByteString pretty analogous?
03:00 <geekosaur> this is *not* the common case and can be very hard to achieve by deliberate intent (but then it sometimes happens when you least expect/want it....)
03:00 <geekosaur> not really unless you're an American :p
03:01 <geekosaur> Text is Unicode text. ByteString is octets, which are enough to represent characters in US-ASCII or ISO 8859 but not full Unicode
03:03 <geekosaur> generally ByteString is used for network connections because network sockets transmit/receive octets. if some/all of those octets represent some kind of text, you will want to use the encode/decode functions in Data.Text to get Text values
03:03 <geekosaur> (and it's on you to know or determine *what kind* of text)
03:03 <tswett> Well, yeah... I meant are they equivalent *apart* from the fact that a Text is a string of Unicode scalar values whereas a ByteString is a string of bytes?
03:03 <geekosaur> I think there are implementation differences
03:04 <geekosaur> aside from Text being UTF16
03:04 stoopkid joined
03:04 <geekosaur> like, iirc text uses normal primitive arrays but ByteString is pinned?
03:05 <geekosaur> (which would mean gc can move a Text around but not a ByteString)
03:06 <tswett> *nod*
03:06 <tswett> Anyway, I'm gonna go buy a burrito. Be back soon.
03:06 Heasummn joined
03:06 <geekosaur> don't let it bind you:p
03:07 <wkoiking> geekosaur: could you elaborate on prism thing you have mentioned? and how it helps?
03:07 <geekosaur> I didn't mention prisms
03:08 <geekosaur> [12 02:51:23] <aarvar> and actually you'd only need Folds, not Prisms
03:08 <geekosaur> that perhaps?
03:08 <geekosaur> sounds like lenses to me
03:08 <geekosaur> right, I see earlier refs from them as well
03:09 <Cale> wkoiking: What would the code you want to write look like?
03:09 eacameron joined
03:09 <Cale> Perhaps write the code you'd like to be able to write and then see how close you can get to it by making definitions.
03:10 esph joined
03:10 <aarvar> wkoiking: something like this maybe? http://lpaste.net/353440
03:10 <wkoiking> Sorry that was aarvar
03:12 bjz joined
03:13 <wkoiking> Oh, this looks cool. (though I do not understand fully yet)
03:14 danthemyth joined
03:14 <aarvar> the idea being to construct a list of functions, [a -> Maybe r]
03:15 FjordPrefect joined
03:19 <aarvar> wkoiking: updated the paste
03:19 <aarvar> it's not really much shorter than the case statement
03:19 <aarvar> *expression
03:23 <wkoiking> but that was almost what I was looking for... thanks
03:23 randomclown joined
03:24 <ertes> jophish: is the vulkan library still maintained?
03:25 Ov3rload joined
03:25 <wkoiking> I often use the msum to replace guard to omit default case and Im looking for similar in case of case expression
03:25 <ertes> jophish: i'm asking, because the last release is almost a year old, and vector-sized got updated in the meantime
03:26 ystael joined
03:26 Noob64753 joined
03:28 chenyu`` joined
03:29 electrostat_ joined
03:29 marens joined
03:29 Dunearhp_ joined
03:29 staffehn joined
03:30 pdgwien- joined
03:30 bjarki joined
03:31 Kneiva joined
03:31 noteshui_ joined
03:31 skewerr joined
03:31 tippenei1 joined
03:31 hegge joined
03:31 Ariadeno joined
03:31 eyen joined
03:31 xnyhps_ joined
03:31 nglsr joined
03:31 mkoenig_ joined
03:31 Jaak joined
03:31 Warrigal joined
03:31 tumdedum_ joined
03:31 cjh`_ joined
03:31 cods_ joined
03:31 jrslepak_ joined
03:31 LeNsTR|away joined
03:31 comboy_ joined
03:31 juri__ joined
03:31 dogui_ joined
03:32 mutsig__ joined
03:32 mokus_ joined
03:32 zomg_ joined
03:32 kosmikus_ joined
03:33 opqdonut_ joined
03:34 revprez_1irai joined
03:34 blackdog_ joined
03:34 Geekingfrog_ joined
03:34 ambrosia_ joined
03:34 iross joined
03:34 maerwald_ joined
03:35 Hijiri_ joined
03:35 mantovani_ joined
03:35 Raynes_ joined
03:35 jzl joined
03:35 jzl joined
03:35 NextHendrix joined
03:35 sdothum_ joined
03:35 Bane^^ joined
03:35 Mindless- joined
03:35 myfreeweb_ joined
03:35 ploop_ joined
03:35 Haskellfant joined
03:35 aaronweiss74 joined
03:35 me` joined
03:35 Sam___ joined
03:35 SegFaultAX_ joined
03:35 vqrs_ joined
03:35 julmac joined
03:35 xa0 joined
03:35 grayWolf joined
03:36 safe joined
03:36 Raynes joined
03:36 tibbe joined
03:36 amuck_ joined
03:36 <MarcelineVQ> behold
03:36 ynyounuo joined
03:36 Cthalupa joined
03:36 JDevlieghere joined
03:37 xxpor joined
03:37 alibabzo joined
03:37 prooftechnique joined
03:37 asivitz joined
03:37 pharaun joined
03:37 ynyounuo joined
03:39 codebam joined
03:40 zcourts joined
03:40 Amadiro- joined
03:41 raynold joined
03:42 <aarvar> wkoiking: maybe something like this would work? Don't ask me if it's safe http://lpaste.net/353442
03:43 pleax joined
03:44 amatecha joined
03:44 Qommand0r joined
03:44 louispan joined
03:44 unclechu joined
03:45 fabianhu joined
03:45 manjaro-kde5 joined
03:46 robkennedy joined
03:48 <wkoiking> I dont have enough knowledge about exception, so I prefer the former ones
03:49 greenbagels joined
03:49 vektorweg1 joined
03:49 s3mi0 joined
03:49 path[l] joined
03:49 ninja_in_neopren joined
03:49 Enigmagic joined
03:49 scinawa joined
03:49 troydm joined
03:49 Chobbes joined
03:49 jokester joined
03:49 divVerent joined
03:49 hansihe joined
03:49 AlainODea joined
03:49 jacobm[m] joined
03:49 roadrunner168[m] joined
03:49 Soif[m] joined
03:49 curry[m] joined
03:49 miviotros[m] joined
03:49 gentam[m] joined
03:49 ayk[m] joined
03:49 tfc[m] joined
03:49 M-Shrike joined
03:49 gkaplan[m] joined
03:49 SaidinWoT joined
03:49 buoto joined
03:49 zph joined
03:49 FrankZappa_ joined
03:49 wyvern joined
03:49 metalrain joined
03:49 yminsky joined
03:49 trig-ger_ joined
03:49 Phillemann joined
03:49 clog joined
03:49 majoh joined
03:49 <wkoiking> Now I understand the former at least :)
03:49 Wizek joined
03:50 Wizek_ joined
03:50 greenbagels joined
03:52 exferenceBot joined
03:53 Brando753-o_O_o joined
03:53 wyvern joined
03:54 Cthalupa joined
03:55 faberbrain joined
03:57 hexagoxel joined
03:58 fkurkowski joined
03:58 michael1 joined
03:58 smwangi joined
03:58 bjz joined
04:04 djapo joined
04:05 pavonia joined
04:06 Heasummn joined
04:10 roboguy` joined
04:12 robertkennedy joined
04:15 winny joined
04:17 Rodya_ joined
04:19 teggi joined
04:19 eacameron joined
04:21 bsmt joined
04:25 Rizy joined
04:27 ystael joined
04:27 brynedwards joined
04:28 vimal2012 joined
04:28 benjic joined
04:29 tdammers joined
04:30 fragamus joined
04:36 subttle joined
04:39 steeze joined
04:41 systemfault joined
04:42 hexagoxel joined
04:43 louispan joined
04:44 pleax joined
04:44 otto_s joined
04:48 text1 joined
04:48 jmcarthur joined
04:51 mson joined
04:51 yrdz` joined
04:51 JohnnyDown joined
04:55 Welkin joined
04:56 mizu_no_oto joined
05:00 sobaken_ joined
05:05 meck joined
05:06 Heasummn joined
05:11 castlelore joined
05:11 castlelore joined
05:13 MrcRjs joined
05:14 JoshTriplett joined
05:14 JoshTriplett left
05:14 Heasummn joined
05:16 mvr_ joined
05:17 pleax joined
05:18 tnks joined
05:22 structuralist joined
05:22 xplat joined
05:23 SuprDewd joined
05:23 <ezyang> More naming advice please. "count" is currently overloading to mean "count characters" in ByteString and "count strings" in Text. What are good names to disambiguate these to?
05:24 hexagoxel joined
05:25 <ezyang> I guess for now I'll go with elemCount and substringCount
05:27 ystael joined
05:28 begriffs joined
05:29 cereal_killer_ joined
05:30 osa1 joined
05:30 osa1 joined
05:31 zcourts joined
05:33 Rizy joined
05:34 <johnw> ezyang: that sounds good to me
05:39 raycoll joined
05:42 hackebeilchen joined
05:45 variable joined
05:46 MrWoohoo joined
05:49 just2n joined
05:52 dbmikus joined
05:56 darjeeling_ joined
05:57 faberbrain joined
06:00 Jesin joined
06:01 buttons840 joined
06:02 sidei joined
06:02 dbmikus joined
06:04 <buttons840> is HXT the only option for xpath?
06:07 <buttons840> ah, looks like HXT and HaXml are both packages with XPath support, and they are independent of each other -- both look fairly complicated, but it's nice to know there's two independent options to choose from
06:08 sobaken joined
06:08 sidei_ joined
06:09 eSVG joined
06:10 <johnw> usually when someone looks at two libraries and says they both look complicated, we'll have someone in a few months say they found three libraries and they all look complicated :)
06:11 lithie joined
06:12 darjeeling_ joined
06:20 xmonader joined
06:21 monochrom joined
06:21 Arxenix_ joined
06:27 mmn80 joined
06:27 lukke100 joined
06:28 ystael joined
06:30 <ertes> instance (Show a, Show (v a)) => Show (Linear v a)
06:30 <ertes> this doesn't require FlexibleContexts?
06:30 <jle`> only if you pick a concrete type for v i think
06:30 <ertes> weird
06:31 <jle`> if all of your types are type variables then i think you don't need flexible contexts
06:31 <ertes> i could have sworn that GHC complained about a context like that in the past
06:31 <jle`> i mean, the constraints
06:32 hexagoxel joined
06:32 <jle`> oh
06:33 <jle`> i think you're right
06:33 <jle`> it should require FlexibleContexts
06:33 <jle`> w/o flexible contexts, the constraints should only be allowed to be simple type variables like 'Show a', not 'Show (v a)'
06:34 <ertes> yeah… but i'm still on 8.0.1, so perhaps it will be fixed after an upgrade
06:34 <jle`> maybe some extension is turning it on?
06:34 <ertes> i have none enabled
06:34 Destol joined
06:34 <jle`> try setting NoFlexibleContexts
06:34 <ertes> (yet)
06:34 infinity0 joined
06:35 <ertes> as expected it doesn't make a difference
06:35 <jle`> yeah, what you gave is actually the exact example that the GHC manual gives for situations that require FlexibleContexts
06:36 <ertes> BTW, i wish i could tell the deriver to ignore fields… would save me a lot of boilerplate in this particular library
06:36 <ertes> *the Show deriver
06:37 <jle`> `class (Monad m, Monad (t m)) => Transform t m where` is their example, lol
06:39 subttle joined
06:40 Diaoer joined
06:40 <athan> is there a... codo for comonads?..
06:40 <pikajude> no
06:40 <pikajude> but you can use RebindableSyntax
06:41 <athan> hm, thanks pikajude never used that extension before
06:41 zargoertzel joined
06:43 <athan> is there a way to scope language extensions in a source file? Or turn them off at some line?
06:45 <jle`> codo is a thing, but it's not in ghc
06:46 <jle`> i think there might be a TH package
06:49 <athan> RebindableSyntax still looks really cool, thanks for the tip pikajude
06:49 <athan> eh yeah idk, I still don't understand comonads jle` :)
06:49 <pikajude> athan: you can do 🌈anything with it
06:50 <jle`> athan: regarding rebindable syntax, you can import prelude and use the normal (>>=) from Monad
06:50 <jle`> athan: and then in the situations where you want to use a special (>>=), you can introduce a shadowing binding
06:51 Kuros` joined
06:51 <jle`> foo = do ....; where (>>=) = myBind; return = myReturn
06:53 <ertes> athan: i don't think using sugar will improve your understanding of comonads
06:54 darjeeling_ joined
06:55 eSVG joined
06:56 Zorkie joined
06:58 <Zorkie> Hey there. I've installed Haskell to windows. After which I'm trying to install a software package that has a dependency on 'download'. Unfortunately, that package gives me a build error. 'unknon type name 'auth_t'
06:58 <Zorkie> Any clues?
06:58 <Zorkie> Als, an error 'unknown type __BEGIN_DECLS' was given
06:59 <Zorkie> This gives me the impression some core library is missing or not found
06:59 <athan> suppi: did you write that functorial blog post you showed me?
06:59 <athan> the `right` / `left` functions for zippers are partial :(
06:59 <Zorkie> I did add the additional paths to 'config', as the install guide told me.
06:59 <athan> still rediculously cool though
06:59 mounty joined
07:00 <suppi> athan: no, it's phils blog
07:00 connrs joined
07:01 <athan> oop right on
07:01 <nshepperd> what would a codo look like
07:02 <athan> ... ?:)
07:02 takuan joined
07:02 <athan> codo {g x; f -> x}
07:03 <athan> idk lol
07:03 <athan> don't {...}
07:03 <jle`> https://hackage.haskell.org/package/codo-notation
07:03 <athan> o_o
07:03 <nshepperd> codo { wx <- x; f wx } = extend f x?
07:03 <jle`> oh sorry should have linked to http://www.cl.cam.ac.uk/~dao29/drafts/codo-notation-orchard-ifl12.pdf
07:04 <athan> hm!
07:06 mounty joined
07:08 <ertes> codo and do are pretty much the same thing with a flipped arrow
07:09 FreeBirdLjj joined
07:09 <ertes> more importantly codo is rather confusing
07:09 hexagoxel joined
07:09 <johnw> in the future, people will discover that "codo" meant "close the door"
07:10 <ertes> codo t <- s; v t
07:10 <Zorkie> Anybod got a clue as to why I'm getting build errors e.g. 'unknown type name auth_t' ?
07:10 <Zorkie> Running haskell on windows
07:10 <ertes> 't' has the same type as 's', and (v t) is supposed to be an unwrapped value
07:11 <ertes> it's confusing… just use 'extend' and 'extract'
07:11 Vzox01 joined
07:11 <athan> heh, thanks ertes
07:12 <ertes> i guess comonads are also flipped in whether you want sugar or not =)
07:13 <ertes> @paste -- Zorkie
07:13 <lambdabot> Haskell pastebin: http://lpaste.net/
07:16 raichoo joined
07:16 mounty joined
07:17 <Zorkie> http://pastebin.com/TxW0vNJY
07:18 <Zorkie> thank you
07:19 <Zorkie> sorry for slow response, 4-month old demands my full attention :-P
07:20 Rodya_ joined
07:21 <ertes> Zorkie: what are you trying to build?
07:22 <ertes> and how?
07:23 Sh4pe joined
07:23 <ertes> ah, 'download'
07:24 <Zorkie> cabal install download -v3 >log
07:24 connrs joined
07:24 jedws joined
07:24 <ertes> as far as i see parts of that library are written in non-portable C
07:24 <Zorkie> Actually i want to install 'implicit', but it fails on dependency 'download'
07:24 <ertes> or at least: not portable to windows
07:25 <Zorkie> hmm, that would explain it... but that would suck too ;-)
07:26 <ertes> yeah, it's including stuff like unistd.h unconditionally
07:26 <Zorkie> okay, well, thats a showstopper then :-)
07:26 <Zorkie> thanks for explaining,
07:26 <ertes> so unless you would enjoy some sunday pain with cygwin, you're pretty much out of luck =)
07:27 <ertes> alternatively port the library yourself
07:27 <Zorkie> hehe, nah... a vm with linux would be easier :-P
07:27 <ertes> yeah, definitely
07:27 <Zorkie> okay, I'll give that a spin. Thanks a lot guys!
07:28 <Zorkie> Have a great sunday!
07:28 <ertes> Zorkie: you could try a different library
07:29 ystael joined
07:30 Raptor8m3 joined
07:34 oberstein joined
07:35 caumeslasal joined
07:36 zero_byte joined
07:40 ner0x652 joined
07:47 vlatkoB joined
07:47 nshepperd joined
07:52 Copperis joined
07:52 zariuq joined
07:54 biglama joined
07:57 gmhafiz joined
07:59 faberbrain joined
08:00 calincru joined
08:02 sagittarian joined
08:04 Rizy joined
08:06 seveg joined
08:08 hazmat_ joined
08:09 Fuuzetsu joined
08:09 pleax joined
08:10 __name__ joined
08:10 Speed joined
08:11 joneshf-laptop joined
08:11 beaky joined
08:11 Ring0` joined
08:11 bjz_ joined
08:11 sbrg joined
08:11 sbrg joined
08:11 Dykam joined
08:12 dredozubov joined
08:12 sternmull joined
08:14 Xanather joined
08:14 seveg joined
08:16 Detrumi joined
08:17 <joneshf-laptop> I'm trying to hand write a `Distributive` instance, and I feel like I'm doing something wrong.
08:18 <joneshf-laptop> Someone tell me I'm doing something wrong, please.
08:18 hexagoxel joined
08:18 <joneshf-laptop> I don't see any `Generic` tooling either :(
08:20 suls joined
08:20 shafox joined
08:20 jutaro joined
08:21 Rodya_ joined
08:21 connrs joined
08:21 <joneshf-laptop> Wait, I was looking at an old version.
08:22 <joneshf-laptop> Life might be good again!
08:22 ikke joined
08:22 <jle`> :D
08:23 suls joined
08:23 <jle`> you can always write a distributive instance by going through its representation
08:23 deepfire` joined
08:23 <jle`> even though it might not always be the most efficient way
08:24 <joneshf-laptop> what does taht mean?
08:24 rmrfroot joined
08:25 mojjo joined
08:26 <joneshf-laptop> Oh, this: https://www.stackage.org/haddock/lts-8.5/adjunctions-4.3/Data-Functor-Rep.html#v:distributeRep ?
08:26 shafox joined
08:27 <rmrfroot> i have a data type called `Resource` that has a member `resourceName :: Text`, i would like to have a list of `Resource`s with a uniqueness constraint on the `resourceName` member. can i express this on the type level?
08:28 <rmrfroot> currently using a newtype that enforces this constraint in construction
08:30 ystael joined
08:31 dan_f joined
08:33 danvet joined
08:37 ThomasLocke joined
08:38 hexagoxel joined
08:39 louispan joined
08:40 cfricke joined
08:41 cfricke joined
08:42 dbmikus joined
08:42 dan_f joined
08:43 oish joined
08:43 subttle joined
08:47 <joneshf-laptop> Nope, still hard.
08:49 <joneshf-laptop> Is there an ecosystem around adjunctions that doesn't involve `Representable` and `Distributive`?
08:50 <joneshf-laptop> I mostly want the adjunctions betweeen `Free`/`Cofree` and `(:+:)`/`(:*:)`.
08:50 <joneshf-laptop> But without having to write `Representable` instances.
08:50 pandem left
08:51 <joneshf-laptop> All I really want is this function: https://www.stackage.org/haddock/lts-8.5/adjunctions-4.3/Data-Functor-Adjunction.html#v:zapWithAdjunction, but that requires a whole slew of instances.
08:51 bjz joined
08:52 jgt joined
08:53 smwangi joined
08:58 louispan joined
09:00 xplat joined
09:00 moongazer joined
09:00 fetter_oml joined
09:01 faberbrain joined
09:04 Dagnabit joined
09:05 inad922 joined
09:07 eklavya joined
09:08 djapo joined
09:10 jgt joined
09:10 pleax joined
09:11 hexagoxel joined
09:14 <jle`> joneshf-laptop: what i mean is that for all distributive instances F, any 'F a' is isomorphic to a 'K -> a'
09:14 <jle`> for some type K
09:15 <jle`> so if you can write that function explicitly, you can do some basic manipulations to get 'distribute' from it
09:15 <jle`> oh yeah similar to what you linked to
09:15 albertus1 joined
09:16 owiecc joined
09:19 hucksy joined
09:21 bab joined
09:22 Rodya_ joined
09:23 <ezyang> Hey guys look at this: https://gist.github.com/ezyang/baf6b71e9032748d9c317cf2af3fe38b
09:23 <ezyang> would you prefer the rows to be sorted, or as they are now?
09:23 Matajon joined
09:24 <athan> they aren't sorted, but that _might_ be nice :s
09:24 <* athan> isn't sure if there's a preorder of utility :D
09:24 <ezyang> the order they're in now is the order they appear in Haddock
09:24 <athan> I like it this way imho
09:24 <athan> is this some kind of api comparison system you're building?
09:25 <ezyang> yep
09:25 <athan> sweet :)
09:25 <ezyang> i wish I could get diagonal column headers but alas
09:25 shafox joined
09:26 <ezyang> left aligned checkmarks, or center aligned?
09:26 <athan> diagonal? Left aligned :)
09:26 <athan> in semantic ui you can have structured tables, but im not sure if that's up your alley
09:26 <ezyang> the thing where you can make the cells thinner if you angle the labels on top
09:26 <athan> (i think html natively supports them)
09:26 <ezyang> i want to render it on GH, unfortunately :(
09:27 <athan> hm, shoot I don't think asciidoc would be comprable either
09:27 <athan> maybe multiple tables?
09:27 <athan> One for each -- * section?
09:27 <athan> :S
09:27 <ezyang> then they won't line up
09:28 <ezyang> Well, I guess they would
09:28 <ezyang> if you pad out the first col enough
09:29 <athan> heh, I think the utf8 space has a standard width
09:29 <* athan> LaTeX quad to the rescue >.>
09:30 systadmin joined
09:30 <joneshf-laptop> jle`, Gotcha! Thanks. My problem is figuring out what `K` is and then being motivated enough to actually implement the instance :).
09:30 ystael joined
09:33 catsup joined
09:34 Ferdirand joined
09:34 catsup joined
09:35 Morgawr joined
09:35 Moyst joined
09:37 cods joined
09:37 Glooomy joined
09:37 tfc joined
09:37 tfc joined
09:38 flobberlet joined
09:39 Willis joined
09:39 path[l] joined
09:39 meoblast001 joined
09:40 thewormkill joined
09:40 aib joined
09:42 doomlord joined
09:44 shafox joined
09:44 eugenez joined
09:45 path[l] joined
09:45 mstruebing joined
09:45 osa1_ joined
09:45 <eugenez> Hello, friends! Is there a command like find, but one that finds and returns all values that satisfy the predicate?
09:46 <Rembane> eugenez: partition might do what you want
09:46 <Rembane> :i partition
09:46 <Rembane> Hm...
09:46 <ezyang> filter
09:46 <ezyang> :t filter
09:46 <lambdabot> (a -> Bool) -> [a] -> [a]
09:46 <eugenez> Thank you, friends!
09:46 hexagoxel joined
09:46 <Rembane> eugenez: https://hackage.haskell.org/package/base-
09:46 medicijnman joined
09:47 tsahyt joined
09:49 simukis__ joined
09:51 Kreest__ joined
09:51 JagaJaga joined
09:51 curious_corn joined
09:52 jutaro joined
09:56 darjeeling_ joined
09:58 avn joined
09:58 spatial joined
10:00 <spatial> http://lpaste.net/353451 if loops always have else. Right. In this I just want to return without doing anything in else.
10:01 caumeslasal joined
10:01 <spatial> Just exit the function.
10:01 chaosmasttter joined
10:03 erisco joined
10:04 ThomasLocke joined
10:05 sidei joined
10:05 Beetny joined
10:07 kritzcreek_ joined
10:08 fotonzade joined
10:08 oberstein joined
10:10 pleax joined
10:12 <cocreature> spatial: you might be looking for "when"
10:12 <cocreature> :t when
10:12 <lambdabot> Applicative f => Bool -> f () -> f ()
10:13 <cocreature> ah no, that requires that valueofnewstate has type () which it probably doesn’t
10:13 <cocreature> spatial: what do you want to return if result is False?
10:15 zdenal joined
10:16 nut joined
10:17 t7 joined
10:17 coot joined
10:18 sedeki joined
10:19 mmn80 joined
10:20 <spatial> cocreature: http://lpaste.net/353452 Trying to port this lisp
10:20 curious_corn joined
10:21 <cocreature> spatial: so does this return nil if the condition is false?
10:21 zcourts joined
10:22 Rodya_ joined
10:26 <spatial> It just continues with the rest if when isn't true
10:28 chb joined
10:28 schjetne joined
10:29 thc202 joined
10:29 xall joined
10:31 baldrick joined
10:31 <cocreature> spatial: but what’s the rest? there is nothing following the if clause
10:31 ystael joined
10:32 kini joined
10:34 cyborg-one joined
10:35 eklavya joined
10:38 skapazzo joined
10:38 osa1 joined
10:38 AleXoundOS joined
10:39 <spatial> cocreature: http://lpaste.net/353455 Lisp at the top and my Haskell at the bottom.
10:40 <cocreature> spatial: how about "if result then … else explore r epsilon"
10:40 <spatial> Incomplete because I am still figuring it out.
10:40 <cocreature> "return" does not return from a function if that’s what you’re expecting
10:44 Khamal joined
10:45 qqwy joined
10:46 <spatial> You mean in Lisp ?
10:47 <cocreature> no in Haskell
10:47 govg joined
10:48 <cocreature> "return" is just an ordinary function of type "Monad f => a -> f a"
10:50 qqwy joined
10:50 <qqwy> Hello, everyone! :-)
10:50 <cocreature> hello qqwy :)
10:50 <spatial> Could you explain ? 'return' does what ?
10:50 <cocreature> :t return
10:50 <lambdabot> Monad m => a -> m a
10:50 silver joined
10:50 <jophish> ertes: I've not had cause to touch it for a while sadly
10:50 <cocreature> spatial: what it does depends on what "m" is
10:50 owiecc joined
10:50 psychicist__ joined
10:51 <jophish> I made it for a use case at work that didn't end up panning out. My hobby coding hasn't involved vulkan recently
10:51 <cocreature> spatial: in the case of m=IO, "return x" evaluates to an IO action that does nothing when executed and returns x
10:51 Rizy joined
10:51 AntiSpamMeta joined
10:51 <jophish> I'd certainly like to keep the package going though
10:54 <qqwy> Yesterday I used the ST monad, and STUArrays for the first time. I wonder if there are ways to make this code more idiomatic (and maybe even faster?)
10:54 <qqwy> https://gist.github.com/Qqwy/75e5a1c4ff37f94df853e77446432cc2#file-matrixchain-hs-L49
10:54 albel727 joined
10:55 <qqwy> For instance, on line 59..61 I read out multiple values from the array before using them in a calculation
10:55 <qqwy> maybe there is a way to do this better?
10:56 <spatial> cocreature: Any better Haskell way to do what Lisp does ?
10:57 <qqwy> Spatial: I only entered the discussion halfway through. What's the context?
10:57 <cocreature> spatial: as I said "if result then … else explore r epsilon" should probably work
10:57 <cocreature> just don’t recurse if you want to return from a function
10:57 <cocreature> qqwy: http://lpaste.net/353455
10:58 sidei joined
10:58 bjz joined
10:58 <spatial> qqyw: Was trying convert lisp to haskell http://lpaste.net/353455
10:59 albel727 joined
10:59 <ski> @hoogle runSTUArray
10:59 <lambdabot> Data.Array.ST runSTUArray :: (forall s . ST s (STUArray s i e)) -> UArray i e
10:59 <lambdabot> Data.Array.ST.Safe runSTUArray :: (forall s . ST s (STUArray s i e)) -> UArray i e
11:00 robertkennedy joined
11:00 <ski> @src print
11:00 <lambdabot> print x = putStrLn (show x)
11:01 CoolerZ joined
11:01 <CoolerZ> why do i get a warning saying missing methods ? http://lpaste.net/353457
11:02 <erisco> CoolerZ, indent the fmap definition
11:02 <CoolerZ> No explicit implementation for `Prelude.fmap`
11:05 logzet joined
11:06 _ashbreeze_ joined
11:06 hexagoxel joined
11:06 LuckyRawApe joined
11:06 Jackneill joined
11:06 <CoolerZ> erisco is ask = Reader id?
11:07 <qqwy> ski: Would runSTUArray be better to use here?
11:07 <CoolerZ> it compiles
11:07 <ski> qqwy : more efficient
11:07 <erisco> :t ask
11:07 <lambdabot> MonadReader r m => m r
11:07 <qqwy> I couldn't get it to work; probably because I specified the types wrong
11:07 <erisco> CoolerZ, probably. I haven't used Reader
11:07 <qqwy> Where does the array from runSTUArray come from?
11:07 jomg joined
11:07 intx joined
11:07 <ski> qqwy : it does `runST (unsafeFreeze =<< ...)', but this particular use of `unsafeFreeze' is safe
11:08 <ski> qqwy : `freeze' copies; `unsafeFreeze' doesn't, but requires that you feed it the last reference to the mutable array
11:09 <erisco> well, having it compile is a low bar. Does it actually satisfy your intent?
11:09 <qqwy> When I swap runST for runSTUArray, then line 54 does not type match anymore
11:09 <qqwy> (the second for_)
11:10 <ski> also replace `freeze' with `return'
11:10 <qqwy> Ah, that was it :-)
11:12 <qqwy> thank you, ski!
11:13 <ski> np
11:13 <qqwy> Are there was to make lines 59..64 more idiomatic?
11:15 lukaramu joined
11:18 Zialus joined
11:18 <erisco> you can remove the redundant parens on 60 and 61
11:20 <ski> (and `55',`62')
11:20 <ski> (`42')
11:21 <erisco> can you turn the array into some sort of state monad? that's be interesting
11:21 Khamal joined
11:21 <erisco> so that get/put are reading and writing, though you'd require indexing
11:21 bjz joined
11:21 ziocroc2 joined
11:22 <qqwy> Would that be faster than an unboxed mutable array?
11:22 louispan joined
11:22 <qqwy> The strange thing about this (by nature imperative) algorithm is that it uses a square matrix, but then only uses the upper triangle of it
11:23 <qqwy> (the main diagonal and the upper right section above it)
11:23 Gurkenglas joined
11:23 Rodya_ joined
11:23 Rainb joined
11:23 <erisco> no, it would just be an interface where you wouldn't have "writeArray memo (i,i) 0" and "readArray memo (i,j)" but instead "write (i,i) 0" and "read (i,j)"
11:24 <* ski> isn't sure it would be much gain
11:24 <qqwy> I have no experience with the State monad, but the indexing that it requires to find `(i,j)` in its data probably require another array.
11:25 <qqwy> Interestingly, the current version (when optimizing with -O3) is already twice as fast on large inputs as an C++-implementation.
11:25 <qqwy> But then again, when optimizing the C++-implementation using g++'s -O3, then that one is three times faster still
11:26 <erisco> mm, but maybe you could generalise to indexed state
11:27 <qqwy> What I've tried to optimize this algorithm further was to rewrite 58..64 to return a list of all possibilities and then take the minimum from that. But that was significantly slower for some reason.
11:28 <qqwy> Maybe there is another way to take the minimum that does not require to read the `curval' during each iteration.
11:28 suls joined
11:28 <erisco> probably more useful with dependent typing so that you can project values of various types from the state
11:31 <erisco> so there is a function project_t : I -> Type and project_v : (i : I) -> S -> project_t i
11:32 ystael joined
11:32 <erisco> so you might get somewhere with singletons but the practicality goes down
11:33 <* qqwy> nods
11:33 connrs joined
11:34 janitor1 joined
11:36 marfoldi joined
11:38 Snircle joined
11:38 <ezyang> Look at this beautiful table!! https://github.com/haskell-backpack/backpack-str
11:39 <erisco> it is nice, but it would be improved by repeating the header every nth row. otherwise you have to scroll back to the top to recall what the columns means
11:40 danthemyth joined
11:41 faberbrain joined
11:42 <Rembane> ezyang: It's a beauty!
11:44 Fendor joined
11:44 <ezyang> erisco: Oh all right :)
11:44 <ezyang> blah I wish haskell-src-exts knew how to parse comments. Or maybe it does?
11:46 <ezyang> oh it does
11:50 Newb joined
11:52 <Newb> Hi, i got custom Data 'class', how to define order by multiple keys ? http://lpaste.net/7429912621689602048 firstly i want it to be sorted by 'from', afterwards by 'symbol'
11:52 cloudhead joined
11:53 <erisco> :t thenCmo -- Newb
11:53 <lambdabot> error: Variable not in scope: thenCmo
11:53 <erisco> :t thenCmp -- Newb
11:53 <lambdabot> error: Variable not in scope: thenCmp
11:53 <erisco> mkay, well, there is a function like this around somewhere
11:53 <erisco> Ordering -> Ordering -> Ordering
11:54 <erisco> http://hackage.haskell.org/package/template-haskell-
11:54 DexterLB joined
11:56 <erisco> well hang on, your Eq also includes t1 == t2 Newb
11:57 <erisco> if x == y then it has to be that compare x y == Eq
11:57 <erisco> and vice versa
11:58 <Newb> i already got thenCmp, thanks, but i dont know what u mean with Eq
11:58 <erisco> == considers all three components, but compare is only considering two, this is incoherent
11:58 <erisco> because it means that the property I stated above does not hold
11:58 MoronMan joined
11:59 <Newb> so in fact my instance Eq is redundant
11:59 systadmin joined
11:59 <erisco> no, it is wrong, or Ord is wrong
12:01 <MoronMan> @help
12:01 <lambdabot> help <command>. Ask for help for <command>. Try 'list' for all commands
12:01 Sampuka joined
12:01 <Newb> i am confused now, i just want to be sorted it liek this [T(1,a,2), T(1,b,2), T(2,a,5), T(2,b,4)]
12:02 <Newb> State and Symbosl are only aliases type State = String type Symbol = Char
12:02 <erisco> this has to be true Newb, forall x :: Transition, y :: Transition, (x == y) == (compare x y == Eq)
12:02 jutaro joined
12:02 <erisco> but with how you have written it there are some x y where compare x y == Eq but not x == y
12:02 Arb1t3r joined
12:03 <Newb> well so how to achieve it, instead of `==` i should use `compare` ?
12:03 Arb1t3r left
12:03 <erisco> paste what you have now
12:04 <Newb> erisco http://lpaste.net/7429912621689602048
12:05 <erisco> okay, so lets say you have r = Transition "a" 'x' "b" and s = Transition "a" 'x' "c"
12:05 <erisco> what is r == s?
12:06 <Newb> it should be False
12:06 bennofs joined
12:06 <erisco> correct, and what is compare r s?
12:07 <Newb> idk, propably False when u are asking :D
12:07 <erisco> :t compare
12:07 <lambdabot> Ord a => a -> a -> Ordering
12:07 <erisco> :t False
12:07 <lambdabot> Bool
12:07 skapazzo joined
12:07 <Newb> ah
12:08 <erisco> so what is compare r s?
12:08 <Newb> LT ?
12:09 Rizy joined
12:09 <erisco> explain
12:09 <Newb> from and symbol are same but 'to' is not the same, and 'b' is LT 'c'
12:10 <erisco> be more mechanical about it. What is the definition of compare?
12:11 <Newb> well it it just returns LT if 'r' is less than 's', EQ if they are equal etc .. no ? or what do u mean
12:11 <erisco> you just wrote it
12:12 <erisco> (Transition f1 s1 t1) `compare` (Transition f2 s2 t2) = (f1 `compare` f2) `thenCmp` (s1 `compare` s2 )
12:12 <erisco> so what is f1, s1, t1, f2, s2, t2
12:13 <Newb> so i should add thenCmp also on t1, t2 ?
12:14 <erisco> for it to work with your definition of ==, yes
12:15 oisdk joined
12:15 <Newb> ok thank you
12:15 <eugenez> Friends, i'm using stack ghci, it fails to import Data.Set with the following Could not find module ‘Data.Set’ It is a member of the hidden package ‘containers-’. What do I do?
12:16 shayan_ joined
12:16 tsmish joined
12:16 <erisco> if this was equality and hash codes it'd be fine, but this isn't that
12:17 <erisco> it is also valid to remove t1 == t2 from your == definition, but know what you're doing if you do this
12:18 <erisco> because then x == y no longer implies they are structurally identical
12:18 <erisco> and structural equality is the assumed default (it is what you get with deriving Eq)
12:19 <erisco> and so when you go on to implement other classes you have to be clear about what equality you're using
12:19 <erisco> otherwise the laws are meaningless
12:20 diskie_ joined
12:21 mr_sm1th joined
12:23 zdenal joined
12:24 Rodya_ joined
12:26 suls joined
12:26 M0r0nM4N joined
12:26 <lyxia> eugenez: add containers to the dependencies of your package
12:26 <bennofs> what rank does the type 'forall b c. ((forall a. a -> a) -> b) -> c' have?
12:26 chlong_ joined
12:27 <erisco> n ;)
12:28 <erisco> if once to the left of -> is rank 2 then I guess that is rank 3, but I don't know
12:28 Glooomy joined
12:28 glamas joined
12:29 sidei joined
12:29 lep-delete joined
12:29 <eugenez> Thank you very much, it worked! :)
12:30 FullyFunctional joined
12:30 HoierM joined
12:31 grayjoc joined
12:33 ystael joined
12:33 curious_corn joined
12:34 robotroll joined
12:34 chrisdotcode joined
12:37 CoolerZ joined
12:37 <CoolerZ> whats pure here? http://lpaste.net/353458
12:38 <erisco> you have x :: a and need something of type r -> a
12:39 <erisco> so, you need a function, that is known because the type is ->
12:39 <erisco> and you have to return something of type a
12:39 <erisco> well, we have x :: a, so we can return that
12:39 <erisco> so what function can take something of type r (i.e. anything) and return x?
12:40 <grayhatter> IO ((), Data) -> IO (), Data ??
12:40 <erisco> what oO
12:41 <grayhatter> cmdline.org/err.png
12:41 <erisco> :t void -- grayhatter
12:41 <lambdabot> Functor f => f a -> f ()
12:42 <erisco> or if you are in do-notation you may write return ()
12:43 dbmikus joined
12:43 <erisco> or $> () may be convenient
12:43 Ferdirand joined
12:44 <grayhatter> https://gist.github.com/13824fd7054b532151b4d9b8a36c6485
12:45 <erisco> CoolerZ, solve it?
12:46 <CoolerZ> erisco: i was gone
12:46 <CoolerZ> back
12:46 yuri joined
12:47 <CoolerZ> erisco: const x?
12:47 <erisco> looks good
12:48 soLucien joined
12:48 yuri joined
12:49 dbmikus joined
12:50 <erisco> you could write pure = fmap Reader pure
12:50 HoierM joined
12:51 danthemyth joined
12:52 <erisco> though pure a = Reader (pure a) I think is more sensible
12:52 tomphp joined
12:53 <erisco> particularly with newtypes we often have an underlying Applicative when we implement our newtype Applicative
12:53 <erisco> (and similarly for Functor, Monad, and other classes)
12:53 <erisco> fmap f (Reader x) = Reader (fmap f x)
12:53 <erisco> pure a = Reader (pure a)
12:54 teppic joined
12:54 <erisco> (->) is a Functor, Applicative, Monad, and so we can directly use these definitions
12:55 <erisco> with GeneralizedNewtypeDeriving we can even have these written for us
12:56 Fendor joined
12:56 HoierM joined
12:56 <erisco> I should say (->)a are those things, before someone writes me a kind fine
12:57 grayhatter left
12:57 <CoolerZ> erisco: wait what?
12:57 <CoolerZ> why is pure recursive?
12:58 HoierM joined
12:58 Rizy joined
12:59 <CoolerZ> erisco: pure x = Reader const x right?
12:59 lithie joined
12:59 <Taneb> CoolerZ, it's sneakily not quite recursive
12:59 <Taneb> pure for Reader is being defined in terms of pure for (->) e
13:00 <CoolerZ> oh
13:01 mmn80 joined
13:04 <Taneb> CoolerZ, your definition is equivalent and possibly less confusing (although has a slight mistake)
13:04 whald joined
13:05 eacameron joined
13:06 curious_corn joined
13:06 <CoolerZ> Taneb: what mistake?
13:08 dbmikus joined
13:09 shafox joined
13:09 sid_fules joined
13:10 <Taneb> CoolerZ, should be pure x = Reader (const x)
13:10 <CoolerZ> oh
13:11 simendsjo joined
13:12 rekahsoft joined
13:12 robkennedy joined
13:12 CounterPillow joined
13:13 <CounterPillow> if monads are so good how come they live in tents
13:13 fizruk joined
13:14 dbmikus joined
13:15 coot joined
13:16 emc2 joined
13:17 heurist joined
13:19 roundhouse joined
13:19 Khamal joined
13:23 SudhanshuJ joined
13:25 Rodya_ joined
13:25 <erisco> CoolerZ, remember that functions such as pure are overloaded, so one site of pure is not necessarily the same as another, it depends on the type
13:25 <CoolerZ> erisco: yeah i got that
13:27 <erisco> once that is understood there should not be anything confusing about it, because it is typical to use the existing implementation for the type we are newtyping
13:28 <SudhanshuJ> I was playing and trying to make my own version of tic tac toe game from Graham Hutton's Haskell book.
13:28 <SudhanshuJ> I am however having trouble trying to implement a simpler version of printing the tic tac toe grid. I would like to implement it using a single function or using an easier to understand function.
13:28 <SudhanshuJ> The relevant sections of the code is posted on http://lpaste.net/353460
13:29 <erisco> what is wrong with line 9? seems short to me
13:30 <CoolerZ> whats the use case for the applicative instance of functions?
13:30 <CoolerZ> (Reader rab) <*> (Reader ra) = Reader $ \r -> (rab r) (ra r)
13:30 <erisco> if you do not understand function composition then the better path is to learn function composition, because it is ubiquitous
13:30 <CoolerZ> seems very arbitrary to me
13:31 nomicflux joined
13:31 <sm> SudhanshuJ: it looks pretty reasonable already. You can move the helpers into a where clause in putPaygrid if you want
13:31 <erisco> CoolerZ, well, in one sense that is just how it has to be because that is what Applicative requires
13:31 <sm> SudhanshuJ: the use of foldr1 seems a little surprising perhaps
13:31 M0r0nM4N joined
13:32 <erisco> CoolerZ, but if you want to understand some uses for it, read about the SK combinators
13:32 <CoolerZ> SK?
13:32 <eugenez> Friends, I'm trying to work with Cartesian product of 3 lists and for some reason beautiful comprehension [(x,y,z) | x <- xs, y <- ys, z <- zs] is several orders slower than weird (,,) <$> xs <*> ys <*> zs , why is that, my friends?
13:33 <erisco> CoolerZ, from Lambda Calculus. S = pure = const, K = (<*>) = \f g x -> f x (g x)
13:33 <erisco> using S and K you can write any function (as far as Lambda Calculus defines functions)
13:34 ystael joined
13:34 lukaramu_ joined
13:34 <SudhanshuJ> <erisco> i forgot to remove the extra space
13:35 <erisco> also, the Applicative idiom is f <$> a <*> b <*> c ... which is like "programmable application" in the way monads are "programmable semicolons"
13:35 <erisco> so it is like f a b c but you get to say what $ is
13:35 <erisco> see http://stackoverflow.com/a/34536499/260584 for how you can use that idiom with (->)a
13:35 govg joined
13:35 Lempr joined
13:37 moth joined
13:37 raichoo joined
13:38 owiecc joined
13:38 <eugenez> Thanks, i'm still working my way towards understanding monads, it just surprised me why comprehension would be so slow and this solution so fast
13:39 <sm> SudhanshuJ: a cheap alternative would be putPlaygrid = mapM_ print
13:39 <SudhanshuJ> sm: Can you explain why foldr1 was used ?
13:39 <Lempr> Hi, anyone who could help me with algorithm to make "equality split class", idk how to describe it, here is sample http://lpaste.net/4041273696768229376
13:39 <erisco> eugenez, how did you measure this?
13:39 Berra joined
13:40 <sm> nope
13:40 <eugenez> codewars mostly, but when i just outright print it in ghci, you can see the second solution prints combinations waaay faster
13:41 <sm> Sudanshu: or, cleaner output: putPlaygrid = mapM_ (putStrLn . intercalate " " . map show)
13:41 <lyxia> Lempr: groupBy only groups consecutive elements
13:41 Deide joined
13:41 ziocroc2 joined
13:41 <lyxia> Lempr: you will need to write your own function that groups related elements in the whole list
13:41 <Lempr> yeah thats the problem :/ is there any simple solution how to achieve to group 'all' elements ?
13:42 faberbrain joined
13:43 <lyxia> nubBy might do it.
13:44 <lyxia> If your input is assumed to represent an equivalence relation.
13:45 <Lempr> yeah is equivalence relation, but how do u mean it ?
13:45 takle joined
13:46 <lyxia> nubBy (\x y -> (x, y) `elem` relation) states
13:46 teppic joined
13:47 <CoolerZ> erisco: what is maybeIf/
13:47 <CoolerZ> ?
13:47 Sampuka joined
13:47 <CoolerZ> maybeIf = liftA3 truth <*> pure Just <*> pure (pure Nothing)
13:48 <Lempr> lyzia it just returns ["1","2","3"] which, but now i dont that "1" is old ["1","6"] etc ..
13:48 <erisco> CoolerZ, that was part of the question
13:48 <CoolerZ> this is really confusing using lift with <*>
13:48 <erisco> you can see it as an example but what I really wanted to show was the "some intuitions" part
13:48 <CoolerZ> usually you don't need <*> when using lift
13:48 sepp2k joined
13:49 <erisco> well, it needn't be, look at what I write below :)
13:49 <lyxia> lambdabot: what?
13:49 <lyxia> Lempr: what?
13:50 <Lempr> well output is ["1","2","3"] i need [["1","6"],["3","4"],["5,"6"]]
13:50 <erisco> eugenez, I am not sure. As far as I know they should be the same
13:51 <lyxia> Lempr: Oh I see nubBy doesn't work because it just discards "equal" elements
13:51 k0001_ joined
13:51 <lyxia> Lempr: you'll have to write the function
13:52 manjaro-kde5-- joined
13:52 <Lempr> ah okay, it's part of school project, some former schoolmate solved id by using groupBy and sortBy but i dont know how to sort it.. anyway thanks
13:53 <CoolerZ> doesn't lift f ma mb = f <$> ma <*> mb ?
13:53 manjaro-kde5-- left
13:53 <CoolerZ> so why are you using lift AND <$> and <*>
13:53 <CoolerZ> ?
13:53 <erisco> you mean liftA2?
13:53 <CoolerZ> yes
13:54 <erisco> that is correct, but look at the expression
13:54 <erisco> would that be a natural way to rewrite it?
13:54 <Lempr> lyxia: I found this http://stackoverflow.com/questions/8262179/group-list-by-equivalence-relation but i am not able to rewrite it for my purpose
13:54 <eugenez> erisco: thank you
13:55 oberstein joined
13:55 <erisco> why would you want to write \ma mb -> f <$> ma <*> mb when you can just write liftA2 f?
13:56 <erisco> maybe the precedence is confusing you
13:56 <erisco> liftA2 f <$> x <*> y is (liftA2 f) <$> x <*> y
13:56 <CoolerZ> ik
13:56 jomg joined
13:57 <erisco> well, are you suggesting I write (\a b -> f <$> a <*> b) <$> x <*> y instead?
13:57 <CoolerZ> why are you using fmap and apply/
13:57 <lyxia> Lempr: "If you can define a compatible ordering relation,"
13:57 <lyxia> Lempr: can you
13:58 dramforever joined
13:58 <erisco> by "apply" do you mean <*> ?
13:58 <CoolerZ> yes
13:58 <Lempr> Me personally not :D
13:58 <CoolerZ> your lifting the function once with lifta2 and then again with <*>
13:58 <erisco> I don't really understand the nature of your question
13:59 <CoolerZ> why are you lifting twice?
13:59 <erisco> <*> is not the same as the liftAn functions
13:59 <erisco> you know this though, so I don't understand the question
13:59 <lyxia> Lempr: as far as I can see you only have an equivalence relation, and no ordering, so you can't use that
14:00 <erisco> if you proposed the way you'd want to see it maybe I'd understand
14:00 boombanana joined
14:00 <CoolerZ> what is pure Just?
14:01 <erisco> :t pure Just
14:01 <lambdabot> Applicative f => f (a -> Maybe a)
14:01 <CoolerZ> which pure?
14:01 <erisco> any of them
14:01 SudhanshuJ joined
14:01 <erisco> in this case it is const
14:02 <erisco> you can see the full derivation at the end
14:02 <CoolerZ> its the pure for functions?
14:02 <erisco> yes, pure for functions is const
14:03 <CoolerZ> = liftA3 truth <$> id <*> pure Just <*> pure (pure Nothing)
14:03 <CoolerZ> where did the <$> id come from?
14:06 <erisco> you are asking why is liftA3 truth = liftA3 truth <$> id
14:06 <CoolerZ> is it just me or this really convoluted?
14:06 <CoolerZ> is*
14:06 <CoolerZ> yes where did the <$> id come from
14:07 <erisco> finding pointfree definitions can lead you down strange roads, and in this particular case it is not so practical, but that wasn't the question
14:07 <erisco> the reasoning behind the presented solution is simple. it is just two equations
14:08 <CoolerZ> i guess <$> is just (.) so . id makes sense
14:08 <erisco> yes, there you are CoolerZ :)
14:08 <erisco> id is an identity of (.)
14:08 <erisco> this expansion was used so that it would match the idiom which is how I presented the equations
14:10 oisdk joined
14:11 inad922 joined
14:11 <erisco> a loose way to think about it is that each lift adds an argument
14:13 <erisco> we start with one argument inherent from the idiom, and then add a second with liftA3
14:13 <erisco> liftA3 liftA3 f would be three arguments, and so on
14:14 <erisco> er, maybe that liftA3 (liftA3 f)
14:14 <erisco> make that*
14:14 <CoolerZ> do you have a simpler use case?
14:14 <CoolerZ> for applicative instance of functions
14:15 <lyxia> eugenez: http://lpaste.net/353461 In this benchmark the applicative style is faster when interpreted, slower when compiled without optimizations, the same with optimizations.
14:15 curious_corn joined
14:15 <erisco> well you can rewrite many functions like this, so if you have a candidate I'll show you how
14:15 jao joined
14:16 <erisco> but practically I do not use this. sometimes the f x (g x) pattern will come up and I'll stick <*> in there
14:16 steeze joined
14:16 plutoniix joined
14:16 <erisco> or the f (g x) (h x) pattern will come up and I'll stick in liftA2
14:16 <michalrus> Quick/newbie question: how can I have a separate function with the same name as a record field, both defined within the same scope? It seems that DuplicateRecordFields enable only… duplicate record fields. If that regular function was of different type than the record field, then it would still be unambiguous, right?
14:17 plutoniix joined
14:17 xall joined
14:17 <erisco> but I am not going out of my way to write everything like this. It is just part of the bag of tricks to abbreviate definitions
14:18 sid_fules joined
14:18 <CoolerZ> so \x -> f x (g x) = f <*> g ?
14:18 <erisco> yes
14:18 janitor joined
14:18 plutoniix joined
14:19 insitu joined
14:19 Polarina joined
14:20 <erisco> sometimes it is just a bit of fun to find pointfree expressions
14:20 <eugenez> lyxia: I think I figured it out, I actually had it like this: [(x,y,z)| x <- someFunc, y <- someFunc, z <- someFunc], once I moved xs ys and zs out with where it started working way faster
14:20 <erisco> and if you have some tricks like this you can often come up with something more understandable than @pl
14:20 <lyxia> eugenez: that changes everything indeed
14:21 bjz_ joined
14:21 Myrl-saki joined
14:21 janitor1 joined
14:21 <erisco> @pl \p -> \a -> truth (p a) (Just a) Nothing
14:21 <lambdabot> flip flip Nothing . (`ap` Just) . (truth .)
14:21 takle joined
14:21 <erisco> sure, it is equivalent, but what is the intuition
14:23 <lyxia> michalrus: yes you could disambiguate by types, that's what type classes are for.
14:24 <lyxia> eugenez: when talking about performance it is important to show your code and how you are measuring it.
14:25 <erisco> someFunc has to be a list, not a function, but I presume you meant it is an expression containing application
14:26 <michalrus> *nods* Yes, I know that. =) lyxia, what caused my question was working with some REST API that returns an `error` field… And also there’s `Prelude.error`… If DuplicateRecordFields also allowed regular function names to be duplicates with record field names, it could’ve been easier in this case. =)
14:27 <erisco> it is likely that ys was re-evaluated for every x and zs for every y
14:28 skeuomorf joined
14:28 <erisco> it is an optimisation to abstract an invariant expression, and GHC does not always do this, though I do not know the specifics
14:29 <erisco> if you compiled with -O or -O2 you may have seen the performance difference vanish
14:29 <erisco> versus the REPL which, afaik, does no optimisation
14:29 janitor1 joined
14:30 stef204 joined
14:33 Khamal joined
14:34 ystael joined
14:36 <* erisco> looks up "preorder" and sees video games, ugh
14:37 marfoldi joined
14:37 max3 joined
14:37 insitu joined
14:38 <lyxia> michalrus: I see. Ad-hoc overloading of duplicate names might be yucky but useful.
14:39 janitor1 joined
14:39 IanKelling joined
14:42 janitor1 joined
14:42 jmcarthur joined
14:46 jetho joined
14:47 certainty joined
14:49 <* ski> . o O ( <https://ncatlab.org/nlab/show/preorder> )
14:50 kuribas joined
14:50 Ranhir joined
14:50 <xa0> hello
14:50 <xa0> does anyone here understand cofree
14:50 <xa0> i'd like to create an example of it's use, without using free and/or pairing
14:50 spatial_ joined
14:50 <xa0> is that possible
14:51 <spatial_> How do I use 'do' in a case statement ? http://lpaste.net/353465
14:51 <spatial_> To compare the unwrapped value with another.
14:51 JuanMiguel joined
14:51 <erisco> you mean in the guard?
14:51 <kuribas> spatial_: I see no case?
14:52 boombana1a joined
14:53 <lyxia> xa0: type Tree = Cofree []
14:53 <spatial_> Yes in the guard.
14:53 <lyxia> xa0: What do you mean by "pairing
14:53 <erisco> you cannot
14:53 tax joined
14:53 <xa0> lyxia: every example i've seen of cofree eventually uses a "pairing" functor to pair it with a free monad
14:54 <xa0> i've constructed a cofree but i've no idea how to use it without that
14:54 <erisco> the guard is constructed from a Bool expression and pattern matches
14:54 <erisco> so you can have do notation in the expression, but the result must be a Bool
14:55 <spatial_> I have a comparison that returns a Bool.
14:55 alx741 joined
14:56 pera joined
14:57 <tomboy64> hmm. pretty newbie question. how would i go about constructing a cli-parser? e.g. a program that reads (a variable number of) lines, until it's completed its tasks?
14:58 cereal_killer_ joined
14:58 <lyxia> xa0: what about my list example
14:58 <tomboy64> just using await/yield or getLine/putStrLn wouldn't work as the number of lines need to be variable and i might have to accumulate data from stdin.
14:58 <xa0> lyxia: okay you have the cofree, now what do you do with it
14:59 <xa0> this is where i get stuck, i can make the cofree happily, but what do you do to "run" it or use it somehow
15:00 mszczygiel joined
15:01 <erisco> spatial_, readthevalue returns a Bool?
15:03 tomphp joined
15:03 Ov3rload joined
15:05 miklcct joined
15:10 <lyxia> xa0: the unfold functions are convenient to generate trees, and then you can search/fold/traverse them using recursion-schemes.
15:10 CounterPillow left
15:10 <CoolerZ> erisco: why is it called Reader?
15:10 <xa0> lyxia: that sounds like just a Tree thing, not a Cofree thing, though
15:11 <erisco> there are three types: Reader, Writer, and State
15:11 <erisco> State = Reader + Writer
15:11 <xa0> lyxia: i'm reading this for example http://dlaing.org/cofun/posts/free_and_cofree.html
15:11 <erisco> Reader lets you read a state, Writer lets you write a state
15:11 <erisco> and so State lets you do both
15:13 <erisco> a lot of the time you will be using classes instead of Reader, but in the cases where a class is inappropriate or impossible (such as data that only arrives at runtime) then Reader is available
15:14 Zialus joined
15:14 sid_fules joined
15:14 <erisco> the connection is that instead of a class you can pass around a dictionary of its methods
15:14 <erisco> and Reader facilities this
15:14 Gurkenglas_ joined
15:14 <erisco> a common use for Reader is configuration read from a file
15:15 coot joined
15:17 iomonad joined
15:17 <spatial_> erisco: It is supposed to be like this http://lpaste.net/353467
15:18 anieuwland joined
15:18 <erisco> I am not sure what that is supposed to be
15:18 <erisco> what is the type of thethevalue?
15:19 <erisco> readthevalue*
15:19 <spatial_> Int. Unwrapping in the guard.
15:19 <erisco> it is not Int
15:20 <erisco> it is A -> B -> Int maybe, and so what is A and B?
15:20 authority joined
15:20 teppic joined
15:21 <spatial_> readthevalue works separately. It takes an IOArray etc.
15:21 <anieuwland> Hi everyone :) I have a question about how I detect connected hardware (phones, ereaders) to a Linux computer in Haskell
15:21 <erisco> well, let me know when you figure out the type
15:21 <spatial_> I have a problem with the unwrapping in 'do' in the guard
15:22 sid_fules joined
15:22 <anieuwland> I'm not sure how I would go about doing this. Is there a specific library for, or should I work with typical linux files likes /proc/mounts?
15:22 <anieuwland> I would appreciate any tips,thanks!
15:23 <spatial_> Ok. It is a rough cut. But readthevalueis readthevalue :: ( IOArray Int Double) -> Int -> IO Double
15:23 zygentoma joined
15:24 <erisco> :t (<)
15:24 nh2 joined
15:24 <lambdabot> Ord a => a -> a -> Bool
15:24 nh2 left
15:25 fizruk joined
15:25 <erisco> so best-value has to have the type IO Double
15:25 <erisco> but < is not defined for IO Double
15:26 Rodya_ joined
15:26 <erisco> what you want to start with is do x <- readthevalue ...;
15:26 <erisco> now x :: Double, and it is the Double you have read from the array
15:26 <erisco> (I presume, I am guessing as to what readthevalue does here)
15:27 <spatial_> Yes. I need to unwrap it first.
15:27 <erisco> no, there is no such thing with IO
15:27 <erisco> i.e. there is no function with type IO a -> a
15:27 sz0 joined
15:28 <spatial_> I am able to do this http://lpaste.net/353468
15:28 <erisco> what you use is bind, i.e. >>=, which in do-notation is <- loosely speaking
15:28 <geekosaur> you need to learn how IO works, not try to evade it
15:29 <erisco> yes, that's right, so if you follow similarly as you've done with terminalstatep you can solve this
15:29 vektorweg1 joined
15:29 <spatial_> Right. Let me change that and ask again.
15:30 <erisco> so you begin with do x <- readthevalue ...; and then you can do things with the x
15:30 <erisco> if best_value < x then ... else if best_value > x then ... else ...
15:30 dbmikus joined
15:31 <erisco> or, in a better fashion, case compare best_value x of LT -> ...; GT -> ...; EQ -> ...;
15:31 <erisco> in the end you don't really need a guard
15:31 MindlessDrone joined
15:33 takle joined
15:35 <spatial_> erisco: That is legal haskell. Exactly like you typed ?
15:35 ystael joined
15:36 max3 joined
15:36 <erisco> if you replace the ellipses with something, yes
15:36 <kuribas> Is it possible to have data allocated on the stack?
15:36 <hpc> kuribas: ghc uses the stack and heap in a wildly different way than C
15:36 <hpc> so that question doesn't really make much sense
15:37 dbmikus joined
15:37 <kuribas> does ghc still garbage collect data when it is consumed immediately?
15:37 sid_fule_ joined
15:37 anton joined
15:37 MindlessDrone joined
15:37 <hpc> depends
15:38 <kuribas> I'd like to avoid the cost of GC for critical code...
15:39 <hpc> what i would do then is write the critical code, and then if it does not perform adequately profile it
15:39 cyborg-one joined
15:40 agjacome joined
15:40 <geekosaur> nursery gc is very fast, you probably care about gen1 gc more
15:41 <erisco> the imagery of calling it the nursery is unpleasant
15:42 <hpc> plus ghc can occasionally optimize repeated allocation into a single allocation and many mutations
15:42 kagcc joined
15:43 <hpc> erisco: computer science already has the concept of slaves and killing children, the nursery is downright harmless ;)
15:43 dbmikus joined
15:43 <* geekosaur> has had the joy of changing the diaper of a baby with projectile diarrhea. "nursery" is reasonably apropos :p
15:43 arawack joined
15:44 <kuribas> I improved performance 8X by avoiding thunks...
15:44 faberbrain joined
15:44 <kuribas> it's still expensive for critical code
15:45 mszczygiel joined
15:47 <erisco> hpc, I am harrowed
15:47 <kuribas> why doesn't ghc compile minimum[a, b, c] into min a (min b c)?
15:48 andrybak joined
15:48 structuralist joined
15:48 thunderrd joined
15:49 uncertainty joined
15:49 <erisco> because it is less computational work
15:49 <erisco> oh, why *doesn't* it
15:49 <erisco> well because that rewrite rule is not present :P
15:49 <kuribas> erisco: yeah :)
15:50 <erisco> minimum (x:xs) => min a (minimum xs)
15:50 <nshepperd_> Because that involves inlining a recursive function, i bet
15:50 <erisco> min x (minimum xs)
15:50 <kuribas> erisco: well foldl f [a, b, c] in general
15:50 slack1256 joined
15:50 <erisco> how is a three-item list general?
15:51 <kuribas> erisco: well, a small list
15:51 <erisco> what is f?
15:51 <kuribas> it could partially evaluate the expression.
15:51 metalbot joined
15:51 <erisco> oh, you mean minimum is defined in terms of foldl
15:52 <erisco> well probably foldl' but sure
15:52 <kuribas> if the list is known at compile time.
15:53 <erisco> the compiler can unroll (if that is an appropriate word here) but that is a trade-off
15:54 <kuribas> Are there rules for when it does?
15:54 Big_G joined
15:54 <erisco> trading jumps for more instructions is a balancing act, and I don't know about the runtime either
15:55 Snircle joined
15:55 <erisco> I know I have read in another case a rewrite rule was omitted because it was too likely to produce large expressions which would probably be slower
15:55 krypton_ joined
15:56 mizu_no_oto joined
15:56 <spatial_> http://lpaste.net/353469 I have this now.
15:57 spatial_ joined
15:57 Gentilhomme joined
15:57 <spatial_> http://lpaste.net/353469 I have this now. Just variable scope problems.
15:57 <erisco> you have to load instructions into memory too, remember
15:59 <erisco> > let x-x = 1 in x-x
15:59 <lambdabot> error:
15:59 <lambdabot> • Conflicting definitions for ‘x’
15:59 <lambdabot> Bound at: <interactive>:1:5
15:59 <erisco> I don't think hyphens are valid in identifiers
15:59 esad joined
16:01 sid_fules joined
16:01 <nshepperd_> That line is defining subtraction
16:01 <geekosaur> ...but violating the linear pattern rule
16:02 <nshepperd_> Heh, so it is
16:02 <erisco> well I am surprised spatial_'s code hasn't exploded in these errors and instead has scope errors
16:02 <kuribas> It hasn't deleted the internet yet?
16:03 <erisco> I just answer questions. What people's programs do is their business :P
16:03 <geekosaur> it probably does report those but they scrolled off and spatial_ only looked at the later errors where the names are indeed not in scope
16:04 mizu_no_oto_work joined
16:04 <nshepperd_> The code has lots of type errors but ghc won't report those until all the undefined names are fixed
16:04 alx741 joined
16:04 eschnett joined
16:05 <kuribas> erisco: sure, but c compilers unroll loops also.
16:05 wildlander joined
16:05 <erisco> I think if you looked at how the runtime works it'd be a substantially different circumstance, but that is my speculation
16:07 <kuribas> I think it's more about a lack of manpower behind haskell compilers.
16:07 <kuribas> not that the men lack power, but there aren't enough of them...
16:07 <nshepperd_> Ghc could unroll folds i think. Just has to inline the fold and cancel the inlining if the result is much bigger
16:08 <spatial_> Maybe my haskell layer is spacemacs isn't setup properly.
16:08 <kuribas> yeah
16:08 <Tuplanolla> I think it's a general lack of manpower in compiler development, kuribas.
16:08 <erisco> I'm sure they'd tell you kuribas: "pull requests welcomed!"
16:08 <Tuplanolla> We don't even have proper link-time optimization for C compilers yet.
16:08 <kuribas> Tuplanolla: C++ and java have plenty...
16:09 <nshepperd_> spatial_: anyway, you can't use - in variable names
16:09 <Tuplanolla> Considering their importance, not as much as they should.
16:09 <kuribas> But ghc is all volunteer work?
16:09 <erisco> spatial_, what language are you coming from? just curious
16:10 pleax joined
16:11 <geekosaur> yes, ghc is all volunteer and chronically in need of devs
16:11 <geekosaur> also care needs to be taken with things like loop unrolling if it can alter strictness
16:11 <exio4> erisco: minimum (x:xs) = min x (minimum xs) doesn't hold
16:12 <exio4> > minimum []
16:12 <lambdabot> *Exception: Prelude.minimum: empty list
16:12 <erisco> oh, one of them partial functions, well don't blame me :P
16:12 <exio4> minimum [1] = minimum (1:[]) = min 1 (minimum []) = ⊥
16:12 <exio4> > minimum [1]
16:12 <lambdabot> 1
16:13 sternmull joined
16:13 <erisco> minimum (a:b:cs) = min a (minimum (b:cs)) then, but I'd rather fix minimum than worry about this optimisation
16:13 <exio4> erisco: it should be minimum (x0:x1:xs) = min x0 (minimum (x1:xs)) ∧ minimum (x0:[]) = x0
16:13 <exio4> erisco: fix?
16:13 cfricke joined
16:14 <erisco> yes, make it total
16:14 eklavya joined
16:14 <exio4> erisco: replacing [] with NonEmptyList?
16:14 isaac_ joined
16:15 <exio4> erisco: or adding a Bounded restriction to the type?
16:15 Welkin joined
16:16 <erisco> well, I am not sure that minBound makes much sense
16:16 <kuribas> exio4: that's not problem for partial evaluation
16:17 <exio4> kuribas: what do you mean?
16:17 <exio4> kuribas: oh, this is about evaluating an arbitrary function? not the specific rules?
16:17 desku joined
16:17 <kuribas> exio4: about ghc unrolling functions on known lists.
16:18 Hexagenic joined
16:18 <kuribas> exio4: for example minimum [a, b, c] => min a (min b c)
16:19 argent0 joined
16:19 <Tuplanolla> There's a school of thought for evaluating everything that doesn't depend on run-time values at compile-time, kuribas.
16:19 theelous3 joined
16:19 <exio4> there has been a POC compiler for "supercompilation"
16:19 <erisco> that's a school of thought?
16:20 <exio4> it took quite a few minutes, IIRC :P
16:20 <erisco> piece of crap?
16:20 <exio4> proof of concept
16:21 rmrfroot joined
16:22 <erisco> does it run to a fixed point exio4?
16:22 esad joined
16:22 <exio4> erisco: I don't remember, I barely skimmed through it
16:23 <erisco> without knowing much, it doesn't sound that interesting
16:23 <spatial_> let x = 0 in x followed by let y = 0 in y That has a parse error at 'let'
16:23 path[l] joined
16:23 <erisco> if you have some optimisations then of course you can apply them iteratively
16:24 <exio4> erisco: IIRC the "biggest part" of the paper was about recursive functions, knowing when to stop, and how to handle partial application and high order functions
16:25 <kuribas> it's increases compile time, but that could be a command line option...
16:25 <rmrfroot> getting a very unhelpful "dist/build/Backuper_o_split: getDirectoryContents" when preprocessing a library using GHC 8.0.1, anyone that has had something similar happen to them?
16:25 oberstein joined
16:25 tomphp joined
16:25 takle joined
16:26 <geekosaur> spatial_, if you are in a do block then you can use let that way, otherwise it is let <bindings> in <expr>
16:26 <geekosaur> and note that outside do blocks you do not have "statements"
16:27 <geekosaur> (technically you don't inside them either but you can pretend. you can't pretend elsewhere)
16:27 <geekosaur> @paste your actual code also
16:27 <lambdabot> Haskell pastebin: http://lpaste.net/
16:27 Rodya_ joined
16:27 <erisco> maybe I am misremembering... there was a supposed technique where you run an optimising compiler on the output of an optimising compiler and so on
16:27 <erisco> so your target and source languages have to be the same if you want to do it iteratively, but that was an idea
16:27 <erisco> then another was to run an optimiser on the compiler itself
16:28 <erisco> the idea being that the optimised compiler can produce more optimal code (by some magic?)
16:28 <geekosaur> only if they have disjoint optimizations or you're assuming the peephole optimization technique is actually useful
16:28 <erisco> and if the compiler can compile itself, now you just keep going until you you're content with your level of optimisation
16:28 beerdrop joined
16:28 <geekosaur> or both compilers' authors were too lazy to optimize in multiple passes
16:29 <exio4> erisco: multiple passes are actually that, just inside a compiler
16:29 <exio4> erisco: the thing is, how many times do you run the optimizations?
16:29 <exio4> erisco: they're also one of the most expensive parts of most compilers nowadays
16:29 <exio4> erisco: and you want modular support too.. it's a tough problem :)
16:31 rkazak_ joined
16:31 janitor joined
16:31 <erisco> yes well for the iterative approach you'd have to limit your depth or guarantee convergence
16:31 Noldorin joined
16:33 <erisco> I want to see more examples of evolved code
16:33 <erisco> like they designed that logic gate some years ago
16:34 gugah joined
16:34 <erisco> so when you ship your final version you have a super computer take a crack at it for a good while
16:35 roundhouse joined
16:35 BartAdv joined
16:35 <rmrfroot> disabling split-objs solved my problem.
16:35 _sg joined
16:36 shafox joined
16:36 <erisco> I think you're chiefly worried about knowing whether a program fits the spec
16:36 <erisco> or how to measure how closely it fits
16:36 ystael joined
16:36 inad922 joined
16:36 benjic joined
16:37 <erisco> has anyone given serious consideration to measuring how close an implementation fits a spec? we clearly do it when we program
16:37 <erisco> that's how we figure out to change this bit over here rather than that bit over there
16:37 mada joined
16:39 mstruebing joined
16:40 cdidd joined
16:41 Welkin left
16:41 Gentilhomme joined
16:41 simukis__ joined
16:41 qqwy joined
16:42 osa1 joined
16:42 osa1 joined
16:42 pleax joined
16:42 ner0x652 joined
16:42 seveg joined
16:43 janitor1 joined
16:43 Micamo joined
16:44 <juri_> ouch. hlint is not installable. my machine cannot find the right version of 'happy'.
16:44 rkazak_ joined
16:44 nomicflux joined
16:47 <rom1504> try 'sad'
16:49 Jeanne-Kamikaze joined
16:49 xall joined
16:50 <osa1> juri_: install happy in a sandbox. add sandbox's bin to $PATH. build hlint.
16:52 <juri_> weird.
16:52 raycoll joined
16:53 sword865 joined
16:53 <osa1> I'm assuming you don't want to just install it system-wide otherwise you'd just do it
16:53 <osa1> `cabal install happy`
16:53 buttons840 joined
16:53 <osa1> or `stack install happy`
16:54 <juri_> strange. installing happy first seems to have worked.
16:54 <osa1> why is it strange? what did you expect?
16:54 uncertainty joined
16:54 sgflt joined
16:55 subttle joined
16:55 <juri_> i expected for it to download and build it, rather than just erroring out.
16:55 gienah joined
16:56 <osa1> not sure what's the error message is but I don't think hlint directly depends on happy. it's probably a problem with a dependency.
16:56 <osa1> there's a cabal field `build-tools` for that
16:56 <osa1> so you add preprocessors to that field and it's supposed to work
16:56 takle joined
16:56 <osa1> haven't tried it myself though so not sure if there's a bug
16:57 error joined
16:57 fizruk joined
16:58 <osa1> juri_: example https://github.com/haskell-suite/haskell-src-exts/blob/master/haskell-src-exts.cabal#L45
16:58 dsh joined
16:59 <geekosaur> some people do seem to assume that happy is always installed and they don't need to list the dependency as a build tool
17:02 anuxivm joined
17:03 Khisanth joined
17:03 <maerwald_> geekosaur: isn't that still broken wrt PATH?
17:03 <geekosaur> depends
17:04 thadtheman joined
17:04 <geekosaur> with stack, or cabal-install to user (not sandbox) with ~/.cabal/bin already in $PATH, it should work
17:04 <geekosaur> isntall to sandbox and use elsewhere is problematic
17:05 Morgawr joined
17:05 <thadtheman> Is there a generic fp channel?
17:05 <maerwald_> .cabal/bin can't be expected to be in PATH so it's broken
17:06 <hodapp> thadtheman: on freenode, I'm not aware of one; there is, however, a functional programming Slack
17:07 programo joined
17:07 _sras_ joined
17:07 krypton_ joined
17:07 <geekosaur> maerwald_, in the same way building a binding with only runtime libs installed and not automatically running your package manager to fix it is "broken"
17:07 <geekosaur> they're build tools, not nannies
17:08 connrs joined
17:08 cloudhead joined
17:08 <maerwald_> no. those are different problems
17:09 tsmish joined
17:10 <thadtheman> Well I'll try here. Even though it has been a while.
17:10 <_sras_> If I have two records of types A and B and B have a (subset of fields from A + fields that are functions of fields from A). Is there any way to make the conversions between these types easy?
17:10 <maerwald_> system libs are not managed by cabal. build tools like happy are, yet it is unable to register them for internal cabal processes
17:10 <thadtheman> Given a monad, with return, and bind. How do I make join and fmap?
17:10 <maerwald_> that's simply broken. sandbox or not
17:11 <hpc> happy isn't a build tool
17:11 <maerwald_> nitpicking incomong
17:12 leat joined
17:12 <hpc> i think you misunderstand what exactly a build tool is
17:12 <hpc> and what its responsibilities are
17:12 <srhb> We should have a shared calendar so we can cross off each day this discussion recurs. Perhaps there's a pattern. :-)
17:13 urodna joined
17:14 <c_wraith> :t (>>= id) -- thadtheman
17:14 <lambdabot> Monad m => m (m b) -> m b
17:14 pleax joined
17:15 <c_wraith> :t \f x -> x >>= return . f -- thadtheman
17:15 <lambdabot> Monad m => (a -> b) -> m a -> m b
17:15 <* thadtheman> says -- a build tool is software designed to distract the user from learning a language by forcing them to learn something else.
17:15 <thadtheman> Thank you cwraith.
17:16 epsilonhalbe joined
17:16 <thadtheman> Thank you c_wraith.
17:16 <hpc> oh, "build tools" here means cabal's build-tools field
17:17 <* hpc> would have considered cabal to be a build tool, and happy to be a build dependency
17:17 <maerwald_> hpc: maybe read the whole discussion before nitpicking
17:18 _sg2 joined
17:18 luto1 joined
17:19 <hpc> maybe don't jump on me the instant i say something?
17:19 <maerwald_> the point is... cabal _knows_ about the location of it's database and such, but when it comes to binaries it needs for building, it just uses PATH and pretends to know nothing
17:19 <maerwald_> that is broken
17:19 <maerwald_> especially wrt sandboxes, but also without
17:20 <geekosaur> fine, you fix ghc-pjkg to list binaries
17:20 <geekosaur> (stack had the same problem and hacked around it)
17:20 <geekosaur> (and *still* has it with custom build tools, see the ticket about building gtk with stack)
17:21 <roundhouse> Hi, if I have a type with a phantom type, e.g. "newtype A b = A { unA :: Int }", how can I instance a typeclass for (A Text)?
17:21 epsilonhalbe left
17:22 gcross_ joined
17:22 <hpc> roundhouse: what error are you getting?
17:24 <roundhouse> hpc: Illegal instance declaration for `DBI.Binary (AssetID Text)'
17:24 <roundhouse> (All instance types must be of the form (T a1 ... an)
17:24 <monochrom> I recommend instancing (A b) instead.
17:24 janitor1 joined
17:24 <hpc> is there any more to the error?
17:24 connrs joined
17:25 thewormkill joined
17:25 <roundhouse> yeah, it recommends enabling FlexibleInstances, is that what I need?
17:25 <hpc> possibly
17:25 <hpc> you might want to try monochrom's suggestion first though
17:25 <roundhouse> monochrom: thanks that fixes it. I don't understand why though :)
17:25 seveg joined
17:26 ptek joined
17:27 <geekosaur> the problem has nothing to do with your phantoom type, it's because you are expected to have type variables and not concrete types (here Text is the culprit)
17:27 takle_ joined
17:27 <hpc> class instances are required to be in a particular form to keep instance resolution simple (according to the haskell spec)
17:27 <monochrom> It is a rule. The rule is stated in the error message.
17:27 <hpc> ghc comes with language extensions that relax and extend that behavior
17:27 <geekosaur> this is basically a limitation intended to make things easier for haskell compiler implementors, which is why overriding it involves a ghc extension
17:27 tomphp joined
17:27 <geekosaur> and FlexibleInstances is one of the mostly-safe extensions
17:28 Rodya_ joined
17:28 <roundhouse> I see, but (A Int) and (A Text) should be different types, right? So they should be able to have different instances of a type class
17:28 <roundhouse> ah ok
17:28 <roundhouse> I see
17:28 <geekosaur> (it can get you in trouble if you later define an instance on A a, since now you have an overlap and behavior is NOT guaranteed)
17:28 <hpc> the ghc documentation has some discussion of what the implications of FlexibleInstances are
17:28 <roundhouse> thanks, I'll look into that
17:28 <geekosaur> basically overlaps + separate compilation = can't guarantee instance selection
17:29 janitor1 joined
17:31 jluttine_ joined
17:34 wtetzner joined
17:35 doodlehaus joined
17:36 le_idiot joined
17:36 janitor joined
17:37 ystael joined
17:37 DonComo joined
17:37 Rodya_ joined
17:37 <robkennedy> At what point in a paper should I begin soliciting co-authors? How should I go about that?
17:37 anuxivm left
17:38 SudhanshuJ joined
17:38 <monochrom> When and only when you can't do the work alone.
17:39 <monochrom> or maybe don't want to.
17:40 kini joined
17:41 augur joined
17:43 subttle joined
17:43 xall joined
17:45 le_idiot joined
17:45 tomphp joined
17:45 eacameron joined
17:46 faberbrain joined
17:48 hiThisIsMe joined
17:48 le_idiot joined
17:48 mac10688 joined
17:49 le-idiot joined
17:50 ziocroc2 joined
17:50 zcourts joined
17:52 Guest91320 joined
17:52 doomlord joined
17:54 ertesx joined
17:55 pera joined
17:56 danthemyth joined
17:57 takle joined
17:59 Einwq joined
17:59 deepfire` joined
18:00 ragepandemic joined
18:01 medicijnman joined
18:03 lenstr joined
18:03 fizruk_ joined
18:04 augur joined
18:04 doodlehaus joined
18:04 raycoll joined
18:05 nwf joined
18:07 Bechill joined
18:12 ertes joined
18:12 longjump joined
18:16 pleax joined
18:16 coot joined
18:17 <kuribas> I have algorithms in my bezier library that I haven't seen elsewhere. Should I write a paper about them?
18:17 <Tuplanolla> Review existing literature first.
18:18 osa1 joined
18:18 xinming joined
18:19 <kuribas> To much work...
18:19 <kuribas> I don't even have access to academic literature...
18:19 <Tuplanolla> That's what Sci-Hub is for.
18:20 ragepandemic joined
18:20 honeymead joined
18:20 obadz joined
18:20 <kuribas> I'll have to do an analysis, etc... I don't think it's worth the effort...
18:21 <jmcarthur> Too much work to research, but not too much work to write the paper?
18:22 <Tuplanolla> Some say one hour in the library is worth ten in the lab.
18:22 <monochrom> Write a blog.
18:22 nomicflux joined
18:22 <* geekosaur> would think research would be fairly important before writing a paper...
18:23 <geekosaur> (blog not so much, so agree w/monochrom)
18:23 <kuribas> right, I'll write a blog.
18:24 esad joined
18:25 leevei joined
18:25 xall joined
18:26 umoukun joined
18:26 arj joined
18:26 <geekosaur> you could even ask your readers to do the research for you, not in so many words ("if anyone happens to know ...")
18:26 <kuribas> jmcarthur: My research upto now is google...
18:26 <kuribas> geekosaur: good idea :)
18:26 mda1 joined
18:26 <umoukun> can someone here explain to me why haskell doesnt work when i try to enumerate patterns with my USB dildo????
18:27 <umoukun> NEED HELP
18:28 <zomg_> you need to "plug it in" if you know what I mean
18:28 <Tuplanolla> I think Emacs has a mode for this.
18:29 pleax joined
18:29 <ertes> kuribas: "The first discovery I'd like to present here is an algorithm for lazy evaluation of research papers. Just write whatever you want and don't cite any previous work, and indignant readers will send you references to all the papers you should have cited. I discovered this algorithm after ``A Plan for Spam'' [1] was on Slashdot." -- paul graham
18:30 <kuribas> ertes: lol
18:30 <srk> how often do you self censor yourself when about to ask this channel something? :D
18:30 <ertes> honestly i don't think i'll ever write a paper in my life, because if you aren't already somewhat involved in the scientific community, it's almost impossible to penetrate
18:31 <ertes> "write a blog post and show it to smart people" generally works just as well, at least for software engineering stuff =)
18:31 <srk> it seems to work better than a rubber duck
18:32 <ertes> a good example in this particular community: van laarhoven lenses
18:32 netheranthem joined
18:33 rkazak_ joined
18:34 mda1 joined
18:35 thibaud joined
18:37 Heasummn joined
18:37 <kuribas> ertes: you didn't go to university?
18:37 <ertes> kuribas: nope
18:37 <kuribas> so like me
18:37 ystael joined
18:38 danharaj joined
18:39 <Tene> I like to say that I graduated early with a double major in sleeping a lot and dropping out
18:39 path[l] joined
18:40 <johnw> ertes: I think it's a misperception to see it as a "closed group"
18:40 <ertes> johnw: i don't see it as a closed group, but it's still difficult to penetrate, unless you have an idea that is clearly original
18:40 safe joined
18:41 <johnw> it can also just be an idea that advances things along
18:41 <ertes> johnw: note: this is particularly about writing papers, not about general community interaction
18:41 <johnw> yeah, I'm talking about writing papers
18:42 <johnw> I've been rejected a few times already, but then was accepted last year for an experience report, and I'm going to submit another one tomorrow. I think you just have to do it, rather than assume it won't be accepted because you're not already a well-known academic.
18:42 mson joined
18:43 shafox joined
18:43 grumble joined
18:44 <johnw> at the very least, you'll get some excellent feedback on your idea, and you go through the work of preparing it
18:45 <ertes> probably, but then the second problem is that it's a lot of work, far beyond the work of actually explaining your idea
18:45 <johnw> I received two pages of feedback from Conor McBridge on one rejection that was worth the whole process
18:45 <johnw> McBride*
18:45 <kuribas> ertes: exactly
18:45 <johnw> yeah, that's true
18:45 <johnw> *that's* why most people don't do it, I'd say :)
18:45 <ertes> yes, and that's a problem
18:45 <johnw> plus side, I'm getting a lot better with LaTeX
18:46 chaosmasttter joined
18:47 ner0x652 joined
18:47 <ertes> you know… i see direct parallels between that and writing a java program… ultimately the semantics of your program is at most 20 lines of code, but you have to follow all this OOP nonsense for the average java hipster to even look at it
18:47 faberbrain joined
18:47 <johnw> lol
18:47 fizruk_ joined
18:47 oisdk joined
18:48 <ertes> in the end you have done lots of research into factories and facades and the size of your program has grown to 2000 lines
18:48 <kuribas> ertes: well, looking at existing literature and comparing different timings may still give interesting results.
18:49 <ertes> kuribas: yes, i agree about that
18:49 <ertes> and generally at that point i would have done that
18:50 <geekosaur> if I'm going for some reason to formally submit something to a journal, I'd expect to need to do some homework first (references to prior art, etc.)
18:50 <geekosaur> (not that I foresee any particular need to do so)
18:51 <geekosaur> but then most of my journal experience is (a) reading (b) the likes of _Science_ and _Nature_, not CS or math journals
18:54 <monochrom> Paper rejection rate is high for everyone, not just for outsiders, whatever that means.
18:54 <Adluc> johnw: can you send DOI of the accepted paper if was already published?
18:55 conal joined
18:55 s4kashya5 joined
18:55 <ertes> you know what would be really helpful? an "outsider guide"
18:55 <ertes> "this is what you need to do to write a paper, and these are the things you need to keep in mind"
18:56 <johnw> Adluc: the conference date exactly coincided with an anniversary trip, so I actually had to decline to present. But I can give you a link to the paper: https://dl.dropboxusercontent.com/u/137615/linearscan.pdf
18:57 <johnw> haven't decided whether to resubmit or not
18:57 danthemyth joined
19:00 AleXoundOS joined
19:00 structuralist joined
19:03 FullyFunctional left
19:03 connrs joined
19:04 shafox joined
19:05 takle joined
19:06 path[l] joined
19:09 <kuribas> My algorithm is quite simple, I am surprised it doesn't exist already... Basicly I am using the curvature of a parametric curve to find the closest distance of a point to the curve.
19:09 caumeslasal joined
19:11 <* kuribas> 'd better write a paper or blog about it...
19:12 takle joined
19:14 logzet joined
19:14 dan_f joined
19:15 <ongy> qui
19:15 phyrex1an joined
19:16 nwf joined
19:17 soLucien joined
19:18 ronnik joined
19:19 jomg joined
19:20 nwf_ joined
19:22 stef204 joined
19:23 arcetera joined
19:23 <ertes> i have an associated type Sample that is defined elsewhere… how do i exported instances defined in this module properly? Sample(..)?
19:25 Intensity joined
19:27 structuralist joined
19:27 ptek joined
19:29 seveg joined
19:29 <geekosaur> instances are always exported
19:29 <geekosaur> and always imported
19:30 <geekosaur> oh, type instances not typeclass instances
19:30 <geekosaur> um, there's an extension for control of that
19:30 <geekosaur> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#explicit-namespaces-in-import-export
19:31 <geekosaur> I think it also describes the default behavior there?
19:31 Intensity joined
19:32 pleax joined
19:32 jutaro joined
19:33 takle joined
19:33 takle joined
19:36 chaosmasttter joined
19:37 <kuribas> I found a paper with the same algorithm: https://hal.archives-ouvertes.fr/hal-00920672/document
19:37 takle joined
19:38 ystael joined
19:40 doodlehaus joined
19:41 cdg joined
19:43 MP2E joined
19:44 conal joined
19:46 Intensity joined
19:46 <Tuplanolla> That didn't take long, kuribas.
19:47 <kuribas> Tuplanolla: no, it didn't :-P
19:47 dev-Zero_ joined
19:48 <Tuplanolla> I may have thought about this problem at some point as well.
19:48 <Tuplanolla> Not enough to take it anywhere, however.
19:49 Habib joined
19:49 pleax joined
19:50 <kuribas> Tuplanolla: apparently the problem is called "point projection".
19:50 <Habib> Does anyone know of a function like stripPrefix that just returns the second argument by default instead of Nothing if it fails?
19:50 <ertes> ah: pattern LinearSample
19:51 <Habib> This is what I've got so far:
19:51 <ertes> geekosaur: i had tried that, but got a syntax error… didn't realise that i also need -XPatternSynonyms
19:51 <Habib> (join $ stripPrefix "https://google.co.uk" <$> Just "/search?q=search+query") <|> Just "/search?q=search+query"
19:52 codesoup joined
19:52 <Habib> Whoos, sorry more lilke (join $ stripPrefix hostUrl <$> possiblePathOrUrl) <|> possiblePathOrUrl
19:52 <Habib> But that's ugly as hell.
19:53 <sm> maybeStripPrefix p s | p `isPrefixOf` s = drop (length p) s
19:53 <sm> | otherwise = s
19:54 <Habib> Ha, fair enough. I did think about just implementing it myself, but I thought I might be able to drastically shorten it by building upon the original.
19:54 <ertes> Habib: you should probably use an actual URL library
19:55 <Habib> Another good idea.
19:55 djfo joined
19:55 tomphp joined
19:55 <ertes> Habib: https://hackage.haskell.org/package/network-uri
19:55 cdg joined
19:56 xwl joined
19:56 ragepandemic joined
19:57 calincru joined
19:57 danthemyth joined
20:02 deepfire` joined
20:04 <zennist> is there a way for ghc to print the typeclass instance selection process?
20:04 <zennist> i'm having trouble understanding some of the errors it arrives with
20:05 subttle joined
20:06 whald joined
20:06 augur joined
20:07 biglama joined
20:08 jmcarthur joined
20:09 armyriad joined
20:09 Jeanne-Kamikaze joined
20:09 <geekosaur> I think -ddump-tc-trace is the best you can do?
20:10 psychicist__ joined
20:11 Big_G joined
20:13 aarvar joined
20:14 Rainb joined
20:14 dustmote joined
20:17 emmanuel_erc joined
20:18 bjz joined
20:19 tomphp joined
20:21 sleblanc joined
20:21 takle joined
20:22 raichoo joined
20:25 conal joined
20:26 zcourts joined
20:27 Uakh joined
20:28 meoblast001 joined
20:28 freeside joined
20:29 zcourts_ joined
20:30 takuan joined
20:31 fizruk joined
20:32 grayjoc joined
20:34 cyborg-one joined
20:34 path[l] joined
20:36 Kreest__ joined
20:36 <michalrus> So I would need to define a… sort of Bifunctor for my type, but with the first function inverted: `(c -> a) -> (b -> d) -> f a b -> f c d`. Is there a name for that?
20:38 <phadej> Produnctor
20:38 <phadej> michalrus: Profunctor
20:38 <michalrus> Awesome, thank you! ♥
20:38 <phadej> np
20:39 ikke joined
20:39 ystael joined
20:40 bollu joined
20:40 khumba joined
20:45 insitu joined
20:46 <Zemyla> So if a term made by composition of S, K, and I hasa valid type in the simply typed lambda calculus, then it's guaranteed to terminate, correct?
20:46 Miroboru joined
20:46 takle joined
20:49 faberbrain joined
20:50 pleax joined
20:51 meoblast001 joined
20:51 psychicist__ joined
20:52 freusque joined
20:53 <hpc> Zemyla: STLC is strongly normalizing, so yes
20:53 jgt joined
20:53 <jgt> hey folks
20:54 <jgt> I have a `HandlerT App IO ()` in my Yesod app, but I need to give it to something expecting a `ReaderT App m ()`
20:54 <jgt> am I able to transform one to the other?
20:56 dfeuer joined
20:57 wtetzner joined
20:57 IanKelling joined
20:57 <jgt> basically I want to call a handler from a `runJob`, as defined here: https://github.com/nakaji-dayo/yesod-job-queue/blob/master/Yesod/JobQueue.hs#L99
20:58 <jgt> but since `runJob` takes a ReaderT, I'm guessing it can't take a HandlerT, as a HandlerT can change some state, and ReaderT disallows that… maybe?
20:59 balor joined
21:02 Rodya_ joined
21:03 steeze joined
21:04 <Zemyla> hpc: Is it still strongly normalizing when augmented with C :: (((a -> b) -> a) -> a? I don't think so, since that implies the law of the excluded middle.
21:04 oisdk joined
21:06 <lyxia> jgt: runJob doesn't take a ReaderT, it produces one
21:06 <Zemyla> Though it's still not inconsistent, so hmm.
21:06 <lyxia> jgt: and you can convert it to a HandlerT because a HandlerT site m a is an instance of MonadReader site
21:07 pleax joined
21:07 <hpc> @djinn f :: (((a -> b) -> a) -> a
21:07 <lambdabot> Cannot parse command
21:07 <jgt> lyxia: so is what I'm trying to do, actually doable?
21:07 <hpc> Zemyla: probably not, because i don't think that type has any normal form inhabitants
21:07 <mauke> ((())
21:08 <lyxia> jgt: I guess so. What are the exact types of the input you have, and the output you expect?
21:08 <jgt> lyxia: are you familiar with Yesod?
21:09 <bollu> :t callCC
21:09 <lambdabot> MonadCont m => ((a -> m b) -> m a) -> m a
21:09 <bollu> ^ someone explain that to me? I don't intuitively understand what's happening.
21:10 <lyxia> jgt: kind of
21:10 Swizec joined
21:10 <monochrom> bollu: My http://www.vex.net/~trebla/haskell/cont-monad.xhtml
21:10 <bollu> monochrom: ooh thanks
21:10 vtomole joined
21:10 MrcRjs joined
21:11 nilof joined
21:11 <jgt> lyxia: basically when I write my `instance YesodJobQueue App where`, I have a line like this: `runJob app FetchNextCompany = appFetchNewCompaniesJob app`
21:12 bangtree joined
21:12 <jgt> lyxia: and `appFetchNewCompaniesJob app` is a `HandlerT App IO ()`
21:12 <bollu> monochrom: what I do not understand is: the early exit handler returns "m b" but the final type of callCC returns an "m a"
21:12 <bollu> monochrom: so, like, how the hell do you implement it in your head? I've written the implementation with "follow the types"
21:12 <Eduard_Munteanu> jgt, 'm' can be a HandlerT App IO ()
21:12 <bollu> monochrom: but it makes no sense to me
21:12 <ezyang> the early exit handler doesn't have to "return"
21:12 gugah joined
21:12 <ezyang> think about error: it takes any type
21:12 <ezyang> that's because it shortcuts out
21:12 <ezyang> same with the early exit
21:13 <bollu> ezyang: I don't follow, I'm sorry
21:13 <ezyang> :t error
21:13 <lambdabot> [Char] -> a
21:13 <monochrom> It is similar to 'error "hello"' has a polymorphic return type. It doesn't return. It can afford to claim a polymorphic return type and blend into any context you like.
21:13 <mauke> bollu: do you happen to know C?
21:14 MrcRjs joined
21:14 <jgt> lyxia Eduard_Munteanu $100 to anyone who wants to pair with me on this for like 30 minutes (probably takes less time though)
21:14 FullyFunctional joined
21:15 <bollu> mauke: yes
21:15 Rodya_ joined
21:15 <mauke> what type would longjmp have in Haskell?
21:15 merijn joined
21:15 <bollu> ((a -> m b) -> m a) -> m a <- if I use callCC $ \handler -> k "error" or something, it would actually get called?
21:16 <ezyang> you didn't call handler
21:16 <monochrom> But I don't have to use callCC in that boring way.
21:16 <bollu> mauke: I haven't used longjmp, sorry :)
21:17 <bollu> ezyang: what do you mean?
21:17 <bollu> monochrom: how else would you make use of callCC?
21:17 twanvl joined
21:17 <ezyang> bollu: Did you mean s/k/handler/
21:17 <monochrom> callCC $ (\k -> do { x <- if 4>5 then k False else return 10; return (x > 20) })
21:18 cdg_ joined
21:19 <monochrom> Also the examples in my article.
21:19 <bollu> monochrom: change the "k False" to "k 'a'" or something? because in your example, b ~ a
21:19 <bollu> monochrom: oh wait that doesn't make sense
21:19 <monochrom> No, x>20 :: Bool, therefore I need k (something :: Bool).
21:19 <bollu> monochrom: yeah
21:20 <bollu> monochrom: so, well, what if k = return "monochrom"
21:20 <bollu> monochrom: what would the output of actually running this continuation be?
21:20 <monochrom> But k != return "monochrom".
21:20 <bollu> monochrom: how do you know that?
21:20 <bollu> monochrom: k _ = return "monochrom" I mean
21:20 <monochrom> Neither.
21:21 <bollu> monochrom: OK, so, what is "k"?
21:21 <jgt> Eduard_Munteanu: So I guess I'm reading it wrong? Perhaps I should read it like: “runJob takes a `JobType master` and produces a `ReaderT master (HandlerT App IO ()) ()`”?
21:21 <monochrom> Let's say I read the source code of Cont and callCC so I know k _ != return "monochrom", OK?
21:21 <bollu> sure :)
21:22 supki joined
21:22 <Eduard_Munteanu> jgt, that could work, with master ~ App. Note HandlerT is already ReaderT-like
21:22 <hpc> k = everything that happens after that callCC
21:22 <monochrom> It is the job of callCC to create something sensible and hand it to you as your k, and it has the effect of early escape. It is going to be a beast.
21:22 <bollu> I see
21:23 <hpc> including things not currently in scope
21:23 <* hpc> lpastes
21:23 <bollu> https://github.com/bollu/haskell-koans/blob/master/cont.hs#L46
21:23 <bollu> I had implemented it before
21:23 <bollu> I do not understand it however
21:23 cereal_killer_ joined
21:23 <jgt> Eduard_Munteanu: I don't suppose you fancy pairing on this with me?
21:24 <Eduard_Munteanu> jgt, not exactly, I can help here though
21:24 maninalift joined
21:24 <bollu> monochrom: so, well, what would it look like / be?
21:24 <jgt> Eduard_Munteanu: are you familiar with Yesod?
21:25 <hpc> bollu: http://lpaste.net/3364016637622616064
21:25 <monochrom> callCC has access to the piece of program that appears after callCC. (Well, every program in the Cont monad does, but few actually exploit it.)
21:25 <bollu> monochrom: in general, what is the type of "b" that is chosen in the ((a -> m b) -> m a) -> m a
21:25 lopex joined
21:26 <monochrom> So callCC creates a k that says "let's jump forward to that future point".
21:26 <Eduard_Munteanu> jgt, if you want to use runJob in a handler, you just have to do something like do { app <- getYesod; runReaderT (runJob app ...) app } though I'm not sure it makes much sense
21:26 cyborg-one joined
21:26 <hpc> bollu: in a very real way, saying anything about the value of k there is like writing "do x <- get; print x" and declaring that x = 5
21:26 <monochrom> In general, it is determined by the context.
21:26 <bollu> hpc: oh, oh
21:26 <Eduard_Munteanu> jgt, yes
21:26 <bollu> I see
21:26 coot joined
21:26 <jgt> Eduard_Munteanu: other way around. I want to call a handler from `runJob`
21:26 <hpc> it depends on things outside your current knowledge
21:26 <bollu> hpc, monochrom: so is there an intuition to the _implementation_ of callCC?
21:26 <Eduard_Munteanu> jgt, oh, then just lift
21:27 <bollu> I've implemented it but I don't understand why it works :)
21:27 <monochrom> For example, I wrote "if 4>5 then k False else return 10" so the context wants Integer because "else return 10", so b = Integer by type inference.
21:27 <bollu> right
21:27 <monochrom> Yes, the intuition is what I said.
21:27 pleax joined
21:27 <monochrom> <monochrom> callCC has access to the piece of program that appears after callCC. (Well, every program in the Cont monad does, but few actually exploit it.)
21:27 <Eduard_Munteanu> jgt, you might need a MonadHandler constraint on m
21:27 <hpc> honestly, if i had to write callCC by hand right now i would probably start by running the djinn algorithm in my head
21:27 <monochrom> <monochrom> So callCC creates a k that says "let's jump forward to that future point".
21:28 Lord_of_Life joined
21:28 <jgt> Eduard_Munteanu: I tried saying `data App = App {...appFetchNewCompaniesJob :: IO () }`, and then in `makeFoundation` I did `appFetchNewCompaniesJob <- return $ handler fetchNextCompany`
21:29 <bollu> monochrom: so you would implement it using that intuition?
21:29 <monochrom> Yes.
21:29 <jgt> Eduard_Munteanu: and this worked _somewhat_ but it sometimes failed after a while with “runFakeHandler issue: InternalError "<socket: 14>: hFlush: illegal operation (handle is closed)"”
21:29 <Eduard_Munteanu> Let me get some context on this package.
21:29 <monochrom> I think I actually did.
21:29 <bollu> monochrom: when?
21:29 <jgt> Eduard_Munteanu: and I suspect it's because I used the `handler` function, which is implemented with the `unsafeHandler` function
21:29 <monochrom> A long time ago when I was learning this stuff.
21:30 <monochrom> When maybe it's unfair to call it intuition.
21:30 <monochrom> I don't do intuition. I do realistic theories.
21:30 <Eduard_Munteanu> jgt, oh, I see. You're not supposed to run a handler, but an IO action that executes asynchronously, I think.
21:30 <jgt> Eduard_Munteanu: oh and to run it, I was doing `runJob app FetchNextCompany = liftIO (appFetchNewCompaniesJob app)`
21:31 <Eduard_Munteanu> jgt, but you could turn appFetchNewCompaniesJob into an IO action and a handler action using the IO action.
21:31 louispan joined
21:31 <monochrom> callCC lives in the Cont monad therefore it has access to "the rest of the program". (Everything that lives in Cont does, though you don't always have to care.)
21:32 <bollu> I see
21:32 <jgt> Eduard_Munteanu: I _may_ have been doing that…? I'm not quite sure
21:32 <bollu> hm, OK
21:32 <monochrom> So callCC just needs to package that "rest of the program" up in a form suitable for the user.
21:32 <hpc> if you've ever written assembly, it's like having access to the instruction pointer
21:32 <monochrom> I don't know whether this is intuition or not. But it is the reality.
21:32 <hpc> (which also in some way represents the complete remainder of the program)
21:33 <jgt> Eduard_Munteanu: I think `data App = App {...appFetchNewCompaniesJob :: IO ()...}` means that appFetchNewCompaniesJob is an IO action
21:33 <hpc> you should experiment with it in ghci, and especially with constructing ContT values with the data constructor
21:34 <hpc> see what happens when you ignore the continuation, or when you do other fancy things with it
21:34 <jgt> Eduard_Munteanu: (also, I'm using ellipses here to emit other irrelevant fields; not some record wildcard thing)
21:34 doodlehaus joined
21:34 <hpc> and then try and work out why it did those things for yourself
21:34 <Eduard_Munteanu> jgt, without using 'handler' to turn HandlerT App IO () into IO (), but the other way around... make your HandlerT App IO () use the IO () action
21:35 sensei joined
21:36 <jgt> Eduard_Munteanu: so how should I initialize the appFetchNewCompaniesJob field?
21:36 <nilof> I'm wondering how MonoFoldable relates for Foldable? Is every instance of Foldable a MonoFoldable? Or the other way around? Or neither?
21:36 <nilof> *relates to
21:36 rger joined
21:37 HoierM joined
21:37 <Eduard_Munteanu> jgt, point it to the IO action that does the IO work (possibly including database stuff).
21:37 <bollu> hpc: cool, thanks. Much appreciated
21:38 <bollu> hpc: I've been trying to construct interesting things with Cont, but it is hard
21:38 <freeside> nilof: http://stackoverflow.com/questions/39634504/is-there-anything-we-lose-with-monofoldable
21:38 <geekosaur> "The motivation is that some commonly used data types (i.e., ByteString and Text) do not allow for instances of typeclasses like Functor and Foldable, since they are monomorphic structures. This module allows both monomorphic and polymorphic data types to be instances of the same typeclasses."
21:39 <jgt> Eduard_Munteanu: I'm not able to do `appFetchNewCompaniesJob <- fetchNextCompany`, with `fetchNextCompany` being the name of my handler
21:40 <Rotaerk> geekosaur, what's that from
21:40 <jgt> Eduard_Munteanu: that, combined with `runJob app FetchNextCompany = appFetchNewCompaniesJob app`, fails with:
21:40 <jgt> Couldn't match expected type ‘ReaderT App m ()’
21:40 ystael joined
21:40 <jgt> with actual type ‘HandlerT App IO ()’
21:40 <freeside> https://hackage.haskell.org/package/mono-traversable-1.0.2/docs/Data-MonoTraversable.html
21:40 <Eduard_Munteanu> jgt, sure, it's not supposed to be a Handler.
21:40 <Rotaerk> ah
21:40 <geekosaur> haddock for Data.MonoTraversable (mono-traversable package)
21:40 <Eduard_Munteanu> jgt, what I mean is you have to rewrite fetchNextCompany to split it into handler stuff and IO stuff
21:41 <geekosaur> and, somewhere in there, the point is to make a bunch of things able to work with any of String/ByteString/Text
21:41 <Eduard_Munteanu> jgt, after that, initialize the field to point to the IO bits.
21:41 <monochrom> callCC is passe these days. We have found that shift and reset exposes the real usefulness of Cont and ContT.
21:42 <jgt> Eduard_Munteanu: It might not even need to be a handler. If I understand it correctly, a handler is for when you need information about a request. I'm only using a `Handler ()` so I can use Yesod's logging, i.e., `$(logInfo)`
21:42 <Eduard_Munteanu> jgt, yep
21:42 <jgt> Eduard_Munteanu: Can I do logging that way without being inside a handler?
21:43 Noldorin joined
21:43 <Eduard_Munteanu> jgt, sure, you just need the monad to be a MonadLogger for instance
21:43 <Eduard_Munteanu> And make a runner function that takes care of passing the right logger around.
21:44 <jgt> Eduard_Munteanu: so I need to write something like `instance MonadLogger where; fetchNextJob = …`?
21:44 <jgt> s/Job/Company/
21:46 <jgt> actually, if this doesn't need to be a Handler then the whole thing becomes so much simpler
21:46 <bollu> monochrom: what's shift and reset?
21:46 <Eduard_Munteanu> jgt, no... you can have fetchNextJob :: MonadLogger m => m ... then you can have a runner function which takes care of calling it
21:46 <monochrom> reset m = runCont m id
21:46 <jgt> I then don't need this appFetchNewCompaniesJob field
21:46 <monochrom> shift I forgot, but it is not complicated.
21:46 <bollu> monochrom: what does it do?
21:47 <ezyang> Curses! Got bit by 'length has an instance for (,) a'
21:48 <monochrom> Let me see if I can recall it off the top of my head. I only have it written down in a file I don't have now.
21:48 <ezyang> oops
21:49 <freeside> jgt: are you using WAI?
21:50 <ezyang> that error only occurs on update right?
21:50 <jgt> freeside: I think so? I mean, Yesod uses it, right?
21:50 <geekosaur> was that for #hackage, ezyang?
21:50 <ezyang> yes oops
21:51 Lord_of_Life joined
21:52 darjeeling_ joined
21:52 <freeside> jgt: i'm looking at http://www.yesodweb.com/book/web-application-interface and wondering if your app would benefit from that structure.
21:53 <jgt> Eduard_Munteanu: how should I be running it? Do I need a `runReaderT`? I'm doing `runJob app FetchNextCompany = fetchNextCompany` and it's failing with this: http://sprunge.us/bVLh
21:53 hiratara joined
21:53 <freeside> bollu: re shift and reset, see https://en.wikipedia.org/wiki/Delimited_continuation#Examples
21:53 <bollu> freeside: thank you
21:53 <ezyang> the problem with optparse-applicative is I can never find where the combinators are defined
21:54 cdg joined
21:55 <freeside> http://citeseerx.ist.psu.edu/viewdoc/download?doi=
21:55 <jgt> freeside: I'm not sure what the relevant part is :-/
21:56 bennofs1 joined
21:58 Goplat joined
21:58 buttbutter joined
22:00 <freeside> yeah, sorry, I don't know Yesod well enough to be useful to you, i think
22:00 <jgt> freeside: no problem, thanks for trying :)
22:00 seveg joined
22:01 ziocroc2 joined
22:01 <jgt> Eduard_Munteanu: I think I figured out that last error; I was doing `app <- getYesod` which was making it a MonadHandler
22:02 conal joined
22:03 subttle joined
22:04 rger left
22:05 <centril> Say I have a: type N a = a -> Maybe a, which denotes a normalizer of some term a ... The normalizer yields Just if something was normalized, or Nothing on identity... I then want to traverse the tree applying this normalizer recursively... but if I use >>= , then failing to normalize a sub-tree will yield Nothing for the whole computation...
22:05 <Athas> Which IO exception should I catch if I want to catch all IO errors, except those signalled by 'exitWith'?
22:05 <centril> Which leads me to... Is there some dual to Maybe where computations only yield Nothing if all parts yield Nothing... ?
22:05 jao joined
22:05 <Athas> Specifically, I want a top-level catcher for my program that catches all otherwise-unhandled exceptions, in order to print a custom error message.
22:06 sidei joined
22:06 <centril> I thought of: data N a = Normalized a | Id a ... but this won't work with Functor, Monad, etc.
22:07 <monochrom> Athas: Use the method in my http://www.vex.net/~trebla/haskell/exception-tutorial.xhtml#subtyping
22:07 <jgt> Eduard_Munteanu: currently, my thinking is that in order to use logging like `$(logInfo)`, I need to change the type constraint of `runJob` from `(MonadBaseControl IO m, MonadIO m)` to `(MonadBaseControl IO m, MonadIO m, MonadLogger m)`. Is that right?
22:07 ubsan_ joined
22:08 <freeside> centril: you seem to imply that returning the term unchanged is a failure to normalize; do i understand you correctly?
22:08 <Athas> monochrom: I see. Thank you.
22:09 <freeside> it seems to me that if the normalizer returns the term unchanged, then it is already in normal form, and you should give back Just whatever, rather than Nothing.
22:09 <monochrom> Is exitWith's exception really an IOException?
22:09 <Athas> monochrom: however, how can I check whether an exception is an ExitCode?
22:09 <Athas> No, it is an ExitCode.
22:09 dev-Zero_ joined
22:10 peterbecich joined
22:10 <monochrom> OK, then you catch/try for the ExitCode type instead.
22:10 <centril> freeside: Yes, but the top normalizer loop-applies all normalizers until none yield Just anymore
22:10 <Athas> Hm, there is Control.Exception.catches.
22:10 <monochrom> Scroll up to the "Typing" section.
22:10 <Squarism> can one use type designators "type UserId = Int" to actually check an argument is not just an Int but a UserId?
22:10 <centril> freeside: and if they keep yielding Just, then the normalizers will never terminate
22:10 <jgt> Eduard_Munteanu: but to override the type signature of `runJob`, I have to create my own class with a new `runJob`, called something else like `runJob'`
22:11 <jgt> I think?
22:11 <geekosaur> Squarism, no
22:11 <Squarism> geekosaur, thanks
22:12 <geekosaur> you also cannot escape using a constructor if you wnt UserId to be a distinct type; the constructor is how the compiler / language keeps track
22:12 <freeside> centril: er, your approach sounds kind of imperative, are you thinking functionally?
22:12 <centril> freeside: the logic is: run all normalizers until you can't normalize no more
22:12 cpup joined
22:13 <centril> freeside: how else should you do it... ? one normalization may unlock another... and they may be written independently
22:14 <centril> I could roll a bunch of functions: l2 :: (a -> b -> c) -> a -> b -> Maybe a -> Maybe b -> Maybe c
22:14 silver_ joined
22:14 <centril> l3 :: (a -> b -> c -> d) -> a -> b -> c -> Maybe a -> Maybe b -> Maybe c -> Maybe d
22:14 <centril> but that is not very generalizable
22:14 Habib left
22:16 <centril> I want to avoid a combinatorial explosion of manually writing code for checking if (Just a, Just b, Just c) -> ... (Just a, Just b, Nothing) -> ... (Just a, Nothing, Nothing) -> ... (Nothing, Just b, Nothing) -> ...
22:16 <freeside> what kind of normalization are you performing? are you validating input data or are you doing some kind of program refinement?
22:17 <centril> freeside: im normalizing ASTs of parsed java programs
22:17 <centril> freeside: https://github.com/DATX02-17-26/DATX02-17-26/blob/dev/libsrc/NormalizationStrategies.hs
22:19 <centril> there is zero validation, just semantic preserving normalizations of the AST
22:19 <freeside> ok, so you want to keep normalizing until you detect convergence.
22:20 <centril> freeside: convergence meaning what in this context?
22:21 <freeside> your thingy stops moving
22:21 <centril> yes, keep normalizing until all normalizations yield "no change"
22:21 <centril> We already do that...
22:22 esad joined
22:22 <centril> but... writing a single normalizer :: AST -> Maybe AST may be tricky and verbose since ASTs are deep, and there might be a normalization that can be applied deep within the tree
22:23 <robkennedy> When compiler writers worry about exponential code gen, what is their concern? Compilation time, or performance?
22:23 graygoose124 joined
22:24 <monochrom> I think neither. I think it's this:
22:24 <monochrom> * newhaskeller has joined #haskell
22:25 ddere joined
22:25 <monochrom> <newhaskeller> Why are GHC-generated executables so bloody huge? Mine is 100MB and it's just summing numbers. I want my money back.
22:25 <monochrom> * newhaskeller has quitted #haskell
22:25 <centril> freeside: for example, for expressions, data E = V String | E :+: E | E :*: E we might want to rewrite x * (x + x) = x * 2 x, and given normXX :: E -> Maybe E , we need to normalize deeply in l :+: r
22:26 <centril> robkennedy: performance = runtime performance of compiled program ?
22:27 <freeside> okay. i have two comments. first, why aren't you relying on the Traversable nature of your AST? second, using a Maybe in lines 98--100 seems like the wrong way to go about detecting stability/convergence.
22:27 <centril> a compiler writer would want to have a code-gen pass that emits an as efficient as possible program, but takes as little compile time as possible... sadly, you can't have it all
22:28 <freeside> your reduction rules may converge, diverge, or loop; you need to detect all these cases, and shoehorning things into a Maybe doesn't feel like the right design approach.
22:28 <centril> converge, diverge, loop - define the terms =)
22:29 <centril> a reduction rule may never loop - it must terminate
22:29 <centril> otherwise normalization is stuck
22:30 <freeside> if you are confident that reduction always converges, why not just tag each node of your AST with a "stable" predicate?
22:31 hiratara joined
22:33 <centril> freeside: by "stable" predicate I'm guessing you mean: "decorate the tree with, I can't be normalized further"... because that would change the structure of the AST itself - and I can't say atm when something is stable or not - because Java is complicated and I could add more complex reduction passes
22:33 louispan joined
22:34 <centril> freeside: I also don't get how I can make the AST Traversable...
22:34 <freeside> as for looping and divergence, i'm talking about a set of reduction rules that may, um, let me give an example: suppose you have a rule (a :: exp) "+" (b :: exp) ==> b "+" a
22:34 <Athas> robkennedy: exponential *anything* is bad. You run the risk of sudden explosion, which is as bad as nontermination.
22:34 pleax joined
22:34 <freeside> so that rule, the first time you run it, flips a+b into b+a. then the second time you run it, it turns back into a+b. so there you have a loop.
22:35 <centril> Athas: hah, im my BsC project we're dealing with factoral complexities at places
22:35 <centril> factorial*
22:35 subttle joined
22:36 <centril> freeside: well that would not be a valid reduction rule, because it doesn't reduce
22:36 <jgt> I'm using this library code, but I want to change the type constraint of this line. How can I override it? https://github.com/nakaji-dayo/yesod-job-queue/blob/master/Yesod/JobQueue.hs#L99
22:36 <centril> freeside: unless you sort a & b lexiographically
22:36 shayan_ joined
22:37 <mofasa> Has any of you had any luck doing `stack install hsdev`? I'm getting dependency hell, stack can't figure things out on its own
22:37 <centril> Athas: iirc dependent types in Idris & Agda requires SMT solvers, which makes type checking exponential
22:38 <mofasa> http://pastebin.com/8qB3Gfcs
22:39 <AWizzArd> Does Haskell support Arrays that have no bounds checking at runtime?
22:39 Raptor8m3 joined
22:39 <centril> AWizzArd: by Arrays, do you mean a sequential list ?
22:39 <ezyang> there exist libraries that offer unchecked indexing
22:40 <geekosaur> you probably want Data.Vector
22:40 <AWizzArd> centril: I mean ordinary simple Arrays. Could be byte arrays. I think there is a string type like this. Was it ByteString maybe? But I meant in general, Arrays, like Float Arrays.
22:41 ystael joined
22:41 <AWizzArd> For maximum read speed, of indexed data.
22:41 <centril> AWizzArd: sounds like you'd want dependent types and type level Nat:s to ensure that the compiler verifies bounds instead of doing it at run-time
22:42 <centril> (as a general comment)
22:42 <AWizzArd> centril: no dependent types. I trust that I will only access an element within the bounds.
22:42 AndreasK joined
22:42 <geekosaur> :t unsafeAt
22:42 <lambdabot> error: Variable not in scope: unsafeAt
22:42 <AWizzArd> I have 20 million floats and want to access the nth element, and I am confident that my code never tries to access the element 20000001
22:43 <AWizzArd> Lists would work of course, but I want the fastest possible access time, as this sits in tight loops that run billions of times.
22:43 <centril> :t (Data.Array.!)
22:43 <lambdabot> Ix i => Array i e -> i -> e
22:44 <AWizzArd> The JVM for example always checks when I access the nth element, if n is <= the max element number. I can’t go around this check. While C# does allow reads without any runtime checks.
22:45 <freeside> as geekosaur said, maybe you want Data.Vector
22:45 tfc joined
22:45 <geekosaur> right, I was trying to remember what the no-bounds-check version of (!) was
22:45 nomicflux joined
22:45 Voldenet joined
22:45 Voldenet joined
22:45 <geekosaur> there was one in there, I thought
22:46 zcourts joined
22:46 <Rotaerk> hmm I'm writing a script where you can give it the name and version of a hackage package, and it will download http://hackage.haskell.org/package/<name>-<version>.tar.gz and hash it
22:46 <centril> geekosaur: does (Data.Array.!) do bounds checking ?
22:46 <AWizzArd> freeside: the Unboxed version possibly?
22:47 <geekosaur> iirc it does
22:47 <Rotaerk> if I want to allow the user not to have to specify a version, is there some easy way (without having a locally up to date cabal) to get the latest version of that package?
22:47 cfricke joined
22:47 <centril> geekosaur: then why isnt it yielding Maybe e ?
22:47 <geekosaur> same reason hed doesn't
22:48 <geekosaur> someone thought that was a good idea
22:48 <geekosaur> (Array is not used much...)
22:48 <centril> stupid partial functions in base make me sad...
22:48 <geekosaur> you're far from the only one
22:49 <robkennedy> Athas: exponential everything isn't necessarily bad. Solving P problems with NP compiler difficulty is an optimization sometimes.
22:49 <centril> geekosaur: ye =)
22:49 <Rotaerk> well, apart from scraping the contents of http://hackage.haskell.org/package/<name>-<version>
22:50 <jgt> (asking again)
22:50 <centril> robkennedy: for small n ;)
22:50 <jgt> I'm using this library code, but I want to change the type constraint of this line. How can I override it? https://github.com/nakaji-dayo/yesod-job-queue/blob/master/Yesod/JobQueue.hs#L99
22:50 <robkennedy> centril: yes, I thought of exponential code gen as performance hit, where performance is dichotomously compiler or run-time
22:50 <Rotaerk> eh, maybe cabal is fine in this case..
22:50 <jgt> or do I need to write my own fork of that library?
22:50 <geekosaur> the latter
22:51 faberbrain joined
22:51 Rodya_ joined
22:51 <jgt> geekosaur: was that addressed to me?
22:51 <geekosaur> you can't override something else's type (well, there is a way but unless you know exactly what you are doinbg and what ti means to the compiler, you are inviting a core dump)
22:51 <jgt> ah, I see. So the right thing to do here would be to fork the library and use my own version in my project, then send a patch upstream?
22:51 <robkennedy> monochrom: good reason. What is the base line and "poor" Haskell exe? That's a priming I've yet to bother with
22:52 marsam joined
22:53 <robkennedy> centril: but many types are bound by small n (ie Int)
22:53 <geekosaur> likely, although if they don't accept the patch for whatever reason you may be stuck maintaining yoiur own fork
22:53 <geekosaur> (in that case it is usually worth listening to why; you may learn how to make it work without modification)
22:53 <centril> robkennedy: 2^32 sounds like very large
22:54 cdg joined
22:54 <jgt> geekosaur: Thanks for the clarification! :)
22:54 <freeside> jgt: i said previously that I don't know Yesod well enough, and that's still true, but 20 years of software development experience suggests that there's a right way and a wrong way to get Yesod to do what you want, and forking the library to change a type constraint sounds like the right way is still waiting to be discovered :)
22:55 <ongy> jgt: before you put effort into that it may be worth creating an issue (if it's on github) or equivalent, so you get told if there's a better way
22:55 <kuribas> Yesod isn't some obscure forgotten package.
22:55 <freeside> back on #perl, purl used to talk about XY Problem
22:55 <robkennedy> centril: I was referring to the 32. You're right that Int has a large domain. The times SPJ has referenced exponential code gen, I've wondered on that bound for N. I'll look back on those cases.
22:55 <jgt> freeside: well, in the example usage of that library, the author prints stuff to screen with `putStrLn`. I don't want to do that; I want to use Yesod's logger. And to do that, I believe I must add `MonadLogger m` to that type constraint
22:56 Guest4561 joined
22:56 marr joined
22:56 <centril> robkennedy: oh =)
22:57 <jgt> ongy: I intend to open an issue, but I also want to get this thing working now, and also I'm learning a whole bunch of stuff along the way
22:57 <Cale> jgt: Which is unfortunate, because you can already perform arbitrary IO actions -- not being able to log stuff at that point is a crime :)
22:57 <centril> robkennedy: im very happy that topological sorting of a DAG is P, or we would be in deep shit
22:58 <jgt> Cale: I'm not sure *exactly* what you mean; are you saying that my wish to log stuff is reasonable in this context?
22:58 <centril> dependency analysis would be super expensive if it werent
22:58 <Cale> jgt: It is reasonable to want to log stuff, but I'm not a fan of MonadLogger
22:59 <Squarism> i wonder what a good way to create an api is. Right now i have all my types in Types.hs. I want to describe an api. Should import certain types to Api.hs and document them there?
22:59 <Cale> jgt: It does appear that there's a class MonadLoggerIO which, supposing that it applies to whatever monad you're using, will get you a function that gives you a plain IO action at the end
22:59 <Squarism> (for the "type" part of the api)
22:59 <centril> Squarism: will you export Types.hs in exposed-modules ?
23:00 <centril> Squarism: I think having small files is nice - you can always re-export... and the haddock docs will just magically work
23:01 <jgt> Cale: I *think* I want to use MonadLogger for a couple of reasons: 1. Consistency, and some free stuff like timestamps and other data, and 2. I vaguely remember reading something (I think Snoyman wrote it?) about output buffering; if you just use `putStrLn`, then eventually the output will start getting mashed together and will be useless. This is at least what I was seeing when I tried using `putStrLn`.
23:02 <jgt> although “output buffering” may not have been the correct term
23:02 <Rembane> MonadLogger is using something more low-level that I like.
23:02 <Cale> Oh, in a multithreaded application, you definitely want to set up a logging thread if you're going to be logging stuff from multiple threads.
23:02 ompaul joined
23:02 <Cale> But I would just do that myself usually, and stick the action for writing to the log into whatever record structure I'm passing around for my application's state (or just pass it around directly if I don't have one of those yet)
23:02 <jgt> Cale: well, I'm using this library for background jobs, and naturally those jobs run in some worker threads in the background (I think? Yes?)
23:03 <Cale> Yeah, that's fine
23:03 doodlehaus joined
23:03 <jgt> Cale: So even more so since you say that, it's strange that the author uses putStrLn in the usage examples
23:03 argent0 joined
23:04 <jgt> but then again, I feel I'm working to defend this point in an IRC room full of Haskellers much more experienced than me, so I feel I'm probably wrong about something still
23:04 <freeside> maybe the putStrLn usage examples were written before fast-logger, etc were put into yesod
23:04 <Cale> It's mostly a matter of taste, and people can disagree on it.
23:04 <Cale> (reasonably)
23:04 <Cale> anyway, try askLoggerIO :: m (Loc -> LogSource -> LogLevel -> LogStr -> IO ())
23:05 <Cale> Assuming you're using Snoyman's monad-logger, which it sounds like you are :)
23:05 danthemyth joined
23:06 cschneid_ joined
23:06 <jgt> freeside: that project is only a year old. Not sure when fast-logger went into Yesod
23:06 <freeside> oh ok
23:06 <jgt> freeside: it's this one: https://github.com/nakaji-dayo/yesod-job-queue
23:06 pleax joined
23:06 <jgt> Cale: I'm not sure where I'd put that function
23:08 ContessaTP joined
23:08 <freeside> "a monad is not like a burrito, but if it were, a monad-logger would be like the trail of meat juices and sour cream that squirts out from the distal end onto your jeans"
23:08 <pikajude> which end is the distal end
23:09 <johnw> lol
23:09 <johnw> distal is the one facing away from your mouth
23:09 <pikajude> oh
23:09 <jgt> I had a burrito this evening and the juice ended up on my trackpad
23:09 fkurkowski joined
23:09 <jgt> my macbook is basically an eating utensil
23:09 <freeside> well, clearly It's A Sign
23:09 <centril> freeside: depends on where you put your logger in the monad transformer stack
23:09 <Squarism> centril, well some of them. The API atleast
23:11 <centril> Squarism: I would design like this: let Type.hs be an exported-module and Api.hs as well, and then in Api.hs, reexport Type.hs - put documentation relevant to Type.hs in Type.hs
23:11 kav joined
23:11 <centril> in Type.hs, only export API stuff
23:11 crobbins joined
23:12 <centril> you can always have auxilary functions related to Type.hs in TypeAux.hs which is not exported, etc...
23:12 <centril> Squarism: documenting stuff about Type.hs in Type.hs is good because it makes maintenance easier
23:12 <Squarism> ok.. so Api will just export stuff, nothing defined there?
23:13 structuralist joined
23:13 neophytes joined
23:13 <centril> Squarism: well... you can still define extra stuff in Api.hs , but yes ... that is a thumbrule
23:13 <Squarism> ok
23:14 <centril> Squarism: take a look at: https://hackage.haskell.org/package/lens-4.15.1/docs/Control-Lens.html
23:14 structuralist joined
23:15 <neophytes> I am new to programming, the book I have (purple Haskell programming book) doesn't explain how to set up an IDE + Haskell on a Mac. What IDE should I use (that isn't vim/emacs + is free)?
23:16 <srk> ghcid
23:16 <neophytes> Also, is there any step-by-step tutorials on setting this up and writing a first 'hello world' program to see it works?
23:16 <neophytes> what is a ghcid IDE?
23:16 <srk> nah, just ghci ;)
23:16 <srk> ghcid is "IDE", it just compiles your code over and over and tells you that it compiles
23:16 contiver joined
23:17 <srk> which often is the only thing you need
23:17 <neophytes> So you type your complete program into ghci and it will have highlighting and so open like ecplise
23:17 <neophytes> ?
23:17 <srk> ghci is interpreter, you can prototype whole program in ghci
23:17 <Cale> You generally won't type much of your program into ghci
23:17 <srk> but mostly for testing/trying out stuff
23:17 <Cale> but ghci is not the same thing as ghcid
23:17 <Cale> you don't type anything into ghcid
23:17 justan0theruser joined
23:18 <Cale> It just sits there and lets you know the status of your code -- any errors or warnings which presently exist in it
23:18 <neophytes> I want something that will be like ecplise / sublime / IntelliJ so I can see my code /edit it if errors etc
23:18 <Cale> and then you use whatever text editor you like best alongside that
23:18 <centril> neophytes: my setup is: sublime text 3 in one 1/2 of the window to the left, a terminal with ghci on 1/2 of the window to the right - then I use SublimeLinter-hlint to give me tips inside sublime text for improvements
23:18 <Cale> You can even use IntelliJ if you like
23:18 mengwong joined
23:18 <centril> Yes, IntelliJ has a haskell plugin
23:18 <Cale> I use SublimeText myself
23:18 maninalift joined
23:19 <Cale> I used vim for years before that
23:19 <centril> Cale: there's a vim mode for st3
23:19 <centril> im sure you use it
23:19 <neophytes> I am wanting to learn functional programming to learn its connections to category theory (math guy here), not much of a programmer so I don't know anything about setting up IDEs or anything as such
23:19 <Cale> Yeah, I mostly switched away from ST to get away from vim's keys though
23:19 <neophytes> I just need a dumb easy to set up DIE
23:19 <neophytes> IDE*
23:19 <mengwong> oh lol then for once the tables are turned
23:19 <neophytes> so I can start hacking right away
23:20 <Cale> Due to the Chinese water torture of hitting u when I meant to hit i all the time
23:20 <centril> neophytes: I recommend just going with a text editor with syntax highlighting and a plugin system + ghci like I described
23:20 gugah_ joined
23:20 <Cale> and then having to redo, and then find the place where I was going to edit again
23:20 <neophytes> okay centril -- does sublime cost?
23:20 <bollu> Cale: you don't like vim?
23:20 <centril> neophytes: sublime text 3 is good, but a bit pricey... there is Atom if you want a FOSS solution that is free
23:21 <freeside> "ghci is simply a CLI IDE installable as part of any haskell platform, so all you have to do is familiarize yourself with the standard packaging system used on your *nix variant and you should be all set, it's easy"
23:21 <Cale> bollu: I hate every text editor.
23:21 <bollu> Cale: :)
23:21 <freeside> revenge of the software people on the math people
23:21 <srk> nix* variant :D
23:21 <neophytes> okay centril I'll look into atom and see if I can figure out how to set up Haskell with it
23:21 Edith joined
23:22 <Cale> bollu: The only reason I'm using Sublime right now is that I haven't been annoyed with its annoyances enough times to switch to yet another thing, but I'm sure they'll eventually get to me too
23:22 <freeside> neophytes: have you gone and downloaded https://www.haskell.org/platform/mac.html yet?
23:22 <neophytes> no
23:22 <neophytes> I need a step-by-step process of what to do.
23:22 <neophytes> I'll use atom
23:22 <centril> freeside: why not start with stack from the start?
23:23 <srk> +1 for stack
23:23 <bollu> Cale: I see
23:23 <bollu> Cale: what is your idea?
23:23 <bollu> ideal*
23:23 <neophytes> I don't know what a 'stack' is -- I literally am, new
23:23 <freeside> because he wants a one-click situation, and https://www.haskell.org/platform/mac.html includes stack now
23:23 <centril> freeside: oh, right
23:23 <srk> nice
23:23 <centril> that's nice
23:23 <freeside> neophytes: get that download going and we can figure out a text editor next
23:23 <neophytes> ok, downloading that now
23:23 <freeside> what do you normally use to write your LaTeX papers, etc?
23:24 <Monoide> neophytes: what area of maths are you from?
23:24 <Cale> bollu: I don't even know -- something which doesn't do unexpected bullshit that wastes my time (hard to characterise, but almost every text editor seems to do at least some of this), and makes it easy to flip between contexts where I've recently been working.
23:24 tsmish joined
23:24 <centril> Cale: that is awfully nondescript and vague...
23:25 <Cale> centril: yes
23:25 <freeside> it ain't just text editors ... the unexpected bullshit that wastes your time is part of all computing.
23:25 <Cale> centril: If it were less vague, I'd write my own text editor
23:25 <freeside> https://projects.csail.mit.edu/gsb/old-archive/gsb-archive/gsb2000-02-11.html
23:25 <neophytes> do I do core or full download freeside ? Monoide, I'm a math newbie but logic.. i got interested in FP because I realized there is a connection between covariance and contravariance (types) and covariant and contra variant functors.
23:25 <Cale> One thing I really like in ST is that it has keys you can press to move through your history of positions without editing anything, across many files
23:25 <freeside> go with the full download if you're on a decent connection.
23:25 <centril> Cale: I can't really fix code for "makes it easy to flip btw contexts where I've recently been working"
23:26 <neophytes> ok @freeside doing so now
23:26 <Monoide> just do haskell beaucause it's a good langage and a huge source of amusement
23:26 <Monoide> doing it for maths seems a bit ackward (I am a mathematician)
23:26 <freeside> yes, the functors you are talking about there are https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/profunctors
23:26 jluttine_ joined
23:26 <neophytes> sweet freeside -- I want to learn Haskell so I can understand that code! I know the math, not the code there haha
23:26 <Monoide> if you like logic don't foret to do some CoQ
23:27 <Cale> centril: So Sublime does a nice job there -- I have f12 bound to looking up the definition of the thing under my cursor, and Shift-f12 bound to jumping back in the history of locations, so I can quickly get back to where I was working after looking something up.
23:27 <centril> neophytes: if you want proofs about math stuff, then haskell really isn't for you... it's a general purpose programming language
23:27 <Cale> That much is good.
23:27 <neophytes> but I wanna say I'm very new to this sort of math and programming so I'm learning everything
23:27 <centril> neophytes: I'd recommend taking a look at Agda
23:27 <neophytes> ok
23:27 <centril> if you want to do proofs
23:27 <freeside> also you will probably get excited about Coq https://www.cis.upenn.edu/~bcpierce/sf/current/index.html
23:27 <centril> freeside: AGDA Agda agda!
23:27 <Monoide> Coq coq coq \o
23:28 <centril> (and idris)
23:28 <centril> Monoide: even the guy who made Coq uses Agda, i've heard
23:28 <freeside> idris, the new 007
23:28 <Cale> Where ST fails for me right now is that its highlighting for Haskell really sucks (it often gets confused and things that entire blocks of code are type signatures, especially if you put a signature in a pattern or have a let bound definition with a signature on it)
23:28 <neophytes> freeside: it says the installation was successful
23:28 structuralist joined
23:29 <freeside> neophytes: what text editor do you normally use to write your LaTeX papers, etc?
23:29 <centril> Cale: OK, but that can be fixed by improving the highlighter for haskell...
23:29 mdarse joined
23:29 <Cale> Yes, sure.
23:29 <freeside> (hoping the answer is not "Word")
23:29 <MarcelineVQ> Cale: I wonder if any editor survives syntax for promoted types
23:29 <centril> Cale: it's not really a big problem...
23:29 doodlehaus joined
23:29 bjz joined
23:29 <neophytes> freeside: text edit but i am on another computer (that is brand new) with nothing on it
23:29 <Cale> centril: It's big enough that I want to turn syntax highlighting off or switch to something else sometimes.
23:29 <neophytes> (I think that is what its called)
23:30 <neophytes> I think I can use sublime 3 license thingy?
23:30 <centril> Cale: ST3 for haskell is fine enough for me...
23:30 <Cale> (and I'm not going to fix the highlighter -- have you seen the highlighter definition for Haskell? :)
23:30 <Cale> There are also some annoyances with how it deals with closing braces
23:30 <centril> Cale: haskell is not a big nough language that ST3 devs care that much, probably...
23:31 <freeside> you said you wanted $0, so you might prefer Atom to Sublime Text
23:31 <Cale> Like, sometimes I'll type } and it will unindent the line "helpfully" when I already had my cursor positioned where I wanted it.
23:31 <neophytes> ok freeside
23:31 <neophytes> so how do I set it up with atom
23:31 <neophytes> I never used kit
23:31 <neophytes> only used ecplise for java (which I am comfortable with)
23:31 <neophytes> (both java + ecplise which I cannot spell)
23:31 <Cale> That's the kind of "stupid unexpected bullshit" I was talking about before.
23:31 <centril> Cale: so recent updates to GHC havent had recent updates in the highlighter for ST3
23:31 <centril> neophytes: https://github.com/simonmichael/haskell-atom-setup
23:31 <neophytes> I would like high lighting and so on
23:31 <Cale> If I type a printable character, you're not allowed to move my cursor on me before inserting it.
23:32 <freeside> well, if you're already familiar with Eclipse, then you can use that as your text editor for haskell, it's not a big deal
23:32 anuxivm joined
23:32 tromp joined
23:32 <centril> Eclipse...
23:32 <neophytes> ill use something different-- ill use atom
23:32 <freeside> if you want to try something different, try Atom: http://atom.io/
23:32 <neophytes> ok
23:32 minn joined
23:32 <neophytes> so I download that now?
23:32 <centril> neophytes: atom is nice, it also VERY similar to sublime text 3
23:32 <freeside> yes
23:32 <neophytes> k
23:32 <centril> but it is open source and free
23:33 <neophytes> downloading atom
23:33 <Cale> centril: But don't get me wrong, all in all, ST3 *is* okay for me -- for now.
23:33 <freeside> there are haskell packages, but why don't we get you running hello world and fibonacci before we install those. https://atom.io/packages/search?q=haskell
23:33 <Cale> centril: It's just I'm sure that eventually these little annoyances will gradually piss me off enough to try yet another thing
23:33 <centril> Cale: what I most of all want in ST3 is language-server usage, so I can use ST3 more like an IDE for Rust
23:33 <Cale> which will have different problems that I'm less annoyed with ;)
23:33 Tuplanolla joined
23:33 <neophytes> ok @ freeside atom is downloaded
23:33 <neophytes> what should I do next
23:33 <freeside> okay, well, go run the installers for both of those packages
23:34 <neophytes> ok'
23:34 <centril> neophytes: you probably want to setup hlint integration some time in the future
23:34 eschnett joined
23:34 <neophytes> wait which packages specially? the one you gave a link to has a lot
23:34 <neophytes> https://atom.io/packages/search?q=haskell
23:34 <Monoide> just do something that works and you'll complete your future needs in time
23:34 <minn> It's been a while since I've used Haskell. Am I supposed to be using Stack to manage packages (among other things) instead of Cabal, or is that not standard?
23:34 <centril> what Monoide said
23:34 louispan joined
23:34 <Cale> centril: btw, do you know how to get ST3 to read a standard tags file (like that emitted by hasktags)?
23:34 <monochrom> Both cabal and stack are standards.
23:34 <ertes> i'll face the question of editors on wednesday when i give my annual haskell workshop, which will no doubt have a few windows and mac users, and i don't want to force anyone to use emacs =)
23:35 <centril> neophytes: start small... add plugins later
23:35 <neophytes> ok
23:35 <ertes> i'd actually like to give leksah a shot this time
23:35 <neophytes> Ii only downloaded atom, not sure what to download next
23:35 Linoleum joined
23:35 <centril> Cale: wtf is standard tags file and hasktags ?
23:35 <centril> neophytes: nothing... start a project, and open a terminal and write ghci in it
23:35 <MarcelineVQ> ertes: there's also yi, iirc leksah is using yi though
23:35 <neophytes> how do I start a project? got the terminal open and typed that on
23:36 <Monoide> $ghci in terminal
23:36 <centril> neophytes: then you edit a file, save it, and go to your terminal, load it, and when you make changes you do :r
23:36 <Cale> centril: Many editors support a particular file format for describing the locations of definitions of various names, so that the editor can easily jump you to the definition
23:36 <ertes> MarcelineVQ: i considered yi to be among the more advanced editors that require some dedication
23:36 <Monoide> then >print "Hey I'm doing some Haskell"
23:36 <minn> monochrom: Thanks.
23:36 <neophytes> Last login: Sun Mar 12 19:12:30 on ttys000 recursive-functions-MacBook-Pro:~ ternary$ gchi -bash: gchi: command not found recursive-functions-MacBook-Pro:~ ternary$
23:36 <MarcelineVQ> ertes: in the realm of opening and it and going "well now what do​ I do" I agree
23:36 <freeside> typo, yo
23:36 <Cale> Sublime is semi-okay at this, but it's really not all that good at it, and often wants to take me to the export declaration instead of the actual definition, for example.
23:37 <centril> Cale: ST3 is not an IDE... there are limits to how smart text editors can be
23:37 <Cale> right
23:37 <neophytes> GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help Prelude>
23:37 <ertes> MarcelineVQ: judging by the screenshots leksah has at least one major advantage: users of the more established IDEs will feel at home instantly
23:37 <Monoide> neophytes: print "Hey GHCI, my name is neophytes"
23:37 <neophytes> Prelude> print "Hey GHCI, my name is neophytes" "Hey GHCI, my name is neophytes" Prelude>
23:37 <Cale> centril: But you don't have to be all that smart to read a file which has a bunch of strings and file names together with source locations and use that to decide where to jump
23:37 <neophytes> ok cool
23:37 <centril> neophytes: Monoide: print "Hello World"
23:37 <neophytes> so this is the REPL?
23:37 <centril> neophytes: yes
23:37 <neophytes> ok
23:37 <Monoide> neophytes: congratulations, you just did your very first haskell line of code
23:37 <Cale> centril: and then leave it up to some other program to generate that file :)
23:38 <neophytes> sweet!
23:38 <freeside> Prelude> take 10 $ map (+10) [1..]
23:38 <neophytes> how do I use the compiler to write code and so on and see it produce a value
23:38 <centril> Cale: I think language-server is better
23:38 <freeside> now you need to boot up Atom
23:38 <Cale> This was originally used for C, but most editors support it, and there are programs to generate them for other languages
23:38 <neophytes> Prelude> take 10 $ map (+10) [1..] [11,12,13,14,15,16,17,18,19,20] Prelude>
23:38 <neophytes> okay atom is up
23:38 <Monoide> neophytes: the compiler is named 'ghc', you can run it for command line: $ghc you_code.hs
23:38 <monochrom> emacs certainly has limits to how smart it can be. Not smart enough to solve the halting problem, something like that. :)
23:38 <Monoide> it procuces (if no errors) an executable file you_code
23:38 <Cale> ST3 does have a CTags plugin, but it seems to ignore my existing tags file
23:38 <centril> effing emacs & vim...
23:39 <centril> they should both be banned
23:39 <centril> nano rules!
23:39 <monochrom> nano doesn't have rules.
23:39 mizu_no_oto joined
23:39 <Monoide> nano doesn't
23:39 <ertes> how am i supposed to connect to IRC without emacs?
23:39 <ertes> how am i supposed to read my mail?
23:39 <neophytes> okay so I have atom up what is the "Hello world" of Haskell?
23:39 <centril> monochrom: I know of one thing to do in vim: :q!
23:39 <neophytes> I wanna try to compile it
23:40 <ertes> neophytes: main = putStrLn "Hello world!"
23:40 <neophytes> k
23:40 <Monoide> neophytes: to compile it you need to do a module, but then you also want to read a real documentation / tutorial / book
23:40 <Cale> ertes: I use HexChat for IRC, and usually a web browser for mail, though my phone often competes with that.
23:40 <ertes> neophytes: this line is enough as your main module
23:40 <neophytes> ok
23:40 <Monoide> (instead of asking IRC, which is fine, but maybe not really needed here)
23:40 <centril> neophytes: but you should always try to put types on functions, so main :: IO () \n main = putStrLn "Hello World!"
23:40 <neophytes> I saved it as hello_world.hs
23:41 <neophytes> main = putStrLn "Hello world!"
23:41 <neophytes> is my source code
23:41 <neophytes> so I wanna compile it
23:41 <ertes> neophytes: here is the quick way to compile it: ghc -O -o hello_world hello_world.hs
23:41 <ertes> put an ".exe" there, if you're on windows
23:41 <neophytes> ok
23:41 bno1 joined
23:41 ystael joined
23:41 <centril> neophytes: for real world compilation of haskell, you should take a look at cabal & stack
23:42 <monochrom> You don't need "-o hello_world" for this. Unix or Windows.
23:42 <centril> noone uses ghc directly like that in real world scenarios
23:42 <neophytes> did I not download that already?
23:42 <Monoide> ghc hello_world.hs is enough
23:42 coot joined
23:42 <freeside> did it compile? good. you now have enough equipment to be dangerous. your next step should be to choose between http://haskellbook.com/ and https://fldit-www.cs.uni-dortmund.de/~peter/PS07/HR.pdf
23:42 <centril> neophytes: yes =) but DLing and using is not the same ;)
23:42 raycoll joined
23:42 <ertes> neophytes: which OS?
23:42 <centril> freeside: why not http://learnyouahaskell.com/chapters ?
23:43 <neophytes> recursive-functions-MacBook-Pro:Haskell ternary$ ghc hello_world.hs [1 of 1] Compiling Main ( hello_world.hs, hello_world.o ) Linking hello_world ... recursive-functions-MacBook-Pro:Haskell ternary$
23:43 robertkennedy joined
23:43 USBoss joined
23:43 <neophytes> did that work?
23:43 <ertes> neophytes: looks good
23:43 <Monoide> neophytes: try it!
23:43 <neophytes> it didn't print hello world did it?
23:43 <centril> neophytes: ./hello_world.o
23:43 <ertes> neophytes: you should now have a file called "hello_world", which is executable
23:43 <ertes> that's your actual program
23:43 <neophytes> ecursive-functions-MacBook-Pro:Haskell ternary$ ./hello_world.o -bash: ./hello_world.o: Permission denied recursive-functions-MacBook-Pro:Haskell ternary$
23:43 <centril> neophytes: or: $ ./hello_world
23:44 <Monoide> not the .o
23:44 augur joined
23:44 <centril> Monoide: depends on the OS, no ?
23:44 <Monoide> it's an object file
23:44 <centril> oh, right
23:44 <Monoide> it's not an executable
23:44 <monochrom> The OS only determines whether you say ./ or .\
23:44 <centril> but still, object files might be executable sometimes
23:44 <centril> or .o files i mean
23:44 <Monoide> well you need linkage
23:45 <freeside> why is it that on the radio, everybody spells out URLs saying "backslash" when they should say "slash"?
23:45 <ertes> whether you say "./" or ""… windows has the horrible habit of including . in PATH
23:45 <neophytes> so what do I do to execute it
23:45 <centril> neophytes: ./hello_world
23:45 <Monoide> (you also want to read a few stuff about your Mac's terminal ;)
23:45 <ertes> neophytes: or: ./hell<tab>
23:45 <neophytes> sweet it worked
23:45 <freeside> it worked! now go buy the purple book
23:46 <centril> neophytes: you can always use ls -lah to see the files in your directory
23:46 <ertes> neophytes: try this command: cabal --version
23:46 <ertes> neophytes: if you get a bunch of version numbers, you now have a minimal development environment
23:46 <neophytes> ownloading the latest package list from hackage.haskell.org
23:46 <freeside> http://haskellbook.com/assets/img/sample.pdf
23:46 <neophytes> Downloading the latest package list from hackage.haskell.org cabal-install version compiled using version of the Cabal library recursive-functions-MacBook-Pro:Haskell ternary$
23:46 <monochrom> Neat.
23:46 <neophytes> freeside: thanks just bought the book
23:47 <neophytes> so Im good to go thru that now?
23:47 <freeside> yeah
23:47 <neophytes> (the book)
23:47 <Monoide> yup
23:47 <neophytes> ok sweet
23:47 <neophytes> sweet do
23:47 <neophytes> thanks guys for setting me up
23:47 <Monoide> now you need some brain, some hard work and a lot of coffee / tea
23:47 <centril> neophytes: now that you've setup haskell... forget all about it, and read:
23:47 <monochrom> No, you need sleep.
23:47 <centril> neophytes: http://www.cse.chalmers.se/edu/year/2016/course/DAT140/
23:47 <neophytes> I'm new to programming + math stuff but very open to lots of hard work + coffeee & tea
23:47 <Monoide> (and this channel to answer all your silly questions ;)
23:48 <ertes> neophytes: if you have any questions your learning resource doesn't cover, feel free to ask here
23:48 <neophytes> centril: just checked and they have a free pdf version of the book you linked with my university access -- will check this out too
23:48 <neophytes> ertes: sweet thanks
23:48 <freeside> and being a mathematician you should probably also read some of the foundational papers, like, hm, http://publications.lib.chalmers.se/records/fulltext/local_135303.pdf
23:48 <ezyang> String, Text, ByteString, Foundation String; anything I've missed?
23:49 justicefries left
23:49 <ertes> neophytes: if you happen to live in germany near stuttgart, you can also visit my workshop on wednesday =)
23:49 <neophytes> excellent thanks freeside (I am an aspiring mathematician / newbie I should say ;-) ) but I have a deep interest in this!
23:49 <centril> neophytes: you probably want Types and Programming Languages (Pierce)
23:49 <neophytes> shoot I live in US lol else I would!
23:49 <freeside> you can also pick up some videos at https://www.cs.uoregon.edu/research/summerschool/summer10/curriculum.html
23:49 <Monoide> you would love https://projecteuler.net/
23:50 <neophytes> wow they have videos
23:50 <neophytes> excellent
23:50 <Monoide> because it's a bunch of exercices to learn haskell, plus it's algorithmic / maths
23:50 <freeside> also https://www.cs.uoregon.edu/research/summerschool/summer16/curriculum.php
23:50 <neophytes> centril: which one should I read first
23:50 <centril> neophytes: or, just move to Sweden, Gothenburg and start studying at Chalmers Technical University, the world capital of Haskell, Agda, and functional programming
23:50 <neophytes> also which universities have research groups in this?
23:50 <centril> Chalmers, Chalmers, Chalmers
23:50 <neophytes> k
23:51 <neophytes> this is my new favorite irc channel
23:51 <freeside> you are our new favourite haskell newbie
23:51 <ertes> i'm not sure haskellbook.com is suitable, if you're new to programming altogether
23:51 <monochrom> The enthusiasm of #haskell participants ensures that every student has enough reading material to learn Haskell for 7 lifetimes (and therefore never getting to use Haskell).
23:51 <neophytes> haha
23:51 <Monoide> monochrom: :D
23:51 <centril> neophytes: but... beware, Donald Trump said that stuff is going on in Sweden :P
23:51 <freeside> we're also up for a good editor war anytime
23:51 <neophytes> trump says a lot of things
23:51 <neophytes> I'll be careful ;-)
23:51 <centril> monochrom: lol :D
23:52 <neophytes> k im gonna go read
23:52 <neophytes> thanks guys
23:52 <centril> ertes: I'd say for a newbie, start with learnyouahaskell
23:52 <Monoide> do https://projecteuler.net/ to practice
23:52 <minn> I learned to program from Thompson's "The Craft of Functional Programming" and supplementing with some papers by Wadler. Would recommend to anyone.
23:52 <Monoide> (it will get you in algorithmic / recursive problems)
23:53 <ertes> centril: honestly i don't recommend that one, regardless of whether one is a programmer or not
23:53 <Monoide> (so you can learn good usage without going too deep too quickly)
23:53 <freeside> i just worked through the purple book, i'm a big fan of it. imho the best and most comprehensive
23:53 <centril> neophytes: so: my recommendation: learnyouahaskell -> your book -> write a compiler for a small imperative language + a small functional language -> (forget about haskell) -> http://www.cse.chalmers.se/edu/year/2016/course/DAT140/ -> Types and Programming Languages
23:53 <ertes> the resource i'd recommend without hesitation is this: https://www.seas.upenn.edu/~cis194/spring13/lectures.html
23:53 <freeside> i was disappointed by Learn You A Haskell -- it had the whimsy of Why's Poignant Guide to Ruby but not the rigour
23:53 <neophytes> centril: sounds good
23:54 <neophytes> copying your comment
23:54 <neophytes> pasting in my notepad
23:54 <centril> freeside: you dont want rigour for an intro course to FP...
23:54 <centril> you want: get shit done fast
23:54 <monochrom> freeside: Does "purple book" mean haskellbook.com?
23:54 <freeside> yes
23:54 <MarcelineVQ> ertes: idk about that, haskellbook.com is called haskell programming from first principles for a reason, I'm not sure there's a better place to start with haskell if you're entirely new to programming
23:55 <centril> and for that LYaH (LearnYouAHaskell) is nice
23:55 <ertes> CIS194 has, as far as i see, very good pacing *and* correctness
23:55 <monochrom> I don't think LYAH gets shit done fast either.
23:55 <ertes> MarcelineVQ: the name alone doesn't cut it though =)
23:55 <freeside> neophytes, you should get used to using Atom instead of TextEdit
23:56 <Monoide> neophytes: stop listening to us
23:56 <centril> neophytes: for the purposes of mathematical proofs, you want to learn haskell just to familiarize yourself with coding in FP, and then move on to Agda
23:56 <Monoide> just do what tf you want and have fun
23:56 Rodya_ joined
23:56 <Monoide> fun is what you want, and should be your only goal
23:56 <centril> also ^
23:56 <freeside> also **
23:56 <Monoide> if you want ideas to have fun, I have a bunch just ask me :)
23:56 <neophytes> okay centril
23:57 <neophytes> https://www.youtube.com/playlist?list=PLbgaMIhjbmEnaH_LTkxLI7FMa2HsnawM_ -- just found this guy
23:57 <centril> neophytes: but if you want general purpose programming, then haskell is really nice
23:57 <ertes> centril: you know, you could just pay someone to beat the crap out of you… doing proofs in agda achieves the same thing, but much much slower
23:57 <monochrom> Also, rigour or not depends on personality, not absolute mandate.
23:57 <freeside> looks good ... soon you too will be able to talk about FP in incomprehensible terms
23:57 Guest92877 joined
23:57 <centril> ertes: say what ?
23:58 <neophytes> lol
23:58 <neophytes> im gonna go read
23:58 <neophytes> thanks guyys
23:58 <* neophytes> afk
23:58 mzf joined
23:58 <neophytes> guys*
23:58 <ertes> centril: the next time you pass six universe level variables around you will remember this conversation
23:58 <* neophytes> afk now
23:58 <centril> neophytes: now I have to thank you... gonna watch those
23:58 <monochrom> FWIW for example when I learned Haskell (or anything) I went for rigour. Maybe not absolute rigour, but rigour enough so that it was scientific not cargo-culting.
23:58 <centril> ertes: :D
23:58 <centril> ertes: at least it doesn't have :t * :: * ^^
23:59 <monochrom> But cargo-culting works fine for some people too, so I don't always inflict my degree of rigour to everyone.
23:59 esad joined
23:59 <freeside> you don't want to build your tech stack on sand.
23:59 Xlaech joined
23:59 <freeside> known knowns are preferable to known unknowns and unknown knowns.