<    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 24 25  
26 27 28 29 30 31
00:00 <scope> see this is where you're losing me
00:00 <erisco> whoops I meant map :: (Edge c -> [Point c]) -> [Edge c] -> [[Point c]]
00:00 <erisco> well this comes back to bollu's school of function types
00:00 <allenj12> ski: im mainly following https://en.wikipedia.org/wiki/Church_encoding and it does work currently
00:00 <erisco> we're applying map to the argument pointsOfEdge
00:01 <erisco> how many arguments does map pointsOfEdge take?
00:01 <erisco> that is either a confusing question or an enlightening one
00:01 <allenj12> ski: how would i make it church encoding?
00:01 <Lazersmoke> scope: what happens when you apply a function with the type "(Edge c -> [Point c]) -> [Edge a] -> [[Point c]]" to an argument with the type "Edge c -> [Point c]"?
00:01 ner0x652 joined
00:02 <scope> type mismatch?
00:02 <scope> I mean one is [Point c] and one is [[Point c]]
00:02 <Lazersmoke> scope: what is the type of the first argument of a function with the type "(Edge c -> [Point c]) -> [Edge a] -> [[Point c]]"?
00:02 bjz joined
00:02 <erisco> okay give me the floor for a second
00:02 <scope> Edge
00:02 <Welkin> yes, senator
00:03 <erisco> lets say f :: (Edge c -> [Point c]) -> X
00:03 <* Welkin> prepares to watch a filibuster
00:03 cyborg-one joined
00:03 <erisco> what is the type of f pointsOfEdge ?
00:03 <halogenandtoast> Welkin: ha, well sometimes too many cooks leads to more confusion, so it was a fair request
00:03 <scope> (Edge c -> [Point c])
00:04 <ski> allenj12 : `nil = \n c -> n' and `cons h t = \n c -> c h (t n c)'
00:04 <erisco> f takes some value with type Edge c -> [Point c] and gives us a value with what type?
00:04 <scope> X
00:05 <erisco> okay, so pointsOfEdge is a value with type Edge c -> [Point c], and I give this to f, so what is the type of the value I get?
00:05 coot joined
00:05 <okeuday_bak> erisco: Prelude.floor
00:05 <scope> X according to your definition
00:06 <erisco> yes! and so what is the type of f pointsOfEdge ?
00:06 <dolio> Cale: Oh, thanks for the link.
00:06 <scope> X
00:06 <erisco> good
00:06 <dolio> I knew about the weighted (co)limit angle but couldn't figure out how to use that.
00:06 ali_bush joined
00:06 <erisco> you said it was Edge c -> [Point c] first. do you see why that is wrong now?
00:06 <scope> so map pointsOfEdge is [Edge a] -> [[Point c]]
00:07 <* erisco> weeps in joy
00:07 <scope> lmfao
00:07 <allenj12> ski: seems actually equvalest except you define nil instead of having True/False. is that right?
00:07 <scope> me too
00:07 <allenj12> equivalent*
00:07 <erisco> now, it is [Edge c] -> [[Point c]] but I think you just copied my earlier typo
00:08 <Jinxit> i keep running into circular dependencies between my modules :(
00:08 mda1 joined
00:08 <erisco> okay, so, map pointsOfEdge is a function which takes a list of edges (some value of type [Edge c]) and returns a list of list of points (some value of type [[Point c]])
00:08 <Welkin> Jinxit: extract the common parts out into another module, then import that
00:08 <scope> right
00:08 <scope> but convexHullPoints just wants a list
00:08 <scope> not a list of lists
00:09 <erisco> good, you're right! that is why we want to know the types
00:09 <halogenandtoast> so you'd need something that has type [[a]] -> [a]
00:09 <Jinxit> it feels weird to have a module that's "this and this and that just because it's a cycle" when there would be no problem if they were all declared in the same file
00:09 <erisco> we can see those don't match and can now figure out how to get a list from a list of lists
00:09 marcopullo joined
00:09 <erisco> there is a function called "concat" which does precisely this
00:09 <erisco> :t concat
00:09 <lambdabot> Foldable t => t [a] -> [a]
00:09 <erisco> damn...
00:09 <halogenandtoast> lol
00:09 <scope> lol
00:09 <Welkin> Jinxit: it's common to have a `Common` module
00:09 <ski> allenj12 : i didn't exactly follow what you meant by `(True,True)'. i was assuming you had something like `nil = (True,())' or `nil = (True,(True,True))' in mind
00:09 <erisco> okay, concat :: [[a]] -> [a]
00:09 ahri joined
00:10 <scope> ok, so concat(map pointsOfEdge (convexHullEdges(points)))
00:10 <erisco> bang on
00:10 <Welkin> bang on?
00:10 <erisco> now, conventionally we'd write this concat (map pointsOfEdge (convexHullEdges points))
00:10 <Jinxit> and there's no ghc extension or anything to resolve this? (except hs-boot)
00:10 <scope> alright so that compiles but I still have double values
00:10 <halogenandtoast> Welkin: UK colloquialism probably
00:10 tristanp joined
00:11 <ski> @src concatMap
00:11 <lambdabot> concatMap f = foldr ((++) . f) []
00:11 <Welkin> erisco is a canoodle though D:<
00:11 <erisco> well, we'd write it differently using function composition, but if we used parens we'd write it like that
00:11 <ski> .. or just `concatMap f xs = concat (map f xs)'
00:11 Ayey_ joined
00:11 <erisco> ski, yes yes ski, I just like to start with concat and map and mention concatMap as a "by the way"
00:11 <allenj12> ski: anything with True in fst position on the tuple is actually considered Nil here, but that does kind lead to my original question. Also i realized something happened when i tried to paste the original question, im currently making an lpaste, one sec
00:11 <scope> so, you said nub removes duplicates?
00:11 <ski> erisco : of course :)
00:11 <halogenandtoast> I would have waited
00:11 <halogenandtoast> let the current situation settle in
00:11 plugin_ joined
00:12 <erisco> scope, yup, try it in ghci
00:12 <scope> so is it just nub(everything from above)
00:12 <scope> ?
00:12 <erisco> yes
00:12 <scope> holy shit
00:12 <erisco> you earlier also had another keen observation, another way to remove the duplicates
00:13 <Welkin> nub and nubBy
00:13 <scope> what was that? I don't remember
00:13 <erisco> and that observation was that the edges are chained, so the end of one edge is the beginning of another
00:13 <bollu> scope: be warned, nub is O(n^2)
00:13 <Welkin> there is also a version of nub that edwardk wrote (using radix trees?) that runs in linear time
00:13 albertus1 joined
00:13 <erisco> so instead of pointsOfEdge, which gives us both points, we can just use fst to take the first point
00:13 <lpaste_> allenj12 pasted “How does cons type check?” at http://lpaste.net/353658
00:14 <erisco> because the second point will be the first point of another edge anyways
00:14 lp joined
00:14 <allenj12> ski: that should clear things up slighlty
00:14 <scope> jesus, well thank you guys for bearing with me
00:14 <Welkin> erisco: triangle fan :D
00:14 <scope> I know you guys must have been smacking your face on your desk
00:14 <erisco> that is a more efficient solution
00:14 albertus1 joined
00:14 <erisco> I only went away from that because it relies on a careful observation about how the list of edges are constructed
00:14 <halogenandtoast> scope: some people just want to teach others, if they do they're used to this and neither upset nor "smacking our faces on our desks"
00:15 <bollu> scope: teaching is fun
00:15 <bollu> ^
00:15 <Welkin> does anyone remember where that linear-time nub was (which library)?
00:15 <scope> ah gotcha, honestly I'm just glad this is working now
00:15 <scope> this program isn't working with huge lists so nub is fine
00:15 <scope> now, erisco, if you're up for it my closestPair function is still broken
00:16 <scope> the one we were talking about minimumBy with
00:16 <bollu> scope: closestPair does what?
00:16 <scope> one sec
00:16 <scope> I'll post the code
00:16 albertus1 joined
00:16 <erisco> we can also write this as a list comprehension if you want to see the similarity
00:16 dawehner joined
00:16 <scope> http://lpaste.net/3953644544179830784
00:17 <scope> so there's the context. closestPair takes a set of points and finds the closest pair of points coordinate-wise
00:17 ali_bush joined
00:17 ali_bush joined
00:17 <erisco> ah that one again, okay
00:17 <scope> I wanted to use minimumBy, but I don't quite understand it
00:17 <halogenandtoast> :t minimumBy
00:17 <ski> allenj12 : each use of `cons' may have different actual types used in place of the type variables `a' and `b'
00:17 <lambdabot> Foldable t => (a -> a -> Ordering) -> t a -> a
00:17 <erisco> well minimumBy doesn't make use of closerPair which is why we didn't use it
00:17 <scope> ah ok
00:18 <halogenandtoast> so minimumBy :: (a -> a -> Ordering) -> [a] -> a
00:18 <erisco> we need something like it but not quite
00:18 <scope> well forget about minimumBy then
00:18 <allenj12> ski: is that possible since its recursive? should b be set all the way down?
00:18 <erisco> okay, well the other way was a fold, which does use closerPair
00:18 MrcRjs joined
00:18 <scope> I'm all ears
00:18 <ski> allenj12 : "since its recursive" -- since what is recursive ?
00:18 <erisco> you may be surprised to know that the recursive function you wrote earlier is also just foldr1 closerPair
00:18 <Welkin> found it http://hackage.haskell.org/package/discrimination-0.2.1/docs/Data-Discrimination.html#v:nub
00:18 <Welkin> :D
00:18 <erisco> try that one out
00:19 <scope> wait what???
00:19 <bollu> :t foldr1
00:19 <lambdabot> Foldable t => (a -> a -> a) -> t a -> a
00:19 <bollu> *sigh
00:19 <bollu> :t foldr1 :: (a -> a -> a) -> [a] -> a
00:19 <scope> lol
00:19 <lambdabot> (a -> a -> a) -> [a] -> a
00:19 <bollu> foldr1 (+) [1..10]
00:19 <Welkin> :t Data.List.foldr1
00:19 <lambdabot> Foldable t => (a -> a -> a) -> t a -> a
00:19 <Welkin> lol
00:19 <bollu> > :t Data.List.foldr1
00:19 <lambdabot> <hint>:1:1: error: parse error on input ‘:’
00:19 <allenj12> ski: the type signature could you not unstack it so. a -> b (Bool, (a,(a -> b -> (Bool, (a...)))))
00:19 <scope> looool
00:20 <bollu> > foldr1 (+) [1..10]
00:20 <allenj12> would all the bs have to be the same in this case?
00:20 <bollu> scope: they're just general version of the idea
00:20 <lambdabot> mueval: ExitFailure 1
00:20 <erisco> I can explain a fold to you really quickly, but there is much to be said about them
00:20 <erisco> and I'm only talking about list fold
00:20 <scope> if that's what you think is the simplest solution then sure
00:20 <erisco> > foldr f z [a,b,c]
00:20 <hexagoxel> :t GHC.OldList.foldr1
00:20 <ski> allenj12 : if you want to, you could say `bogusList = cons 2 (Maybe "not a list")', where `bogusList' gets type `(Bool,(Integer,Maybe String))'. here `a' becomes `Integer' and `b' becomes `Maybe String'
00:20 <lambdabot> mueval-core: Time limit exceeded
00:20 <lambdabot> mueval: ExitFailure 1
00:20 <lambdabot> (a -> a -> a) -> [a] -> a
00:21 <scope> jesus lambdabot
00:21 dbmikus joined
00:21 <erisco> it should have said: f a (f b (f c z))
00:21 <bollu> int-e: ping
00:21 <ski> allenj12 : btw, looking at <https://aphyr.com/posts/340-acing-the-technical-interview>, i should say that that post is not doing what you sketched above
00:21 <Welkin> > foldl1 (+) [1..10000]
00:21 <Jinxit> Welkin: is a Common module really the most common (heh) solution? i lose any semblance of code structure and just get one big file
00:21 <lambdabot> 50005000
00:21 <Welkin> > foldl1 (+) [1..1000000]
00:21 <scope> so when you say "foldr1 closerPair" that can't be all that it takes?
00:21 <lambdabot> *Exception: stack overflow
00:21 <Welkin> > foldl1' (+) [1..1000000]
00:21 <lambdabot> 500000500000
00:21 <Welkin> :D
00:21 <erisco> yes that is the whole thing scope
00:22 <scope> well that throws up errors
00:22 <allenj12> ski: i know but you cant really do what there doing in that post since its untyped, i have kinda been going on a different path since
00:22 <ski> allenj12 : "would all the bs have to be the same in this case?" -- the answer to the question you intended to ask is : no, they don't
00:22 <ski> allenj12 : however, `a -> b (Bool, (a,(a -> b -> (Bool, (a...)))))' doesn't make sense in this context
00:22 ramzifu joined
00:22 <erisco> scope, that is for closestPair' which we wrote earlier, not closestPair
00:22 <scope> ohhh, to be honest I didn't actually write the code for that, I was just trying to understand it
00:22 <Welkin> Jinxit: well, a Common module is used in Yesod to import other modules and re-export them
00:22 <erisco> scope, for closestPair we'd write foldr1 closerPair . pairsFromPoints
00:23 aib joined
00:23 <Welkin> Jinxit: Ideally you would structure your code in such a way that you don't have circular dependencies
00:23 <scope> foldr1 closerPair . pairsFromPoints(points) right erisco?
00:23 <Welkin> put functions that rely on each other together
00:23 <Jinxit> Welkin: that sounds fine to me, that's more for user convenience
00:23 <erisco> no
00:23 <Jinxit> well
00:23 <erisco> you omit the argument on the left of =
00:23 Beetny joined
00:23 <Jinxit> it's types that rely on eachother
00:23 <erisco> or the parameter, rather
00:23 <ydl> k
00:23 ydl left
00:23 <Welkin> Jinxit: I see
00:23 Apocalisp joined
00:23 <scope> erisco what do you mean?
00:23 <halogenandtoast> erisco: maybe that's a little complex
00:23 <allenj12> ski: interesting, i just thought the type of b was set from the first cons because in every instance of cons it has the type of the next 'b' defined to be the same as the original
00:23 <scope> ohhh nevermind I see
00:23 <erisco> so closestPair = foldr1 closerPair . pairsFromPoints
00:23 <Welkin> there is also another common way to structure your code by putting all of your types in a Types.hs module
00:24 <scope> it automatically sends it?
00:24 <Welkin> I have used this before and it is helpful
00:24 <Jinxit> that's what i have
00:24 <ski> allenj12 : `(Bool,(a0,(Bool,(a1,..(Bool,(a_{n-1},(Bool,Bool)))..))))' would make more sense ..
00:24 <erisco> yes this involves some things we haven't talked about but that is how a Haskeller would actually write it
00:24 <erisco> since we're just on a hypothetical of "what if we used a fold"
00:24 <scope> still get errors that way as well
00:24 <ski> allenj12 : each use of `cons' gets its own "copy" of `b' (and `a')
00:24 nakal_ joined
00:24 <erisco> hm, pastebin it for me scope
00:24 <erisco> as well as the error
00:24 <Welkin> erisco: lpaste you mean!
00:24 <Jinxit> Welkin: but it turns out i need this one thing in that file to solve a circular dependency
00:24 <Welkin> @lpaste
00:24 <lambdabot> Haskell pastebin: http://lpaste.net/
00:24 <Jinxit> and boom, it drags in everything
00:25 <Jinxit> in a cascade
00:25 <erisco> yes of course, I am just devaluing the pastebin brand by using it as a verb
00:25 <scope> http://lpaste.net/8545957051761688576
00:25 <allenj12> ski: ah, a little bit confusing but makes sense
00:25 <erisco> you should thank me
00:25 <Welkin> Jinxit: post an example
00:25 <Welkin> Jinxit: is it on github?
00:25 <allenj12> ski: your type signature does make more sense aswell :D i was getting confused haha
00:25 <Jinxit> Welkin: will be in a bit, just gotta fix some compiler errors
00:25 <ski> allenj12 : there's no problem with `cons 2 (cons False (cons "help !" (putStr "This is not an action")))'
00:25 <halogenandtoast> scope: you have to drop the argument on the left as well
00:26 <scope> oh see I can't remove that
00:26 <erisco> yes you can
00:26 <halogenandtoast> why?
00:26 <ski> allenj12 : still, if you want to be able to process the elements of such a "list", one after another, in some uniform fashion (what's known as a "loop"), then this is not a good representation of lists
00:26 <scope> not allowed to change the stubs
00:26 <Welkin> scope: what is this? a homework assignment?
00:26 <scope> something like that
00:26 <halogenandtoast> Welkin: wasn't that obvious?
00:26 <ski> allenj12 : better would be the `nil = \n c -> n' and `cons h t = \n c -> c h (t n c)' i mentioned
00:26 <Welkin> o.o
00:27 <erisco> okay, well, you are not submitting this anyways because you don't understand foldr1 and . and so on well enough
00:27 <erisco> you're submitting your recursive version
00:27 <erisco> I am just showing you how else it would be written if it was someone experienced
00:27 <erisco> gives you something to consider
00:27 <scope> right, I wanted to check it out
00:27 ali_bush joined
00:27 <Welkin> erisco: lol, did you show them the "evolution of a haskell programmer" page yet?
00:27 <halogenandtoast> scope: so drop the parameter on the left and try it out
00:27 <allenj12> ski: i see, say you wanted to make sure all 'a's are the same type? how would you enforce that since the type signature does not carry down
00:27 <Welkin> http://www.willamette.edu/~fruehr/haskell/evolution.html
00:27 <Welkin> :P
00:27 <erisco> the one that ends in fac n = product [1..n] Welkin?
00:27 <scope> well yeah that works
00:27 <scope> that's amazing
00:28 <erisco> so, my quick view of folds is foldr f z [a,b,c] is f a (f b (f c z))
00:28 <bollu> Welkin: I can understand till "post doc" IIRC. I was quite proud when I grokked over half of it
00:28 Mon_Ouie joined
00:28 <scope> erisco would you mind going over how to solve this recursively again?
00:28 <bollu> :t foldr
00:28 <lambdabot> Foldable t => (a -> b -> b) -> b -> t a -> b
00:28 <erisco> you can extrapolate the pattern for any list. I will also tell you foldr f z [] = z
00:28 <ski> allenj12 : you would enforce that by not using this list representation
00:29 <scope> this is the only other function that has been giving me trouble
00:29 <Welkin> scope: throw them a curve ball and use Data.Sequence.Seq instead of lists
00:29 <ski> allenj12 : this is exactly the kind of issue i was having in mind
00:29 <erisco> if you understand foldr then foldr1 is similar
00:29 <Jinxit> Welkin: http://lpaste.net/4504528366803615744
00:29 <erisco> scope, yes sure, we can do that
00:29 <scope> ty
00:30 <allenj12> ski: I havent tested your version yet, but im assuming your saying I have to use an ADT if i do want that
00:30 <ski> allenj12 : no, i'm not saying that
00:30 <scope> need to piss really quick though, tag me in your next message so I can find it easily
00:30 <allenj12> ski: gotcha, i need to play around with your version for a second. does your keep type?
00:30 <halogenandtoast> I'm out, time to get ready for the day, can't lie in bed and irc all day...
00:30 <Welkin> Jinxit: where is the circular dependency?
00:31 <erisco> scope, is there somewhere you want to start particularly? something confusing?
00:31 <ski> allenj12 : you need extensions to be able to state the type of my `cons', though
00:32 <Jinxit> Welkin: first off several of the types go in a circle, but i'm kindof ok with having them in a giant file (but it's not optimal), second is from line 200 onwards
00:32 <Jinxit> Welkin: when i moved in Trigger because it needed Game which needs Character which needs Trigger
00:32 <ski> allenj12 : `cons :: a -> (forall o. o -> (a -> o -> o) -> o) -> (forall o. o -> (a -> o -> o) -> o)', namely .. (you can avoid mentioning the latter `forall o.', but not the former one)
00:32 <allenj12> ski: λ> :t cons
00:32 <allenj12> cons
00:32 <allenj12> :: t3
00:32 <allenj12> -> (t2 -> (t3 -> t1 -> t) -> t1) -> t2 -> (t3 -> t1 -> t) -> t :D
00:32 <ski> wrong type
00:33 doodlehaus joined
00:33 locallycompact joined
00:35 <Jinxit> Welkin: and on top of that the unsolved error because Types requires Database requires Game requires Types
00:35 <allenj12> ski: the types are confusing me a little bit, how would you get the head in your version?
00:36 <Welkin> Jinxit: why are all of these extra things in your Types modules?
00:36 <Welkin> did you pull them in to try to get rid of the errors?
00:36 <Jinxit> correct
00:36 <Jinxit> it was only types before
00:36 <Jinxit> so the name stuck
00:36 <scope> erisco sorry about that, roommate started a conversation with me
00:36 <Welkin> could you link me to a commit where it was the way it should normally be? I can build locally and see what I can do
00:36 <scope> I honestly just don't even know how to start
00:37 <erisco> have you written a recursive function before?
00:37 hsk3 joined
00:37 <scope> In other languages, and once in haskell
00:37 <erisco> okay, explain to me what a recursive function is
00:37 <scope> but it was with a parameter that could be incremented
00:37 <erisco> lets make sure we know the basics
00:37 <Jinxit> i don't have a commit for that stage, but the moved things (past line 200 in Types) are all annotated with where they came from
00:38 <Welkin> okay
00:38 ali_bush joined
00:38 ali_bush joined
00:38 <hsk3> multThree :: Int -> Int -> Int -> Int
00:38 <hsk3> multThree x y z = x * y * z
00:38 <hsk3> What happens when we compute multThree 1 2 3 ? Does a thunk of 1 and 2 and 3 first build up in memory and then the result is computed?
00:39 <Jinxit> i appreciate that you're taking a look btw :)
00:39 <scope> erisco ok
00:39 <jle`> hsk3: you can't really ask 'what happens when we compute multThree 1 2 3' in a vacuum
00:39 <jle`> hsk3: do you mean, what happens when we print the result of multThree 1 2 3 ?
00:39 <scope> erisco this was the function I solved recursively in Haskell http://lpaste.net/5997182596272881664
00:40 <scope> from a previous project
00:40 <hsk3> jle` yeah
00:40 sveit joined
00:40 <erisco> okay cool, and what makes it recursive? that is what I am asking
00:40 <scope> the fact that it calls itself
00:40 <hsk3> jle` i'm guessing the memory buildup because (multThree 1) returns a new func, etc.
00:40 <scope> and then increments the parameter each time
00:41 connrs joined
00:41 <erisco> well just your first description suffices
00:41 <ski> allenj12 : `maybeHead l = l Nothing (\x _ -> Just x)'
00:41 <jle`> hsk3: calls like that are usually optimized away by ghc
00:41 tromp joined
00:41 <erisco> a recursive definition is one which refers to itself
00:41 <erisco> so recursive functions are ones which refer to themselves
00:41 jsgrant joined
00:41 <scope> right
00:41 <scope> you're right the parameter incrementation doesn't matter
00:41 <ski> allenj12 : or `head l = l (error "empty list") (\x _ -> x)', if you want a partial one
00:41 <erisco> now, in practical application there is a usual way recursive functions look
00:42 <hsk3> jle` is it good practice to assume such optimizations?
00:42 <erisco> there are one or more base cases, or stopping conditions, and one or more recursive cases
00:42 <erisco> in nextPrime, what is the base case?
00:42 <jle`> usually no, but in this case, it's pretty straightforward i think
00:42 <scope> the else statement
00:43 <scope> whoops
00:43 <scope> nevermind, it's if the number is prime
00:43 <scope> so what comes after the then
00:43 <erisco> right, the terminology is a little ambiguous here, so I'd say it altogether
00:43 <jle`> hsk3: the partially applied functions won't be built up, but depending on the specific Num instance, (x * y) * z might build up and collapse thunks
00:43 <erisco> the base case is n + 1 when isPrime (n + 1)
00:43 <jle`> it might be optimized away for Ints though
00:44 <scope> right
00:44 <erisco> and the recursive case is nextPrime (n + 1) when not isPrime (n + 1)
00:44 yrdz joined
00:44 <hsk3> jle` won't it be x*(y*z) ?
00:44 <erisco> most recursive functions are going to look just like this
00:45 <hsk3> 1*(2*(3))
00:45 nemorichard joined
00:45 <erisco> so when we go to write one we're asking what are the base cases and what are the recursive cases
00:45 Levex joined
00:45 nemorichard left
00:45 <jle`> :i (*) => infixl 7 *
00:45 <scope> so the base case for closestPair would be if that pair is the closest, but I'm having trouble figuring out how you'd know without going through the entire list
00:45 eacameron joined
00:46 <scope> as the pairs aren't in any order
00:46 <erisco> ah, well, I think you're halfway
00:46 <erisco> there is a list where the minimum is obvious
00:46 <erisco> which list is that?
00:46 <scope> closerPair
00:46 <erisco> closerPair is a function, not a list
00:46 <hsk3> jle` Okay. So without the optimization, multThree 1 would give (1 * y) * z. Applying that to 2 would give (1 * 2) * z. Applying that to 3 would give (1 * 2) * 3.
00:46 <erisco> I'm asking in what list can we trivially know the minimum element?
00:47 <scope> an ordered list
00:47 lp joined
00:47 <erisco> that is a good answer, since it would always be the first (or last) element
00:47 <erisco> however, we do not have an ordered list, so think of something else
00:47 <jle`> hsk3: multThree 1 is semantically \y z -> (1*y)+z
00:47 <erisco> remember we're looking for base cases
00:47 epsilonhalbe joined
00:47 <erisco> and common with base cases is they are trivial
00:47 <jle`> and (multThree 1) 2 is \z -> (1*2)*z
00:47 <erisco> so when we think "what is the base case" we are thinking "what is the trivial case"
00:48 <scope> when there is only one element in the list
00:48 <erisco> bingo
00:48 epsilonhalbe left
00:48 <erisco> so, closestPair' [x] = x, you remember that?
00:48 <scope> so, discard whichever pair isn't the closer from closerPair?
00:48 <scope> and yes
00:49 <erisco> well we don't need closerPair at all when there is just one element in the list
00:49 yrdz` joined
00:49 <scope> right, was thinking ahead
00:49 markus1209 joined
00:50 <scope> so, closestPair' isn't a separate function is it?
00:50 markus1219 joined
00:50 <erisco> yes
00:50 <erisco> oh, it is a separate function
00:50 <erisco> because I gave it type [Pair a] -> Pair a
00:50 <scope> ah ok
00:50 <scope> I see
00:51 <erisco> we're interested in recursing on the list of pairs, so that is what we need
00:51 <erisco> we can use this function to define closestPair
00:51 <erisco> closestPair just needs to use pairsFromPoints and pass that to closestPair'
00:51 <erisco> feel free to give it a better name
00:52 ziyourenxiang joined
00:52 Apocalis_ joined
00:52 <scope> so like this
00:52 <erisco> and yes, after the base case we think about the recursive case
00:52 <scope> lpaste being slow
00:52 <erisco> we have covered a list of just one element, so to cover all (nonempty) lists we also need to cover lists of two or more elements
00:53 <scope> http://lpaste.net/5060198668485787648
00:53 <scope> so would I need an if then else under closestPair?
00:53 <allenj12> ski: im still playing with your version and trying to figure it out. but I think im slowly getting it, thanks
00:53 <erisco> when we have a list of two or more elements we can use closerPair to reduce one element from the list
00:53 dawehner joined
00:53 <erisco> no, no if/then/else needed
00:53 <scope> hm
00:53 <scope> ok
00:54 <erisco> also you want closestPair points = closestPair' (pairsFromPoints points)
00:54 <scope> ok
00:54 <erisco> function application associates to the left, so what you wrote is (closestPair' pairsFromPoints) points
00:54 <scope> right, understood
00:54 nemorichard joined
00:55 <erisco> I think you're unlearning the call syntax from other languages
00:55 <scope> yeah it's killing me
00:55 <scope> lol
00:55 <erisco> the funny thing is you will see f(x,y) in Haskell and this sort of is what you'd expect
00:55 <scope> right lol that did throw me off for a bit
00:56 <bollu> > (+ 1) $ 2
00:56 <erisco> but the key is (x, y) is a tuple and we're passing it to f
00:56 <lambdabot> 3
00:56 <scope> exactly
00:56 <erisco> so if you like, other languages are just the same, only they force you to use tuples ;)
00:56 MrcRjs joined
00:57 <erisco> though you can curry in other languages
00:57 <scope> so now, why wouldn't I need the if then else to determine whether points is only one element?
00:57 <erisco> ah, well this is the power of pattern matching
00:57 <erisco> [x] is a pattern that only matches a list with one element
00:57 <erisco> (x:[]) is an equivalent pattern
00:57 theDon_ joined
00:58 <erisco> something else to learn... in other languages you branch on Bool
00:58 <erisco> in Haskell you branch on any sum type
00:58 <erisco> so Bool is a sum of True and False
00:58 <erisco> List is a sum of [] and :
00:59 <erisco> Haskell isn't the only language with this, that's a bit of hyperbole
00:59 <scope> so, how does closestPair determine whether to use closerPair? sorry if I'm not understanding
01:00 <erisco> we're going to add another case, the case closestPair' (p1:p2:ps) = ?
01:00 <erisco> this is the case of "a list with two or more elements"
01:00 <scope> wait so closestPair' (pairsFromPoints points) is a case?
01:00 <erisco> no
01:01 <scope> so this is an entirely new function then
01:01 <erisco> no
01:01 <erisco> anyone know the official terminology? function segment? I forget
01:03 <scope> so this will go right under the pairsFromPoints points one, I moved the first case to a new line
01:03 <flobberlet> erisco: function clause?
01:03 <bollu> erisco: terminology for?
01:03 <erisco> right, a clause, thank-you
01:03 <erisco> so in Haskell we can define functions as multiple clauses
01:03 <erisco> you don't do this in other languages like C and Python and so forth
01:04 <erisco> so let me show you another popular example: http://lpaste.net/353659
01:04 <scope> ah
01:04 <erisco> flobberlet, does the clause refer just to the parameter patterns or to the whole thing?
01:05 <ski> erisco : i say "defining equation"
01:05 <scope> so just to be clear, this should be looking something like this? http://lpaste.net/109962978232631296
01:05 <Welkin> are you trying to emulate obama?
01:05 <erisco> ski, as in "e is the defining equation of the clause c"?
01:05 <Welkin> "Let me be clear"
01:05 <scope> no watch this drive
01:05 <scope> now*
01:05 <ski> erisco : the whole thing, not just the parameter patterns
01:06 <erisco> ski, so you'd say a function may be defined with many equations?
01:06 <ski> erisco : closestPair' (p1:p2:ps) = ..p1..p2..ps.. is a definition equation, aka clause of a function definition
01:06 <erisco> I am sure there is something in the report but I can't find it atm
01:06 <ski> erisco : yes
01:07 <ski> s/definition equation/defining equation/
01:07 <erisco> scope, no we're quite far off here :P
01:07 <scope> hahaha I was trying
01:08 <erisco> scope, I added an annotation for you
01:08 <erisco> lines 6, 7, and 8 are all talking about the same function closestPair'
01:09 <Welkin> Jinxit: I don't see a Trigger.hs or a Character.hs
01:09 <erisco> line 6 declares the type, line 7 is a clause (or defining equation) and line 8 is a clause
01:09 <Jinxit> Welkin: oh right, deleted them when they turned out empty
01:09 <scope> are you about to paste something or are we talking about my last lpaste link?
01:09 <Jinxit> check the master branch
01:09 <Jinxit> still has them
01:10 <Jinxit> (to some extent, since they were also changed)
01:10 <erisco> so, when we give closestPair' a list with exactly one element it uses line 7, and with two or more elements line 8, and with no elements a secret line that crashes our program
01:10 <allenj12> ski: ok i actually cant figure out how to get the tail :(
01:11 <scope> erisco are you talking about a different paste than mine?
01:11 <erisco> scope, lpaste lets anyone annotate a paste, so I have added an annotation under your paste
01:11 levex_ joined
01:11 <allenj12> guess im confused what n and c are really suppose to be conceptually
01:11 <scope> oh shit
01:11 <scope> I didn't realize
01:11 ali_bush joined
01:11 ali_bush joined
01:11 <erisco> surprise :)
01:11 <erisco> so take a look at that and go back over what I said about it
01:12 <scope> OK I see
01:12 carlosdagos joined
01:12 <scope> like polymorphism in a sense I guess?
01:12 systemfault joined
01:12 <erisco> mm no, not really related
01:12 <bollu> > let fibs = 1:2:zipWith (+) fibs (tail fibs) in take 10 fibs
01:12 <lambdabot> [1,2,3,5,8,13,21,34,55,89]
01:12 <scope> maybe I'm thinking of a different term
01:12 <scope> I mean it chooses the correct function based on what it's passed
01:12 TheWizardTower joined
01:13 <erisco> so what might you do in another language? if is_empty xs then ... else if has_two_elements xs then ... else ...
01:13 <scope> right
01:13 <bollu> scope: I expected you to be impressed at the fiboncci thing :(
01:13 <scope> wait what bollu?
01:13 <erisco> well, we don't have to do that in Haskell, and in fact it is a waste of effort
01:13 <scope> Oh
01:13 <scope> I thought you were talking to someone else
01:13 <erisco> in Haskell we can branch on more than just Bool
01:13 systemfault joined
01:13 <erisco> so we don't have to come up with a Bool, i.e. we don't have to use if/then/else
01:13 <bollu> erisco: oh nvm I thought you were showing him cute uses of higher order funtions
01:14 <bollu> scope: let's do this later
01:14 <scope> ha as soon as I'm finished with this function I'm going to the store any buying alcohol and enjoying my Friday night as much as I can
01:14 <erisco> we can just branch directly on a list
01:14 <scope> gotcha erisco
01:15 <scope> so erisco, line 8 will call closerPair?
01:15 <erisco> yes, line 8 will need closerPair
01:16 <Welkin> Jinxit: I still can't seem to get any circular dependency errors, although it won't compile anyway because of other errors
01:16 <scope> now would it be passing (p1:p2:ps) or what? I'm a bit confused as to how it will go through the list of pairs
01:17 <Welkin> Jinxit: is there a way you could give me the exact code that is causing the problem?
01:17 <scope> tails ps maybe?
01:17 <erisco> yes, well, this takes some practice
01:17 <Jinxit> Welkin: gimme a mo
01:17 vydd joined
01:18 <erisco> what we want to do is do the smallest possible thing to make the problem smaller
01:18 robertkennedy joined
01:18 <erisco> why? because if we know how to do that we can repeatedly apply the technique
01:18 <scope> right
01:18 <erisco> until the problem is so small it becomes trivial, i.e. our base case
01:18 <scope> recursion and all that
01:18 fosskers joined
01:18 dbmikus joined
01:18 <erisco> so how do we make the problem smaller if our problem is on a list?
01:19 <erisco> well we have to make the list smaller
01:19 <scope> but if control passes to closerPair, how do we get back to closestPair etc.
01:19 gugah joined
01:19 <scope> nevermind dumb question, my guess is we'd use tails
01:19 <erisco> that isn't really the way you want to think about Haskell programs
01:19 <scope> yeah I realized after I said that
01:20 <erisco> we just write expressions and they evaluate
01:20 <erisco> control doesn't pass around
01:20 <scope> right
01:20 tristanp joined
01:20 <erisco> if we talk specifically about *evaluation order* then we can identity when we're evaluating the closerPair part of the expression
01:20 <erisco> and when we finish doing so
01:21 halogenandtoast joined
01:21 <erisco> but we're not usually worried about it
01:21 <erisco> that comes up when your program mysteriously does nothing or takes up all your memory, or something
01:21 <Jinxit> Welkin: https://github.com/Jinxit/firestone/tree/temp
01:21 <Jinxit> might have some more compiler errors once that circular dependency goes away, not sure
01:22 <scope> ok, so closestPair' (p1:p2:ps) needs to call closerPair, but it also needs to call itself I'm guessing?
01:22 <Jinxit> but now it's Character -> Trigger -> Script -> Game -> Character
01:22 <erisco> yes, otherwise we haven't a recursive function, by definition
01:22 <erisco> so first just think, how do we make the list p1:p2:ps smaller?
01:22 <scope> tails ps
01:22 <erisco> to make it smaller we have to get rid of an element, so which one do we get rid of? how do we tell?
01:22 <scope> oh
01:23 <scope> true we can't just get rid of anything
01:23 Bruno joined
01:23 <scope> well we'd have to compare p1 and p2
01:23 <erisco> right, if we throw out any ol' pair it could be the one we actually want to keep
01:23 <scope> and decide which one is the further distance, and drop it
01:23 <erisco> right, great!
01:24 <scope> so there must be a list function that deletes based on a requirement
01:24 <Jinxit> Welkin: hold on i'm dumb and forgot to commit
01:24 <erisco> yes, but no need here
01:25 <scope> hm
01:25 <Jinxit> Welkin: there we go
01:25 <erisco> so we're comparing p1 and p2 and we're going to end up with just one of them
01:25 <scope> right
01:25 <erisco> the name of this pair is closerPair p1 p2
01:25 <halogenandtoast> If I have `newtype NhkDateGrouping = NhkDateGrouping (Map String [NhkArticle])` is there a way to make this pointfree: importDateGrouping (NhkDateGrouping m) = (importNhkArticles . concat . elems) m
01:25 <erisco> then there is the rest of the list, ps
01:26 <erisco> but we've already made the list smaller by removing one of p1 and p2, so we don't need to touch ps
01:26 <scope> right, but how do we drop the larger one?
01:26 <scope> from the list that is
01:27 <erisco> we're going to construct a new list that doesn't include it
01:27 <scope> ah, of only the smallest distance from each pair?
01:27 <geekosaur> halogenandtoast, no, but if you use record syntax in the newtype then you can
01:27 <erisco> we're going to construct a new list from ps and the smaller of p1 and p2
01:27 <halogenandtoast> geekosaur: right silly me
01:28 <allenj12> syntax for lamda function with no arguments?
01:29 <erisco> allenj12, but that defies what a lambda is
01:29 <geekosaur> allenj, there isn't one because it's a somewhat dubious concept. if you really need one, you generally pass unit
01:29 <geekosaur> but, what are you trying to do?
01:29 obadz joined
01:29 <scope> erisco alright, I'm still a bit lost on how the recursion is going to work for this though.
01:29 <allenj12> geekosaur: im trying to work out ski's example of a list, im trying to create a tail function but its really confusing me
01:29 ali_bush joined
01:29 ali_bush joined
01:29 <halogenandtoast> geekosaur: I absolutely love that I can just switch it to use record syntax and nothing breaks.
01:29 <erisco> that's like a cheeseburger with no cheese
01:30 <Jinxit> a burger, if you will
01:30 <geekosaur> well, I could see someone trying to be pointfree, but the lambda kinda kills that anyway
01:30 <allenj12> geekosaur: nil n c = n
01:30 <allenj12> cons h t = \n c -> c h (t n c)
01:30 <allenj12> maybeHead l = l Nothing (\x _ -> Just x)
01:30 <allenj12> and i want to write tail, but its becoming kinda hard
01:31 <erisco> scope, okay, shoot, what do you have right now?
01:31 xkapastel joined
01:31 <scope> pretty much just up to where that lpaste is
01:31 <erisco> okay, well we know up to closestPair' (p1:p2:ps) = ... closerPair p1 p2 ... at least, right?
01:32 <scope> yes
01:32 <scope> it's the recursion that's confusing me, and how the new list will be made
01:32 <erisco> now we want to build a new list with the smaller of p1 and p2 (i.e. closerPair p1 p2) and ps
01:32 <erisco> which is the same as a new list without the larger
01:32 <erisco> what is that?
01:33 benl23 joined
01:33 <scope> whichever one closerPair returns + ps
01:33 <erisco> okay, two things
01:33 <erisco> the one closerPair return is exactly closerPair p1 p2
01:34 <erisco> we could give this a name, we could say let p_smaller = closerPair p1 p2 in ...
01:34 oisdk joined
01:34 <erisco> or we can just say closerPair p1 p2
01:34 <erisco> in either case, "closerPair p1 p2" *is* the smaller of p1 and p2
01:34 Swizec joined
01:34 <scope> right, now going about using let ... in ...
01:35 <scope> where does the recursion come in?
01:35 <erisco> well, don't, because I think this is important to realise
01:35 <erisco> say we have 1 + 1
01:35 <scope> alright, so (p1:p2:ps) = closerPair p1 p2 ...
01:35 <erisco> what is this?
01:35 <scope> that's a vague question
01:35 subttle joined
01:36 <erisco> I don't think it is
01:36 <erisco> there are a couple ways to answer it
01:36 <scope> the addition of two numbers
01:36 <erisco> that is one way
01:36 <scope> an expression
01:36 <erisco> the other is: 1 + 1 is 2!
01:36 <erisco> (that is exclamation, not factorial)
01:37 <erisco> so, one way to look at what something is is to consider the syntax
01:37 <scope> ha, right
01:37 <halogenandtoast> A human abstraction of physical state quantified into a made up system in order to pattern match and discuss quantities of objects
01:37 <erisco> 1 + 1 is the addition of two numbers
01:37 <erisco> that is a syntactical view of 1 + 1
01:37 <halogenandtoast> or a monoid
01:37 <erisco> another way to look at what something is is to consider the meaning, i.e. semantic
01:37 <erisco> 1 + 1 is 2
01:38 <erisco> 1 + 1 is 3 - 1
01:38 <erisco> well, that last one might set some alarm bells off for people here :P
01:38 <halogenandtoast> it did
01:38 <scope> 3 - (1)
01:38 <erisco> haha
01:38 <halogenandtoast> you mean equivalent to
01:38 <scope> lol
01:38 <erisco> in a practical sense, yes halogenandtoast
01:39 <erisco> but we could choose the meaning to be 3 - 1, it would just be a strange choice
01:39 <erisco> but I shouldn't confuse like that
01:39 dawehner joined
01:39 <erisco> so let me rephrase it correctly
01:39 <erisco> we can say the meaning of 2 is 1 + 1
01:39 Apocalis_ joined
01:39 <erisco> i.e. the way we define what 2 is is that it is 1 + 1
01:40 <erisco> this is a one-way thing, we don't say the meaning of 1 + 1 is 2, if we're talking denotational semantics
01:40 <erisco> then we can say 2 and 3 - 1 have the same meaning
01:40 <scope> so, closestPair' (p1:p2:ps) = closestPair' closerPair p1 p2:ps
01:40 <erisco> because they both mean 1 + 1
01:40 <scope> is that at least in the ballpark?
01:40 <erisco> maybe this is a bit too nuanced for the moment
01:41 ali_bush joined
01:41 <scope> well, closestPair' (closerPair p1 p2):ps
01:41 systadmin joined
01:41 <scope> or something like that
01:41 <erisco> in any case we can say closerPair p1 p2 means the lesser of p1 and p2
01:41 <scope> yes I get that
01:41 <scope> I'm trying to figure out the recursion
01:41 <glguy> scope: You probably meant: closestPair' (closerPair p1 p2 : ps)
01:41 <erisco> (or equivalent to, I don't want to split not-so-fine hairs with people)
01:41 lp joined
01:41 <scope> yes that glguy
01:43 <scope> erisco is that on the right track though?
01:43 Rainb joined
01:44 <erisco> x = y iff μ(x) = μ(y)
01:44 <erisco> halogenandtoast, does that satisfy? :P
01:44 Christian joined
01:45 pera joined
01:45 <Christian> Hello, how are you?
01:45 <erisco> scope, well that looks like the full solution to me
01:46 <scope> I can't get it to work lol
01:46 <erisco> scope, it is up to where we left off earlier
01:46 <erisco> alright, what is going wrong?
01:46 <scope> here I'll update the paste
01:46 dennisvennink joined
01:46 uglyfigurine joined
01:46 <Christian> Does anyone know how to connect an Irc bot to a weather API?
01:46 <scope> erisco updated
01:47 <scope> maybe you can spot something glaring
01:47 <glguy> Christian: Sorry, this channel is about the Haskell programming language
01:47 <Christian> Ohhhkay
01:47 <erisco> well what is the error scope?
01:47 <scope> erisco: error "No instance for (real a) arising from a use of `closerPair`"
01:48 mexisme2 joined
01:48 <erisco> right, so you need closestPair' :: Real a => [Pair a] -> Pair a
01:48 <scope> telling me to add (Real a) to the context of the type signature for closestPair' :: [Pair a] -> Pair a
01:48 <scope> ah
01:48 <scope> ok
01:48 <erisco> sorry, I omitted the context originally because I thought it was just noisy at the time
01:48 <Christian> Ping
01:49 <scope> awesome! erisco you're a life saver
01:49 <scope> Cale too if he's still around
01:49 <erisco> Cale taught me Haskell too
01:50 <scope> ha, that's awesome
01:50 Christian left
01:50 crobbins joined
01:50 <erisco> and many others but he was a key contributor to when I was developing an Applicative parser
01:50 <scope> well I seem to be passing all of my tests, so I guess I'm out of here for the night. I'm sure I'll see you guys around
01:50 <erisco> night
01:50 <scope> thanks again erisco
01:50 <erisco> glad to help
01:51 sssilver joined
01:52 FreeBirdLjj joined
01:52 <erisco> now I've fallen into the deep end and am writing Idris
01:52 <erisco> they should have signs that read "BEWARE" when you start learning Haskell
01:53 systemfault joined
01:53 <monochrom> But I'm still writing Haskell.
01:53 <erisco> "BEWARE: path of no return"
01:53 <monochrom> and pretty sure I started earlier than you did.
01:53 ali_bush joined
01:53 ali_bush joined
01:53 <monochrom> So I conclude that it's a function of you, not a function of Haskell.
01:53 <geekosaur> "so it's Applicative?"
01:54 <erisco> monochrom, well some can control themselves and for others it is a gateway language :P
01:55 Apocalis_ joined
01:56 <erisco> if you go deeper into types it seems like that is how you'd progress, I don't see how you'd stay away from DT forever
01:56 <monochrom> No, I think instead #haskell is bad influence on a lot of people.
01:57 <glguy> Exposure to DT can help drive you back to not wanting them
01:57 <monochrom> I already saw Coq and formed my opinion before I came to #haskell. Probably why I was immune.
01:57 <erisco> okay, well I am still on my DT tour, so maybe I'll come around
01:58 <monochrom> But I understand that millions of people are vulnerable.
01:58 <monochrom> Well both outcomes are possible. Just look at Hongwei Xi.
01:58 <erisco> I initially wanted to see things done much differently, and I still do, but I am trying to fill in the blanks by learning
01:58 <monochrom> That is, the ATS guy.
01:59 <erisco> I think there is a significant traction problem right now
01:59 <dolio> ATS will definitely convince you that you don't want anything resembling dependent types.
01:59 <monochrom> So exposed to DT, and loving it so much, he made his own Frankenstein's monster.
01:59 <erisco> Idris is a step but it won't be the language to break DT in, I don't think, but a critical milestone nonetheless
02:00 <erisco> if you're a math head it is one thing... I am speaking from a programmer's perspective
02:00 <monochrom> Did you know: He started his career by working on Dependent ML?
02:00 <erisco> if you consider the friction with Haskell... well you guys know DT, you know the implications
02:01 <erisco> what does ATS stand for?
02:01 <monochrom> I forgot.
02:01 <dolio> Advanced Type System.
02:01 <monochrom> And I think the long name contains no information anyway.
02:01 <Welkin> Jinxit: I'm not familiar enough with Lens, but I got to a point where I am getting no more import errors (at least until this other errors is fixed)
02:01 <lpaste_> allenj12 pasted “tail of church list?” at http://lpaste.net/353663
02:01 <erisco> https://en.wikipedia.org/wiki/ATS_%28programming_language%29 ?
02:02 <Welkin> Jinxit: but I am getting this error http://lpaste.net/353664
02:02 <monochrom> I use an acronym iff the long name contains no more information than the few letters in the acronym.
02:02 <erisco> I will take a look. maybe it speaks more to my ideals
02:02 <erisco> but I am still working out why DT upsets me
02:02 <monochrom> For example you look at my recent http://www.vex.net/~trebla/haskell/cont.xhtml and it doesn't even say "CPS" once. Because "continuation-passing style" actually helps.
02:02 <Welkin> Jinxit: why were you importing Game into Script? I don't see anything obvious that would require that import
02:02 <erisco> have to understand it better to decide
02:02 <erisco> and in the process I fear growing too familiar with it to be discontent
02:03 <MarcelineVQ> erisco: think of the poor implementers, won't anyone think of the poor implementers?
02:03 <monochrom> Whereas why would I expand "PCMCIA"?
02:03 <erisco> the compiler (writer) works hard so I don't have to
02:03 <monochrom> Oh oops the sample code does say "one_cps" oh well.
02:03 <Jinxit> Welkin: that error is probably fixed with the ImpredicativeTypes extension, or some other extension from Types.hs
02:03 <Jinxit> Welkin: interpret
02:04 <glguy> No, the solution isn't to turn on ImpredicativeTypes for that case
02:04 <monochrom> But yeah, ATS the programming language.
02:04 <glguy> (which is broken)
02:05 <glguy> The issue is that MinionLens is a type synonym for a polymorphic type and thus can't be the argument to Scruot
02:05 <glguy> Script*
02:05 Figaro_ joined
02:05 <erisco> monochrom, is there any concise reason why you like ATS?
02:05 <monochrom> No, I don't like ATS.
02:05 <Jinxit> ah, i see
02:05 <monochrom> I just kind of like Hongwei Xi because I met him and he was a nice guy.
02:06 <erisco> lol, well I guess I misunderstood :P
02:06 <monochrom> And then I went on to citing him as an example of joining the Dark Side.
02:06 <Figaro_> Hi, newbie to haskell here
02:06 <Figaro_> Can i make a question?
02:06 <ski> you just did
02:06 <glguy> Congratz!
02:06 louispan joined
02:06 <Figaro_> Well, two question hehe
02:06 <Jinxit> glguy: wait, i have "type MinionLens = Traversal' Game Minion", is that really polymorphic?
02:06 <glguy> Jinxit: yes
02:07 <erisco> a constructive proof that questions exist
02:07 <Guest69913> Hello everyone
02:07 codesoup joined
02:07 <Figaro_> It's about folding
02:07 <monochrom> In fact I don't even like intuitionistic logics generally all that much.
02:07 <Figaro_> Can I break a foldr early?
02:07 <glguy> Jinxit: You can use a ReifiedTraversal wrapper
02:07 <ski> Figaro_ : eys
02:07 bjz joined
02:07 <ski> yes
02:07 <Figaro_> How so?
02:08 <erisco> monochrom, are you more on board with Eric, erm, I forget his last name, perspective? though I don't know how well that lends to a paradigm
02:08 <Figaro_> Like if I want to break when the accumulator reach some value
02:08 <Jinxit> glguy: what's the polymorphism here?
02:08 <ski> > foldr const undefined [0 ..] -- breaking early
02:08 <lambdabot> 0
02:08 <monochrom> Erik Meijer? Eric Hehner?
02:08 <glguy> Jinxit: Keep unfolding type synonyms
02:08 <erisco> begins with an H, perhaps Hehner then
02:08 <erisco> we share a first name so I remember that much ;)
02:08 <monochrom> Yes. Clearly, he's my thesis supervisor.
02:09 <erisco> well you don't have to agree with his work :P
02:09 <monochrom> Do we need a paradigm?
02:09 <erisco> from an aesthetics standard
02:09 <Jinxit> ah i see it
02:09 <erisco> a way in which to program, yes
02:09 <ski> > foldr (\n foldr_ns acc -> if acc > 1000 then acc else foldr_ns (acc + 2 ^ n)) (\acc -> acc) [0 ..] 0 -- Figaro_
02:09 <erisco> that is kind of what we're talking about
02:09 <lambdabot> 1023
02:09 sssilver joined
02:09 <monochrom> But I do. At least the aPToP book. On aesthetic reasons.
02:09 <Figaro_> whoa
02:09 <Jinxit> can a ReifiedTraversal be used as a Traversal?
02:10 <erisco> I knew that monochrom because you gave me his paper a while ago and I read part of it
02:10 <Jinxit> never quite understood reification
02:10 <monochrom> My disagreement with him is on some other topic not in his textbook.
02:10 MrcRjs joined
02:10 <glguy> Jinxit: Not directly, but you can match on the constructor to get a Traversal again
02:11 <erisco> my short description of discontent is that DT is not presented in the right way, for me
02:11 Ayey_ joined
02:11 <ski> Figaro_ : another approach would be to use an exception monad (`Either e' or `ExceptT e m'), to break out
02:11 <erisco> it is becoming more like practical programming, and that is good
02:11 <monochrom> I think Idris is a good take on DT.
02:11 <erisco> but when it starts with logic, well, that's great that you can correlate
02:11 <erisco> but it doesn't mean that is how I want to program
02:12 <Figaro_> A bit too hard for me
02:12 <Guest69913> wait, what's the magic behind this @ski?
02:12 <Figaro_> I'm trying to understand it
02:12 <ski> no magic
02:12 <monochrom> Coq is really not a programming language, whether by intent or by outcome.
02:12 carlosdagos joined
02:13 AndiK joined
02:13 <erisco> I should reread Eric Hehner's paper again because I'd probably understand much more of it now
02:13 <monochrom> A few very clever people like Xavier Leroy pulled it off (using Coq for programming), but that only proves subjective cleverness, not objective suitability.
02:13 <erisco> and the perspective he has I remember appreciating a lot
02:13 <monochrom> A few very clever people wrote proof generators in javascript too.
02:14 Rainb joined
02:14 MrcRjs joined
02:14 systadmin joined
02:14 <erisco> I want to be minimally clever to write programs :P
02:15 <Jinxit> Welkin: gotta go to bed now, but either ping or PM me and i'll read it tomorrow :)
02:16 <ski> > case foldM (\acc n -> if acc > 1000 then throwError acc else return (acc + 2 ^ n)) 0 [0 ..] of Left acc -> "Aborted : " ++ show acc; Right acc -> "Finished : " ++ show acc
02:16 <lambdabot> "Aborted : 1023"
02:16 <ski> > case foldM (\acc n -> if acc > 1000 then throwError acc else return (acc + 2 ^ n)) 0 [0 .. 8] of Left acc -> "Aborted : " ++ show acc; Right acc -> "Finished : " ++ show acc
02:16 <lambdabot> "Finished : 511"
02:16 <monochrom> Oh, I know a simpler example for Figaro_
02:16 infinity0_ joined
02:16 <ski> Figaro_ : `throwError' there is `Left', and `return' is `Right'
02:16 infinity0_ joined
02:17 <Figaro_> The exception stuff is with monads?
02:17 <ski> @type foldM
02:17 <ski> yes
02:17 <Figaro_> I have not read about it yet
02:17 <lambdabot> (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
02:17 <Welkin> using guard?
02:17 <Figaro_> foldr (\n foldr_ns acc -> if acc > 1000 then acc else foldr_ns (acc + 2 ^ n)) (\acc -> acc) [0 ..] 0
02:17 Jeanne-Kamikaze joined
02:17 <monochrom> foldr (\b r -> if b then True else r) False [False, True, False, False, False,...]
02:17 <Figaro_> What's the (\acc -> acc ) for
02:17 <Figaro_> ?
02:17 <Welkin> looks weir
02:17 <Welkin> looks weird
02:17 <Welkin> it's just `id`
02:18 <ski> `foldr' "replaces" the `(:)'s in the list skeleton by the first argument, and the `[]' at the end (if any) by the second argument
02:18 <ski> in this case, `[]' will be replaced by `\acc -> acc'
02:18 Rodya_ joined
02:18 <ski> > foldr f z [a,b,c]
02:18 <lambdabot> error:
02:18 <lambdabot> Ambiguous occurrence ‘f’
02:18 <lambdabot> It could refer to either ‘Debug.SimpleReflect.f’,
02:18 <Welkin> > foldr f z [a,b,c] :: Expr
02:18 bjz joined
02:18 <lambdabot> error:
02:18 <lambdabot> Ambiguous occurrence ‘f’
02:18 <lambdabot> It could refer to either ‘Debug.SimpleReflect.f’,
02:18 <Welkin> lol
02:19 <ski> @undefine
02:19 <lambdabot> Undefined.
02:19 <ski> > foldr f z [a,b,c]
02:19 infinity0 joined
02:19 MrcRjs joined
02:19 <lambdabot> f a (f b (f c z))
02:19 <ski> (someone had defined `f' ..)
02:19 <ski> > foldr f z (a:b:c:[])
02:20 <lambdabot> f a (f b (f c z))
02:20 <ski> > foldr (-) z (a:b:c:[])
02:20 <lambdabot> a - (b - (c - z))
02:20 <* ski> hopes the idea of "replace" is clear now
02:20 <ski> Figaro_ : but monochrom's example is also good, and simpler
02:21 <Welkin> how is a function used as the accumulator value
02:21 <Welkin> ?
02:21 <ski> my example is "leaned so far right they came back as left"
02:21 a3Dman joined
02:22 infinity0 joined
02:22 JoshS joined
02:22 Wizek_ joined
02:23 <ski> if you want to ponder my example, then ask yourself : how many arguments does `foldr' take ?
02:23 ramzifu joined
02:23 plugin joined
02:24 <Welkin> only 3
02:24 <Figaro_> (i think) i get the examples
02:24 <Welkin> the accumulator functions, starting value, and a foldable datatype
02:24 <Welkin> but your accumulator function takes 3 parameters
02:24 infinity0 joined
02:25 <ski> look again at the `foldr' example. how many arguments ?
02:25 <Figaro_> but I think I made the wrong question
02:25 <Welkin> ski: yours somehow takes 4
02:25 <ski> yes
02:25 <ski> how is that possible ?
02:25 <Figaro_> What Welkin mentions is not clear
02:26 <Figaro_> about your example
02:26 <glguy> > id f x
02:26 <lambdabot> error:
02:26 <lambdabot> • Ambiguous type variable ‘a0’ arising from a use of ‘show_M409624688158...
02:26 <lambdabot> prevents the constraint ‘(Show a0)’ from being solved.
02:26 <ski> the general type signature (only considering lists) of `foldr' is
02:26 <glguy> > id (f :: Expr -> Expr) (x :: Expr)
02:26 <lambdabot> f x
02:26 <ski> foldr :: (a -> o -> o) -> o -> [a] -> o
02:26 <glguy> How many arguments does "id" have there?
02:26 <ski> in my specific use, the type of `foldr' is
02:27 Swizec joined
02:27 <ski> foldr :: (Integer -> (Integer -> Integer) -> (Integer -> Integer)) -> (Integer -> Integer) -> [Integer] -> (Integer -> Integer)
02:27 <ski> or, skipping redundant brackets
02:27 <glguy> Welkin: ^
02:27 <ski> foldr :: (Integer -> (Integer -> Integer) -> (Integer -> Integer)) -> (Integer -> Integer) -> [Integer] -> Integer -> Integer
02:27 <ski> do you see what has happened here ?
02:27 infinity0 joined
02:27 <ski> (actually even
02:28 <ski> foldr :: (Integer -> (Integer -> Integer) -> Integer -> Integer) -> (Integer -> Integer) -> [Integer] -> Integer -> Integer
02:28 <ski> )
02:28 mgu joined
02:30 tmtwd joined
02:30 infinity0 joined
02:30 <Figaro_> Isn't your example returning a number? Does not .... -> (Integer -> Integer) means that your result whould be a functin that takes an Integer and return and Integer?
02:30 <Welkin> Figaro_: all functions in haskell are curried
02:30 <Figaro_> Yes
02:30 <Welkin> so all functions only take one parameter
02:31 <Welkin> and produce another function
02:31 plugin joined
02:31 <Figaro_> I still don't get why ski gives 4 parameteres to foldr
02:32 <glguy> Figaro_: Do you understand how I gave 2 parameters to id?
02:32 <Welkin> glguy: `id` still only has one arugment, but `id f` gets reduced to `f`
02:32 <glguy> sure, same situation in foldr
02:32 <glguy> :t foldr
02:32 <lambdabot> Foldable t => (a -> b -> b) -> b -> t a -> b
02:32 <Figaro_> glguy: nop
02:32 <glguy> :t id
02:32 <lambdabot> a -> a
02:33 <glguy> For id, we can pick the type 'a' to be 'this -> that'
02:33 infinity0 joined
02:33 <glguy> and we get: (this -> that) -> this -> that
02:33 <Figaro_> Yes
02:33 <Welkin> :t const id
02:33 <lambdabot> b -> a -> a
02:33 <Welkin> that is the closest example I know
02:33 <glguy> same deal for foldr, pick 'b' to be a function type
02:33 <Figaro_> Yes
02:33 <glguy> suddenly it looks like there are 4 "arguments"
02:33 <Welkin> it took a while for me to work out the type transformations on that one when I did it a while back
02:33 <Figaro_> Then this fold IS returning a function?
02:34 wlemuel joined
02:34 <glguy> yeah
02:34 <Figaro_> and applying it to 0 ?
02:34 <Welkin> is there a cleaner pattern to use for a fold that you can break from?
02:34 xplat joined
02:35 nickofnames joined
02:36 plugin_ joined
02:36 mexisme joined
02:37 subttle joined
02:37 Redrield joined
02:38 tromp joined
02:38 <Redrield> What would be the best editor to use for Haskell. I'm trying to use VSCode with the Haskelly extension, but it just isn't working out as smoothly as other languages have been when using VSCode
02:38 <Redrield> Should I be using a different extension (I really don't feel like having another text editor installed, so if that could be a last resort I would appreciate it)
02:38 <Welkin> emacs
02:39 <Welkin> it has the best haskell support
02:39 <Redrield> Emacs failed me, I'm almost certainly not going back
02:39 <jle`> i use vim for the most part
02:39 <jle`> but people like atom, sublime, etc. too
02:40 raycoll joined
02:40 tripped joined
02:41 Mal_Trapo joined
02:41 Mal_Trapo left
02:41 augur joined
02:41 marvin3 joined
02:43 Ayey_ joined
02:43 {emptyset} joined
02:43 <ski> Figaro_ : yes
02:43 <ski> that `0' is the accumulator
02:44 NeverDie joined
02:45 tswett_to_go joined
02:45 <Guest69913> http://lpaste.net/353662 I have these datatypes. It works well when I'm using LogicGate or Proposition, but things get messy when I try to use "Boolean" alone. I'm having an infinite type error
02:45 <tswett_to_go> I just thought of a dumb joke.
02:46 <tswett_to_go> What language is this: update a set b = null where null = b
02:46 dennisvennink joined
02:46 tristanp joined
02:46 gobrewers14 joined
02:47 <tswett_to_go> There's no punchline. I just thought it was funny that you can make a thing which is both a valid SQL statement and a valid Haskell statement, and which uses both languages' "where" clauses.
02:47 <jle`> Guest69913: can you post the error?
02:47 whaletechno joined
02:47 <jle`> tswett_to_go: cute :)
02:47 dennisvennink joined
02:47 gobrewers14 left
02:49 <Guest69913> here you go http://lpaste.net/353666 jle`
02:49 <jle`> Guest69913: what line is the error on?
02:50 <Guest69913> the first one
02:50 <jle`> Guest69913: what type do you think 'f' has?
02:51 <jle`> ...what type do you want it to have?
02:51 <jle`> (what is f supposed to do?)
02:51 <jle`> if you answer these questions then you might see your problem
02:51 <Figaro_> ski : Another question from your example
02:52 <jle`> Guest69913: giving it a type signature will help you see what the problem is
02:52 sektor joined
02:52 <jle`> i don't know how to help you fix it because i'm not sure what 'f' is supposed to be doing
02:52 <jle`> but if you think about what f is doing, then you'll see why it doesn't make sense, the way you have written it
02:53 <jle`> you're applying 'f' to things of different types, and the types don't unify
02:53 <jle`> kind of like saying foo True = foo "hello"
02:53 <Guest69913> jle` it's supposed to walk though the tree and convert everything to haskell's I want the type to be like "Boolean Boolean Bool"
02:53 <jle`> foo is taking a Bool as an argument, but I later apply it to a String?
02:54 <jle`> Guest69913: Boolean Boolean Bool ?
02:54 <jle`> there's your problem
02:54 <jle`> that's not a function type
02:54 kusti85 joined
02:54 <jle`> so f isn't a function
02:54 <Guest69913> http://lpaste.net/353662
02:54 steshaw joined
02:54 <jle`> Guest69913: if you want f :: Boolean Boolean Bool, then it isn't a function
02:54 <jle`> so there isn't any reason to pattern match on arguments
02:54 archofit joined
02:54 <Guest69913> oh no I want Boolean Boolean Bool -> Bool
02:54 <jle`> also, Boolean Boolean Bool isn't well-kinded
02:55 <jle`> Boolean's first argument is a (* -> *)
02:55 <jle`> but Boolean is (* -> *) -> (* -> *)
02:55 <jle`> so `Boolean Boolean Bool` doesn't make sense as a type
02:55 ziman joined
02:55 <jle`> are you familiar with kinds?
02:55 zomg joined
02:56 louispvb joined
02:56 micro_ joined
02:56 <* ski> waits for Figaro_ to formulate their question
02:56 <Guest69913> yes kind of, I get the error, but I don't know how to fix it
02:56 <jle`> maybe you want 'Boolean Identity Bool' ?
02:56 <jle`> from Data.Functor.Identity
02:56 <Guest69913> I want it to be still recursive
02:57 LeCamarade joined
02:57 <glguy> Probably not the ideal, but we can do : newtype BooleanBoolean a = BB (Boolean BooleanBoolean a)
02:57 <jle`> ah, so you want Boolean (Boolean (Boolean (Boolean ...))) Bool, huh?
02:57 Eduard_Munteanu joined
02:57 <Figaro_> Many questions actually, why the function you give to foldr has three paramters?
02:57 <Figaro_> What's the n parameter
02:57 <ski> the current element of the list
02:57 <Figaro_> ohhhh
02:57 <Guest69913> in a way yes
02:58 <jle`> you want each inner layer to be another Boolean
02:58 <Guest69913> ya
02:58 <jle`> boolean wrapping a boolean wrapping a boolean wrapping a boolean forever
02:58 <Figaro_> That what I wanted originally
02:58 datajerk joined
02:58 <Figaro_> But again, isn't the function you give to foldr supposed to have two parameters?
02:58 <glguy> Guest69913: You could avoid the pain with: data Boolean = Value Bool | And Boolean Boolean
02:58 <jle`> haskell doesn't quite let you do that nakedly, you'll have to wrap it up like how glguy posted, or use a generic fixed-point combinator
02:59 Sonderblade joined
02:59 <ski> Figaro_ : it's supposed to have type `a -> o -> o', for some types `a' and `o'. in my case `a' is `Integer' and `o' is `Integer -> Integer'
02:59 <jle`> there's a common one in the 'data-fix' library if you want to leverage it
02:59 <ski> Figaro_ : meaning that callback function has type `Integer -> (Integer -> Integer) -> Integer -> Integer'
03:00 <jle`> or yeah, you can write a data type implementing the infinte recursion, newtype BoolForever a = BF (Boolean BoolForever a)
03:00 geppettodivacin joined
03:00 hucksy_ joined
03:00 <jle`> so a `Boolean BoolForever a` contains BoolForever's, which contain Boolean's
03:00 doodlehaus joined
03:00 laudiacay joined
03:00 <jle`> then you can write f :: Boolean BoolForever Bool -> Bool
03:01 <jle`> f (And (BF x) (BF y)) = f x && f y
03:01 <jle`> this works because the type of x is :: Boolean BoolForever a
03:01 <jle`> er, the type of x is :: Boolean BoolForever Bool
03:01 <jle`> so now, every time you use 'f', you're applying it to a Boolean BoolFrever Bool
03:01 <jle`> so it's all well-typed :)
03:01 <Guest69913> that's awesome, I'll look into the fix-point and use the newtype if it fails, thanks a lot jle` and glguy! :)
03:02 cross joined
03:04 dennisvennink joined
03:06 <jle`> Guest66913: the data-fix package provides a parameterized version of BoolForever, and also some nice polymorphic combinators for recursion like what we quote here
03:06 <Figaro_> ski: your foldr takes its initial value as a function then
03:06 nemorichard joined
03:07 <Figaro_> Sorry if I ask you many things
03:07 <ski> what do you mean by "initial value" ?
03:08 <Figaro_> > foldr (\acc x -> x + acc) 0 [1,2,3,4]
03:08 <lambdabot> 10
03:08 <Figaro_> has 0 as initial value
03:08 <glguy> Figaro_: foldr "starts" from the beginning of the list, like any other operation on lists
03:08 <glguy> at best the 0 is the "end" value
03:08 Reisen joined
03:10 nemorichard left
03:12 zero_byte joined
03:13 Ayey_ joined
03:13 carlosdagos joined
03:14 <tswett_to_go> Can templates in Template Haskell have "side effects"? In my case, I want to have a template that returns a type, but also generates a declaration.
03:15 <glguy> No
03:15 Guest30139 joined
03:16 <tswett_to_go> Well... that's a straightforward answer. :)
03:16 <tswett_to_go> Thanks.
03:17 kyndi joined
03:17 Goplat joined
03:18 <Welkin> glguy: you forgot the full stop
03:19 vydd joined
03:19 <glguy> Thanks.
03:21 <tswett_to_go> I see that you can use Template Haskell to query whether or not Template Haskell is enabled.
03:21 <tswett_to_go> Sounds kind of... cartesian.
03:21 <lpaste_> codebje revised “tail of church list?”: “tail of church list?” at http://lpaste.net/353663
03:22 eacameron joined
03:25 <tswett_to_go> Next question, then. I see that a TH QuasiQuoter can contain a "quoteDec" parser, which is expected to return a Dec.
03:25 <tswett_to_go> Does this mean it's not possible to have a QuasiQuoter which returns multiple declarations?
03:25 tristanp joined
03:26 <glguy> No, it's type is : quoteDec :: String -> Q [Dec]
03:26 louispan joined
03:26 chu joined
03:27 <tswett_to_go> Ah, nice.
03:29 Ayey_ joined
03:29 <Maxdamantus> codebje: I'm not sure what you mean by "will immediately call tail"
03:29 <Maxdamantus> codebje: tail should work just the same way as head.
03:29 <Maxdamantus> maybeTail l = l Nothing (\_ x -> Just x)
03:30 lp joined
03:31 pavonia joined
03:31 Apocalis_ joined
03:33 Figaro_ left
03:34 pera joined
03:35 geekosaur joined
03:37 emmanuel_erc joined
03:40 doomlord joined
03:42 bjz joined
03:43 ertes joined
03:45 exferenceBot joined
03:45 meba joined
03:48 justan0theruser joined
03:49 hexagoxel joined
03:51 tromp joined
03:51 mson joined
03:54 adlan joined
03:55 fabianhu joined
04:00 JoshS joined
04:01 systemfault joined
04:02 Starfflame joined
04:02 plugin joined
04:03 <Starfflame> https://www.irccloud.com/pastebin/iGcgpNxK/
04:03 <Starfflame> https://www.irccloud.com/pastebin/gKIjaeEU/
04:03 <Starfflame> crap
04:04 <Starfflame> I can't format my text, but I'm confused how this is producing an error
04:04 plugin_ joined
04:04 <Starfflame> I don't have a Maybe input specified anywhere...?
04:05 <glguy> Starfflame: First issue is that you have the arguments to comp backward
04:05 <Starfflame> they are?
04:06 <Starfflame> rip
04:06 xtreak joined
04:06 nemorichard joined
04:06 sanett joined
04:07 Scip joined
04:09 <lpaste_> glguy pasted “for starfflame” at http://lpaste.net/6795469252544430080
04:09 <glguy> Starfflame: The other problem was that comp was using 'x' as though it had type 'Maybe a' instead of the actual 'a'
04:09 marvin3 left
04:10 <Starfflame> I'm confused, why should that matter?
04:10 <Starfflame> doesn't comparing Just X and Just Y work equally well?
04:10 <glguy> You weren't doing that
04:10 <glguy> You were comparing X and Nothing
04:11 <glguy> Not Just X and Nothing
04:11 <glguy> and then you were returning that same x as the first element of your 3-tuple
04:11 <glguy> where it needed to have a Maybe type, but didn't
04:12 <Starfflame> My list should compose all of Maybe types
04:12 <Starfflame> perhaps I should declare that in the type declaration, but
04:12 ahri joined
04:12 sanett joined
04:12 <glguy> Right, you declared that that was not necessarily the case
04:13 <Starfflame> so why does Haskell freak out when I use Just X?
04:13 <glguy> It tells you right in the message
04:14 <Starfflame> I see
04:14 <Starfflame> thanks man :D
04:15 carlosdagos joined
04:15 mmachenry joined
04:16 mmachenry1 joined
04:18 <Starfflame> haskell's error messages are kinda cryptic
04:18 <Starfflame> at least to a noob
04:19 neezer joined
04:19 <glguy> If you have a question about one you can of course ask it
04:19 moongazer joined
04:19 Rotaerk joined
04:20 systemfault joined
04:20 vydd joined
04:20 <Starfflame> usually I'm able to figure it out
04:20 <Starfflame> but the specific one I saw was just confusing xD
04:20 <Cale> Starfflame: One thing which helps a lot is if you add type signatures to things which don't have them -- generally the compiler will be able to improve the quality of the messages, since it has more information about what it is that you want.
04:21 Xanather joined
04:22 <neezer> Hello! I'm new to Haskell and trying to understand the Turtle library (https://hackage.haskell.org/package/turtle-1.3.2/docs/Turtle-Prelude.html) for a script I'm working on... specifically how to filter the output of `lstree "/some/dir"` to only return files and not directories. Would appreciate any help/guidance!
04:23 sssilver joined
04:23 ramzifu joined
04:23 <Cale> This library is... weird
04:23 halogenandtoast joined
04:24 Apocalis_ joined
04:24 <neezer> @Cale Any recommendations for an alternative? Really I just need a list of all files in a directory (recursive).
04:24 <lambdabot> Unknown command, try @list
04:25 <neezer> @list
04:25 <lambdabot> What module? Try @listmodules for some ideas.
04:25 <neezer> @listmodules
04:25 <lambdabot> activity base bf check compose dice dict djinn dummy elite eval filter free fresh haddock help hoogle instances irc karma localtime metar more oeis offlineRC pl pointful poll pretty quote search
04:25 <lambdabot> slap source spell system tell ticker todo topic type undo unlambda unmtl version where
04:25 <glguy> The @ is for bot commands, not addressing other users.
04:26 <neezer> glguy Thanks, also new to IRC. Usually on Slack these days. :)
04:27 <dmwit> Might be nice to remove @ from \bot's vocabulary. It's becoming a much more common way to address people on other media, and I think we can expect continued confusion here from it.
04:27 <Cale> neezer: There's a package called directory-tree which is relatively straightforward. You should be able to use readDirectoryWith return "/path/to/somewhere"
04:28 <neezer> Cale Thanks for the recommendation, I'll check it out.
04:29 mmachenry joined
04:29 hexagoxel joined
04:29 Rizy joined
04:29 sanett joined
04:31 <Cale> toList . dirTree <$> readDirectoryWith return "/path/to/somewhere"
04:31 <Cale> will turn it into a list of paths
04:31 <Cale> (since you'll get a tree to start with)
04:31 <Cale> toList is from Data.Foldable
04:33 <Cale> Prelude System.Directory.Tree Data.Foldable> length . toList . dirTree <$> readDirectoryWith return "/home/cale/Music"
04:33 <Cale> 16181
04:33 <neezer> Cale: Awesome, that's exactly what I needed. Thank you!
04:36 <Cale> neezer: That Turtle library is actually probably worth looking at more closely, given who its author is, however, it looks like a pretty fancy tool for the job.
04:37 <Starfflame> is there a built-in function that does concat splitOn?
04:37 <Cale> Starfflame: You just want to delete the separators?
04:37 <Starfflame> yeah
04:38 <neezer> Another question, unrelated to the first: I'm trying to use HLint and I have a data type that I want to not use camelCasing on, so I read about how to add an annotation pragma to the top of my file to disable that rule: I used `{-# ANN module "HLint: ignore Use camelCase" #-}` and that gets rid of the HLint error, but now my app won't compile with the error "File name does not match module name: Saw: ‘Main’ Expected: ‘Lib’"
04:38 <neezer> Docs here: http://community.haskell.org/~ndm/darcs/hlint/hlint.htm#customization
04:38 <Cale> Starfflame: perhaps replace?
04:38 <Cale> Starfflame: Is this a Text you're working with?
04:38 <Starfflame> Yeah, a string
04:39 ali_bush joined
04:40 <Eduard_Munteanu> neezer, the error seems totally unrelated to hlint
04:40 <Eduard_Munteanu> neezer, do you have a module declaration at the top of your file?
04:41 <neezer> Eduard_Munteanu: Yes, after the ANN pragma, which reads `module Lib (argConfig, defaultFromEnv) where`
04:41 <neezer> Eduard_Munteanu: Removing the ANN pragma allows my app to compile and run fine.
04:41 <glguy> Put the ANN under the module declaration
04:42 <neezer> glguy: After my imports too? Otherwise I get parsing errors.
04:43 cschneid_ joined
04:43 <neezer> Hmm, now I'm getting "Ambiguous type variable ‘t0’ arising from an annotation prevents the constraint ‘(Data t0)’ from being solved."
04:44 <neezer> I can't help but wonder if my ANN pragma is malformed in some way.
04:44 <glguy> OverloadedStrings enabled?
04:45 <neezer> glguy: Yes.
04:45 <glguy> OK, then you'll need a type signature on the string literal in the annotation
04:46 Gurkenglas joined
04:46 <* ski> would prefer being able to say `@type',&c. in the future as well
04:46 <neezer> glguy: What would that look like?
04:48 <dmwit> ski: What makes you prefer @type to ?type?
04:48 <glguy> neezer: Try: {-# ANN module ("stuff" :: String) #-} perhaps
04:49 <glguy> Annotations are more interesting than simply expecting strings, then can take arbitrary data types as annotations
04:49 fold4 joined
04:49 ali_bush joined
04:49 ali_bush joined
04:49 <neezer> glguy: That seemed to work. Compiled without errors.
04:49 <ski> tradition
04:49 bungoman joined
04:50 <neezer> glguy: Thanks for the help!
04:50 castlelore joined
04:51 <dmwit> ski: yeah =)
04:51 <ski> (for me, `?' just feels wrong. i feel like i'd refrain from interacting with lambdabot via such commands, should the old way become unavailable)
04:52 xplat joined
04:54 sanett joined
04:58 dbmikus joined
05:00 moongazer joined
05:00 brynedwards joined
05:04 dbmikus joined
05:08 mizu_no_oto joined
05:09 ali_bush joined
05:09 ali_bush joined
05:11 sanett joined
05:12 kody joined
05:13 mkoenig joined
05:16 carlosdagos joined
05:17 darjeeling_ joined
05:19 ali_bush joined
05:19 ali_bush joined
05:19 xtreak joined
05:20 forgottenone joined
05:22 ramzifu joined
05:23 uglyfigurine joined
05:29 Ayey_ joined
05:30 Rizy joined
05:33 bjz joined
05:34 FreeBirdLjj joined
05:37 sanett joined
05:37 vlatkoB joined
05:43 hexagoxel joined
05:44 arawack joined
05:48 nemorichard joined
05:50 connrs joined
05:50 sanett joined
05:52 Ayey_ joined
05:52 tag joined
05:53 dbmikus joined
05:53 tromp joined
05:56 robkennedy joined
05:59 louispan joined
06:05 moongazer joined
06:08 Ayey_ joined
06:09 echo-area joined
06:15 BartAdv joined
06:17 systadmin joined
06:17 carlosdagos joined
06:21 hexagoxel joined
06:27 simukis__ joined
06:28 sanett joined
06:31 sanett_ joined
06:31 eacameron joined
06:33 connrs joined
06:33 FreeBirdLjj joined
06:35 exferenceBot joined
06:37 sanett joined
06:41 owiecc joined
06:42 vydd joined
06:42 AleXoundOS joined
06:43 ali_bush joined
06:44 Ayey_ joined
06:46 hexagoxel joined
06:46 weurdo joined
06:48 dbmikus joined
06:51 meandi_2 joined
06:53 dbmikus joined
06:55 ali_bush_ joined
06:57 danvet joined
07:03 connrs joined
07:06 forgottenone joined
07:08 vlatkoB_ joined
07:08 lp joined
07:11 forgottenone joined
07:14 FreeBirdLjj joined
07:18 carlosdagos joined
07:24 ali_bush joined
07:25 <ahri> apologies in advance; i don't quite know how to express this: i'm familiar with the idea of composing two fmaps together to process a 2d list, and i wonder whether i can do something similar with foldr so that i can carry some state along while keeping the simplicity of having a function that operates only on the type contained within my 2d list. does this make sense? e.g. with my composed fmaps i can just
07:25 <ahri> have a function 'a -> b' without caring about the structure. i'd like something like '(s, a) -> (s, b)' to carry state along, but still not care about the structure
07:26 Rizy joined
07:30 Kreest__ joined
07:30 xtreak joined
07:31 dni joined
07:31 takuan joined
07:31 magneticduck joined
07:33 boxofdeath joined
07:34 <ski> ahri : something like `runState ((mapM . mapM) (state . process) my2dList) initialState', with `process :: a -> s -> (b,s)' ?
07:36 <ski> or `(mapAccumL . mapAccumL) process initialStte my2dList)', this time with `process :: s -> a -> (s,b)'
07:38 <ski> that's assuming you want to initialize the state once, then visit each element in turn, "sweeping" across the rows
07:39 <ski> if you want to do some extra processing inbetween the rows as well (possibly also involving the row index), affecting the state, then that's slightly more complicated, but should be possible as well
07:40 ali_bush joined
07:40 ali_bush joined
07:43 halogenandtoast joined
07:43 dbmikus joined
07:43 <halogenandtoast> When I do something like :t (>>) is there a way to get it to automatically replace `m` with IO for instance
07:43 <halogenandtoast> :t (>>)
07:43 <lambdabot> Monad m => m a -> m b -> m b
07:43 <halogenandtoast> and for this I mean in ghci, not lambdabt
07:45 <ahri> ski: sorry, i'm just looking all this up before i'm able to reply :)
07:46 zcourts_ joined
07:46 caumeslasal joined
07:47 meba joined
07:48 ali_bush joined
07:48 ali_bush joined
07:48 dbmikus joined
07:49 <ahri> ski: mapAccumL looks like what i'm after. i'm a bit confused about the State monad at the moment so i'll try mapAccumL first!
07:49 <Maxdamantus> halogenandtoast: it would sort of be a lie if it replaced `m` with `IO`. It wouldn't be clear when you want it to lie to you by narrowing down the range of types.
07:50 <Cale> ahri: Another thing you can do is to use foldr like this:
07:50 <Cale> > foldr (\x xs s -> (x,s) : xs (s+1)) (const []) "hello" 0
07:50 <lambdabot> [('h',0),('e',1),('l',2),('l',3),('o',4)]
07:50 <Maxdamantus> Theoretically, it could make sense to somehow denote a type-level application of that `m` parameter as `IO`.
07:51 <Maxdamantus> You can do that in Idris for example, but you would be explicitly passing it `IO` .. Haskell only lets you pass it implicitly.
07:52 <nshepperd> you can do :set -XTypeApplications
07:52 <nshepperd> then :t (>>) @ IO
07:52 <Maxdamantus> Mk, so that's GHC's version of that.
07:52 FreeBird_ joined
07:53 connrs joined
07:54 tromp joined
07:54 Coldblackice joined
07:55 <ahri> Cale: i wondered about that, but i don't understand how i would compose that up to operate on a 2d list. there's something very lovely about (fmap . fmap) !
07:55 <nshepperd> 'f @ T' gives you f with the first type parameter in its type sig unified with (replaced by) T
07:56 robertkennedy joined
07:56 robertkennedy joined
07:57 <ski> ahri : there's also `mapAccumR' for "processing a list from the right" .. but presumably you want it the `mapAccumL' way
07:58 Elish joined
07:59 robkennedy joined
08:00 Wizek joined
08:01 <Wizek> Hello. Am I reading the source for `bracket` correctly ( https://hackage.haskell.org/package/base- ) that the release function (called `after` in the source) is called twice if there was an exception?
08:01 ali_bush joined
08:03 <Cale> No, the exception is rethrown by onException, and will propagate outward, so the second after will never occur in that case.
08:03 <Wizek> Cale, I see
08:04 fizruk joined
08:05 robertkennedy joined
08:07 robkennedy joined
08:08 doomlord joined
08:08 revprez joined
08:10 Rainb joined
08:11 NeverDie_ joined
08:11 systadmin joined
08:13 echo-area joined
08:13 kritzcreek_ joined
08:14 ali_bush joined
08:14 ali_bush joined
08:17 ubsan_ joined
08:18 carlosdagos joined
08:22 eacameron joined
08:22 mzf joined
08:25 ali_bush joined
08:25 ali_bush joined
08:26 systadmin joined
08:28 Phil joined
08:28 Yuras joined
08:32 boombanana joined
08:33 Ayey_ joined
08:34 Cassiopaya joined
08:36 Rizy joined
08:38 dbmikus joined
08:40 SpinTensor joined
08:41 freechips joined
08:42 xtreak joined
08:43 chenyu joined
08:44 ali_bush joined
08:44 ali_bush joined
08:45 vydd joined
08:45 sanett joined
08:46 t0by joined
08:54 yrid joined
08:55 raichoo joined
08:57 hackebeilchen joined
08:58 Einwq joined
08:58 caumeslasal joined
08:59 sanett joined
08:59 fizbin joined
09:01 biglama joined
09:02 ragepandemic joined
09:05 atomi joined
09:06 hexagoxel joined
09:06 sibi joined
09:06 OnkelTem joined
09:10 ltielen joined
09:11 uglyfigurine joined
09:11 sanett_ joined
09:12 forgottenone joined
09:12 dni joined
09:13 mstruebing joined
09:15 doomlord joined
09:15 ali_bush joined
09:15 ali_bush joined
09:16 Levex joined
09:17 bshelden joined
09:17 dawehner joined
09:18 mmn80 joined
09:18 ralu joined
09:19 carlosdagos joined
09:21 cschneid_ joined
09:21 <Jinxit> regarding https://goo.gl/IT3NDD (not my question, but i have the same issue), is there really no neater solution that the ones presented?
09:21 AndreasK joined
09:21 shane joined
09:22 Kreest_ joined
09:23 marcopullo joined
09:23 plugin joined
09:23 xtreak joined
09:25 Levex joined
09:26 Rizy joined
09:26 ali_bush joined
09:26 ali_bush joined
09:29 jgt joined
09:30 <jgt> hey folks :)
09:30 kadabra joined
09:31 ziyourenxiang joined
09:31 <jgt> in Shakespeare/Yesod, how do I render a widget? I have a `WidgetT site2 m2 ()`, and I need an `Html`
09:31 <jgt> I read in the documentation that a `WidgetT` is actually a `WriterT`, defined in a newtype
09:32 <jgt> do I have to do something like `runWriterT`?
09:33 <Rembane> Do you have a runWidgetT?
09:33 <jgt> Rembane: doesn't look that way
09:33 dbmikus joined
09:33 <jgt> but, I don't know, hence the question :)
09:34 <jgt> (still a noob)
09:34 marcopul_ joined
09:34 <Rembane> Me neither, I'm just doing informed guessing, speaking of which do you have a link to the documentation where the WidgetT is declared?
09:34 hackebeilchen joined
09:34 <jgt> https://hackage.haskell.org/package/yesod-core-1.4.32/docs/Yesod-Core-Widget.html
09:35 <jgt> oh… perhaps I want `unWidgetT`? I'm looking at the source
09:36 <Rembane> That is promising.
09:38 dbmikus joined
09:38 <jgt> ok, I'm not even sure if I can use that
09:38 chenyu joined
09:39 dawehner joined
09:39 <Rembane> jgt: Some Template Haskell magic seems to be in play here, look at the first example: http://www.yesodweb.com/book/widgets
09:40 omega8cc joined
09:41 Levex joined
09:41 <jgt> ok, so if I use `defaultLayout`, then I at least have a `HandlerT site0 IO Html`
09:42 <Rembane> Cool
09:42 <Rembane> jgt: You could on the other hand go WidgetT -> PageContent -> Hamlet -> ByteString
09:42 mohsen_ joined
09:42 <Rembane> jgt: Where the arrows are not function application arrows
09:42 albertus1 joined
09:42 <Rembane> jgt: You have a widgetToPageContent in Yesod.Widget.
09:43 <jgt> I'd be happy ending up with a ByteString
09:43 <jgt> trying to think now how to formulate this
09:44 Rainb joined
09:45 MtWGA joined
09:46 <Rembane> jgt: Cool, are you trying to render stuff to a page like in the examples in the Yesod book?
09:46 Levex joined
09:46 SepakoRayl joined
09:46 kadabra joined
09:47 <jgt> Rembane: not exactly; the examples in the book are fine for rendering pages in a normal Handler flow, i.e., visitors making requests and receiving responses
09:47 ali_bush joined
09:47 ali_bush joined
09:47 <jgt> what I'm trying to do now is take a widget, with some html and css, and serialise that to a ByteString so I can pass it into my mailer
09:47 <SepakoRayl> hello everyone, any idea why stack exec sets -icanon ?
09:47 <jgt> for sending some html email
09:48 <geekosaur> SepakoRayl, it's trying to disable buffering, but the ghc runtime conflates that with character at a time mode
09:48 <geekosaur> there's an open bug about it
09:48 meba joined
09:49 <SepakoRayl> it was very confusing because this happened even if i explicitely set LineBuffering
09:49 metafoobar joined
09:49 <SepakoRayl> It seems to work correctly with BlockBuffering though
09:49 <geekosaur> stack itself is setting NoBuffering, and what the program you run does is not relevant to it
09:50 coot joined
09:50 <SepakoRayl> yes but it seems LineBuffering does not restore the icanon flag
09:50 <geekosaur> block buffering likely undoes what the runtime is doing though. Personally I think ghc should not have tried to conflate these; it will not only get it wrong in the way you are seeing, it just confuses things worse.
09:51 <Rembane> jgt: That's a reasonable use case.
09:51 <jgt> Rembane: glad I'm on the right track then :)
09:52 sw1nn joined
09:52 <SepakoRayl> do you guys know where I can read more aobut this ?
09:52 ali_bush joined
09:52 ali_bush joined
09:53 vydd joined
09:53 vydd joined
09:54 <geekosaur> https://github.com/commercialhaskell/stack/issues/2884
09:54 <Rembane> jgt: ^^
09:54 <SepakoRayl> ah it was this issue
09:55 gawen joined
09:55 <SepakoRayl> I guess I was just surprised that setting LineBuffering explicitely did not set icanon again
09:56 metafoobar left
09:56 <geekosaur> I expect they forgot that case when adding the termios twiddling. Just another reason they shouldn't have done so in the first place.
09:56 <geekosaur> Also, since termios state is part of the terminal and not part of the program context, it's problematic when multiple programs are involved (here, stack and your program)
09:58 metafoobar joined
09:58 sepp2k joined
09:58 dbmikus joined
10:01 cschneid_ joined
10:01 <SepakoRayl> this was how i found it, the program compiled with ghc worked as expected but stack exec messed everything up and afterwards even the original program did not run as exptected
10:02 ali_bush joined
10:02 ali_bush joined
10:03 <geekosaur> yes, probably left the terminal in the wrong mode, that is what I meant by "problematic when multiple programs are involved"
10:03 <geekosaur> in the shell: stty sane
10:03 Dunearhp_ joined
10:03 cpup joined
10:03 <geekosaur> (shells will not be affected unless you use one that doesn't use readline/editline for some reason)
10:04 silver joined
10:06 chaosmasttter joined
10:09 sdlnv joined
10:10 OnkelTem joined
10:13 hexagoxel joined
10:15 <jgt> Rembane: looks like someone had a similar thought as me a couple of years ago: https://github.com/yesodweb/yesod/issues/699
10:15 boombanana joined
10:17 <jgt> it's interesting that in his `htmlVersion`, he's just using a hamlet file, and not a widget
10:18 <Rembane> jgt: Yes indeed.
10:20 carlosdagos joined
10:20 dennisvennink joined
10:20 ali_bush joined
10:20 ali_bush joined
10:21 systadmin joined
10:23 plugin joined
10:24 albertus1 joined
10:24 mgu` joined
10:26 <jgt> Rembane: I'm giving up the widget idea for now. I'll just stick everything in the same hamlet file, and worry about this widget stuff later
10:26 <ph88^> i don't understand why i have in the type signature on line 41 1 arrow, but in implementation on line 58 i need 3 arguments, can anyone explain? https://bpaste.net/show/4ec41c1fcae7
10:27 <jgt> can't get sidetracked; gotta 🚢 some Haskell
10:28 <Chousuke> amusskekt1
10:28 <jgt> ph88^: I'm not sure, but I'm thinking something along the lines of partial application
10:28 agaric joined
10:28 <Chousuke> bah :(
10:28 <Chousuke> oh well, it was way past the time to change that particular password anyway
10:29 <ph88^> jgt, maybe i should maybe the second argument of kind * -> * ?
10:30 <jgt> ph88^: actually forget what I said; I really have no idea
10:31 <ph88^> oh i thought you were onto something
10:33 <Rembane> jgt: That's a good plan.
10:33 troydm joined
10:34 albertus1 joined
10:34 albertus1 joined
10:35 simendsjo joined
10:36 fabianhu joined
10:38 <jgt> ph88^: possibly, but I don't have a solid enough grasp of typeclasses. What stuck out to me was that you said there are “three arguments”, whereas I'm sure everything in Haskell only takes one argument. There's also this common case where arguments are passed to stuff, but you don't necessarily see them in any signature
10:39 systadmin joined
10:41 MoALTz joined
10:42 <jgt> but also I could be confused about some of those points
10:43 mgu joined
10:43 <jgt> at this point, my Haskell advice should be taken with enough salt to disable a kidney
10:43 systadmin joined
10:47 osa1 joined
10:47 <ph88^> i usually use drinks for that
10:48 lukaramu joined
10:49 Jackneill joined
10:53 sidei joined
10:53 stoopkid joined
10:54 cschneid_ joined
10:55 tromp joined
10:56 uncertainty joined
10:57 thc202 joined
10:57 <ski> ph88^ : i'm pretty sure LensLike' f eot a is a type synonym of a function type
10:58 lp joined
10:59 eacameron joined
11:00 <ski> ph88^ : however, i'm suspecting that the (unused !) formal parameter `eot' in the `instance' declarations of "Code piece 3" should be removed (together with `eot ->' in the type signature in the `class' declaraion) ..
11:01 <ski> ph88^ : .. either that, or something should be passed in this position, in the calls to `eotTerminal' in the definientia
11:02 Snircle joined
11:02 oisdk joined
11:06 hexagoxel joined
11:06 Miroboru_ joined
11:08 howdoi joined
11:09 <ph88^> ski, thanks for your help, i will go over what you said as soon as i get to it, i have to leave immediately :/
11:10 al-damiri joined
11:11 AndreasPK joined
11:11 zeta joined
11:12 orion__ joined
11:12 orion__ left
11:14 willprice joined
11:14 schjetne joined
11:15 netheranthem joined
11:15 osa1 joined
11:15 osa1 joined
11:15 <AWizzArd> Can I „automatically trace” function calls in ghci, without using the trace function? Similar to Lisp, where I can see the input and output arguments to each function call?
11:16 <AWizzArd> Automatic in the sense that I don’t need to touch the code, and don’t need to use breakpoints.
11:16 Rizy joined
11:16 sanett joined
11:18 thunderrd_ joined
11:18 dawehner joined
11:18 Miroboru_ joined
11:19 djfo joined
11:21 marfoldi joined
11:21 carlosdagos joined
11:21 wildlander joined
11:21 sanett_ joined
11:22 thunderrd joined
11:23 mojjo joined
11:25 schjetne joined
11:25 <mojjo> hi! I just created an instance of Num for a custom type. I can use it like this now: (Length 1) + (Length 1) --> Length 2 . However the same did not work for creating an instance of Fractional in order to use sqrt on the type as well. Can anybody help me out here?
11:26 louispan joined
11:27 meff` joined
11:28 Raddamu joined
11:28 bennofs joined
11:28 dennisvennink joined
11:28 sanett joined
11:29 xtreak joined
11:34 revtintin joined
11:35 marcopullo joined
11:35 coot joined
11:35 oisdk_ joined
11:35 sanett_ joined
11:37 peterhil joined
11:38 bjz joined
11:38 Jackneill joined
11:41 forgottenone joined
11:42 arawack joined
11:45 sanett joined
11:50 <* ski> notes mojjo hasn't provided enough info for readers to be able to give any useful help
11:50 ziocroc joined
11:51 irc2000 joined
11:51 <irc2000> can we talk about humanity for a second?
11:52 <irc2000> i hate humanity
11:52 <ski> is this Haskell-related ?
11:52 <irc2000> we work hard to advance humanity.. meanwhile some gypsie is trafficking humans.
11:53 <irc2000> ski: well, I want to work on improving haskell
11:53 <irc2000> ski: but humanity is putting me off my mood
11:53 <ski> perhaps vent somewhere else about it ?
11:53 petervaro joined
11:53 <irc2000> ski: about haskell? what other channel is more related to that
11:53 oisdk joined
11:53 <irc2000> ski: now you're just being retarded man..
11:54 <cocreature> irc2000: please stop insulting people
11:54 <irc2000> cocreature: please stop fucking children.
11:54 <cocreature> @where ops
11:54 <lambdabot> byorgey Cale conal copumpkin dcoutts dibblego dolio edwardk geekosaur glguy jmcarthur johnw monochrom quicksilver Saizan shachaf shapr ski
11:55 was kicked by dibblego: irc2000
11:55 <cocreature> thanks
11:55 ali_bush joined
11:55 ali_bush joined
11:56 sanett joined
11:58 bjz joined
11:59 takle joined
12:04 oisdk joined
12:08 caumeslasal joined
12:08 plugin joined
12:09 systadmin joined
12:09 alanb99 joined
12:10 sdothum joined
12:10 alanb99 left
12:11 Jackneill joined
12:11 Rodya_ joined
12:13 <centril> stupid racists... :/
12:13 <centril> anyways
12:15 <centril> For a set of (data) types A, and a set of types B, I have, \forall a \in A. \exists b \in B. a -> Maybe b
12:16 <centril> i.e: every type in A has a (partial) correspondence in some type in B.
12:16 <ski> `b' not depending on the input value in `a' ?
12:16 epsilonhalbe joined
12:17 <centril> Also: for every type a in A, there exists a function :: a -> String ("printTree")
12:17 fizruk joined
12:17 <centril> ski: it depends on the value in a
12:18 <ski> so i suppose you mean to say `\forall a \in A. a -> \exists b \in B. Maybe b' ?
12:18 Destol joined
12:18 <ski> or maybe `\forall a \in A. a -> Maybe (\exists b \in B. b)' ?
12:19 <centril> ski: ok ill stop with the formal version and just write english :P
12:19 _sg joined
12:19 jophish joined
12:20 <ski> in the last, there needn't exist a `b' for any value in `a'. in the penultimate, `b' would have to exist regardless of whether you get `Nothing' or `Just (...)'
12:21 <* ski> isn't quite seeing where this is going, though ..
12:21 <ski> .. go on
12:21 <centril> ski: So I have an AST with some types {a1, a2, a3} in A - and an AST with other types {b1, b2, b3} in B - and then, I have a partial function going from a1 -> Maybe b1 , a2 -> Maybe b2, a3 -> Maybe b3, ...
12:21 <centril> (one of these are the root node type of course...)
12:21 carlosdagos joined
12:22 <centril> (in both A & B)
12:22 eliasr joined
12:22 <ski> are `a1',`a2',`a3' types .. or data constructors ?
12:22 <centril> ski: data types
12:23 sanett joined
12:23 JuanMiguel joined
12:24 bjz joined
12:24 Rizy joined
12:24 CurryWurst joined
12:26 <centril> Now - for every (almost) type `a` in `A`, for its corresponding type `b` in `B` there is a constructor that is not representable in `a` - so `b -> a` must also be partial... however, there is a function `a -> String` for every `a in A` which I'd also like to use for `b`, but I'd also like to "printTree" the constructor not in `a` ... but if I do `b -> Maybe a` , I can't do that because I've lost that
12:26 <centril> info...
12:27 <centril> so... can I reuse the code for "printTree" for A while injecting some code for the special constructor in B ?
12:27 <centril> by any means... like template haskell ?
12:27 <centril> ski: I think im done elaborating now :P
12:28 kittyP joined
12:28 <* ski> doesn't get the picture
12:29 <centril> ski: sec, I'll write some code so that you get it ;)
12:29 mettekou joined
12:30 Robin_Jadoul joined
12:30 lep_ joined
12:32 arawack joined
12:35 aydio joined
12:35 Aidan[m] joined
12:37 a3Dman joined
12:37 dhart joined
12:39 epsilonhalbe left
12:40 fabianhu joined
12:40 oisdk joined
12:41 jaspervdj joined
12:42 <lpaste_> Centril pasted “make-ski-get-the-picture” at http://lpaste.net/353671
12:42 <centril> ski: ^
12:42 jeltsch joined
12:42 acarrico joined
12:47 <centril> ski: perhaps if I case match on the b:s and then for BExpNotInA divert to a special logic, and otherwise convert and use printA ?
12:47 <ski> i suppose i would try factoring out the common parts
12:47 cyborg-one joined
12:47 <centril> ski: I have no control over A or the printA ;)
12:47 <ski> centril : hm, i think you need open recursion for that
12:48 Fendor joined
12:48 uncertainty joined
12:49 Fairy joined
12:49 <centril> ski: hmm... what if I do this for every b in B ?
12:49 eacameron joined
12:49 <ski> if you have e.g. `BPlus (BLit (BBool False)) BExpNotInA', if you just call `convB', it'll fail, so that you don't reuse the code in `printA' for `APlus',`ALit',`ABool'
12:50 <centril> right right
12:50 <centril> ski: what if I pass it a series of failure handlers for every level ?
12:51 nepiktaz joined
12:51 <ski> to apply open recursion, you'd need to have some control over `printA', in order to make it call back into your code for recursive calls, iiuc
12:51 initiumdoeslinux joined
12:51 <centril> ski: can't I just have control over convB and add failure handlers for the case of Left ?
12:52 CoconutCrab left
12:52 ziocroc joined
12:53 markus1189 joined
12:53 <ski> how will you reuse the code in `printA (APlus e0 e1) = "(" ++ printA e0 ++ " + " ++ printA e1 ++ ")"' (or whatever), for `BPlus' ?
12:54 <centril> oh right
12:54 <centril> crap
12:54 <ski> you need to get back control on the recursive calls (aka open recursion)
12:54 <centril> ski: can I still hack my way through this via meta programming ?
12:54 <ski> maybe, but i don't think it will be pretty
12:55 <centril> (where writing the template haskell doesnt take as long as rewriting printA to printB)
12:55 <centril> damn :/ this is most unfortunate
12:57 tromp joined
13:00 geekosaur joined
13:01 harfangk joined
13:02 Lord_of_Life joined
13:02 markus1189 joined
13:03 Rizy joined
13:05 raichoo joined
13:05 Jackneill joined
13:06 systadmin joined
13:07 markus1199 joined
13:08 plugin joined
13:08 ziocroc joined
13:12 xkapastel joined
13:17 moth joined
13:18 markus1189 joined
13:18 augur joined
13:20 takle joined
13:20 <Jinxit> trying this again: http://stackoverflow.com/questions/36978780/haskell-resolving-cyclical-module-dependency are there any other alternatives to the ones listed?
13:20 sanett joined
13:21 haskellnewb joined
13:21 markus1199 joined
13:22 meoblast001 joined
13:22 carlosdagos joined
13:22 t0by joined
13:22 tromp joined
13:25 harfangk joined
13:25 dawehner joined
13:27 bjz_ joined
13:27 Apocalisp joined
13:28 sidei joined
13:30 merijn joined
13:33 <Jinxit> cyclic module dependencies are absolutely killing my code to the point where i'm considering some sort of C-style #include
13:33 Jackneill joined
13:35 lukaramu_ joined
13:36 ahri joined
13:37 mmn80 joined
13:38 tromp joined
13:38 <joneshf-laptop> Jinxit, adding a type parameter isn't necessarily a bad thing.
13:38 <merijn> Jinxit: GHC supports recursive imports via hs-boot files
13:39 <merijn> Although I agree that it's unfortunate that it doesn't automatically do that, as required by the report
13:39 <joneshf-laptop> It's not a free solution, I'll give you that, but it's a fairly nice way to solve your problem.
13:39 <joneshf-laptop> And gives you some stuff.
13:40 <Jinxit> what are the benefits of adding (probably several in my case) type parameters to every type?
13:40 <joneshf-laptop> Also, depending on how you use the function, you could do something with an existential, so the type variable isn't known about.
13:40 <joneshf-laptop> But I think existentials are harder to work with.
13:41 <Jinxit> merijn: already broken one cycle with a hs-boot, i'd rather not go through that again
13:41 <Jinxit> i don't mean to sound entitled but if the code works as a single file but not spread out over multiple files it feels like a bizarre problem to have
13:41 egis joined
13:41 <joneshf-laptop> Jinxit, S11001001 does a much better job explaining it here than I could: https://youtu.be/BHjIl81HgfE
13:42 <Jinxit> can't look right now, but i'll watch it later, thanks
13:42 Darwin226 joined
13:42 <joneshf-laptop> Right, it is 40 minutes :)
13:42 <Jinxit> yeah
13:43 HoierM_ joined
13:43 srenatus[m] joined
13:43 gkaplan[m] joined
13:43 corintho[m] joined
13:43 hiq[m] joined
13:43 drasich[m] joined
13:43 NopeMarker[m] joined
13:43 Yves[m] joined
13:43 tfc[m] joined
13:43 M92854[m] joined
13:43 aspiwack[m] joined
13:43 M-schmittlauch joined
13:43 hendrik[m] joined
13:43 M-Illandan joined
13:43 M-berdario joined
13:43 magnap joined
13:43 chef_excellence[ joined
13:43 ProofTechnique[m joined
13:43 Guest91110[m] joined
13:43 zaphar_ps[m] joined
13:43 noraesae joined
13:43 sudoreboot[m] joined
13:43 rakete joined
13:43 jmnoz[m] joined
13:43 gentam[m] joined
13:44 miviotros[m] joined
13:44 M-Quora joined
13:44 monomon[m] joined
13:44 seequ_ joined
13:44 unclechu joined
13:44 curry[m] joined
13:44 elwan7[m] joined
13:44 foldu[m] joined
13:44 colton[m] joined
13:44 M-BostonEnginerd joined
13:44 karroffel joined
13:44 herzmeister[m] joined
13:44 m4lvin[m] joined
13:44 davidar joined
13:44 Naughtmare[m] joined
13:44 iffsid[m] joined
13:44 jacqueline[m] joined
13:44 jyp[m] joined
13:44 goodboy[m] joined
13:44 TheWizardTower joined
13:44 alaradia[m] joined
13:44 davidar_ joined
13:44 mmmrrr[m] joined
13:44 fizruk joined
13:44 roadrunner168[m] joined
13:44 bb010g joined
13:44 FederalRick[m] joined
13:44 wictory[m] joined
13:44 hakan[m] joined
13:44 closures999[m] joined
13:44 Soif[m] joined
13:44 M-krsiehl joined
13:44 cbHXBY1D[m] joined
13:44 bobjason[m] joined
13:44 TylerCecil[m] joined
13:44 unknownln joined
13:45 <Jinxit> as a last resort: is there any obvious downside to a C-style include to merge everything into one module?
13:47 <merijn> Jinxit: Your compile times will go to shit and you can't do partial recompilation (so you'll always rebuild everything)
13:48 <merijn> Jinxit: Also, GHCs memory usage will probably increase too
13:48 <Jinxit> hm ok
13:48 <merijn> So, functional downsides? Not really. Pragmatic ones? Yes.
13:50 meba joined
13:50 zcourts joined
13:51 zclod joined
13:52 zero_byte joined
13:54 meoblast001 joined
13:55 caumeslasal joined
13:56 <joneshf-laptop> Why is JWT so hard? I just want to decode a thing.
13:56 sanett joined
13:56 OnkelTem joined
13:56 <joneshf-laptop> well, and verify the signature.
13:57 gugah joined
13:58 <merijn> joneshf-laptop: What's JWT?
13:58 plugin joined
13:59 <joneshf-laptop> JSON Web Token
13:59 <joneshf-laptop> https://en.wikipedia.org/wiki/JSON_Web_Token
13:59 <merijn> ah, JSON, I'm already considering myself blissfully ignorant ;)
13:59 <joneshf-laptop> I'd never heard of it until about a month ago.
13:59 livingbeef joined
13:59 <joneshf-laptop> But apparently lots of programs use it.
14:00 govg joined
14:00 <joneshf-laptop> openid, google, amazon, etc
14:01 rekahsoft joined
14:01 Apocalisp joined
14:01 <joneshf-laptop> But each library seems to have something missing :(.
14:02 <merijn> joneshf-laptop: Story of my life
14:02 <merijn> joneshf-laptop: Time to patch the least sucky one to do what you need and submit a PR ;)
14:03 uncertainty joined
14:03 <joneshf-laptop> That's the problem, the things each is missing is cryptography stuff. And I don't feel anywhere confident enough to do that :(
14:03 Mon_Ouie joined
14:03 <joneshf-laptop> Sorry, I'm being too negative. You're right.
14:03 plugin joined
14:04 <* ski> . o O ( "100% and 80% solutions" by Olin Shivers in 1998-08 at <https://scsh.net/docu/post/sre.html> )
14:05 <merijn> ski: Well, if the 80% solution isn't awful you can incrementally approach 100% :)
14:05 <Tuplanolla> When I see that name I can only think of his famous preface, ski.
14:06 <merijn> It's why I try to submit patches/PRs for almost, but not quite, perfect tools. If everyone fixes little things we get awesome solutions :)
14:06 <ski> Shivers has also written some interesting papers
14:08 mohsen_ joined
14:08 eacameron joined
14:09 <ski> e.g. "Multi-return function call" (with David Fisher in 2006) at <http://www.ccs.neu.edu/home/shivers/citations.html#mrlc>, and "The anatomy of a loop: a story of scope and control" (in 2005) at <http://www.ccs.neu.edu/home/shivers/citations.html#mrlc>
14:12 mohsen_ joined
14:12 shesek joined
14:13 caumeslasal joined
14:14 eacameron joined
14:14 <mojjo> consider a list [1,5,7,3] . I'm interested in the distances of the items next to each other. Like: map abs [5 - 1, 7 - 5, 3 - 7] . What is a general approach for such things? I created a function 'part2' (http://pastebin.com/e9kBeHCp), which would produce [(1,5), (5,7), (7,3)] for the list and went on with this but maybe there's another path to go...
14:15 mmachenry joined
14:16 <lyxia> > [x - y | y : x : _ <- tails [1,5,7,3]]
14:16 <lambdabot> [4,2,-4]
14:16 <lyxia> mojjo: How about that
14:17 <Adluc> fmap (\(x,y) -> y-x) $ zip a (drop 1 a)
14:17 <Adluc> > a = [1,5,7,3]; fmap (\(x,y) -> y-x) $ zip a (drop 1 a)
14:18 <lambdabot> <hint>:1:3: error:
14:18 <lambdabot> parse error on input ‘=’
14:18 <lambdabot> Perhaps you need a 'let' in a 'do' block?
14:18 <Adluc> > let a = [1,5,7,3]; fmap (\(x,y) -> y-x) $ zip a (drop 1 a)
14:18 <lambdabot> <hint>:1:59: error:
14:18 <lambdabot> parse error (possibly incorrect indentation or mismatched brackets)
14:18 bjz joined
14:18 <ski> still missing `in'
14:18 <Adluc> > let a = [1,5,7,3] in fmap (\(x,y) -> y-x) $ zip a (drop 1 a)
14:18 <lambdabot> [4,2,-4]
14:18 <Adluc> ^_^ thx
14:19 nilof joined
14:20 <mojjo> yes, the two solutionsa ae certainly much better! thx
14:20 <ski> mojjo : .. how about your `Fractional' question ?
14:21 Darwin226 joined
14:22 <mojjo> oh, actaully very nice you are asking... Its indeed not solved yet... Alright, I'll provide some more details...
14:22 <Adluc> mojjo: zipWith (flip (-)) a (drop 1 a)
14:23 carlosdagos joined
14:24 <Darwin226> Adluc: Isn't this `zipWith (-) (dop 1 a) a`?
14:24 <mojjo> zipWith (-) (tail a) a
14:25 <ski> > zipWith (-) (tail []) []
14:25 <lambdabot> *Exception: Prelude.tail: empty list
14:25 <ski> > zipWith subtract [] (tail [])
14:25 <lambdabot> []
14:27 Ayey_ joined
14:28 <Adluc> well, yes :)
14:28 meoblast001 joined
14:29 sanett joined
14:30 suls joined
14:31 <joneshf-laptop> That's more a problme with `tail` than with the suggestion, right?
14:32 <joneshf-laptop> > zipWith subtract (drop 1 []) []
14:32 <lambdabot> []
14:33 <mojjo> ski: Thanks for asking. The Fractional issue is solved, I mixed it up with Floating. Writing the instance for the latter worked..
14:33 <joneshf-laptop> > let xs = [1, 5, 7, 3] in zipWith subtract (drop 1 xs) xs
14:33 <lambdabot> [-4,-2,4]
14:34 codesoup joined
14:35 pie___ joined
14:35 suls_ joined
14:35 <pie___> do you guys know any good haskell overview articles that you could show a physicist without a strong CS background?
14:36 gugah joined
14:36 <joneshf-laptop> pie___, what do you want your physicist to know?
14:37 geekosaur joined
14:37 <ski> mojjo : .. if you had provided more information when you originally hinted at the problem, possibly someone would have been able to provide more swift help
14:38 mettekou joined
14:38 {emptyset} joined
14:40 mettekou joined
14:41 connrs joined
14:41 govg joined
14:41 <customminer> Hey, I'm using turtle to query a program which returns json to which I'm trying to Parse with aeson, the problem is that shell and inshell write the output one line at a time instead of just returning the full json chunk.. Is there a better shell package than turtle for handling json data? Thanks :)
14:42 psychicist__ joined
14:42 <pie___> joneshf-laptop, whether he might want to use it i guess
14:42 <johnw> customminer: I would be highly surprised if turtle didn't give you a way to read all the input into a single lazy ByteString
14:42 eschnett joined
14:43 psychicist__ joined
14:44 Xanather joined
14:45 sanett joined
14:46 fizruk joined
14:47 <customminer> johnw: ok, I'll look into that, thanks.
14:48 <Redrield> I'm trying to configure a VSCode plugin that uses Intero, it uses 'stack ghci --with-ghc intero --no-build --no-load --ghci-options="-ignore-dot-ghci -Wall"' to spawn the Intero instance, and I'm getting this error when I try that https://hastebin.com/jelocikesu.tex
14:49 pie___ joined
14:50 meoblast001 joined
14:51 caumeslasal joined
14:51 FreeBirdLjj joined
14:52 nikita_is_person joined
14:52 pera joined
14:53 plugin joined
14:56 Marito joined
14:56 Marito left
14:59 sanett joined
15:01 oberstein joined
15:02 marr joined
15:04 oisdk joined
15:04 eacameron joined
15:07 <nitrix> http://lpaste.net/353672 - Anyone can help me resolve this ideally without bruteforce?
15:07 <nitrix> Even better if the solution is in Haskell.
15:08 govg joined
15:08 epsilonhalbe joined
15:08 <nitrix> Or explained with Haskell.
15:09 <nitrix> I can't figure out the algebra because of that alternating thing.
15:09 sanett joined
15:11 Dembel joined
15:12 oisdk joined
15:13 <nitrix> I can easily rephrase the problem of present it differentely if needed, as I'm its author.
15:14 Ayey_ joined
15:16 <lyxia> nitrix: there doesn't seem to be a unique solution
15:17 <lyxia> can't you just add one order of magnitude more beads at each round?
15:18 <nitrix> lyxia: So, my original attempt was to put one bead on one side, then I naively thought, let's keep adding 2 beads on each side, as there'll be one bead heavier and it'll rock back and forth.
15:18 MitchellSalad joined
15:18 markus1189 joined
15:18 <MitchellSalad> hello all, I have a codebase that is throwing deferred type errors, but I don't actually have them turned on... has anyone seen this before?
15:18 <nitrix> Until I quickly realised that at some point the fact that the heavy side gets multiplied by 3 and the light side by 4, it breaks.
15:18 <nitrix> So I need to add progressibely more beads.
15:19 <nitrix> lyxia: Order of magnitude?
15:19 eacameron joined
15:19 <lyxia> nitrix: are you trying to add as few beads as possible?
15:19 <nitrix> lyxia: Yeah
15:19 <lyxia> okay, nevermind what I said then
15:19 <nitrix> lyxia: The actual real application of this problem is for the stock market :P
15:20 <nitrix> I was tempted to put a bounty on it :3
15:20 <nitrix> I'm sure I can figure it out via brute-forcing but it doesn't feel right. I'd love to have a formula.
15:21 <lyxia> I don't even see why you need "brute-forcing" here
15:21 <lyxia> you have x > y beads on each side, you want to add z beads to y, such that 4x < 3(z+y) ?
15:22 takle joined
15:22 <nitrix> Correct.
15:23 <nitrix> But I'm interested in that sequence of Z's.
15:24 carlosdagos joined
15:24 <nitrix> Or at least, the value of Z at any given round R.
15:24 markus1199 joined
15:25 takle joined
15:25 <lyxia> by "brute-forcing" you mean computing the sequence one term after the other, as opposed to a magical formula that gives you Z at round n ?
15:26 <Jinxit> exactly how do i reify a Traversal in lens?
15:26 eacameron joined
15:26 <nitrix> lyxia: Yeah. As I'm a more skilled with programs than with maths :P
15:26 <nitrix> lyxia: But this once, a formula would be really awesome.
15:27 takle_ joined
15:27 <lyxia> nitrix: z is a linear combination of x and y, so there is in fact a more efficient algorithm for that
15:28 <nitrix> lyxia: Could that translate to a recursive function in Haskell or is there even better ways?
15:28 augur joined
15:28 takle joined
15:29 dongkey joined
15:29 sanett joined
15:29 <lyxia> it's going to be a pretty simple program yes. Let me take my pen and paper.
15:30 jdnavarro joined
15:30 ziocroc joined
15:30 <nitrix> Make sure you PM me your paypal too, for your time (:
15:30 <lyxia> nitrix: is z supposed to be an integer?
15:30 <nitrix> lyxia: Positive integer, yes.
15:30 xinming joined
15:31 <Jinxit> linear programming, no?
15:31 <nitrix> lyxia: So a natural number :)
15:32 <orion> Is it true that linear types = the value must be used at least once, and unique types = the value must be used at most once?
15:32 Dembel joined
15:32 <lyxia> nitrix: I might only get an approximation
15:32 <Jinxit> isn't linear at most once?
15:33 <nitrix> lyxia: I don't mind if it's not as optimal as the linear growth allows you.
15:33 <nitrix> lyxia: As long as 4x < 3 (z+y) is maintained.
15:33 <Redrield> Someone?
15:34 nomicflux joined
15:34 <lyxia> In the linear Haskell paper "linear" is "exactly once"
15:34 <nitrix> lyxia: "Somewhat optimal" as much as working with naturals allows you is pretty much what I'm after.
15:34 <c_wraith> Jinxit: affine is at most once, linear is exactly once
15:35 <nitrix> lyxia: Maybe you can use doubles and ceil the result?
15:35 <Jinxit> indeed
15:36 govg joined
15:37 taktoa joined
15:39 sword865 joined
15:40 awkure_ joined
15:41 <lyxia> nitrix: do you necessarily start from an empty scale
15:41 marsam joined
15:42 <nitrix> lyxia: Yus, which makes the first round pretty much always 1.
15:42 <nitrix> 4*0 < 3 * (1 + 0)
15:43 bollu joined
15:43 <nitrix> I quite confident the second round is also 2.
15:44 <AndreasK> Redrield: Sounds like an error with either a library or the setup, if you haven't already I would try to clean out your stack cache and set it up again to exlude the chance of some outdated file/lib messing up your setup.
15:44 <nitrix> 4*1 < 3*(2 + 0)
15:44 <AndreasK> Redrield: Or try with a newer lts version and see if it happens there as well
15:45 <lyxia> nitrix: it's <, not <=, right?
15:45 <nitrix> lyxia: It is, but does it affects the formula a lot or can it be changed later?
15:46 <nitrix> lyxia: It makes a difference between making a profit or breaking even in my case :P
15:46 <nitrix> Let's go with <
15:47 asmyers joined
15:47 metafoobar joined
15:47 doomlord joined
15:47 t7 joined
15:47 FjordPrefect joined
15:48 <pie___> so, if the haskell compiler is much "better" than say C compilers, why is it still relatively slower?
15:48 wtetzner joined
15:48 <pie___> i mean why are programs produced by it
15:48 <lyxia> nitrix: Using some general and flexible method I can have a pretty good upper-bound, I'm wondering whether you have a specific enough case such that using enough tricks lands you on an exact solution.
15:49 MissingNoIOI joined
15:50 plugin joined
15:50 peterbecich joined
15:50 <AndreasK> pie___: How do you define better when comparing compilers for different languages?
15:50 takle_ joined
15:51 <hpc> how do you compare?
15:51 <hpc> do you spend 6 months making a benchmark in C and another 6 months in haskell?
15:51 <hpc> or do you spend a day and a half on each
15:51 OnkelTem joined
15:51 <hpc> or do you spend exactly enough time to write something correct
15:51 <hpc> and then see how fast those are
15:52 <hpc> also what benchmarks do you pick
15:52 takle joined
15:52 sepp2k joined
15:52 <monochrom> I think pie___ means they read someone else wrote "better".
15:52 <hpc> ah
15:52 <monochrom> In which case why should I defend some anonymous author.
15:53 <pie___> :I im not saying youre wrong...
15:53 <pie___> in fact youre right
15:53 <pie___> i know its not a precisely defined comparison but if you want to write numeric code would it be fair to say haskell is inherently bad for that?
15:53 coot joined
15:53 <pie___> and that c is better
15:53 <c_wraith> Not really.
15:54 <monochrom> Fortran.
15:54 <pie___> :P
15:54 <c_wraith> Fortran is good for numerical code. C really isn't.
15:54 <monochrom> C is worse because its pointer features actually disable a lot of optimizations.
15:54 <lyxia> nitrix: at every step if x is the heavier side, at the next step the heavier side will be between 4x and 4x+3. So you get an exponential bound on the heavier side, and from that you can derive how much was added at every step.
15:54 <monochrom> (Of course, I mean "C is worse than Fortran" for this.)
15:55 <pie___> monochrom, ok so haskell is better than c for numerical code, so why is it slower? or is it not slower
15:55 <pie___> ok so c is worse than fortran.
15:55 <monochrom> Haskell's case depends on the programmer.
15:55 <c_wraith> Haskell can get pretty solid numerical performance, but you have to know a lot about what's going on.
15:56 <monochrom> GHC does its part, but the programmer needs to know how to trigger GHC into that.
15:56 urodna joined
15:56 <c_wraith> iirc, carter has been doing a lot of numerical work in Haskell
15:56 <pie___> haskell sounds disproportionately hard to optimize
15:56 <c_wraith> It's really not. It's just different
15:56 <pie___> ok
15:56 <carter> c_wraith: I'm slowly resuming it too :)
15:57 <carter> Get the math right first
15:57 psychicist__ joined
15:57 <carter> Then figure out stuff
15:57 sw1nn joined
15:57 <nitrix> lyxia: They are hedging positions (one buying, one selling). While a position is losing, the other position will be winning, the wins must outgrows the losses, so to achieve a profit, one side of the hedge is slightly bigger than the other. As the market reverses and the targets still aren't hit, it's possible that target B becomes more likely than A, so we increase the small hedge to make it the biggest
15:57 <nitrix> hedge, hoping it'll hit its target.
15:58 <nitrix> lyxia: It's not very easy to explain without all the pieces that makes it work in practice.
16:00 <metafoobar> nitrix,lyxia: can you give me some background on what you two are discussing? sounds very relevant to my interests
16:00 raycoll joined
16:00 <nitrix> lyxia: That's very helpful. I should be able to derive from the growth how much was added with a bit of thinkering.
16:00 <nitrix> lyxia: Can you PM me?
16:02 gawen joined
16:02 subtletee joined
16:03 bollu joined
16:03 <nitrix> metafoobar: lyxia has been helping me figure out the growth of positions for a strategy I've seen been used successfully used by some friends.
16:04 Noldorin joined
16:05 cschneid_ joined
16:05 alx741 joined
16:06 <nitrix> metafoobar: It's still in the early stages, but I'll definitely come back and thinker/share the results with you if you have an interest :)
16:07 cschneid_ joined
16:07 sw1nn joined
16:07 mada joined
16:08 mson joined
16:08 plugin joined
16:08 govg joined
16:08 halogenandtoast joined
16:09 raycoll joined
16:09 mizu_no_oto joined
16:10 <orion> 11:34:29 < lyxia> In the linear Haskell paper "linear" is "exactly once" -- link to paper?
16:11 <lyxia> http://www.microsoft.com/en-us/research/publication/retrofitting-linear-types/
16:11 <orion> thanks
16:11 ninedotnine joined
16:13 moongazer joined
16:14 Ayey_ joined
16:14 Khisanth joined
16:15 <Redrield> How can I clear the stack cache?
16:15 <Tuplanolla> The what now?
16:16 <Tuplanolla> Oh, Stack.
16:16 <Redrield> I was told to clear my stack cache and recompile intero, because at the moment it's crashing
16:17 <Tuplanolla> See if there's a `.stack-work` directory nearby.
16:19 theelous3 joined
16:20 bollu joined
16:21 wtetzner joined
16:22 <Tuplanolla> For a moment there I thought you were talking about processor cache eviction.
16:22 e14 joined
16:24 carlosdagos joined
16:25 <lyxia> nitrix: do you want a bound on the optimal strategy, or do you want one actual strategy? These are not quite equivalent.
16:25 raichoo joined
16:25 lp joined
16:26 ninedotnine left
16:26 pera joined
16:28 <Redrield> I'm so confused .-. https://hastebin.com/gijiviseji.pas
16:29 <johnw> Redrield: I can't even see your code on hastebin without disabling all of my ad blocking
16:29 <int-e> right, this is the age of blank pastebins. it saves me a lot of trouble ;-)
16:29 <johnw> and that's after letting through cookies, scripts, and XHR in uMatrix
16:30 <Redrield> https://gist.github.com/Redrield/0d9f601ddc79039d5098365327aeec40
16:30 <johnw> gone are the days when text was just text
16:30 <johnw> Redrield: thanks :)
16:30 connrs joined
16:30 <johnw> ah, I don't use stack, sorry
16:30 erisco joined
16:32 marcopullo joined
16:32 <jgt> is it possible to get Stack to build just a single file?
16:33 <jgt> i.e., without building a full on project
16:34 <jgt> like, `echo "main = putStrLn \"foo\"" > foo.hs; stack build foo.hs`?
16:34 spacedog82 joined
16:34 <jgt> obviously with the `module main where…`
16:36 zcourts joined
16:36 <djfo> jgt: stack ghc foo.hs
16:37 thunderrd_ joined
16:37 <jgt> djfo: beautiful. Thanks!
16:38 <jgt> I'm writing scripts to be run on a remote server, and I don't want to have to install Stack on the remote machine just to run the one-time scripts
16:38 govg joined
16:40 <jgt> and of course I don't want to do it in bash, because I know I will make a typo which will set everything on fire
16:41 eacameron joined
16:42 oisdk joined
16:43 cdg joined
16:43 <Jinxit> any lens veterans around? i can't seem to reify a traversal
16:44 {emptyset} joined
16:44 ragepandemic joined
16:45 <erisco> jgt, there is runhaskell
16:45 <Jinxit> do i just do "ReifiedTraversal' FromType ToType traversal"?
16:45 <jgt> erisco: what's the difference?
16:45 <glguy> Jinxit: No, what's the data constructor for ReifiedTraversal?
16:45 govg joined
16:46 <erisco> jgt, I don't know exactly, but I think runhaskell is interpreted similarly to ghci
16:46 <nitrix> lyxia: Sorry, had to deal with something. Optimal strategy if you're still interested.
16:46 <Jinxit> glguy: i don't know
16:47 <glguy> Jinxit: OK, type into GHCi: :info ReifiedTraversal
16:47 <erisco> someone told me it takes it to byte code, so whatever that means
16:47 <nitrix> lyxia: Err sorry, one actual strategy.
16:47 <nitrix> lyxia: The bound isn't too helpful.
16:48 nhandler1 joined
16:48 <nitrix> lyxia: The goal in the end is having a function that gives the `z` for any `n` somewhat deterministically.
16:49 jomg joined
16:49 <lyxia> nitrix: that's actually the part I'm having trouble with :/
16:50 <nitrix> lyxia: We're in the same boat :P
16:50 Hoier joined
16:50 <joneshf-laptop> Is there an easy way to go from an RSA public file to a `Crypto.JOSE.JWK`: https://www.stackage.org/haddock/lts-8.5/jose- ?
16:50 <joneshf-laptop> Everything I've tried has lead to pain.
16:50 cdg joined
16:50 albertus1 joined
16:50 <nitrix> lyxia: It must be doable, right? If one can brute-force every z to find the optimal strategy, isn't that a sign there must be a formula?
16:50 pinupgeek joined
16:51 meba joined
16:51 <joneshf-laptop> short of using another language entirely to convert the RSA public file into a JWK and saving it.
16:51 <lyxia> I don't think so
16:51 <nitrix> lyxia: Worst case, I can do my naive approach and just hardcode a large array of z's :/
16:51 marsam left
16:51 govg joined
16:51 <Jinxit> glguy: i think i got it, thanks
16:53 <Jinxit> yeah compiles now :)
16:55 bollu joined
16:59 govg joined
17:00 asmyers joined
17:01 ph88^ joined
17:02 <ph88^> hello
17:02 <ph88^> ski, are you around ?
17:03 fresheyeball joined
17:05 HarveyPwca joined
17:05 Ayey_ joined
17:05 m1911 joined
17:07 xplat joined
17:07 boombanana joined
17:09 Wizek_ joined
17:11 govg joined
17:13 aarvar joined
17:15 Dembel_ joined
17:17 takle joined
17:18 takle joined
17:19 xplat joined
17:20 lp joined
17:21 <* ski> looks at ph88^
17:23 <geekosaur> pie___, C is hard to optimize in the same ways if you are after ultimate speed; Fortran numeric programmers whine about it all the time
17:23 Noldorin joined
17:24 <pie___> guess we should learn from fortran haha ;)
17:24 <geekosaur> and don't get me started abut the few assembly language programmers left that complain about *all* compilers :)
17:24 Jeanne-Kamikaze joined
17:24 <pie___> lol
17:24 <pie___> the demoscene is crazy man
17:24 <pie___> intros are very rad
17:25 <geekosaur> each has its strong points and weak points; in each, there are easy optimizations and hard ones. Haskell makes a number of otherwise hard optimizations much easier --- but loses on some of the ones that are easier with non-pure languages
17:25 carlosdagos joined
17:26 <geekosaur> so the whole notion of comparing them is rather screwy and in many ways meaningless unless you can point to what exactly you are talking about, and sometimes even then
17:26 <pie___> id like to stick to haskell but i keep feeling ill probably end up needing to use matlab or something :P
17:26 <pie___> yeah i know/understand
17:26 e14 joined
17:26 govg joined
17:27 <geekosaur> matlab's actually another example. if it didn't exist you'd be working in APL, which is much faster but ... well, APL.
17:27 <geekosaur> (and neither one is amenable to most optimizations...)
17:27 <pie___> yeah lol
17:27 <pie___> well, one hopes.
17:30 xplat joined
17:32 fizbin joined
17:32 govg joined
17:33 eazar001 joined
17:33 RegEchse joined
17:33 <Jinxit> is it possible to join two traversals into one? does it even make sense to do it?
17:34 <Jinxit> in lens
17:36 <ph88^> ski, i have a bit of a problem getting the bigger pictures together. You were right earlier that the eot argument is not used yet, this is because i don't know what to do with it, but i put it there because Code piece 1 also has it as it's first argument
17:37 peterbecich joined
17:37 owiecc joined
17:37 <nitrix> @let findZ x y = head [z | z <- [1..], (4 * x) < (3 * (z + y))]; formula = unfoldr (\(x, y) -> let z = findZ x y in Just (z, (y+z,x))) (0, 0)
17:37 <lambdabot> Defined.
17:38 xplat joined
17:38 <nitrix> > take 10 formula -- lyxia
17:38 <lambdabot> [1,2,2,3,4,5,7,9,12,16]
17:38 <nitrix> :)
17:39 ph88 joined
17:39 oisdk joined
17:40 govg joined
17:40 <ph88^> ski, i figured i should strive to get the types right first before i should get the implementation right. I already have difficulties grasping what i'm expressing here on the type level, let alone the implementation of the function :(
17:40 Younder joined
17:40 <lyxia> findZ is just a div or something
17:41 <ski> ph88^ : i think probably you don't want that `eor' argument at all
17:41 <ski> s/eor/eot/
17:41 mettekou joined
17:41 <ph88^> ski, on line 6 there is a function that also expects eot as first argument, you see ?
17:41 <nitrix> lyxia: Myeah, or something. When your brain's off, lists comprehensions are awesome :P
17:42 <lyxia> nitrix: findZ x y = (4 * x - 3 * y + 2) `div` 3
17:42 <lyxia> oh wait you want <
17:42 <lyxia> nitrix: findZ x y = ((4 * x - 3 * y) `div` 3) + 1
17:43 <ph88^> ski, if i have eot as first argument i can do eotTerminal . toEot this is simular to the tutorial genericSerialize = eotSerialize 0 . toEot at url https://generics-eot.readthedocs.io/en/latest/tutorial.html that's why i think i need eot to be the first parameter
17:43 dfeuer joined
17:43 oberstein joined
17:43 <nitrix> lyxia: Nice. All I needed was accurate numbers. Beyond 20 elements, it already gets ridiculously big.
17:43 <ski> ph88^ : i was thinking the lens thing was replacing this function from `eot'
17:44 <nitrix> lyxia: Just the 13th element, which I think is 121, is 1.21 lot. That's 121k $.
17:44 <nitrix> lyxia: It's a lot of money :P
17:44 ziocroc joined
17:44 <ph88^> ski, that's what my initial idea was too, but it didn't quite typecheck .. ok let me go back to the previous version of this and come back to you
17:44 <nitrix> lyxia: Anyway, I'll play with that. Thanks for the help :)
17:45 <nitrix> lyxia: PM me your paypal btw.
17:46 govg joined
17:46 connrs joined
17:47 <nitrix> Get yourself a nice dinner or something (:
17:47 Rotaerk joined
17:49 ragepandemic joined
17:50 fizruk joined
17:51 meoblast001 joined
17:51 <* ski> disappears
17:52 <* lerax> is dead
17:53 <ph88^> ok bye ski :P
17:53 <nshepperd> Jinxit: you can compose traversals -- (.) :: Traversal' a b -> Traversal' s a -> Traversal' s b
17:53 <ph88^> i have to go soon too
17:53 <ph88^> i prepare my question for next time
17:53 <nshepperd> Jinxit: but maybe you're thinking of sequentially traversing the same thing? `Traversal' s a -> Traversal' s a -> Traversal' s a`?
17:53 oberstein joined
17:54 <nshepperd> but I dunno how much sense that makes
17:55 zcourts joined
17:57 eacameron joined
17:57 <nshepperd> I think the result would have a Monad constraint if it was sequential, which makes it not a Traversal
17:58 eschnett joined
17:58 <c_wraith> traverse implies a sequential ordering.
17:58 oisdk joined
18:00 ner0x652 joined
18:01 bollu joined
18:01 jsoo1 joined
18:02 sillyotter joined
18:03 mettekou joined
18:04 govg joined
18:05 carlosdagos joined
18:08 e14 joined
18:08 zeta left
18:10 dan_f joined
18:10 vydd joined
18:10 vydd joined
18:11 ertesx joined
18:11 OnkelTem joined
18:12 zcourts joined
18:12 govg joined
18:13 kazagistar joined
18:14 connrs joined
18:15 <fresheyeball> hey out there
18:15 <fresheyeball> anyone using ghcid?
18:16 haskellnewb joined
18:17 <cocreature> fresheyeball: I’ve used it in the past, why?
18:18 gpbaran joined
18:19 serendependy joined
18:19 Jeanne-Kamikaze joined
18:21 robertkennedy joined
18:21 govg joined
18:22 tag joined
18:23 augur joined
18:24 <Jinxit> nshepperd: yeah i meant in sequence
18:24 <Jinxit> (and sorted, too)
18:24 <Jinxit> but i guess i'll change my plans
18:24 Ayey_ joined
18:27 bollu joined
18:28 griverorz joined
18:28 govg joined
18:29 mstruebing joined
18:32 griverorz left
18:32 <pikajude> is there a library that transforms a NominalDiffTime into an English phrase
18:33 alx741 joined
18:34 Swizec joined
18:34 augur joined
18:34 oberstein joined
18:35 govg joined
18:37 dbmikus joined
18:39 BlueRavenGT joined
18:39 OnkelTem joined
18:40 osa1 joined
18:40 takle joined
18:42 ubsan_ joined
18:43 tearitdown joined
18:45 systemfault joined
18:45 eacameron joined
18:47 dpepsilon joined
18:47 dpepsilon joined
18:47 epsilonhalbe joined
18:50 govg joined
18:52 mizu_no_oto joined
18:55 __bluebell__ joined
18:55 andrei joined
18:55 <andrei> How does one read/write global variables in c2hs?
18:55 Glooomy joined
18:56 ego joined
18:57 govg joined
18:58 mohsen_ joined
19:00 Deide joined
19:03 Redrield left
19:04 mettekou joined
19:04 eacameron joined
19:05 ragepandemic joined
19:05 chenyu joined
19:06 oisdk joined
19:08 govg joined
19:08 lp joined
19:11 OnkelTem joined
19:12 alx741 joined
19:13 carlosdagos joined
19:16 oberstein joined
19:18 MP2E joined
19:19 chaosmasttter joined
19:21 takle joined
19:21 govg joined
19:22 coltfred joined
19:25 pacak joined
19:26 connrs joined
19:28 govg joined
19:29 caumeslasal joined
19:29 rishabhjain joined
19:29 mettekou joined
19:33 Frans-Willem joined
19:33 doodlehaus joined
19:34 cyborg-one joined
19:35 aarvar joined
19:35 novakboskov joined
19:36 Tene left
19:37 psychicist__ joined
19:37 takle joined
19:38 govg joined
19:40 lp joined
19:41 oisdk joined
19:43 wtetzner joined
19:44 mfukar joined
19:44 chaosmasttter joined
19:45 variable joined
19:46 takle joined
19:47 epsilonhalbe left
19:49 sidei joined
19:50 dawehner joined
19:51 govg joined
19:53 psychicist__ joined
19:57 dawehner joined
19:57 boombanana joined
19:58 <novakboskov> I have some problem understanding type synonyms instances overlapping. Is there anyone who is willing to clarify it? Code is basically from http://apfelmus.nfshost.com/articles/monoid-fingertree.html (Monoids - the grand unifier) and it is packed at http://lpaste.net/353688
19:59 Goplat joined
20:00 eacameron joined
20:01 owiecc joined
20:02 doomlord joined
20:02 aarvar joined
20:03 <geekosaur> novakboskov, type synonyms are exactly that. you cannot make separate instances for them.
20:03 <geekosaur> newtypes are for use when you need distinct instances.
20:04 dsh joined
20:04 <Tuplanolla> Despite its name `TypeSynonymInstances` doesn't change this either, novakboskov.
20:04 <geekosaur> (I suspect apfelmus forgot to convert the original `type`s to `newtype`s.)
20:05 JuanDaugherty joined
20:05 <geekosaur> looks like the post was cobbled together from various list posts, and that part of it fell through the cracks?
20:07 eacameron joined
20:10 govg joined
20:14 carlosdagos joined
20:15 lambdabot joined
20:15 lambdabot joined
20:16 <metafoobar> nitrix lythia: do you guys have a Git repo or something with the code that you're working on? I'd love to take a look. Of course, I understand if your code is not for the eyes of the lay public :)
20:16 louispan joined
20:19 govg joined
20:21 halogenandtoast joined
20:21 oisdk joined
20:23 meba joined
20:24 e14 joined
20:24 tswett_to_go joined
20:24 fosskers joined
20:26 mda1 joined
20:26 gpbaran joined
20:27 Younder joined
20:27 govg joined
20:30 lambdabot joined
20:31 deech joined
20:31 puregreen joined
20:32 twanvl joined
20:32 Guest__ joined
20:32 Glooomy joined
20:33 robertkennedy joined
20:33 theorbtwo joined
20:33 <deech> Hi all, I'm trying to profile a Haskell executable that statically links to a C library. `stack build` works but `stack build --library-profiling --executable-profiling` throws an error about not being able to find the C lib. Do I need to do something different when profiling?
20:33 Glooomy joined
20:33 <novakboskov> geekosaur, you think it should be something like http://lpaste.net/353690?
20:34 doodlehaus joined
20:34 Glooomy joined
20:35 Glooomy joined
20:35 <cocreature> deech: what’s the exact error you’re seeings
20:36 <cocreature> *seeing?
20:36 JagaJaga joined
20:36 <geekosaur> novakboskov, yes
20:36 Glooomy joined
20:36 tromp joined
20:36 <novakboskov> geekosaur: thanks!
20:36 <deech> cocreature: A linker error about not being able to find C lib.
20:36 <geekosaur> although I'd probably use record syntax in the newtypes rather than define accessors in where clauses; you will likely need them elsewhere as well
20:37 castlelore joined
20:37 <geekosaur> you might compare how the standard Sum and Product newtypes work
20:37 oisdk joined
20:37 conal joined
20:38 <geekosaur> deech, but which C lib?
20:38 ali_bush joined
20:40 mexisme2 joined
20:41 govg joined
20:44 gpbaran joined
20:44 descender joined
20:44 fotonzade joined
20:45 boxofdeath joined
20:46 animated joined
20:47 ltielen joined
20:47 <deech> geekosaur: It's one I built locally. It's my fltkhs package (https://hackage.haskell.org/package/fltkhs). It build the C bindings in their own static library and links to it when building the executables.
20:47 augur joined
20:47 systemfault joined
20:47 <geekosaur> so not a C profiling base library? although still hard to tell. really, we need to see verbose build output including the link command
20:48 <int-e> bollu: mmm
20:48 ali_bush joined
20:48 ali_bush joined
20:49 kritzcreek_ joined
20:50 tmtwd joined
20:52 chenyu joined
20:53 connrs joined
20:53 mmachenry joined
20:55 Fairy joined
20:56 FreeBirdLjj joined
20:56 dni joined
20:57 crobbins joined
20:58 FreeBird_ joined
21:01 govg joined
21:03 schjetne joined
21:04 <boxofdeath> whois bod)
21:04 <boxofdeath> omg
21:04 <boxofdeath> :(
21:05 buttons840 joined
21:06 <buttons840> can I have a type variable in a type alias?
21:06 cschneid_ joined
21:07 <geekosaur> yes
21:07 pacak joined
21:07 <buttons840> `type A = Maybe x` gives me an error because x is undefined?
21:07 <monochrom> Make it: type A x = Maybe x
21:08 <buttons840> ah, ty
21:08 <ertes> buttons840: example: type Maybe2 a = Maybe (Maybe a)
21:08 <ertes> buttons840: a type variable can't come out of nowhere… it must be bound, either by the alias itself or by a 'forall'
21:09 cschneid_ joined
21:09 joachifm joined
21:10 djfo left
21:15 carlosdagos joined
21:16 nomotif joined
21:18 <buttons840> ertes: right, I guess the extreamly wrong case would be `type A = x` -- which doesn't provide a lot of insight to the compiler
21:18 oisdk joined
21:19 ali_bush joined
21:19 ali_bush joined
21:19 Ayey_ joined
21:21 Lord_of_Life joined
21:22 marcopullo joined
21:26 <ertes> buttons840: a type alias is a type-level function, and the compiler doesn't know what you mean by "x" there
21:28 govg joined
21:28 Apocalisp joined
21:29 petervaro joined
21:30 Ayey_ joined
21:31 Apocalisp joined
21:33 JoshS joined
21:36 patbecich joined
21:36 Apocalisp joined
21:37 patbecich joined
21:40 ziocroc joined
21:41 <mofasa_> is there some better pattern to use than: `f inp = if isJust $ runParser p1 inp then runParser p1 inp else runParser p2 inp`
21:41 <monochrom> runParser p1 inp <|> runParser p2 inp
21:42 <monochrom> in fact, runParser (p1 <|> p2) inp
21:42 <mofasa_> monochrom: it's in the implementation for <|>
21:42 <monochrom> Then use my first line.
21:43 <mofasa_> ah yes, since it uses <|> of Maybe, right
21:44 govg joined
21:45 Guest__ joined
21:48 conal joined
21:49 lerax joined
21:49 ttoe joined
21:51 Lord_of_Life joined
21:52 hiratara joined
21:52 govg joined
21:53 novakboskov joined
21:54 buttons840 joined
21:54 fizbin joined
21:55 tripped joined
21:55 pango joined
21:55 Lord_of_Life joined
21:56 louispan joined
21:57 oisdk joined
21:57 eschnett joined
21:58 e14 joined
22:03 ubsan_ joined
22:03 <ttoe> Any insights as to why exhaustiveness check at compile time doesn't warn me here: http://lpaste.net/2307285877706981376
22:04 <glguy> ttoe: You can turn on the non-exhaustive patterns warning if you want it
22:04 fizbin joined
22:05 <ttoe> Oh, Ok I guess I expected not a warning, but that it won't compile to be accurate
22:05 tax joined
22:06 <glguy> You can use -Wincomplete-patterns
22:06 <dmwit> If you want an error, you can then also use -Werror.
22:07 <Tuplanolla> How is that different from `-fwarn-incomplete-patterns`, glguy?
22:07 govg joined
22:08 <dmwit> > (length "-Wincomplete-patterns", length "-fwarn-incomplete-patterns")
22:08 <lambdabot> (21,26)
22:08 Shatnerz joined
22:08 <dmwit> 20% shorter =)
22:08 <glguy> Tuplanolla: -fwarn-incomplete-patterns is old tech, not documented
22:08 <glguy> Mine is hip and new
22:08 <monochrom> heap and new are good friends.
22:09 Cassiopaya joined
22:09 <monochrom> until one day the heap becomes full.
22:09 tristanp joined
22:09 e14 joined
22:10 Apocalisp joined
22:10 burdges joined
22:11 fizbin joined
22:11 <ttoe> I have these ghc-options in the cabal file: -Wall -threaded -rtsopts -with-rtsopts=-N -Werror -Wincomplete-patterns
22:11 <ttoe> with all these flags i dont get anything
22:12 <ttoe> using stack
22:12 <glguy> ttoe: try cleaning and rebuilding
22:12 silver joined
22:13 yellowj joined
22:14 sz0 joined
22:15 minn joined
22:16 gpbaran joined
22:17 carlosdagos joined
22:17 <ttoe> glguy: I deleted .stack-work and still have no luck
22:18 <glguy> You'll have to show more of the file then
22:18 fizbin joined
22:19 mexisme joined
22:19 oisdk joined
22:20 <ttoe> http://lpaste.net/353692
22:20 <ttoe> thats all there is. Main.hs just calls gameLoop
22:22 <tswett_to_go> So, I'm trying to abuse Template Haskell.
22:22 because[m] joined
22:22 hololeap joined
22:22 <tswett_to_go> I mean, abuse is pretty much what it was made for, right? :)
22:22 <glguy> ttoe: and what warning were you expecting?
22:22 Prutheus joined
22:23 <ttoe> well, if line 40 is missing, there is no compile time warning/error about non exhaustiveness
22:23 meba joined
22:24 <glguy> line 40 wasn't missing in what you pasted
22:24 <tswett_to_go> I have some code that automatically creates a class.
22:24 <tswett_to_go> I'm... trying to figure out what I actually want here.
22:24 fizbin joined
22:24 <geekosaur> ttoe, the problem is that patterns in `do` desugar differently
22:25 govg joined
22:25 <ttoe> glguy: i know, but i deleted it for fun and it worked until i hit another key at runtime
22:25 <geekosaur> missing patterns call fail, instead of throwing; the compiler lets this go because it's a feature
22:25 <ttoe> glguy: then it crashed
22:25 <geekosaur> (it is, for example, how you filter in list comprehensions, which use the same machinery)
22:25 <geekosaur> (or the list monad)
22:25 <hololeap> i am looking for a monad transformer that encapsulates the idea of a choice being made from the context of another monad, and then behaving based on this choice
22:25 <glguy> ttoe: these warnings work, so if you've got something wrong you'll have to give us all the information you have or figure it out locally
22:26 pie_ joined
22:26 <glguy> things like the cabal file, command output, actual file you loaded
22:26 <geekosaur> I don't know if there's a separate warning for these
22:27 <hololeap> i tried making one with the data structure, `data Choice x m a = Choice (x -> m Bool) (x -> m a) (x -> m a)`, but i got stuck when trying to make the bind function for the Monad class.
22:27 <glguy> geekosaur: line 40 isn't do-notation pattern matching
22:28 <ttoe> Hm, strange, I'll fiddle around some more
22:28 lambda-11235 joined
22:29 <dmwit> hololeap: Eh, why a monad transformer? That's just a function.
22:29 <dmwit> :t \m l r -> m >>= \x -> if x then l else r
22:29 <lambdabot> Monad m => m Bool -> m b -> m b -> m b
22:29 coot joined
22:30 <hololeap> dmwit: i dunno, masochistic intellectual curiosity?
22:30 fizbin joined
22:30 <hololeap> i thought it was a good idea, but it turns out turning an idea into a working monad is hard
22:30 beanbagula joined
22:30 ragepandemic joined
22:31 <dmwit> :t if'
22:31 <lambdabot> error:
22:31 <lambdabot> • Variable not in scope: if'
22:31 <lambdabot> • Perhaps you meant ‘f'’ (imported from Debug.SimpleReflect)
22:31 <dmwit> ?hoogle ifM
22:31 <lambdabot> Control.Monad.Extra ifM :: Monad m => m Bool -> m a -> m a -> m a
22:31 <lambdabot> Extra ifM :: Monad m => m Bool -> m a -> m a -> m a
22:31 <lambdabot> Bool ifM :: Monad m => m Bool -> m a -> m a -> m a
22:31 <dmwit> heh
22:31 hiratara joined
22:31 <hololeap> dmwit: let me check that out
22:32 <tswett_to_go> I want to be able to write something like this: class MyThing a where { f :: a -> a; f_is_id :: $(call this parameter "x") a -> $(this represents a proof that f x = x) EqualityProof a }
22:32 <tswett_to_go> The resulting class would just be this stuff with the splices removed, but then other Template Haskell stuff would be able to go and look at the splices.
22:32 systadmin joined
22:33 <dmwit> Haskell doesn't really have value-level equality proofs. That requires dependent types. You can sometimes fake it with GADTs and singletons.
22:34 <jle`> is there any nice library for representing/reifying Num-polymorphic functoins
22:34 <jle`> probably osmething similar to simple-reflect but more constrained
22:34 <jle`> i mean at the easiest level you could just make a tree with Integer's as leaves
22:34 <dmwit> tswett_to_go: You're probably going to have a much easier time writing this in Idris and using its Haskell FFI if you need to interface with Haskell code.
22:34 <tswett_to_go> Right. I don't actually want value-level equality proofs anyway; I just want to mark something as representing an equality proof.
22:34 skeuomorf joined
22:35 <dmwit> jle`: I have wished for this occasionally as well. A `newtype` around `forall a. Num a => a` is almost it, even.
22:35 <jle`> well the reason i want one at the moment is for serialization purposes
22:36 <jle`> which miiiiight be a misguided reason
22:36 e14 joined
22:36 <jle`> but yeah i think i've seen a lot of libraries do their own newtype-over-RankN trick...i've done it myself a few times
22:36 <jle`> if there isn't one i'm just going to make it
22:36 <tswett_to_go> Here's a concrete question.
22:36 <dmwit> tswett_to_go: `data Decided a = Inequal a a | Equal a a` -- ?
22:37 <tswett_to_go> Is there shortcut syntax for this: $(transformClassSomehow [| class MyClass a where { class details omitted } |] )
22:38 <jle`> searhjcd for 'numeric' on hackage and browsed the 116 results and didn't see anything, so i'll just go and make one
22:38 IRCFrEAK joined
22:41 dan_f joined
22:41 <centril> how do you make associated types in type classes (open type family) injective ?
22:42 <* geekosaur> needs more sleep :(
22:42 fizbin joined
22:42 <centril> i.e: what is the syntax ?
22:43 <centril> I currently have: type Repr t :: *
22:43 lenec joined
22:44 <tswett_to_go> Does using "data" instead of "type" there do that?
22:45 <centril> tswett_to_go: that would create a data family iirc
22:45 <centril> I already have a data type
22:45 <pita> \quit
22:45 <centril> tswett_to_go: I could try it tho
22:46 <ttoe> glguy: Got it! Thanks! Had to add ghc-options to library settings as well \*_*/
22:46 <tswett_to_go> centril: are you trying to solve a "such-and-such is not injective" error caused by an ambiguity check?
22:46 <centril> tswett_to_go: yes
22:46 Apocalisp joined
22:46 Voldenet joined
22:46 Voldenet joined
22:46 louispan joined
22:47 <tswett_to_go> centril: I don't think there's a way to "make a type family injective", but adding a Proxy parameter should fix your problem.
22:47 falafel joined
22:47 <centril> tswett_to_go: umh... https://ghc.haskell.org/trac/ghc/wiki/InjectiveTypeFamilies
22:48 <tswett_to_go> Well... I guess I don't know what I'm talking about, then. :)
22:48 <tswett_to_go> I don't know much about type families, so I'll quit guessing.
22:48 <centril> :P
22:49 <centril> tswett_to_go: well, now you have some reading to do
22:49 <dmwit> centril: Doesn't the page you linked also answer your question?
22:49 <dmwit> section "Proposed syntax"
22:49 govg joined
22:50 yellowcab joined
22:50 <centril> dmwit: those are for explicit type families - i have a type class
22:50 fizbin joined
22:50 <dmwit> No, they work with associated types, too.
22:50 <dmwit> I have just tested this to be sure.
22:51 pacak joined
22:51 <centril> dmwit: right, but what is the syntax ?
22:51 <dmwit> Same syntax. `type Foo a = b | b -> a` or similar.
22:51 <centril> dmwit: thanks
22:52 <centril> dmwit: oh... so you specify it on the instance and not on the family itself (in the class) ?
22:52 <centril> seems weird
22:52 <dmwit> No, specify it in the class.
22:52 <dmwit> I want to help, but I honestly don't know what you're confused about.
22:52 <centril> dmwit: so type Foo a :: * | b -> a ?
22:52 <dmwit> ...no?
22:53 <dmwit> I typed the exact syntax above.
22:53 <centril> dmwit: sec
22:54 <nshepperd> centril: class Foo a where { type family Bar a = (bara :: *) | bara -> a }
22:54 <lpaste_> Centril pasted “injective associated types?” at http://lpaste.net/353695
22:54 <centril> nshepperd: oh, =) thanks
22:54 <dmwit> centril: `type Repr t = r | r -> t`...
22:55 <centril> dmwit: now i got it ^^
22:55 <centril> i was wondering where the b magically came from
22:55 <centril> confusing syntax :/
22:55 <nshepperd> huh, i didn't know you could leave off the 'family'
22:55 <dmwit> It magically comes from you. =)
22:55 <centril> dmwit: ^^
22:55 <centril> dmwit: I do believe in magic
22:56 <dmwit> I think it's just shorter and less redundant than making the syntax be `type Repr t | (Repr t) -> t`
22:57 <lenec> Hello, I'm a complete functional programming noob, but I'm very intrigued by the paradigm... there are a lot of things I don't understand, but the most prevalent one is that I can't see how functional programming scales properly.
22:57 <lenec> http://www.codenewbie.org/blogs/object-oriented-programming-vs-functional-programming
22:57 <Tuplanolla> Scale wrt what?
22:57 <centril> dmwit: yes, but the = symbol makes me believe I have to provide the type on the RHS from somewhere else
22:57 <lenec> gives an example case about raising salaries of employees.
22:57 <lenec> When I scale this example (by raising the salaries multiple times) in the OOP paradigm, it works really well. the complexity of the program doesn't increase as the amount of salary raises increases, but in the functional programming paradigm...?
22:57 dan_f joined
22:57 <lenec> Would I end up with evenhappiereemmployees, evenmorehappieremployees, incrediblyhappieremployees... and so on? :S
22:58 <lenec> This increase of complexity doesn't make any sense to me. Everywhere I read about functional programming, it is claimed that functional programming can do everything OOP can do, but just in a different way.
22:58 <lenec> But if that means it will be at the cost of scalability, wouldn't that make the paradigm pointless? :S
22:58 <centril> lenec: any two turing equivalent languages can do what the other can, in principle
22:59 <dmwit> centril: I hate that argument. It completely ends any (useful) discussion about whether one language can be better than another.
22:59 <dmwit> We don't program in Brainfuck, thank ${DEITY}.
22:59 <dmwit> lenec: What does "scalability" mean to you?
22:59 <centril> dmwit: well, it's an important statement - not an argument... I don't believe that all languages are equal... quite the opposite actually
22:59 Apocalisp joined
22:59 <Tuplanolla> I know some people make a living by programming in `printf` format strings, dmwit.
23:00 <ertes> lenec: if you're trying to *translate* OOP into FP, you will end up in an unhappy place
23:00 <dmwit> lenec: Presumably you are not writing code with a long list of hand-written rules about which employees get raises; this is input from elsewhere, right? So... you would use all the same techniques for parsing and iterating over that information in FP as you would in OOP.
23:00 fizbin joined
23:00 e14_ joined
23:00 <centril> dmwit: for example: I loathe golang a lot
23:00 doodlehaus joined
23:01 <lenec> dmwit that when I increase the amount of salary raises I don't end up with extra (complexity adding) functions like evenhappieremployees etc.
23:01 <centril> ertes: until you start using lenses
23:01 <ertes> lenec: in FP problems are solved very differently, and in fact more so in *haskell FP*
23:01 <bartavelle> lenec, if all your employees are using haskell, they *will* end up even happier
23:01 <dmwit> lenec: You want more employees' salaries to change without writing more code? That seems unlikely for any language.
23:01 Welkin joined
23:01 <bartavelle> no way to avoid that
23:01 <bartavelle> use OOP to get sad employees
23:02 <bartavelle> :p
23:02 <ertes> lenec: that means using different ways to structure your code altogether, and different abstractions
23:02 <centril> lenec: what is your OOP language of choice ?
23:02 <Welkin> OOPs
23:02 <Welkin> centril: erlang?
23:02 <centril> Welkin: wat? erlang is OOP now ?
23:02 mmn80 joined
23:03 <Welkin> it's off topic, but erlang is closer to the idea of message passing from smalltalk (oop) than jav oop
23:03 <Welkin> java oop*
23:03 <Welkin> there is an alan kay talk about it
23:03 <Welkin> (the inventor of oop)
23:04 <centril> Welkin: well... java oop is just C++ oop but restricted... c++ oop in turn is just making the receiver (self/this) implict and adding fancy syntax for it
23:04 <Welkin> java took the idea and twisted it into something horrible
23:04 <centril> if erlang is OOP, then so is haskell
23:04 <Welkin> it was a joke centril
23:05 <centril> in fact, ill start calling haskell OOP from now on
23:05 <centril> Welkin: oh :P
23:05 <Welkin> we all know oop as java-oop these days, which erlang is certainly not
23:05 <centril> Welkin: wasnt clear ^^
23:05 <Welkin> erlang is very different from haskell though
23:05 <Welkin> so even your logic wouldn't make sense
23:05 <lenec> I don't mind writing more code... but calling employee1.RaiseSalary(50); employee1.RaiseSalary(150); employee1.RaiseSalary(30);... etc. in succession doesn't create new functions with weird names like incrediblyhappieremloyeesthatareevenhappierthanhappyemployees
23:05 fizbin joined
23:05 <lenec> I hope we can all agree that such a function would be retarded
23:06 <Tuplanolla> Your understanding of different paradigms seems to be seriously misguided, lenec.
23:06 <Welkin> lenec: zipWith raiseSalary [employee1, employee1, ...] [50, 150, ...]
23:06 <dmj`> lenec: When you say “scale” do you mean that you’ll have to write more functions to change behavior? Like saying, “addOne”, but now I have to define “addTwo = addOne . addOne”. If you begin writing a fair bit of haskell code, I think you’ll see your capability for expression is far greater than anything OOP can afford, and safer.
23:06 <lenec> and as I understand it right now... functional programming will force me to create such functions
23:06 <dmwit> lenec: writing `raiseSalary 50 . raiseSalary 150 . raiseSalary 30 $ employee1` also does not create new values with weird names. (Here `.` is function composition.)
23:06 <centril> lenec: OK, so OOP is: subject.verb(objects...) - fp is: verb(subject, objects...)
23:06 <dmwit> lenec: Indeed, writing a function doesn't create any new names at all. Only declarations can do that.
23:06 <Welkin> functions are first class
23:06 <Chousuke> FP vs. OOP is not about methods in my view, anyway.
23:06 <Welkin> they can be top level
23:06 <ertes> lenec: i'm reading the article, and the author doesn't really seem to understand what FP is… even though the term FP itself is rather vague, there are some things that are clearly *not* FP
23:07 <Welkin> they are not ocntained inside functions (not "methods")
23:07 <Welkin> contained*
23:07 <ertes> "FP prefers to keep data in plain arrays and/or hashes and not “complicate” data by mixing it with behavior."
23:07 <Welkin> lol, FP is an unknown term
23:07 <ertes> the latter part is true, but the former is nonsense
23:07 <centril> ertes: speaking of... what is "FP"?
23:07 <Welkin> it means something different to everyone
23:07 <ertes> centril: "what we do in haskell"
23:07 <Welkin> even FRP is a disaster
23:07 <centril> Welkin: yeah
23:07 <yushyin> Welkin: I always thought, is he really the inventor of oop? simula 67 is older and also had all those OOP features
23:07 <Welkin> "look at this FRP library in js" "Oh yeah, React is FRP"
23:07 <centril> ertes: oh, well maybe in this context
23:07 <Welkin> which it's not...
23:08 <Chousuke> to me, the important characteristic of functional programming is that you're thinking in terms of data transformations and function composition
23:08 <Welkin> map and filter do not make a functional language :P
23:08 emmanuel_erc joined
23:08 <ertes> @let data Employee a = Employee { _name :: String, _salary :: a } deriving (Eq, Foldable, Functor, Ord, Show, Traversable)
23:08 <lambdabot> .L.hs:145:1: error:
23:08 <lambdabot> • The default type ‘()’ is not an instance of ‘Num’
23:08 <lambdabot> • When checking the types in a default declaration
23:08 <ertes> what?
23:09 <centril> Chousuke: that seems to be what most people do - but... doesnt really come out of lambda calculus per se...
23:09 <bartavelle> lenec, foldl' raiseSalary employee1 [50,150,30] -- see, it scales even better than "OOP", seriously this argument doesn't make much sense
23:09 eacameron joined
23:09 <ertes> @undef
23:09 <lambdabot> Undefined.
23:09 <ertes> @let data Employee a = Employee { _name :: String, _salary :: a } deriving (Eq, Foldable, Functor, Ord, Show, Traversable)
23:09 <lambdabot> .L.hs:145:1: error:
23:09 <lambdabot> • The default type ‘()’ is not an instance of ‘Num’
23:09 <lambdabot> • When checking the types in a default declaration
23:09 <dmwit> lenec: Here is an analogue of your complaint for OOP. Hopefully you can see why I find it an unconvincing reason to avoid OOP: "Currently it looks if you have a different collection of employees who should each get a raise, you have to write different procedures for each collection. Like you have to write raiseBob() { bob.raise(); } and raiseBobAndAlan() { bob.raise(); alan.raise(); }. That doesn't seem like it scales."
23:09 <Welkin> for me, the minimum is: immutable data, referential transparency, strong static typing
23:09 <ertes> am i stupid?
23:09 <geekosaur> uhhh
23:09 <dmwit> lenec: While for an example it might be useful to name these two procedures, in any real application you would never do that.
23:09 <Welkin> you could easily add: all functions are curried
23:09 <geekosaur> somehow ExtendedDefaultRules got turned off?
23:10 <Tuplanolla> Why would ertes need such a thing there, geekosaur?
23:10 <lenec> so basically the article was misguiding?
23:10 <geekosaur> or only partially turned off. I have to guess this is someone tweaking Pristine.hs
23:10 <ertes> @let data V2 a = V2 !a !a deriving (Foldable, Functor)
23:10 <lambdabot> .L.hs:145:1: error:
23:10 <lambdabot> • The default type ‘()’ is not an instance of ‘Num’
23:10 <lambdabot> • When checking the types in a default declaration
23:10 <centril> Welkin: those are nice things to have, but... it's by no means "FP"... especially the last one about static typing
23:10 <ertes> yeah, something is wrong with lambdabot
23:10 <ertes> int-e: ^
23:10 <dmwit> lenec: I don't know. I didn't read it carefully. But I certainly think you took the wrong lesson from it.
23:11 <Welkin> centril: forgot first-class functions
23:11 <Chousuke> data goes in, transformed data comes out. easier with static typing and immutable data, but not impossible without :P
23:11 <Welkin> all the best fp languages are typed
23:11 <centril> Welkin: well, without that one, it's not FP
23:11 <geekosaur> or someone in /msg doing their own thing and not paying attention to the fact that L.hs global across all lambdabot "sessions"
23:11 mdarse joined
23:11 <ertes> lenec: there is a misconception that FP is about not coupling data with functions… while that is part of it, it's a small and rather uninteresting part
23:12 <ertes> lenec: the idea is to use functions to abstract
23:12 <lenec> the solution in the article was... I need to raise the salary of employees, so I'm going to make a new function called happieremployees... if I would repeat that I would end up with "weird" function names
23:12 <ertes> lenec: and abstract over functions
23:12 pacak joined
23:12 <Chousuke> lenec: you wouldn't make new functions, though.
23:12 <Chousuke> or rather, you would, but you wouldn't name them
23:12 <dmwit> lenec: I don't believe whatever was called `happieremployees` was a function.
23:12 <centril> Welkin: minimum: first-class functions - you don't have to have ref transparency locally... just in your exports, or all hell will break loose
23:13 <centril> lenec: start here instead... http://learnyouahaskell.com/chapters
23:13 <Welkin> centril: the only language that is referentially transparent is haskell and other haskell-like languages
23:13 <lenec> dmwit everything in functional programming is a function right? :S
23:13 <Welkin> lenec: no
23:13 <Welkin> lenec: functions and values
23:13 <dmwit> lenec: No. Definitely not.
23:13 <ertes> lenec: every function is a value, but not every value is a function
23:13 <Rembane> And type classes, and data types and ...
23:14 <centril> Welkin: unsafePerformIO (blowUpHouse) :: () <-- pretend like nothing is wrong
23:14 <lenec> ohw than I'm fundamentally not understanding the subject
23:14 Jeanne-Kamikaze joined
23:14 <lenec> then*
23:14 <Welkin> centril: it's called `unsafe` for a reason
23:14 <Welkin> that is not the default
23:14 <ertes> lenec: example: haskell has a functional exception mechanism… 'catch' is not a language construct, but a regular function… now you can create your own abstraction for safely dealing with creating and cleaning up resources (e.g. file handles)
23:14 <centril> Welkin: yes, but it is a counterexample to the conjecture that haskell is referentially transparent
23:15 <Welkin> centril: but it is
23:15 <centril> Welkin: haskell is mostly ref transparent... but FFI makes it not so
23:15 <lenec> although that doesn't matter for the point I was trying to make... function or not... the article's solution was come up with a new name to raise the salary
23:15 <ertes> lenec: 'bracket' is a function that takes a resource creation action, a resource cleanup function and a resource user function
23:15 <lenec> btw the solution you guys gave me makes a lot more sense to me than the one in the article
23:15 <Welkin> centril: one exception that is not the defauolt way of using the language doesn't mean it is not
23:15 <ertes> lenec: then based on that you can write something like 'withFile' that takes a file path, opening mode and a user function for the handle… and it will guarantee that the handle is cleaned up timely
23:15 <dmwit> Welkin: ...yes it does
23:16 <ertes> :t withFile
23:16 <lambdabot> error:
23:16 <lambdabot> • Variable not in scope: withFile
23:16 <lambdabot> • Perhaps you meant one of these:
23:16 <ertes> :t System.IO.withFile
23:16 <lambdabot> FilePath -> GHC.IO.IOMode.IOMode -> (GHC.IO.Handle.Types.Handle -> IO r) -> IO r
23:16 <ertes> lenec: this is a good albeit basic example of FP
23:16 <Welkin> so haskell is not referentially transparent, and javascript is not referentially transparent by your logic
23:16 <dmwit> correct
23:16 <Welkin> so haskell is the same as javascript in that regard, right? But that is totally wrong
23:16 <centril> Welkin: it does... if I for example claim to have a language that is consistent as a logic, and I can, in one tiny place prove that bottom is inhabited... then my whole language is not consistent as a logic
23:16 <dmwit> no
23:17 <dmwit> "Haskell is the same as Javascript in regards to referential transparency" does not follow from "Haskell is not referentially transparent" and "Javascript is not referentially transparent".
23:17 <Welkin> centril: but we are not writing a proof about it here
23:17 <centril> dmwit: indeed
23:17 <Welkin> we are talking about how to categorize
23:17 <centril> Welkin: haskell is __mostly__ referentially transparent ... at least good haskell
23:17 <Welkin> no need to be pedantic
23:18 carlosdagos joined
23:18 <centril> Welkin: you call it pedantic, I call it being clear and exact ;)
23:18 <Welkin> language is not clear and exact though
23:18 <ertes> what does "referentially transparent" or "pure" mean? to me it means that you can use equational reasoning safely
23:18 <Welkin> language is not math or logic
23:18 fizbin joined
23:19 <ertes> in haskell equations exist and the basic laws of equations are supposed to hold… if they don't hold for your library, i would consider that a bug
23:19 <centril> Welkin: https://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspondence
23:19 <ertes> (and they can only fail to hold, if you use certain functions that are clearly marked as "unsafe")
23:19 <centril> still, there is: https://pdfs.semanticscholar.org/a316/3d9097a87a713f0dd3f154f139e19dcb2a82.pdf
23:19 <centril> (Fast and Loose Reasoning is Morally Correct)
23:20 <ertes> in JS equations don't really exist, and it's very difficult to come up with such a notion that satisfies the basic equation laws
23:20 <centril> ertes: well... unless you prove bottom by recursion and whatnot... and without using anything marked as "unsafe"
23:21 <ertes> centril: no, haskell is still not a consistent logic
23:21 <centril> ertes: i know =)
23:21 <ertes> but it has equations, and you can use equational reasoning
23:21 <ertes> stuff like transitivity hold
23:21 <centril> ertes: I buy this argument, sorta...
23:22 <centril> ertes: I'd say: for all intents and purposes, haskell is ref transparent
23:22 <Welkin> lol
23:22 <Welkin> you changed your mind
23:22 <ertes> that doesn't really mean anything ;)
23:22 <Welkin> being absolutionist is not helpful here
23:22 <Welkin> this is not a math or logic debate
23:22 <centril> Welkin: no - I qualified my statement ;)
23:22 <Welkin> it's a casual discussion about how to categorize things
23:22 <centril> Welkin: ok, then I agree
23:22 marcopullo joined
23:23 <ertes> BTW, being a consistent logic comes at a high price… not sure if i'd be willing to pay it… for the purpose of practical software development i believe it should be optional
23:23 t0ry joined
23:23 <Welkin> at least from a programmers perspective, it makes no difference
23:23 <Welkin> they just want some guarantees so they can do their work easier
23:24 <ertes> if you want to know what i'm talking about try to write haskell's 'forever' function in agda
23:24 <centril> ertes: well, you can modularize your language like Rust does with the unsafe { .. } stuff
23:24 <centril> ertes: Agda is not a general purpose programming langauge
23:24 <centril> ertes: being able to be consistent as a logic in some parts, and not in others would be useful
23:25 <ertes> centril: it's not? why not?
23:25 dfeuer joined
23:25 <centril> ertes: it's not used that way... noone runs agda programs, you type check them, and that's it
23:26 <ertes> that's not really relevant, is it?
23:26 <dolio> People have written web applications in Agda, I think.
23:26 <centril> dolio: poor souls :P
23:26 <ertes> yeah, there was a really basic web framework for agda… it's called lemmachine
23:26 praduca joined
23:27 <centril> well, you can make even agda not consistent as a logic
23:27 <ertes> and there is even an FRP framework using linear temporal logic
23:27 <dmwit> That is a great name, but nothing about it screams "web framework" to me. =P
23:27 fizbin1 joined
23:27 <ertes> yeah =)
23:27 <centril> a great name indeed
23:27 <centril> damn... i need to quit this discussion... im supposed to write a bachelor theis n stuff
23:28 <centril> taking up too much time :P
23:28 <ertes> dmwit: well, does "scotty" or indeed "spock"? ;)
23:28 <ertes> those remind me more of terrible technobabble and a certain womanizer =)
23:28 <dmwit> ertes: agreed, they don't either =)
23:29 <Welkin> lol
23:29 <Welkin> scotty = sinatra + warp
23:29 <Welkin> :P
23:29 <Welkin> and spock continues the star trek theme
23:29 <erisco> is there a documentation page to explain all these jokes?
23:29 <Welkin> in the scotty docs
23:29 <dmwit> Was Scotty a singer? I can't think of many Star Trek singers. The EMH, maybe.
23:30 <Welkin> it literally says that
23:30 cschneid_ joined
23:30 <ertes> erisco: you're not a trekkie i take it
23:30 <erisco> not to the extent that I could string that relation together
23:31 lp joined
23:31 Jesin joined
23:31 t0ry left
23:32 <lenec> I think I understand FP a tiny little bit better now, thanks :)
23:32 oisdk joined
23:32 <Welkin> lenec: have you read Richard Bird's sudoku solver?
23:32 <Welkin> it shows the concept of function pipeline and piece-meal programming
23:33 <ertes> since i haven't watched the original series i wouldn't really know most of those names either, if it weren't for a hilarious DS9 episode about tribbles =)
23:33 ragepandemic joined
23:33 <Welkin> scotty and spock are main characters o.o
23:33 <Welkin> "beam me up, scotty!"
23:33 systadmin joined
23:34 <erisco> in my nightmares I open a hatch and am buried by thousands of dead tribbles
23:34 <Welkin> wtf is a tribble
23:34 <lenec> Welkin thanks for the tip... I'll go read that now :)
23:34 <ertes> lenec: unfortunately noone can be told what FP is… you have to… you know… learn haskell =)
23:34 <int-e> @let data V2 a = V2 !a !a deriving (Foldable, Functor)
23:34 <lambdabot> Defined.
23:34 <ertes> int-e: thanks
23:34 <int-e> some ghc 8.0.2 change...
23:35 <ertes> BTW, is TH enabled?
23:35 <int-e> no, of course not
23:35 <ertes> i thought so =)
23:35 <dmwit> lenec: Simon Peyton-Jones' paper on designing a DSL for financial contracts changed my life.
23:35 <ertes> @let data Employee a = Employee { _name :: String, _salary :: a } deriving (Eq, Foldable, Functor, Ord, Show, Traversable)
23:35 <lambdabot> Defined.
23:35 louispan joined
23:35 <dmwit> lenec: It's very approachable for a non-Haskeller.
23:36 <int-e> (TH allows arbitrary IO)
23:36 benl23 joined
23:36 <ertes> > map (traverse +~ 10000) [Employee "alice" 5000, Employee "bob" 400]
23:36 <lambdabot> [Employee {_name = "alice", _salary = 15000},Employee {_name = "bob", _salar...
23:36 <int-e> (at compile time)
23:37 tromp joined
23:37 <ertes> lenec: ^ that's an example of quite a few haskell/FP concepts coming together in order to get a nice abstraction for deep data access (lenses and traversals)
23:38 <erisco> oh, lens, what a simple topic to start with
23:38 <Welkin> lol
23:38 <Welkin> I still haven't really used lens
23:38 <dmwit> lenec: https://www.microsoft.com/en-us/research/publication/composing-contracts-an-adventure-in-financial-engineering/ in case you have trouble finding it from my keywords =P
23:39 <lenec> I was tempted to switch to Scala, but I like the syntax of Haskell more and now I met this community I'm sure I'll stick with Haskell. You guys seem like a very welcoming community :)
23:39 <ertes> lenec: and no, i don't expect you to understand this code right now… it's just a small demo for the potential =)
23:39 <Welkin> lenec: I tried scala once, and it was painful
23:39 <Welkin> lenec: scala is nothing like haskell at all; it is java with a few nice features
23:40 fizbin joined
23:41 robkennedy joined
23:44 zxtx joined
23:45 anuxivm joined
23:45 tristanp joined
23:46 Ayey_ joined
23:47 conal joined
23:47 strykerkkd joined
23:47 cpup joined
23:47 <ogkloo> I feel like, for me at least, I'm bad at Scala because I'm bad at Java
23:48 gpbaran joined
23:48 acarrico joined
23:48 fizbin joined
23:49 <centril> lenec: if you are looking for something "in-between" OOP and FP, there is always Rust. Rust is a systems programming language with a lot of borrowed stuff from haskell: https://www.rust-lang.org/en-US/
23:49 <Tuplanolla> He's gone, centril.
23:49 zgrepc joined
23:50 <centril> Tuplanolla: i noticed
23:50 <centril> :(
23:50 <centril> but the comment applies to everyone tho
23:50 mexisme2 joined
23:50 <centril> rust is nice
23:50 parsnip joined
23:50 <Tuplanolla> Maybe one day I can get over the horrible syntax.
23:51 <centril> Tuplanolla: yes, the syntax could be more haskell-like
23:51 <centril> but it's too late for that methinks
23:51 <parsnip> if you have json with varying number of fields, what is best approach in haskell?
23:53 fizbin joined
23:53 Rodya_ joined
23:53 <brynedwards> lens-aeson? Depends on what else you're doing
23:55 <Welkin> parsnip: you can parse it however you want in your FromJSON instance
23:55 <Welkin> wrap the optional field in Maybe
23:56 <parsnip> so still use record type and aeson?
23:56 <centril> Tuplanolla: for example: specifying signatures separate from argument names like in haskell would be nice
23:56 <Welkin> parsnip: of course
23:56 <parsnip> thank you
23:56 eacameron joined
23:58 bennofs joined
23:58 Rizy joined
23:58 fizbin joined