<    April 2017    >
Su Mo Tu We Th Fr Sa  
 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  
00:00 bydo joined
00:00 <unyu> Data.List should totally have a function “sortDesc = sortBy (flip compare)”.
00:00 atk joined
00:00 <unyu> I can't imagine being the only one who needs it.
00:01 <sophiag> ugh, anyone want to give me some advice on refactoring some complicated data types?
00:01 <MarcelineVQ> monochrom: I saw that the other day when trying to figure out what MonadRandom did for IO :>
00:02 <ezyang> what kin dof advice
00:02 skeuomorf joined
00:04 systemfault joined
00:04 <sophiag> ezyang: well the types i've defined have made it too complicated for me to debug the last remaining bit so i have to think there's a better way to do this. i tried simplifying it a bit, but just traded one operational issue for another with less type safety
00:05 <sophiag> like i considered using lenses, but it really has nothing to do with nesting
00:06 <sophiag> i'm not sure where to go from here other than that it's getting exponentially more difficult to fix the remaining code
00:07 <ezyang> what kind of invariants are you enforcing with types
00:09 <sophiag> i have two records the each have fields that store multiple types, hence created ADTs for both. however, it's become increasingly difficult coercing them to interact to the point i have each ADT wrapping one another and both recursively wrapping themselves
00:10 <ezyang> so... they are interchangeable in some sense?
00:10 <sophiag> what is "they"?
00:10 <ezyang> the two records
00:10 augur joined
00:11 <ezyang> you talked about coercing
00:11 <sophiag> if they were interechangable i would not have two of them
00:11 <sophiag> so no
00:11 bhiliyam joined
00:12 <ezyang> what are the problems when they interact?
00:12 <sophiag> they're of different types...
00:12 <ezyang> is the problem that they form a cyclic graph and you want to update this graph?
00:12 augur joined
00:12 <sophiag> no
00:12 e14 joined
00:13 <ezyang> "they're of different types" elaborate?
00:13 <sophiag> it's ok, i'll just repeat
00:14 <ezyang> The last message I read from you is 20:01
00:14 <sophiag> there's a fundamental confusion here
00:15 mizu_no_oto joined
00:16 <sophiag> i have two adts. one are just list types of the same ones in the other because i don't want the lists to be heterogenous yet need to pattern match for them so some cases make it not feasable to use a type variable to enforce that. on top of that, each ADT has a data constructor that recursively wraps itself as a list type and (for purposes of type coercion) one that wraps the other ADT. so i've mentioned three things here that are
00:16 <sophiag> convoluted hacks and they've caught up to me in terms of my ability to debug the few remaining problems with the code.
00:18 roboguy` joined
00:18 soniku joined
00:19 wroathe joined
00:20 biglambda joined
00:21 serenity1612 joined
00:23 RoyalNightGuard joined
00:25 e14 joined
00:25 ChaiTRex joined
00:26 <ezyang> hmm, could you make a simple example?
00:26 <ezyang> so, basically, you want to enforce an invariant that everything in the list has the same type?
00:27 <sophiag> yes, that's one of the three issues i mentioned.
00:27 <sophiag> here's an example: http://lpaste.net/354629
00:29 <ezyang> maybe you should have done a GADT/existential
00:30 <ezyang> or the fancy new type-indexed Typeable hotness. What version of GHC do you need this to work for
00:30 <sophiag> well it uses pattern synonyms so i suppose 7.8
00:31 <ezyang> this one: https://ghc.haskell.org/trac/ghc/wiki/Typeable
00:31 <sophiag> anyway, i don't see how a GADT would solve any of the three problems i mentioned. can you explain that?
00:31 <sophiag> i know what Typeable is
00:31 foton joined
00:31 <sophiag> again, i don't understand how any of these suggestions would solve any of the three problems i asked about
00:32 Navajo joined
00:32 <Navajo> i need help
00:34 edmundsecho joined
00:36 asciiascetic joined
00:36 <Navajo> what is this channel
00:37 <asciiascetic> its about a programming language called haskell. Are you from kansas? I noticed a school called haskell is there :)
00:38 <Navajo> i'm not from kansas no, but I do want to learn haskell
00:38 <Navajo> you can teach me?
00:38 andyhuzhill joined
00:38 <asciiascetic> haha, probably not. But I am occassionally using it, and teachers are here.
00:39 <Navajo> in what ways is haskell used?
00:39 wroathe joined
00:40 <asciiascetic> hmm... it is often used to write other langauges (see purescript and elm languages, for examples)
00:40 flump joined
00:41 <Navajo> hmm
00:41 <asciiascetic> it is used to create web applications and to create other kinds of network server applications
00:41 augur joined
00:42 <asciiascetic> and a great many other things - i'm sure that google is a better keeper of that information than I am, but thats how I've used it and seen it used.
00:43 <Navajo> I see
00:43 hc_ joined
00:46 <unyu> If I do “data Foo = Foo { bar, qux :: !Double }”, it means that both “bar” and “qux” are strict fields, right?
00:46 Solarion_ joined
00:46 nagao joined
00:47 justan0theruser joined
00:48 <sophiag> unyu: do you not need to define fields distinctly?
00:48 mizu_no_oto joined
00:49 <pacak> unyu: I would say so.
00:49 <unyu> Ah...
00:49 <unyu> sophiag: I'm pretty sure you can define two fields together, if both have the same type.
00:49 <unyu> Mmm... This OverloadedRecordFields seems not to interact very well with type inference. :-(
00:50 wroathe joined
00:50 <sophiag> oh i see
00:50 <sophiag> sorry, i can't answer that
00:51 <pacak> unyu: Do you have a nice example when it's not working well even when it should be obvious?
00:51 nighty-- joined
00:53 conal joined
00:55 <unyu> pacak: http://lpaste.net/354658
00:56 Wuzzy joined
00:59 Wuzzy2 joined
01:00 wroathe joined
01:01 tennix joined
01:02 <sophiag> i'm using breakpoints in ghci for the first time and having a bit of trouble understanding them. what does it mean when it returns a hole? like "i :: Integer = _"
01:03 Welkin joined
01:03 <peddie> sophiag: might that mean it's not yet been evaluated (it's still a thunk)?
01:03 <sophiag> really?
01:04 <peddie> I'm not sure
01:04 <sophiag> oh
01:05 <peddie> you could try :force i and see whether it has a value after that
01:05 yellowj joined
01:06 <sophiag> well, following up on what you suggested yesterday...i couldn't figure out how to enforce homogeneity of lists with a type variable and still pattern match for them. but out of frustration i did just go ahead and allow for heterogenous lists anyway and it fixed one problem and now is breaking the part where i parse lambdas. my intuition is i was *never* parsing lambdas correctly and just didn't know because they weren't being applied
01:06 <sophiag> so now trying to debug that function in this new version
01:06 <sophiag> (it's returning Nothing no matter what...)
01:07 <peddie> sophiag: sounds like some progress. out of curiosity, what does the whole program actually do?
01:07 <sophiag> it doesn't feel like much progress :(
01:07 <sophiag> i feel like i've hit a wall with haskell in general
01:07 <peddie> how so?
01:07 <sophiag> this program is a dsl for programming with constraints
01:08 <sophiag> like i understand the type system and monad hierarchy and such, but my programs are now just complex enough they become exponentially more difficult as i go along due to spaghetti-like type structure
01:08 a3Dman joined
01:08 a3Dman joined
01:09 <peddie> it can take a while to get the hang of designing the types so that they reduce complexity
01:09 <peddie> or at least it did for me
01:09 <sophiag> yeah exactly
01:09 conal joined
01:09 <sophiag> i was thinking the solution might be optics, but i'm not actually nesting records here
01:10 <MarcelineVQ> sophiag: what code have you got atm?
01:10 <sophiag> i have literallly three versions...lol
01:10 <peddie> sophiag: do you have any tests for your program? one thing that took me a while to discover was that if I refactored my program so I could write better quickcheck tests, it almost always made my program structure better as well
01:11 <sophiag> well i was just thinking maybe HUnit (which i normally woudln't be into) could be of use here
01:11 <sophiag> the problem is i'm parsing functions so there's no show instance
01:11 <sophiag> i'm trying to debug something that's totally opaque
01:11 <peddie> helps me think about separating things out when the properties can't be statically enforced
01:12 orhan89 joined
01:12 <sophiag> let me paste the version i refactored today since it has the old code commented out
01:12 <sophiag> so you can see two versions that compile yet both have different operational issues
01:13 <peddie> sophiag: OK, I'll take a look -- don't have a ton of time today, but we'll see how we go :)
01:13 <sophiag> ok, here it is: http://lpaste.net/354660
01:13 <MarcelineVQ> peddie: that makes a lot of sense, a similar thing can happen when you break something down to ask a question about it, it can solve itself in a sense
01:14 <sophiag> so the main eval function i call from the dsl is on line 258...my best guess is that wasn't actually evaluating lambdas before i changed the types as you can see in the comments
01:15 <peddie> sophiag: I see you've now put the list types into `AmbVal` -- haven't made it to nearly 258 yet :)
01:15 <sophiag> the point it's failing is in parseExpr on line 185. it always returns Nothing. i didn't change that code at all hence why i think those lambdas just weren't being initially applied
01:15 cpup joined
01:15 <sophiag> peddie: right. as mentioned, i couldn't figure out how to make it work how you suggested so just allowed heterogenous lists in Amb
01:16 <sophiag> figured i'd solve that later
01:16 Velpoman joined
01:16 <sophiag> it really seems parsing lambdas is where it fails
01:17 <sophiag> and i'm not sure i'm parsing lists in them correctly to begin with, which is necessary for the dsl to actually do anything. however, it still returns Nothing without lists
01:17 {emptyset} joined
01:17 begriffs joined
01:18 e14 joined
01:18 <peddie> sophiag: any interest in using an external parsing library, like megaparsec or something?
01:18 <sophiag> for what?
01:19 <peddie> for doing your parsing
01:19 <sophiag> i'm already using a library to parse ASTs and that's all there is
01:19 soniku joined
01:19 <peddie> ah OK, I just saw this table of operators on 169 and thought "there's a library that can do this"
01:19 <sophiag> yeah, and i'm using it
01:19 <peddie> but if most of it is coming from an AST already, then never mind
01:20 <sophiag> megaparsec actually CANNOT do this
01:20 jmcarthur joined
01:20 wroathe joined
01:20 roboguy`_ joined
01:20 <peddie> hmm, what, have a table of reserved binary operators? I thought it could -- but you're right, it's not relevant to the immediate problem here
01:20 filterfish joined
01:21 <sophiag> it has nothing to do with this
01:21 <sophiag> i'm not parsing anything by hand
01:22 <sophiag> all i'm doing is storing the results of matching haskell ASTs in data structures
01:22 <peddie> sophiag: it seems at first glance like there is a lot of Maybe plumbing that is happening by hand, but that is also not relevant to why it's not parsing lambdas
01:23 <peddie> can you change your `parseExpr` from returning a `Maybe` to returning an `Either`, and in the case of failure, say something about why it failed or the term that didn't match?
01:23 <sophiag> Either what?
01:24 <Squarism> sometimes its not very obvious when you declare function signatures what things are. Like : type SomeFkn = String -> Bool -> Int
01:24 <sophiag> as stated, it does fail no matter what the input is
01:24 <sophiag> you can't print functions...
01:24 <Squarism> is there some common way to tackle that when implementation isnt around?
01:24 mac10688 joined
01:24 metalbot joined
01:24 <Squarism> should one use type alias / designators?
01:25 <peddie> sophiag: is there anything useful you could print when it returns `Nothing`? for example, could you print the `Exp` value that failed to match?
01:25 <sophiag> Squarism: i'm not sure the question. that function would take a String and a Bool and return an Int
01:25 <peddie> sophiag: `Exp` has a `Show` instance, it looks like
01:25 <sophiag> peddie: i suppose...but i already know the Exp
01:26 <sophiag> that's the AST
01:26 <geekosaur> Squarism, I think you can feed a type to :kind! in ghci and get the expansion?
01:26 <sophiag> plus i'd have to refactor the entire code to accept an either type and print it in the dsl's repl
01:26 <geekosaur> (the ! is important)
01:27 <geekosaur> sophiag, the problem Squarism is talking about is when some other type uses SomeFkn and it looks like a "normal value" but is a function that is being partially applied
01:27 <peddie> sophiag: I don't understand this program well enough yet to have a better suggestion at the moment. it seems like if it's returning `Nothing`, then at some point, the Exp doesn't match one of the cases you've laid out in `parseExpr`
01:27 <geekosaur> this does tend to lead to brain-breaking stuff
01:27 <sophiag> pedie: yes, exactly
01:27 <geekosaur> and the web frameworks all seem to thrive on it...
01:27 <Squarism> sophiag, yes.. but its not obvious what what they imply. Like String could be "A-prefix-that-will be added to something", Bool could be "Make warnings be failures" and Int could be "temperature"
01:28 <Squarism> ..bad example but you get my point
01:28 peterbec` joined
01:28 <geekosaur> Squarism, that's the downside of using short names for things. that's often a good thing for type variables, often bad for value bindings :/
01:28 <peddie> sophiag: so it seems like returning `Either Exp (AmbVal -> Maybe AmbVal)` or something like that would let you inspect the exact Exp that didn't match
01:28 <sophiag> peddie: here's what it the two variables look like
01:29 <Squarism> geekosaur, oh ok
01:29 <peddie> sophiag: and thus see why parsing failed
01:29 <sophiag> var: [PVar (Ident "x")]
01:29 <sophiag> body: (InfixApp (Var (UnQual (Ident "x"))) (QVarOp (UnQual (Symbol "=="))) (Lit (Int 0)))
01:29 <sophiag> some form like that
01:29 <sophiag> i don't need to print them since they always come in that form
01:30 <peddie> sophiag: if they always come in that form, then pattern matching always succeeds, right? and thus parsing always succeeds?
01:30 <sophiag> parsing alwayss succeeds because they're not being parsed in this code
01:30 <sophiag> matching never succeeds, which is what we're discussing
01:30 wroathe joined
01:31 mimi_vx_ joined
01:31 <peddie> sophiag: sorry; when I say "parsing," I'm referring to what `parseExpr` is doing -- seems reasonable to call it parsing given that the function has "parse" in its name :)
01:31 <sophiag> oh i have an idea
01:31 <geekosaur> Squarism, however you also touch on another issue commonly described as "boolean blindness": people use a Bool because it exists, when data MyWhatever = This | That is cheap
01:31 <geekosaur> and makes the intent clearer
01:32 <geekosaur> likewise using tuples instead of an ADT; a tuple could be anything, the ADT at least can tell you what it's supposed to be
01:32 <Squarism> geekosaur, ah - glad there is a word for it!
01:32 <peddie> sophiag: let me rephrase without saying "parse": if they're always in that form, then matching always succeeds, and thus `parseExpr` always returns `Just <whatever>`. but that's not happening, so at some point, the Exp has to not match, no?
01:32 <sophiag> well, i figured i could determine that with breakpoints...
01:33 <sophiag> geekosaur: do you know what it means when a breakpoint returns a hole?
01:33 <peddie> sophiag: you probably can, but if you just make it spit out the failing Exp every time, you will never have to enter the debugger to debug this bit . . . and it might be useful later on if you need to explain to the user why some input was invalid
01:34 <sleffy> Is it possible - I could not possibly care less about how hackily this has to work - to compare two functions for equality by their definitions?
01:34 <geekosaur> sleffy, no
01:34 <sleffy> i.e. if I define a function `foo`, and a function `bar`, I want to check if `foo` is *exactly* foo or some other function
01:34 <sleffy> In any other language I'd do this as function pointer equality
01:34 <sleffy> Really? No way?
01:34 conal joined
01:35 <sleffy> I can't, say, export them as foreign and somehow get pointers and check equality there?
01:35 <geekosaur> there are ways to get pointer equality in Haskell, with some limitations (consider the name a warning: reallyUnsafePtrEquality#)
01:35 <sleffy> Yeah I'm willing to deal with that
01:35 <sleffy> This whole thing is a giant hack anyways
01:35 <geekosaur> but "by their definitions" would mean drilling down into the STG defining it and the machine code behind that, which.
01:35 <sleffy> Yeah, I figured that could cause issues
01:35 mimi_vx_ joined
01:36 <sleffy> Really what I've got here is I'm abusing GHCi as a little repl, and I have functions to turn it into a little DSL-console
01:36 <sleffy> I want to write a `help` function which takes in something and then compares it to what it knows are the pointer-identities of all the functions I've made and maybe gives a nice little message
01:36 <geekosaur> sophiag, I'm not even sure what you are talking about, unless you used _ on the right side of a pattern match instead of the left
01:38 <sophiag> np
01:38 <sophiag> oops
01:38 <sophiag> i meant to say no
01:38 <sophiag> in fact, it is a problem :(
01:38 <geekosaur> a hole is not a thing that exists at runtime, generally. if the compiler said "Found hole at..." then you probably used _ in an expression when you intended a pattern
01:38 <sophiag> hmm
01:38 <sophiag> ok, that might help...
01:38 <geekosaur> or, if you used _ as the pattern, that does not let you refer to _ as the matched expression
01:39 <peddie> geekosaur: I thought an underscore in the debugger might mean a thunk that's not yet evaluated
01:39 <geekosaur> name it if you want to use it
01:39 danthemyth joined
01:39 <geekosaur> well it does depend on context
01:39 xcmw joined
01:39 <geekosaur> if you used :print and it gave you a _, then yes, that's a thunk that was not evaluated
01:39 <geekosaur> you would have to step into it
01:39 <geekosaur> or force the expression
01:40 <geekosaur> :sprint might be your friend there
01:40 <peddie> sophiag: you gave context for this debugger question a few minutes ago, maybe you could paste it again?
01:40 <geekosaur> when you are debugging, you sometimes need to care what has been evaluated and what hasn't, so you get the _s. :sprint hsould force the whole expression
01:40 <sophiag> two examples: "_result :: Maybe (AmbVal -> Maybe AmbVal) = _" and "i :: Integer = _"
01:40 <geekosaur> but that could change what continuing execution will do
01:40 <geekosaur> ok, yes, those are unevaluated thunks
01:40 <geekosaur> try :sprint on them
01:40 <peddie> sophiag: I think _result is a special debugger variable
01:40 wroathe joined
01:41 <geekosaur> the implicit result is "it"
01:41 chichou joined
01:41 <sophiag> how do i set :sprint on a breakpoint?
01:41 <geekosaur> oh right, https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#the-result-variable
01:42 splanch joined
01:42 <sophiag> i mean on the rhs tho
01:42 <geekosaur> you want to read that
01:42 <geekosaur> because the breakpoint stopped when evaluating _result so it is always going to be _
01:42 <geekosaur> you can evaluate it explicitly to force it, but that can trigger other breakpoints etc.
01:43 peterbec` joined
01:43 Supersonic112_ joined
01:44 <sophiag> uh... if i call ":force parseExpr" i get "parseExpr = _"
01:44 skeuomorf joined
01:44 <sophiag> maybe it's not a thunk and just unmatched at that line?
01:44 <peddie> sophiag: if you use Either Exp instead of Maybe for the result of `parseExp`, you won't have to work out how the debugger works for this ;)
01:44 <sophiag> peddie...i already explained why that's prohibitory
01:44 <peddie> sophiag: I think you just said that you didn't want to :)
01:44 <sophiag> just look at the program and how many functions are between that one and actually printing
01:45 <sophiag> uh no
01:45 <sophiag> you can see the code and how many lines i'd have to change to do what you're suggesting...
01:45 meba joined
01:45 bongomooz joined
01:45 <peddie> sophiag: it's a pretty mechanical change, though
01:45 <peddie> sophiag: it's pretty easy to get it right, I think
01:46 Guest51282 joined
01:46 <sophiag> no it's not
01:46 bjz joined
01:46 <sophiag> it would require chaning the types of numerous functions, writing new ones to wrap and unwrap them, etc.
01:46 orhan89 joined
01:46 <sophiag> it's not "easy" in the scheme of "a test that seems eh ok"
01:47 <peddie> sophiag: not sure how to parse that last message
01:47 <peddie> sophiag: it would definitely require changing the types of numerous functions, I agree, but having done this same change in many programs, I still think it's quite mechanical. anyway, good luck with the debugger; I have to run for now
01:47 <geekosaur> actually, isn't parseExpr a function here? don;t think you will get anything useful back but a thunk
01:47 <sophiag> i mean, it's just a test and not an amazingly great one. it's a large amount of work for an diea that's grasping for straws
01:47 <geekosaur> because the thunk can't run until given parameters?
01:47 <peddie> sophiag: you might have to apply `parseExpr` to an argument
01:48 <geekosaur> if you want the result of running parseExpr, ^ what peddie said
01:48 <peddie> or really 2 arguments
01:48 <sophiag> geekosaur; the problem is it's never matching so always returning Nothing
01:48 takle joined
01:48 <geekosaur> then you need to step it with an expression, I think
01:48 <sophiag> oh you mean when i call :force it's not in the context of the breakpoint?
01:48 <sophiag> i need *new* arguments?
01:49 <geekosaur> you are assuming that the value of parseExpr is the result of running parseExpr
01:49 Stanley00 joined
01:49 <geekosaur> if you want to see what it is doing, step from the breakpoint
01:50 <sophiag> i think i misunderstood you
01:50 <geekosaur> parseExpr is *always* a thunk, it is a function not the result of running the function
01:50 <geekosaur> either you step into invoking it with some parameters, or you step past the breakpoint to see what the invocation that triggered the breakpoint is doing
01:50 splanch joined
01:51 wroathe joined
01:51 sigmundv joined
01:51 <sophiag> hmm so stepping once causes it to stop
01:52 <geekosaur> ok, I was afraid of that from what I was reading. I think you have to set breakpoints all over the place :/
01:52 takle_ joined
01:52 <sophiag> inside that one function?
01:52 <sophiag> i really want to step through each line frankly
01:53 <geekosaur> since haskell code is a single expression, you'd have to set breakpoints in the things called from there
01:53 <geekosaur> there is no concept of "each line:
01:53 <sophiag> ah
01:53 <sophiag> wait, although nothing is called from that line
01:53 <sophiag> 186
01:53 <geekosaur> even if you used do notation, that turns into a single big expression using >> or >>=
01:53 <geekosaur> you *might* be able to set breakpoints in those and then :stepl
01:53 <geekosaur> to get the effect of "through each line"
01:54 <sophiag> does stopped mean it failed on that line tho?
01:54 <sophiag> frankly i'm really really confused
01:54 Morgawr joined
01:54 <sophiag> the first line in the function doesn't call any other functions
01:55 <sophiag> and that's the one it stops on when i step
01:55 <sophiag> so i've only seen holes
01:56 <sophiag> hmm ok so from what i can gather it does seem just that one line is breaking it
01:56 <sophiag> 186
01:56 mizu_no_oto joined
01:58 <jackhill> l
01:58 <thang1> a
02:00 sssilver joined
02:00 bhiliyam joined
02:00 hucksy_ joined
02:01 wroathe joined
02:02 orhan89 joined
02:03 biglambda joined
02:04 Willis joined
02:06 blender joined
02:08 ublubu joined
02:10 <unyu> When you freeze or thaw a vector, you're performing a full copy of its elements, right?
02:10 okiii joined
02:11 <pacak> unyu: Yes, but there's also unsafe version of freeze and thaw
02:11 <Squarism> is there some nice utility that can parse compiler output and group compile errors in some easy navigatable manner? Instead of needing to scroll a long text of black and white console text
02:11 wroathe joined
02:11 <Squarism> (especially important if yo've done a refactoring that leads to 20 errors or more)
02:12 <pacak> Squarism: I usually start fixing them one by one
02:13 <MarcelineVQ> iirc there's also an option to spit them out in reverse order if you tend to want to look at the end
02:13 <Squarism> pacak, me too. But its still takes time and effort scrolling through a long output
02:13 <MarcelineVQ> *start
02:13 <Squarism> oh ok
02:13 <pacak> Squarism: You can start fixing them from the bottom...
02:14 <MarcelineVQ> it's called -freverse-errors
02:14 RoyalNightGuard joined
02:14 <Squarism> ok thanks
02:15 <Squarism> less also works.
02:15 Fairy joined
02:16 <pacak> Squarism: You can try using ghcid
02:17 orhan89 joined
02:17 fragamus joined
02:17 jchia1 joined
02:18 <Squarism> pacak, thanks. Looks interresting
02:18 athan joined
02:19 latro`a joined
02:20 j2j joined
02:21 wroathe joined
02:23 bhiliyam joined
02:23 featherlessbiped joined
02:24 justanotheruser joined
02:24 Wolfy87 joined
02:27 sssilver_ joined
02:29 SimpleL joined
02:32 nicknovitski joined
02:32 takle joined
02:33 orhan89 joined
02:35 pera joined
02:35 tput joined
02:39 Micamo joined
02:40 orhan89 joined
02:42 wroathe joined
02:44 mjz19910 joined
02:45 bjz joined
02:45 mjz19910 left
02:45 preyalone joined
02:46 fragamus joined
02:47 mjz19910 joined
02:47 asthasr joined
02:48 mckeankylej joined
02:48 splanch joined
02:49 flatmap13 joined
02:51 skeuomorf joined
02:51 fakenerd joined
02:52 sssilver joined
02:52 safe joined
02:52 splanch_ joined
02:52 peterbec` joined
02:52 wroathe joined
02:53 takle joined
02:54 chendo_ joined
02:55 soniku joined
02:55 darlan joined
02:56 tput joined
02:57 meandi_2 joined
02:58 fakenerd joined
02:58 exferenceBot joined
02:59 mjz19910 joined
03:00 nomicflux joined
03:02 fragamus joined
03:03 hexagoxel joined
03:06 peterbec` joined
03:06 xcmw joined
03:08 takle joined
03:12 wroathe joined
03:14 felixsch__ joined
03:16 mizu_no_oto joined
03:16 brynedwards joined
03:16 harfangk joined
03:18 augur joined
03:20 bjz joined
03:22 pavonia joined
03:23 mazeinmaze_ joined
03:25 bjz joined
03:26 takle joined
03:29 otto_s_ joined
03:29 wedens joined
03:29 grayhatter joined
03:29 grayhatter joined
03:30 SimpleL joined
03:30 grayhatter joined
03:30 grayhatter joined
03:31 Sgeo joined
03:33 wroathe joined
03:33 armyriad joined
03:35 taktoa joined
03:35 pera joined
03:36 Destol joined
03:36 mjz19910 joined
03:42 raynold joined
03:43 wroathe joined
03:44 SimpleL joined
03:48 moet joined
03:49 <moet> is there any real difference between defining a function (\_ -> ...) or (\_name -> ...) ?
03:49 <moet> does the compiler recognize both as "unused" variables?
03:49 <glguy> it does
03:49 ian-mi joined
03:50 <moet> thank you
03:50 a3Dman joined
03:50 <geekosaur> I think the main difference is the latter is a named typed hole these days?
03:50 <geekosaur> so you can use it afterward, potentially
03:50 <moet> hmm.. interesting
03:51 <moet> in my case these are typeclass functions, so it has a type.. i'm just not using it
03:51 <moet> s/it/the value/g
03:52 takle joined
03:52 <geekosaur> hm, actually I don;t think typoed holes fire in patterns, so not even that; it;s just a named binding that the compiler won;t issue "binding not used" warnings for
03:54 Durbley joined
03:56 hybrid joined
03:56 infinity0_ joined
03:56 infinity0_ joined
03:57 orhan89_ joined
03:58 takle joined
03:58 bjz joined
03:58 <sophiag> is there anywhere i can find working code implementing the various interpreters in Wadler's "The Essence of Functional Programming" ? i've tried bits myself and can never get it to compile, but there's just so much in that paper i'd like to learn from. especially the section on continuations
03:58 sleffy joined
04:00 infinity0 joined
04:01 fakenerd joined
04:02 Guest83 joined
04:02 systemfault joined
04:02 infinity0 joined
04:03 jsgrant_ joined
04:03 wroathe joined
04:03 systemfault joined
04:04 conal joined
04:05 infinity0 joined
04:08 infinity0 joined
04:08 connrs joined
04:10 aarvar joined
04:11 infinity0 joined
04:11 peterbec` joined
04:11 bhiliyam joined
04:12 conal joined
04:13 moet joined
04:14 Sh4rPEYE joined
04:18 biglambda joined
04:20 mazeinmaze_ joined
04:20 takle joined
04:21 pera joined
04:23 wroathe joined
04:27 TheInfosphere joined
04:27 splanch_ joined
04:28 ricebox23 joined
04:30 splanch joined
04:32 splanch__ joined
04:33 codesoup joined
04:33 splanch_ joined
04:33 takle joined
04:33 castlelore joined
04:33 _jak joined
04:34 wroathe joined
04:34 roth joined
04:38 LordBrain joined
04:39 sleffy joined
04:40 danthemyth joined
04:44 wroathe joined
04:44 sssilver joined
04:46 xormor joined
04:46 etehtsea joined
04:47 Guest63334 joined
04:49 eklavya joined
04:51 forgottenone joined
04:54 jol joined
04:54 wroathe joined
04:56 {emptyset} joined
04:56 benl23 joined
05:00 fakenerd joined
05:00 sssilver joined
05:02 bjz joined
05:03 splanch joined
05:04 wroathe joined
05:05 splanch_ joined
05:11 <ertes> i finally sat down and wrote a library for live diagnostics of concurrent activity instead of reinventing it for every application
05:11 <ertes> https://hackage.haskell.org/package/progress-meter
05:12 peterbec` joined
05:14 <LordBrain> cool
05:15 wroathe joined
05:17 sssilver joined
05:20 fragamus joined
05:22 <centril> HList requires base < 4.9 - but I have base == - what to do in this situation ?
05:22 <centril> seems HList hasnt been updated for some time
05:23 orhan89 joined
05:23 orhan89_ joined
05:23 <monochrom> Use an older GHC. Or modify HList for the newer base.
05:23 <pacak> ertes: 404 at linked source....
05:23 <moet> centril: sometimes it's sufficient to fork on github, adjust deps, and then reference your fork via stack/cabal file
05:23 mac10688 joined
05:23 geekosaur joined
05:23 <moet> ah :/
05:24 <moet> wait, i didn't get a 404
05:24 <LordBrain> take what you need from HList and roll it into your own package
05:24 <centril> moet: ah :/ was hoping to avoid that... using a github package increases build times
05:24 <ertes> pacak: thanks… it seems that i need to update my docs generation code
05:24 <centril> LordBrain: yeah, I'll probably do that
05:24 <ertes> pacak: the source code is here: https://github.com/esoeylemez/progress-meter
05:24 <centril> btw - what is ETA on GHC 8.4.* ?
05:25 <monochrom> ertes: You have an "as" typoed to "es". :)
05:25 <ertes> monochrom: yeah, it's already fixed in the repo =)
05:25 <ertes> noticed as soon as i uploaded =)
05:25 taktoa joined
05:25 <monochrom> Haha OK
05:25 <ertes> … of course
05:26 <pacak> ertes: Nice documentation.
05:26 <LordBrain> i didnt get a 404 either
05:26 <monochrom> ertes: Does this progress meter simply print to stdout?
05:27 <pacak> https://hackage.haskell.org/package/progress-meter-0.1.0/docs/src/System-ProgressMeter.html#runProgress
05:27 <ertes> monochrom: stderr by default, or supplied handle
05:27 <pacak> Page not found Sorry, it's just not here.
05:27 <monochrom> Ah OK.
05:27 <pacak> Not literal 404, but still the same.
05:27 <monochrom> w00t ANSI code.
05:27 <ertes> monochrom: hWithProgress v. withProgress
05:28 <LordBrain> what things were you working on when you needed a progress meter?
05:28 <LordBrain> are they on hackage too?
05:29 <glguy> ertes: I pushed out documentation with hyperlinked (new-style) source
05:29 Itkovian joined
05:29 <ertes> LordBrain: i have a lot of small applications that push data around
05:29 <ertes> glguy: thanks!
05:31 splanch joined
05:32 sword865 joined
05:33 sanitypassing joined
05:34 sssilver joined
05:35 Gurkenglas joined
05:35 wroathe joined
05:36 fakenerd joined
05:38 orhan89 joined
05:38 orhan89_ joined
05:42 taktoa joined
05:42 chichou joined
05:43 takle joined
05:45 orhan89 joined
05:45 orhan89_ joined
05:45 tripped joined
05:45 wroathe joined
05:46 meba joined
05:47 soniku joined
05:48 Xanather joined
05:49 iqubic joined
05:49 <iqubic> What's the right way to make a parallel traversal.
05:50 <jle`> what do you mean by 'parallel traversal'
05:50 <iqubic> Like when using over, my modification function will take a while to complete.
05:50 <iqubic> So I want it to be run in parallel on all the elements of my traversal.
05:51 mjz19910 joined
05:52 <iqubic> So if my traversal is targeting the elements of a Vector, then I want to run my over function in parallel on all the elements of that vector
05:52 <unyu> Parallel map?
05:52 <unyu> Or parallel reduce?
05:52 laplacian joined
05:53 <iqubic> Parallel map is what I want.
05:53 SimpleL joined
05:53 <jle`> there's the async package
05:53 <nshepperd> if it's lazy, you should be able to use a library like `parallel` to evaluate the elements in parallel
05:53 nick123 joined
05:53 <nshepperd> after doing the map normally
05:54 <cocreature> that won’t work for unboxed vectors
05:55 osa1 joined
05:55 plutoniix joined
05:55 osa1 joined
05:55 <nshepperd> fmap f xs `using` parTraversable rseq -- for instance
05:56 thunderrd_ joined
05:56 wroathe joined
05:56 <iqubic> what's parTraversable?
05:57 <cocreature> https://hackage.haskell.org/package/parallel-
05:57 jgt1 joined
05:57 fractalsea joined
05:58 <iqubic> Ah. And why do you need all that extra stuff.
05:58 juhp joined
05:58 <iqubic> How do you create a strategy?
05:58 moet joined
05:58 blender joined
05:58 <unyu> there are combinators for building strategies out of simpler ones
05:59 <unyu> precisely in that module
05:59 <iqubic> I see.
05:59 <jle`> this book has a good chapter on it too http://chimera.labs.oreilly.com/books/1230000000929
05:59 jsgrant_ joined
05:59 <iqubic> I really need to read up on parallelism before asking questions.
05:59 fakenerd joined
06:00 bhiliyam joined
06:01 <nshepperd> (rseq :: Strategy a) is a strategy that just evaluates the value to whnf
06:02 ExcelTro_ joined
06:02 <iqubic> Sure.
06:02 <iqubic> And what does rpar do?
06:03 <nshepperd> (parTraversable x :: Traversable f => Strategy (f _)) is a strategy that applies strategy x to each value in the traversable, in parallel
06:03 <iqubic> parTraversable is what I wanted.
06:03 andyhuzhill joined
06:03 <iqubic> I just didn't know what it was called.
06:03 <nshepperd> so (parTraversable rseq) is a strategy that evaluates each element in a traversable structure to whnf in parallel
06:04 mounty joined
06:04 <iqubic> why isn't is parTraversable rpar?
06:05 <MarcelineVQ> parTraversable already adds rpar
06:05 wroathe joined
06:06 <MarcelineVQ> specifialy using rparWith which is in the same section as rpar
06:06 Fairy joined
06:07 hamishmack joined
06:08 eklavya joined
06:08 <nshepperd> I think 'parTraversable rpar' would have almost the same effect, except that maybe it doesn't wait for all the evaluations to finish?
06:08 connrs joined
06:11 <nshepperd> not sure
06:15 sssilver joined
06:15 hurkan joined
06:16 takuan joined
06:19 yrdz joined
06:19 recycletrash joined
06:21 sophiag joined
06:24 <MarcelineVQ> seems it would be redundant, and result in unnecessary spark creation since it would be making two sparks for everything and only needing to evaluate one of them
06:25 xmonader3 joined
06:27 <MarcelineVQ> though that larger the task the less fizzles occur with the doubled rpar
06:28 <MarcelineVQ> doesn't seems like it actually matters much on tasks of 100 items
06:29 insitu joined
06:29 <MarcelineVQ> but it does double spark creation to use rparWith rpar :>
06:29 <MarcelineVQ> which is what parTraversable rpar will do
06:30 insitu joined
06:32 takle joined
06:34 govg joined
06:36 wroathe joined
06:37 tsahyt joined
06:38 fakenerd_ joined
06:39 mbuf joined
06:40 splanch joined
06:42 danthemyth joined
06:42 fakenerd joined
06:42 mounty joined
06:42 takle joined
06:46 baldrick1 joined
06:48 mk-fg joined
06:48 mk-fg joined
06:50 biglambda joined
06:51 insitu joined
06:51 connrs joined
06:52 SimpleL joined
06:52 ixxie joined
06:54 thc202 joined
06:56 wroathe joined
06:56 jsgrant_ joined
06:59 juhp joined
07:02 takle joined
07:04 insitu joined
07:06 dhil joined
07:08 peterbec` joined
07:09 etehtsea joined
07:11 fakenerd_ joined
07:14 benl23 joined
07:15 zcourts joined
07:16 fakenerd joined
07:16 baldrick joined
07:17 wroathe joined
07:19 zcourts joined
07:20 orhan89 joined
07:20 __paul0 joined
07:20 orhan89_ joined
07:23 troydm joined
07:24 ubsan_ joined
07:25 magneticduck joined
07:27 fakenerd joined
07:27 wroathe joined
07:32 mjz19910 joined
07:32 _sg joined
07:34 cfricke joined
07:36 xmonader2 joined
07:36 eklavya joined
07:37 wroathe joined
07:37 mjz19910 joined
07:38 fizruk joined
07:39 Micamo joined
07:42 j2j joined
07:43 detrumi joined
07:47 meba joined
07:49 bhiliyam joined
07:52 splanch joined
07:52 leah2 joined
07:52 systemfault joined
07:52 wroathe joined
07:54 systemfault joined
07:54 splanch_ joined
07:54 shutdown_-h_now joined
07:57 insitu joined
07:57 mjz19910 joined
08:02 Yuras joined
08:02 wroathe joined
08:02 baldrick joined
08:02 orhan89 joined
08:02 orhan89_ joined
08:04 free_beard joined
08:05 insitu joined
08:05 justicefries left
08:05 juhp joined
08:06 splanch joined
08:08 eighttt joined
08:09 splanch_ joined
08:11 raichoo joined
08:11 chbatey joined
08:11 splanch joined
08:12 infinity0 joined
08:12 wroathe joined
08:12 mjz19910 joined
08:12 skeuomorf joined
08:13 splanch__ joined
08:13 revprez_atlanta joined
08:14 blender joined
08:15 mjz19910 joined
08:18 lep-delete joined
08:20 simukis__ joined
08:21 leah2 joined
08:22 <kaol> I wish monoid had syntatic sugar like monads' do.
08:22 eighttt joined
08:25 jeltsch joined
08:26 ragepandemic joined
08:26 laz joined
08:27 grim__ joined
08:27 yellowj joined
08:27 LAZAR joined
08:27 matt179 joined
08:27 <centril> kaol: elaborate ?
08:28 doomlord joined
08:28 Yuras joined
08:28 Morgawr joined
08:28 <Gurkenglas> > let f = (,()) in fst $ do f $ Sum 3; f $ Sum 8
08:28 <lambdabot> Sum {getSum = 11}
08:30 richi235 joined
08:31 insitu joined
08:32 wroathe joined
08:34 <Gurkenglas> Applicative style arguably gets even shorter when used with monoids :P
08:35 zcourts joined
08:35 <centril> Gurkenglas: Applicative style arguably gets even shorter when used with anything :P
08:36 <centril> <$> and <*> is much shorter than do notaion
08:36 splanch joined
08:37 Edith joined
08:37 takle joined
08:38 splanch_ joined
08:38 <Gurkenglas> centril, when you aren't working with monoids, it doesn't do plumbing well. There's a reason for ApplicativeDo.
08:39 peterbec` joined
08:39 <Gurkenglas> (as in, when you need plumbing, it stops getting shorter)
08:40 <centril> Gurkenglas: well, mostly it is just ctor <$> comp1 <*> comp2 <*> comp3 <*> ...
08:40 splanch__ joined
08:41 <cocreature> do notation is often easier to read but it is rarely shorter
08:41 <centril> cocreature: that depends entirely on if you are used to imperative or functional style programming
08:41 <centril> if imperative => do notation
08:42 splanch joined
08:42 <cocreature> centril: I was more referring to the fact that do notation encourages giving names to intermediate results. ofc you can do that with let and <$> <*> as well.
08:43 <kaol> centril: I'd like to have an implicit (<>) between lines. Like monads have an implicit (>>) with do.
08:43 <centril> cocreature: giving names to intermediate results needn't increase readability
08:44 <Gurkenglas> When you want to give names to things, names are gonna find their way in there. Forcing naming is like paying programmers per line written
08:44 <centril> kaol: you do have that if your monoid is also a monad - but you can always use RebindableSyntax and say that (>>) = (<>)
08:44 krypton joined
08:45 bhiliyam joined
08:45 <centril> it would look a bit weird tho
08:45 splanch_ joined
08:45 danthemyth joined
08:46 <Gurkenglas> There's no instance Monad m => Monoid (m … what would even go here)
08:47 <Gurkenglas> ((), presumably)
08:47 <centril> do notation requires defining (>>=) afaik, so maybe it wont work... you'll have to try it
08:48 <kaol> https://ocharles.org.uk/blog/guest-posts/2014-12-06-rebindable-syntax.html has an example with a "where (>>) = (+)" and no definition for (>>=).
08:49 <centril> kaol: =)
08:49 <centril> kaol: I wouldn't do that tho... none would understand the code w/o looking hard
08:49 <Gurkenglas> If you're only going to use that version of do notation for monads, 'x >>= f = x >> f (error "<- illegal in monoid do notation")' should work fine
08:49 <Gurkenglas> -monads+monoids
08:49 <centril> RebindableSyntax might be warranted in the case of indexed monads tho
08:50 meoblast001 joined
08:50 <Gurkenglas> Has someone combined those last two?
08:50 takle joined
08:51 <centril> Gurkenglas: well, indexed monads just make pure, (>>=), and (>>) more liberal, so it shouldn't be any problems
08:51 fakenerd joined
08:51 <Gurkenglas> Right, I'm asking whether anyone's actually written a thing that I can import in order to use do notation with indexed mondas
08:51 robotroll joined
08:53 <centril> Gurkenglas: well, RebindableSyntax is probably per module, so you'll have to pull an IndexedMonad lib and then rebind at the top level
08:53 wroathe joined
08:54 <centril> Gurkenglas: there's a note about it here, https://ocharles.org.uk/blog/guest-posts/2014-12-06-rebindable-syntax.html
08:54 <Gurkenglas> (Dreaming: A record library that generalizes %= and .= to the indexed state monad and then you can pull fields out of nowhere in the middle of a do block)
08:55 <centril> Gurkenglas: link ?
08:55 <Gurkenglas> Dreaming as in, this is what I hope to see in the future
08:56 <centril> Gurkenglas: anyways, here's a gist of an indexed monad somewhat-lib: https://gist.github.com/Centril/a87d72dc753e0cf71133568de53eb935
08:56 <Gurkenglas> Oh, if you're just looking for an indexed state monad library, that exists. By ekmett. Obviously.
08:56 biglama joined
08:57 <centril> Gurkenglas: well, I don't like that one that much
08:57 <centril> and it's highly incomplete
08:57 <centril> anyways... back to work
08:59 <Gurkenglas> https://github.com/turingjump/bookkeeper/issues/10#issuecomment-242266117
08:59 fakenerd joined
09:00 ebzzry joined
09:00 Wedamm joined
09:01 tabaqui joined
09:02 baldrick joined
09:03 wroathe joined
09:05 mjz19910 joined
09:05 eklavya joined
09:07 mjz19910 joined
09:07 splanch joined
09:07 orhan89 joined
09:08 splanch_ joined
09:09 ccomb joined
09:09 orhan89_ joined
09:10 mjz19910 joined
09:10 takle joined
09:11 filterfish_ joined
09:11 splanch__ joined
09:13 mjz19910 joined
09:14 wroathe joined
09:14 eklavya_ joined
09:16 takle joined
09:16 connrs joined
09:17 mjz19910 joined
09:17 fendoer joined
09:20 <jle`> Gurkenglas: every monoid is associated with a monad
09:20 <jle`> and some people use this to abuse do notation for monoids
09:21 <jle`> it's "a thing"
09:21 <Gurkenglas> "associated with"?
09:21 <jle`> there's a type that lifts monoids to monads
09:21 <jle`> with a homomorphism on <>
09:22 <Gurkenglas> (,()), you mean?
09:22 <jle`> i mean (,)
09:22 eklavya joined
09:22 <jle`> or Writer
09:22 <jle`> every monoid 'w' creates an associated monad, 'Writer w'
09:23 ozgura joined
09:23 <Gurkenglas> <Gurkenglas> > let f = (,()) in fst $ do f $ Sum 3; f $ Sum 8 <- 54 minutes ago :P
09:23 <jle`> ah yeah, that's the homomorphism
09:23 <jle`> commonly known as 'tell'
09:23 <jle`> tell x >> tell y = tell (x <> y)
09:24 <jle`> and now with Applicative Do, you can even use Const with do notation
09:24 <jle`> oh
09:24 <jle`> i suppose i was addressing kaol initially
09:24 <jle`> not Gurkenglas
09:25 <jle`> misread the original person who had the wish :)
09:25 Guest63334 joined
09:26 <jle`> kaol: with Writer, you can have implicit <>'s
09:26 <jle`> kaol: since do blocks use >>, and >> is <>
09:27 <Gurkenglas> I mean I did say that in "<Gurkenglas> > let f = (,()) in fst $ do f $ Sum 3; f $ Sum 8". Const's neater though.
09:27 fgaz joined
09:27 <jle`> yeah, you did say that
09:27 <jle`> but just wanted to show that for Writer, (>>) is literally (<>)
09:28 <jle`> so it's actually literally like "having an implicit <> between each line"
09:29 ofdm joined
09:31 lithie joined
09:32 blender joined
09:33 ft3 joined
09:33 wroathe joined
09:33 gawen joined
09:34 azahi joined
09:34 <jle`> hm, actually, i suppose Const makes the analogy even clearer
09:34 <jle`> instance Monoid m => Applicative (Const m) where
09:34 <jle`> pure _ = Const mempty
09:34 <jle`> Const x *> Const y = Const (x <> y)
09:35 <jle`> it's literally just a newtype wrapper over a monoid, that you can use in do notation :)
09:36 mmn80 joined
09:38 dhil joined
09:38 laplacian joined
09:38 fendor joined
09:39 biglambda joined
09:41 <LAZAR> Is there any way to shorten this lamdba expression : map (\c -> length (filter (==c) code)) colors
09:41 <LAZAR> (its about counting the occurrences of colors in a color code)
09:42 j2j joined
09:43 insitu joined
09:44 chichou joined
09:47 rockfordal joined
09:50 chbatey joined
09:54 wroathe joined
09:54 <Axman6> @pl (\c -> length (filter (==c) code))
09:54 <lambdabot> length . flip filter code . (==)
09:54 <Axman6> not particularly satifying but not as unreadable as it could be
09:57 mfukar joined
09:57 zereraz joined
09:58 mfukar joined
09:59 <LAZAR> Axman6: isnt that point free notation?
10:01 <zereraz> hi I am trying to install https://hackage.haskell.org/package/wx using stack. I did `stack install wx` and I get this error http://lpaste.net/354667
10:02 Spondyl joined
10:02 <pacak> zereraz: Stack is strange.
10:02 SimpleL joined
10:03 <zereraz> in a stack project I could do `cabal install` as well?
10:03 <zereraz> even that is giving error
10:03 <zereraz> http://lpaste.net/354668 cabal error
10:03 <zereraz> for `cabal install wx`
10:04 blender joined
10:05 fendor joined
10:08 fakenerd_ joined
10:09 <pacak> zereraz: At least you can follow this error. wxdirect wants old version of process
10:09 <hvr> zereraz: it's possible there isn't an install-plan for GHC 8.0 yet
10:09 <pacak> You can try using --allow-newer for cabal
10:09 <zereraz> ok thanks I'll try that
10:10 ninjazoete joined
10:10 <hvr> be careful w/ an unqualified --allow-newer
10:10 <pacak> zereraz: use cabal sandbox in order not to break all the things
10:10 <zereraz> ok I'll do that
10:10 sepp2k joined
10:11 <hvr> --allow-newer=wxdirect:process
10:11 <hvr> that's what unlocks an install plan for GHC 8.0 for me
10:12 <zereraz> do you guys not use stack?
10:12 <pacak> Nope.
10:12 <LAZAR> umm how do i return a custom data type? assume i have a function f :: Int -> Person and Person has some fields. Do I need to use a constructor?
10:12 <hvr> zereraz: no... why should I? :)
10:13 <pacak> LAZAR: o_O
10:13 <LAZAR> oh just got it... construcitng is pretty trivial.... Person param1 param2, etc
10:13 <* hvr> just noticed a problem w/ 'wxc'
10:13 <zereraz> I came back to haskell after quite some time so I thought that is what others are using https://github.com/commercialhaskell/stack 2k stars!
10:14 <LAZAR> stack is not a replacement for cabal
10:14 MoALTz joined
10:14 wroathe joined
10:14 <pacak> LAZAR: Rubber duck debugging. Works as usual.
10:15 <zereraz> ok
10:15 <zereraz> I did `cabal install wx --allow-newer=wxdirect:process`
10:16 Yuras joined
10:16 fizruk joined
10:17 Kreest_ joined
10:17 <zereraz> http://lpaste.net/354669 it is saying I need to install `Error: wx-config not found, please install wx-config before installing wxc`
10:18 juhp joined
10:18 <pacak> Hmm... Looks like mac
10:18 <hvr> zereraz: on debian, that's a CLI tool provided by either libwxbase3.0-dev or libwxgtk3.0-dev
10:19 koitalel joined
10:19 <zereraz> ya mac
10:19 <pacak> Ubuntu says it's libwxgtk2.8-dev or libwxgtk3.0-dev
10:20 connrs joined
10:21 <zereraz> I'm trying `brew install wxmac --devel` hopefully it will install
10:22 <zereraz> for FRP is reactive-banana used more or yampa ?
10:23 twanvl joined
10:23 <zereraz> also what about gui's is wx used or something else?
10:23 cfricke joined
10:24 <hvr> zereraz: fwiw, I'm afraid the wx package may be a bit outdated; it doesn't seem to compile against wx 3.0 anymore
10:24 <pacak> We are using gtk
10:24 <zereraz> can I use something like FRP for it?
10:24 <zereraz> I want to learn frp by making something in it
10:24 hegge joined
10:24 <zereraz> I saw reactive-banana had wx
10:25 wroathe joined
10:25 theorb joined
10:25 <zereraz> hvr: damn
10:25 <hvr> at least I'm getting tons of C++ compile errors here
10:25 insitu joined
10:25 <hvr> the package is 2 years old...
10:25 jaspervdj joined
10:26 <pacak> zereraz: gtk can be used with frp, yes
10:26 <zereraz> pacak: with which library?
10:26 <hvr> otoh... https://hackage.haskell.org/package/wxc does claim to work w/ 3.0
10:27 Spondyl_ joined
10:27 <pacak> zereraz: https://hackage.haskell.org/package/euphoria
10:28 <zereraz> pacak: but does it have behavior
10:28 <zereraz> I can see event
10:28 <pacak> zereraz: No idea, I'm carefully avoiding frp related code :)
10:28 revprez_atlanta joined
10:28 <zereraz> pacak: why?
10:29 <LAZAR> how can i access unnames members of data types?
10:29 <LAZAR> unnamed
10:30 <pacak> Our project is big and there are a bunch of smaller parts to it. I find it more fun to work on different parts of code I guess.
10:30 <pacak> LAZAR: Pattern matching
10:30 <LAZAR> data type is data Move = Move Code Int Int deriving (Show, Eq)
10:30 <LAZAR> how would i match a pattern here?
10:30 <pacak> case blah of
10:30 <pacak> Move c a b -> ...
10:30 <hvr> zereraz: ok, something else is going on here... I'm still investigating; I was able to install wxc w/ GHC 7.10.3
10:31 justvisit joined
10:31 <pacak> LAZAR: Are you sure you are reading a textbook?
10:31 osa1 joined
10:31 osa1 joined
10:31 <zereraz> hvr: oh cool my make install is going on
10:31 <zereraz> pacak: got it
10:31 <LAZAR> pacak: im reading CIS 194
10:32 <justvisit> What should I do after reading 'Learn You a Haskell for Great Good'?
10:32 <pacak> justvisit: CIS 194 probably
10:33 <pacak> justvisit: I did real world haskell, but those days it's kind of dated.
10:33 <LAZAR> justvisit: CIS 194 is pretty nice
10:33 <justvisit> I'll check out CIS 194, then.
10:33 <justvisit> Thanks.
10:34 <ertes> zereraz: reactive-banana and reflex
10:34 <LAZAR> they just sometime shave stuff in the exams which arent covered before like pattern matching in my current case
10:34 <LAZAR> im more used to having named fields lol
10:34 <zereraz> ertes: oh wow reflex seems interesting!
10:34 wroathe joined
10:35 jomg joined
10:36 <ertes> zereraz: generally you can use pretty much any UI toolkit with FRP, and for some of them there are libraries to connect the FRP framework to the toolkit… personally i find it easier and more satisfying to make that connection myself
10:37 <zereraz> ertes: I'm a bit new, I would like to try making some bindings myself but not very sure how
10:37 <ertes> zereraz: oh, and regarding AFRP (yampa, wires): avoid it unless you really really need it (like when you have large, highly dynamic systems that need to run at 60 FPS)
10:38 <LAZAR> So the only way to access unnamed fields in data types is like this: getUserName (User name _ _ _ _ _ _ _) = name, means you just memorize the index of the field?
10:39 <zereraz> ertes: what is AFRP ?
10:39 <ertes> zereraz: A = arrowised, as in Control.Arrow
10:40 peterbec` joined
10:40 egis joined
10:41 <pacak> LAZAR: Yes. Or you can give them names.
10:41 <pacak> LAZAR: Or if you are into high energy magic you can use lenses
10:41 <ertes> it's like Monad, except it ruins your life
10:41 <pacak> ertes: Is it? Why?
10:42 <zereraz> ya why? I thought arrows were interesting(learning it first time only)
10:42 <LAZAR> is it possible to deconstruct Data Type parameters like in JS, example: jsDoStuffWithUser({name, age, id})?
10:42 <ertes> you use Arrow when the thing you have is not a Monad (or, as in this case, not a useful Monad)
10:42 <ertes> in exchange for a horrible API with horrible notation
10:42 <pacak> LAZAR: If you have names you can use them: data Foo = Foo { foo :: Int, bar :: Int }
10:43 <pacak> LAZAR: doStuffWithFoo Foo{..} = xxxxxx
10:43 <zereraz> ertes: because if it is not a monad we don't get do syntax?
10:43 <LAZAR> pacak: hmm im doing an exercise from CIS which specifically requests me not to name the fields
10:43 <pacak> LAZAR: xxxxx can use variables foo and bar
10:43 <pacak> LAZAR: I see. In that case you going to suffer.
10:44 <pacak> zereraz: You get arrow syntax
10:44 <ertes> zereraz: it's really difficult to recover monadic information passing for something that acts much more like a proper Applicative
10:44 <ertes> zereraz: that's why you see those countless tuples and a syntax that, beside looking awful, translates into something that is incomprehensible
10:44 nighty-- joined
10:44 <zereraz> hmm got it
10:44 <ertes> unlike the fairly straightforward translation from monadic do-syntax to combinators
10:44 bjz_ joined
10:44 <pacak> ertes: Hmmm... ArrowApply gives you Monad powers, just in an ugly way...
10:44 _sg joined
10:45 asdfjkljkl joined
10:45 <LAZAR> problem is they didnt really introduce Data Type comparison so even simple stuff like pulling a value out of a Data Type is difficult at best
10:45 <ertes> pacak: yes, but if you have an ArrowApply, you might as well not use Arrow at all
10:45 wroathe joined
10:45 <ertes> there is no reason to use Arrow, if you have a Monad
10:45 <zereraz> ertes: have you tried purescript?
10:46 <ertes> zereraz: only very briefly
10:46 <zereraz> ertes: what do you think of https://github.com/paf31/purescript-behaviors/blob/master/test/Main.purs
10:46 <pacak> ertes: Hmm... Actually right now I'm trying to write some code in arrows because I do have a Monad, but I also want some stuff from Arrows specifically...
10:46 <pacak> Not sure yet if it's a good idea or not.
10:46 <zereraz> ertes: does it seem like decent frp features? or does it lack something
10:46 danthemyth joined
10:47 <ertes> zereraz: looks like FRP code to me at least… can't really say much though
10:47 albertus1 joined
10:47 <zereraz> ertes: ok thanks, also do you know some resource for frp?
10:47 <ertes> pacak: it's not a good idea… Monad is strictly more expressive than Arrow
10:48 insitu joined
10:48 <zereraz> when does one need to use Arrow?
10:48 <ertes> pacak: you should want the Monad equivalent of whatever you're looking for
10:48 JuanMiguel joined
10:48 <pacak> ertes: Well, the point is in most cases I want to restrict this expressiveness
10:48 <zereraz> it is a generalized monad right
10:48 kamyar joined
10:48 <ertes> zereraz: not really, sorry, although heinrich apfelmus, the author of reactive-banana, has written *a lot* about FRP
10:48 sibi joined
10:49 <ertes> pacak: that… doesn't make sense…
10:49 <zereraz> ertes: ok thanks, I went with reactive-banana because of that :)
10:49 ixti joined
10:49 <ertes> zereraz: no, Arrow in terms of expressiveness, falls between Applicative and Monad
10:49 <pacak> ertes: Have you ever worked with shake?
10:50 <ertes> pacak: briefly
10:50 soniku joined
10:50 Berra joined
10:50 <pacak> We are using it to build stuff and in one condition it fails to build because of stale files
10:50 NyanPasu joined
10:50 <pacak> Fortunately shake is able to remove all the stale files
10:51 <pacak> Unfortunately it needs to build all the things for that
10:51 blender joined
10:51 <pacak> Which fails. And there's no cheap ways to do that mostly because shake actions are monads
10:52 <pacak> (do that = remove stale files)
10:52 <LAZAR> pacak: Just figured object deconstruction like in JS works exactly the same in Haskell: doStuffWithUser (User name age id) works :-)
10:52 <ertes> ah, so you specifically want a proper arrow
10:52 <pacak> LAZAR: That's also pattern matching
10:52 <pacak> ertes: Right.
10:52 <LAZAR> pacak: yeah but much less complex than doing it inside of the function i guess
10:52 coot joined
10:52 Sampuka joined
10:53 yellowj joined
10:53 <pacak> LAZAR: You might want to do some separate research on haskell syntax
10:53 kritzcreek_ joined
10:53 <pacak> LAZAR: pattern matches, guards, maybe list comprehensions...
10:53 <LAZAR> pacak: Well this is chapter 2 only in CIS i guess i will learn more in the next ones about it
10:53 binaryplease joined
10:54 raichoo joined
10:55 wroathe joined
10:56 netheranthem joined
10:57 <ertes> pacak: i don't know your use case, but wouldn't something like Codensity or even ResourceT suffice to remove stale files?
10:59 _sras_ joined
10:59 <pacak> Codensity? I'm affraid I'm not fluent enough in Kmettish...
10:59 richi235 joined
11:00 <ertes> it's like a restricted ContT
11:00 <_sras_> Can Network.Mail.Smpt package send mails to SMTP servers that require TLS authentication?
11:00 <ertes> https://hackage.haskell.org/package/kan-extensions-5.0.1/docs/Control-Monad-Codensity.html
11:00 fizruk joined
11:01 <ertes> pacak: example: Codensity (\k -> k () `finally` c) -- runs 'c' after the Codensity block
11:02 Snircle joined
11:02 <pacak> ertes: Hmm... I'm affraid that won't help in our case. Stale files are created between runs of build system, when you checkout between different commits that remove modules
11:03 <ertes> ah
11:03 Aruro joined
11:06 wroathe joined
11:07 huss_ joined
11:07 <huss_> hey
11:07 fakenerd joined
11:08 <huss_> Can anyone answer my question about the Reader Monad please ^^?
11:08 orhan89 joined
11:08 orhan89_ joined
11:08 <cocreature> huss_: it’s hard to decide if we can answer that question without knowing it, so just ask it directly :)
11:09 <huss_> What's the difference between the Reader and State and is there any significant benefit using one of them instead of passing the state as arguments
11:10 <cocreature> Reader can’t modify the environment, State can
11:10 Micamo joined
11:10 <ertes> huss_: Reader is really just (->) in disguise… there is little benefit in using it
11:10 <hpc> @src Reader
11:10 <lambdabot> type Reader r = ReaderT r Identity
11:10 <lambdabot> --OR
11:10 <lambdabot> data Reader r a = Reader { runReader :: r -> a }
11:11 <cocreature> the benefit of both is mostly that you don’t need to worry about passing the correct argument around
11:11 <ertes> actually (->) has that, too =)
11:11 <hpc> and for Reader, knowing that the "correct argument" never changes
11:12 <huss_> Thank you guys
11:12 <Aruro> huss_: can be their benefit is possibility to make simple monad out of these data structures
11:12 <huss_> Im just starting Haskell and finding it powerful lol
11:12 mbuf joined
11:13 <Aruro> they use reader and state as examples of simple monads
11:13 <Aruro> thought they are actually rather useless
11:13 nakal_ joined
11:13 <huss_> For my case i'm using the reader to parse a language
11:13 <huss_> But i don't know if im doing it the good way let me explain
11:13 fakenerd_ joined
11:13 <hpc> huss_: fwiw, it is rare that you will use Reader or State directly, but knowing how they work will make it much easier to recognize similar functionality in other types
11:14 <hpc> huss_: for instance you might notice that parsec's parser type has a state component to it now
11:14 <ertes> State/StateT can be really useful for stateful applications… Reader is useless, because it's just an awkward version of (->)… ReaderT is rarely useful in isolation, but can sometimes be useful when part of a domain-specific language
11:15 <huss_> Reader isn't the exact same thing as the (->) >
11:15 <huss_> ?
11:15 ddere joined
11:15 <hpc> oh, i guess that type does explicitly use State lol
11:15 ph88 joined
11:15 <ertes> huss_: not quite… it does the same thing, but is a separate type the type checker will refuse to unify with (->)
11:15 nakal joined
11:15 <Aruro> huss_: maybe try to implement your parser without monads? and then see if monads add clarity and simplification
11:15 <ertes> so you can't use function application, and you can't use regular function syntax
11:16 <ertes> that's why Reader is awkward
11:16 orhan89 joined
11:16 orhan89_ joined
11:16 <Maxdamantus> You can see in the declaration lambdabot showed before:
11:16 <huss_> @Aruro exactly what i did and i have to admit that my first parser had so many arguments to passe state
11:16 <lambdabot> Unknown command, try @list
11:16 <Maxdamantus> 23:10:52 < lambdabot> data Reader r a = Reader { runReader :: r -> a }
11:16 jao joined
11:16 <Maxdamantus> `Reader r a` is just a wrapper around `r -> a`
11:17 <huss_> @ertes I understand the point now
11:17 <lambdabot> Unknown command, try @list
11:17 Edith joined
11:17 <cocreature> hpc: I never understood why parsec includes a custom userstate
11:17 <Aruro> huss_: just Name+:
11:17 <ertes> huss_: you can define a type for the information you need to pass around
11:17 <Maxdamantus> so `Monad (Reader r)` is basically the same as `Monad ((->) r)`
11:18 <ertes> cocreature: i don't know either, but my first guess would be that parsec is older than monad transformers
11:18 <cocreature> ah yeah that could be it
11:18 <huss_> ertes: So if i understand correctly, using theses is just a matter of syntax sugar
11:19 <cocreature> well I just use megaparsec these days anyway and that removed the custom user state :)
11:19 <hpc> cocreature: context-sensitive grammars?
11:19 insitu joined
11:20 <cocreature> hpc: sure but you can just layer StateT for that
11:20 splanch joined
11:20 <hpc> ah true, it's probably what ertes said then
11:21 splanch_ joined
11:22 Denthir joined
11:23 <ij> I've got a type that implements MonadIO, but now I want to do the reverse to pass it to catchJust. How might this go about?
11:23 splanch__ joined
11:23 soniku joined
11:24 <cocreature> ij: there are two solutions to this. 1. use the exceptions package and implement MonadCatch
11:24 <cocreature> and 2. use monad-control and implement MonadBaseControl IO
11:24 <ertes> ij: the second option cocreature is about to mention will take you straight to hell =)
11:24 <cocreature> ertes: you can take monad-control from my cold, dead hands :P
11:25 <ertes> hehe
11:25 <cocreature> but yeah 1. is definitely preferable
11:25 <ij> Is there a proper way amongst these?
11:25 <ertes> i do like it, but it's quite a brain teaser
11:25 wroathe joined
11:25 <ertes> ij: if this is only about exceptions, then the 'exceptions' package is definitely easier
11:26 <cocreature> ij: also hopefully you don’t have ExceptT in your monad transformer stack. then you’re pretty much lost when it comes to exceptions
11:26 <ertes> monad-control is much more general, allowing things like forkIO
11:26 <cocreature> (or something similar)
11:26 meoblast001 joined
11:27 fragamus joined
11:28 fizruk joined
11:29 <ij> Any brief enlightenment about why are you lost then?
11:30 <cocreature> ij: https://stackoverflow.com/questions/41966893/why-is-there-no-monadmask-instance-for-exceptt/41977629#41977629
11:30 <cocreature> ij: the short answer is that you can’t guarantee that finalizers are run because Left shortcircuits
11:31 <cocreature> "catchJust" should work but anything related to "bracket" doesn’t
11:31 <cocreature> which at least I use significantly more often
11:31 orhan89 joined
11:31 orhan89_ joined
11:33 dc0de joined
11:34 fizruk joined
11:34 <Gurkenglas> When is "au f g" not specialized "auf f g id"?
11:35 <LAZAR> are there functions with no parameters? what is their signature?
11:35 <ertes> LAZAR: every function in haskell takes exactly one argument
11:35 gawen joined
11:36 <cocreature> Gurkenglas: the docs contain an example
11:36 wroathe joined
11:37 soLucien joined
11:38 <Gurkenglas> Huh. Why isn't "auf (_Wrapping Sum) foldMap id [1,2,3,4]" "au (_Wrapping Sum) foldMap [1,2,3,4]"? :(
11:38 <LAZAR> ertes: sounds like a strange design decision! imagine something like generateName where you really do not need any input
11:38 <cocreature> Gurkenglas: oh sry I misread your question
11:39 <ertes> LAZAR: what would be the type of generateName?
11:39 kamyar joined
11:39 <cocreature> LAZAR: there are things without parameters. they are just not called functions
11:40 <LAZAR> ertes: well imagine a name generator which just produces a string randomly and doesnt need any input
11:40 <ertes> LAZAR: so it's not String, right?
11:41 <LAZAR> ertes: well the Signature would be generateName :: Void -> String
11:41 <ertes> LAZAR: it's more likely something like IO String, right?
11:41 bbear joined
11:41 <bbear> hello
11:41 <LAZAR> ertes: why IO()? I could use the strings internally too
11:41 <cocreature> LAZAR: because you need to access the rng
11:41 <bbear> hello. I have a question about Haskell.
11:41 <ertes> LAZAR: then something like (ST s String), or perhaps (State StdGen String)
11:42 peterbec` joined
11:42 <bbear> Say I'm working in python and my main() program is an infinite loop.
11:42 <ertes> LAZAR: the point is that in haskell there is a difference between values that depend on other values (functions) and things that have effects
11:42 <bbear> In this case I can retain the previous state of the last loop in a global variable in memory.
11:42 <bbear> How can I do such a thing in Haskell ?
11:42 <LordBrain> there is more than one way
11:43 <cocreature> :t iterateM_
11:43 <lambdabot> error:
11:43 <lambdabot> • Variable not in scope: iterateM_
11:43 <lambdabot> • Perhaps you meant one of these:
11:43 <ertes> LAZAR: for the same reason getLine is not a function… it's just a value
11:43 <LordBrain> first, of all, there's the obvious thing, you could actually use global state, you can make an ioref etc
11:43 <cocreature> *shakes fist at lambdabot*
11:43 <LordBrain> or a TVar
11:43 bollu joined
11:43 <ertes> LAZAR: an action, a description of effects… a recipe, if you will
11:44 <LAZAR> ertes: so a generator wihtout any input would just be a value?
11:44 <ertes> LAZAR: yes
11:44 bollu joined
11:44 <cocreature> bbear: https://hackage.haskell.org/package/monad-loops-0.4.3/docs/Control-Monad-Loops.html#v:iterateM_
11:44 <LordBrain> second, you could use the recursion stack to store your state in parameters
11:44 <bbear> i actually use a recursive call to main
11:44 <ertes> bbear: you could just use recursion
11:44 fakenerd joined
11:45 <ertes> bbear: or StateT
11:45 <bbear> but yeah, chaining monadic value is actually what I'm looking for.
11:45 <bbear> you can't give args to main in Haskell.
11:45 <ertes> bbear: main = mainWith s0
11:45 <cocreature> bbear: well then just have main call "loop initialState"
11:45 <bbear> so each time the function is called it is starting fresh.
11:45 <LordBrain> third, you could actually use something like pipes to make an infinite stream of state values, or lazy lists (but watchout for memory leaks)
11:46 <LordBrain> bbear, thats not an issue, you use the fix command to make a sort of recursive lambda
11:46 RoyalNightGuard left
11:46 wroathe joined
11:47 <LordBrain> you can give as many args as you want, something like main = flip fix (initialstate1,initialstate2) $ \(state1,state2) -> do
11:47 saep joined
11:47 <LordBrain> er
11:47 orhan89 joined
11:47 <LordBrain> you can give as many args as you want, something like main = flip fix (initialstate1,initialstate2) $ \loop (state1,state2) -> do
11:47 orhan89_ joined
11:47 <LordBrain> and then call loop as a function to recurse
11:47 <ertes> "the fix command" just cause a weird sensation in my stomach
11:48 <LordBrain> sorry for the repititious text, i used the up arrow
11:48 <LordBrain> to edit
11:48 azahi joined
11:48 <ertes> *caused
11:48 meba joined
11:50 <cocreature> the proper term is “the fix magic trick”
11:50 <LordBrain> well some people actually find it more readable
11:50 <LordBrain> i guess when you get used to it, it has the advantage of not using a slew of specially designed loop functions like whileM etc
11:51 <ertes> replace "command" by "function"
11:51 <cocreature> you don’t need to use "fix" for that. just declare a recursive function in a where clause
11:51 <ertes> the fix trick is nice, but gets unwieldy with more than one argument
11:52 <LordBrain> well, yeah, you could also use a let
11:53 <LordBrain> i guess fix lets you get by without giving it a name tho
11:53 <LordBrain> its weird to newcomers, but veteren haskellers get it
11:53 <* LordBrain> shrugs
11:53 <cocreature> ofc they get it but there is very little benefit to it
11:53 juri_ joined
11:54 <LordBrain> well thats a subjective thing, i had a guy complain because of my use of monad-loops, insisting i should be using fix everywhere
11:54 <ertes> not having to name the thing is actually quite a large benefit in many cases
11:54 ccomb joined
11:54 <bbear> :t fix
11:54 <lambdabot> (a -> a) -> a
11:54 Avogadro joined
11:54 <bbear> LordBrain: not bad
11:54 <bbear> thanks.
11:55 <bbear> Ill think of it.
11:55 oisdk joined
11:55 <LordBrain> yeah lots of options
11:56 ziocroc joined
11:56 <ertes> bbear: 'fix' can be nice with up to one extra argument, and it's best with no extra arguments at all
11:56 wroathe joined
11:56 redpoppies joined
11:56 <ertes> for example in combination with StateT
11:56 <ertes> ($ s0) . fix $ \again s' -> … again s …
11:56 shlevy joined
11:57 <ertes> fix $ \again -> … again …
11:57 <redpoppies> hello, everyone
11:57 <redpoppies> can anyone help with servant options? https://github.com/sordina/servant-options/issues/1
11:58 <shlevy> I want to write a service that comes with its own systemd unit, which must be installed into $sysconfdir/systemd/system. What's the right way to tell cabal to do that?
11:59 <redpoppies> why do you need cabal for it?
11:59 <redpoppies> is it a library? is it a standalone program and you would like to use cabal for deployment?
12:00 fendor joined
12:00 bhiliyam joined
12:00 <Aruro> cabal has install options no?
12:00 <shlevy> I'm building the service with cabal
12:00 Krisostoomus joined
12:01 <shlevy> cabal has a --sysconfdir flag, but I don't know how to specify in my cabal file that a given file should be installed there
12:01 <ertes> you can use data-files to put the service file in the package, but you can't really choose its target location
12:01 <LordBrain> shlevy, there is a file with a bunch of directories defined under dist i think... you can try twiddling around in there
12:01 <Krisostoomus> Any cunts here?
12:01 <ertes> shlevy: consider using a deployment system around your package
12:01 was kicked by mauke: Krisostoomus
12:03 <redpoppies> shlevy: it does seem a bit out of the purpose of cabal, I might be wrong, do consider using deploy tools.. I wouldn't deploy where I do the building, too messy
12:03 orhan89 joined
12:03 orhan89_ joined
12:03 <redpoppies> especially if the deployment target is also a production server, big no-no
12:04 phaji_ joined
12:04 <redpoppies> you don't know what cabal will bring in as dependencies and with what configurations
12:04 blender joined
12:05 <LordBrain> well, he wants to change what 'cabal install' does tho
12:05 <LordBrain> is that impossible?
12:06 <LordBrain> maybe poke around in the cabal source, maybe there is a way
12:06 <shlevy> I'm not talking about deployment. I'm talking about what "cabal install" will install. It's pretty standard practice for packages to come with their own systemd units, it's up to the sysadmin to decide whether or not to install those units. http://0pointer.de/public/systemd-man/daemon.html#Installing%20Systemd%20Service%20Files
12:06 ixxie joined
12:06 danza joined
12:07 <shlevy> Anyway, I'm guessing I'll have to extend Setup.hs
12:07 <LordBrain> cabal's language doesnt seem as well documented as it should be
12:07 okuu joined
12:08 BatmanBot joined
12:08 <LordBrain> well you should check try to see if you can find a way not to do that
12:08 <ertes> shlevy: my suggestion is to use data-files to put the units into the package, then use a deployment system after build/installation to put them into the correct target directory
12:08 <shlevy> LordBrain: I checked the docs and asked in #haskell :D
12:08 <LordBrain> setup.hs is a pain
12:08 <LordBrain> the cabal api is notoriously unstable, you get a maintenance burden
12:08 <LordBrain> take ertes advice
12:09 <ertes> LordBrain: what?
12:09 <ertes> LordBrain: i use Setup.hs all the time…
12:09 mmhat joined
12:09 <LordBrain> well maybe you know better what parts of the APi to touch or not
12:09 t7 joined
12:09 <cocreature> shlevy: there is a postInst hook
12:10 <saep> shlevy: Make a package for the linux distribution you are building for. Shouldnt be too hard.
12:10 <cocreature> ertes: enjoy ifdefing your Setup.hs since Cabal 2.0 breaks everything in a non-backwards compatible way :)
12:10 <shlevy> ertes: I can't enforce a particular deployment system on my users though. Of course I can include it as a data file in the worst case but it is standard practice to bundle in unit files as I'm suggesting. e.g. fedora recommends its maintainers to convince upstream to include the unit as I'm suggesting :D
12:10 Micamo joined
12:10 <LordBrain> there is a program cabal-debian that helps you make a package
12:10 <LAZAR> Can someone explain me in how far concatMap can help here? Your function should take in a length 2 and return all Code s of that length: allCodes :: Int -> [Code] Hint: This exercise is a bit tricky. Try using a helper function that takes in all the codes of length n − 1 and uses it to produce all codes of length n. You may find the concatMap function helpful.
12:10 <shlevy> saep: I'm not just building something for myself, I'm distributing a package
12:10 <shlevy> saep: I'm not going to insist on a specific package manager for my users
12:10 <LordBrain> i see
12:11 <shlevy> cocreature: Ah, thanks!
12:11 <saep> shlevy: Install script?
12:11 <ertes> cocreature: i use Setup.hs in fairly trivial ways: main = defaultMain
12:11 <cocreature> shlevy: there is also preInst and instHook but I guess postInst is the most appropriate
12:11 <ertes> the point is that i use Setup.hs, not cabal-install
12:11 <shlevy> Yeah postInst sounds right
12:11 <cocreature> ertes: ah fair enough
12:11 <LordBrain> you can avoid the ifdefs if you just actually install after installing... on first run i guess
12:11 <LordBrain> ooooooh
12:11 <LordBrain> thats different ertes
12:12 agjacome joined
12:13 <cocreature> LordBrain: you can’t avoid some sort of conditional compilation of Setup.hs if you want to allow people to build your package with two different versions of Cabal and there is no way to write code that works with both
12:13 rcat joined
12:14 <LordBrain> i mean avoid it by not having much in setup.hs, other than default, simple, and have your actual executable detect its a first run and finish the install itself
12:15 sdothum joined
12:15 asthasr joined
12:15 <shlevy> Ah, so your executable needs to be run with root permissions, and hopefully it's not installed with nix where its install prefix is made readonly after the build :D
12:15 <LordBrain> kinda ugly, but less burdensome than custom
12:16 asmyers joined
12:16 <cocreature> I highly doubt that’s less burdensome than a custom Setup.hs but that’s obviously subjective
12:16 <LordBrain> well, you can give the user some instruction
12:16 <shlevy> I'd rather just have a script in the tarball and tell the user to run it after Setup install if you want to avoid hooks
12:17 <LordBrain> i dont know
12:17 <LordBrain> i'd probably resort to custom even myself, but just dont say you weren't warned when you go ifdef crazy later
12:17 <Durbley> when you want to apply a function to each element in a list you call map right? What if you don't want the resulting list of results? What if calling the function suffices? Is it inefficient? Is there a way to throw away the value
12:17 <LordBrain> Durbley, mapM_
12:17 shlevy left
12:18 <LordBrain> Durbley, the M is because you're actually interested in the side effect, the _ says throw away the result, thats the conventional naming anyway
12:18 <Durbley> now, do you know if there's an erlang equivalent :^)
12:18 <ocharles> can anyone help explain how a cost centre can have 15% of the total allocation time, yet 0 entries?
12:18 <ocharles> I don't really know how to interpret that
12:18 <cocreature> Durbley: ask #erlang? :)
12:18 <LordBrain> i dont know erlang
12:19 <ocharles> It also has 15% of the individual allocation time
12:19 AntiSpamMeta joined
12:19 orhan89 joined
12:19 <ocharles> This is the cost centre, so presumably the allocation is coming from <$> https://www.irccloud.com/pastebin/q4j00XbK/
12:19 orhan89_ joined
12:19 <Durbley> cocreature, that's the next step
12:19 <Durbley> i wanted to know for haskell too
12:20 Icewing joined
12:20 <pacak> ocharles: profiling results can be strange with presense of optimizations.
12:21 <LordBrain> we have a pattern of _ for throw away result, for example sequence_ and in monad-loops package you have whileM_ and so forth.... somewhere theres' an interateM_
12:21 <ocharles> pacak: Hum, I thought profiling was meant to disable optimisations that caused oddities
12:21 <ocharles> I'll try again with -O0
12:22 <pacak> ocharles: profiling results can be useless without presense of optimizations :)
12:23 jeltsch joined
12:23 <ocharles> Fortunately optimisations don't make a huge difference to the performance of this program
12:23 fakenerd joined
12:24 <pacak> Try to play aroud with manually assigning cost centers - that usually works for me.
12:24 splanch joined
12:24 <ocharles> I get the same strange profiling info with -O0 though
12:24 <cocreature> ocharles: could you paste the .prof file somewhere?
12:24 <ocharles> sure
12:24 <ocharles> cocreature: here you go: https://gist.github.com/ocharles/538899febdc6cd857378c9923f89ed19
12:25 <redpoppies> can anyone help with servant options? https://github.com/sordina/servant-options/issues/1
12:25 <ocharles> cocreature: all source code is at https://github.com/ocharles/hs-quake-3
12:26 <cocreature> ocharles: so which cost centre are you talking about?
12:26 <ocharles> search for doDraw.\.face
12:26 jeltsch joined
12:26 <ocharles> 0 entries, yet individually it has time and allocations
12:26 <ocharles> I'd like to understand the general behaviour, not the first time I've seen this
12:27 juri_ joined
12:28 jeltsch joined
12:31 sigmundv joined
12:32 cyborg-one joined
12:34 mrcrjs joined
12:36 asciiascetic left
12:37 <cocreature> hm that’s weird
12:37 mjhoy joined
12:38 fizruk joined
12:38 <ocharles> isn't it just
12:38 <Gurkenglas> :t (alaf StateT . alaf MaybeT) (\f -> asum . map f) -- I rendered lambdabot speechless :D
12:39 epsilonhalbe joined
12:39 plutoniix joined
12:39 sphinxo joined
12:41 mr_sm1th joined
12:41 <Gurkenglas> (It was not having imported Control.Monad.Trans.Maybe. Though that doesnt make sense either, it should error out. I'll be lambdabotquerying so dont be surprised if you interactions with him are inconsistent if you try chasing this.)
12:41 RoyalNightGuard joined
12:41 Avogadro joined
12:42 Denthir joined
12:43 jship joined
12:43 ph88 joined
12:44 <ocharles> cocreature: indeed, that much I figured out :)
12:44 Edith joined
12:44 <cocreature> ocharles: sry not sure what’s going on there
12:44 <Sornaensis> :t alaf
12:44 <lambdabot> (Rewrapped t s, Rewrapped s t, Functor g, Functor f) => (Unwrapped s -> s) -> (f t -> g s) -> f (Unwrapped t) -> g (Unwrapped s)
12:44 <ocharles> np, I think I'll try StackOverflow
12:45 <Gurkenglas> This is how one borrows the features of "MaybeT . StateT s". How does one borrow the features of "StateT s . MaybeT"?
12:45 Faucelme joined
12:46 <cocreature> ocharles: it does have entries here https://gist.github.com/ocharles/538899febdc6cd857378c9923f89ed19#file-gistfile1-txt-L1495
12:46 nomicflux joined
12:47 danthemyth joined
12:47 feynhat joined
12:48 splanch joined
12:48 <Gurkenglas> As in, what combination of alaf, StateT, MaybeT and perhaps some more gives me "Monad m => (a -> s -> m (Maybe (b, s))) -> [a] -> s -> m (Maybe (b, s))"?
12:49 <ocharles> cocreature: true. also surprising a bunch of compileGL stuff is there, as that's all meant to be in a strict map
12:49 <ocharles> Clearly not strict enough somewher
12:50 jomg joined
12:50 wei2912 joined
12:51 <ij> Shouldn't the code «map (foo . bar .)» be valid?
12:51 SCHAPiE joined
12:51 <pacak> :t \foo bar -> map (foo . bar .)
12:52 <lambdabot> error:
12:52 <lambdabot> The operator ‘.’ [infixr 9] of a section
12:52 <lambdabot> must have lower precedence than that of the operand,
12:52 <pacak> ij: Nope
12:53 <Gurkenglas> :t ?f :: Monad m => (a -> s -> m (Maybe (b, s))) -> [a] -> s -> m (Maybe (b, s)) -- Why does this error!?
12:53 <lambdabot> error:
12:53 <lambdabot> • Could not deduce: ?f::(a1 -> s1 -> m1 (Maybe (b1, s1)))
12:53 <lambdabot> -> [a1] -> s1 -> m1 (Maybe (b1, s1))
12:53 revprez_atlanta joined
12:54 <Gurkenglas> What was the command to locally install lambdabot when "stack install lambdabot" complains about extra deps?
12:55 ecthiender joined
12:55 splanch joined
12:56 <ij> Gurkenglas, Is "?f" just a name there or does the ? have some special meaning?
12:57 sea_wulf joined
12:58 <LAZAR> Finally done with CIS 2... if someone wants to take a look at my solution and suggest an improvement I'd be super grateful, I feel it's far from being optimal... : http://lpaste.net/354674
12:59 <Gurkenglas> :t ?x :: Int -- ij
12:59 <lambdabot> (?x::Int) => Int
13:00 eklavya joined
13:01 mmhat joined
13:03 fizruk joined
13:03 mizu_no_oto_work joined
13:04 fizruk joined
13:05 blender joined
13:06 insitu joined
13:06 Micamo joined
13:11 splanch joined
13:12 <hexagoxel> LAZAR: doesn't that give the wrong result for length 0? (fixing this also makes the code a tiny bit simpler.)
13:12 soniku joined
13:14 MrLawrence joined
13:14 terrorjack joined
13:15 <ij> I've a function wrapped in «Control.Monad.Catch.catchJust (\e -> ([e] \\ [ThreadKilled]) `Safe.atMay` 0)», but this doesn't seem to catch a pattern matching failure. Is that odd?
13:16 eschnett joined
13:17 <hexagoxel> LAZAR: `iterate` can replace `aCodes`.
13:18 <LAZAR> hexagoxel: allCodes 0 returns an empty list
13:18 <LAZAR> hexagoxel: how would you apply iterate there?
13:18 <hexagoxel> exactly :p
13:19 <LAZAR> well all codes of length 0, that should be an empty list? ;-)
13:19 <hexagoxel> i can think of more than zero sequences of colors that have length 0.
13:19 Sampuka joined
13:19 <hexagoxel> not much more than zero, though.
13:19 Sampuka joined
13:19 jathan joined
13:20 <LAZAR> hexagoxel: any idea how to use it with concatMap? I hate when the suggested solution turns out to be harder than my own -.-
13:21 <hexagoxel> LAZAR: but you use concatMap already, and i think in the way that was intended.
13:21 LnL joined
13:22 <hexagoxel> `iterate fullyExtendCodes`
13:23 Micamo joined
13:23 <hexagoxel> LAZAR: maybe i am overly indirect again: what i mean is that there is a difference between returning [] and [[]].
13:24 <hexagoxel> the former says "there are no sequences of length 0", the latter "there is exacly one sequence of length 0: the empty one".
13:24 sepp2k1 joined
13:25 <LAZAR> hexagoxel: you are probably right but i guess since you are rarely interested in any 0-length permutations, this might not matter a lot ;-)
13:26 <hexagoxel> LAZAR: true, but then this behaviour only exists because you special-case the 0 case. so you can fix it by simplifying the code.
13:27 Qommand0r joined
13:27 fizruk joined
13:27 Sh4rPEYE joined
13:28 <hexagoxel> and being careless because you will "rarely use" some "special" case is asking for bugs later, too.
13:28 earldouglas joined
13:28 <Sh4rPEYE> I want to update hlint to v.2, but I installed it using Stack and on Stackage it is still at 1.9, the new version is only on hackage. WHat should I do?
13:29 bodisiw joined
13:29 Denthir joined
13:30 <dysfun> can anyone recommend a library for "parsing" lists? where "parsing" here = pattern matching with all the nice tools i get from parsec, but over data?
13:30 <LAZAR> hexagoxel: damn when i remove that case it will loop forever
13:30 <jship> Is it safe to concurrently install multiple binaries from the same LTS via 'stack install'? I've seen some stack issues/PRs from 2015 that added locking support - i.e. https://github.com/commercialhaskell/stack/pull/670. Curious if anything has changed since then.
13:31 fakenerd_ joined
13:32 <hexagoxel> LAZAR: correct. but the empty case in fullyExtendCodes can become unnecessary.
13:33 brit411_ joined
13:33 <cocreature> dysfun: parsec supports custom token types
13:33 <dysfun> so i can "parse" a list with it?
13:34 <cocreature> :t runParserT
13:34 <lambdabot> error: Variable not in scope: runParserT
13:34 <cocreature> meh
13:34 <cocreature> you can parse anything that has a Stream instance
13:34 <* dysfun> is on his way to hackage
13:34 <cocreature> and lists are among those things
13:34 dhil joined
13:34 <cocreature> dysfun: unrelated to that you might want to use megaparsec which is a fork of parsec that’s actually maintained
13:34 <dysfun> sweet!
13:34 <dysfun> thank you
13:35 <cocreature> obviously you can’t use the combinators that are specific to unicode text if you are parsing some other type
13:36 <dysfun> yeah :)
13:36 fizruk joined
13:36 tyler569 joined
13:36 <dysfun> i just want the combinators really
13:36 <dysfun> still, mind kinda blown that this works
13:36 jgt1 joined
13:37 <ij> Are pattern match failures catchable?
13:37 <Eduard_Munteanu> ij, yes, there's an exception for that
13:37 <Gurkenglas> ij, if a pattern match of form "Constructor x <- monadicaction" fails, that calls fail
13:38 fotonzade joined
13:38 tyler569 left
13:38 <ij> It's a (a:[]) kind of match that fials.
13:39 <Eduard_Munteanu> https://hackage.haskell.org/package/base-
13:39 fizruk joined
13:40 <Gurkenglas> ij, (a:[]) is [a] even for matching and that's not a form of pattern match the way I meant it because it could be "[x] <- monadicaction"
13:41 glamas joined
13:41 meba joined
13:42 Guest94198 joined
13:43 peterbec` joined
13:44 _sg joined
13:44 <Gurkenglas> How do i ask lambdabot "What type does this part of this expression need to have in order to have the whole expression have this other type?"
13:44 fendor joined
13:45 piyush-kurur joined
13:45 <mauke> :t [ ord ?x ] :: [Int]
13:45 <lambdabot> (?x::Char) => [Int]
13:46 chichou joined
13:46 vydd joined
13:46 vydd joined
13:46 <piyush-kurur> Is there no more stage restriction for TH ?
13:46 `^_^v joined
13:46 <Gurkenglas> :t [ ?f ] :: a
13:46 <lambdabot> error:
13:46 <lambdabot> • Couldn't match expected type ‘a1’ with actual type ‘[t0]’
13:46 <lambdabot> ‘a1’ is a rigid type variable bound by
13:47 <piyush-kurur> When using lens package, it looks like makeLenses can build lenses for types defined in the module?
13:47 fizruk joined
13:47 stef204 joined
13:48 ystael joined
13:48 ozgura joined
13:49 asthasr joined
13:49 RoyalNightGuard joined
13:53 coltfred joined
13:55 bollu joined
13:55 rossberg joined
13:55 <redpoppies> how does one use the servant NoContent type?
13:56 <redpoppies> I get " No instance for (Accept NoContent) arising from a use of ‘serve’"
13:56 blender joined
13:56 guampa joined
13:57 <redpoppies> I want to define a route "login" :> Verb OPTIONS 200 '[NoContent] NoContent
13:58 wroathe joined
13:59 govg joined
14:00 <redpoppies> ok, it seems that media type cannot be NoContent
14:00 <redpoppies> so "login" :> Verb OPTIONS 200 '[JSON] NoContent
14:01 <redpoppies> for CORS preflight request done by hand
14:01 fizruk joined
14:01 bhiliyam joined
14:02 connrs joined
14:03 anRch joined
14:03 agjacome joined
14:03 coot joined
14:04 eacameron joined
14:05 burtons joined
14:06 Guest92118 joined
14:07 joneshf-laptop joined
14:07 <bollu> does recursion schemes eliminate the need for "visitor pattern"?
14:09 Wuzzy joined
14:12 feynhat joined
14:12 sssilver joined
14:13 mmn80 joined
14:13 <dolio> "Visitor pattern" is one of the ones they had to invent because they didn't have first-class functions.
14:13 cdg joined
14:14 <mauke> I thought visitor was because they didn't have multiple dispatch
14:14 <bollu> I think it also useful to keep state when you walk
14:15 <bollu> down an AST
14:15 <bollu> so, like, that would be some sort of paramorphism?
14:15 fizruk joined
14:15 ozgura joined
14:16 dan_f joined
14:16 ixxie joined
14:17 mkoenig joined
14:17 asmyers joined
14:18 dmiles joined
14:20 splanch joined
14:20 dmiles joined
14:21 wildlander joined
14:22 edmundsecho joined
14:27 magneticduck joined
14:27 ChristopherBurg joined
14:28 <centril> visitor because no proper ADTs
14:29 <centril> having recursive pattern matching down an AST is easy when you have case analysis
14:29 crobbins joined
14:29 <centril> hence, in Rust, you can do it just like in haskell with match (case) expressions
14:31 takle joined
14:31 JuanMiguel joined
14:32 dmiles joined
14:35 Destol joined
14:36 zcourts joined
14:36 HarveyPwca joined
14:37 RoyalNightGuard joined
14:37 roconnor joined
14:38 <roconnor> Is it really true that Data.Array is not part of base?
14:38 <davean> roconnor: of course
14:39 bennofs joined
14:39 <roconnor> Hmm, I forgot that the definition of base isn't what is in Haskell 2010. ... Its what's required to build GHC??
14:40 <davean> several non-base packages are required to build GHC
14:40 <davean> array is one of them
14:40 <reactormonk[m]> I'm creating a little package with aeson instance for a custom data types - which module name should I use? Reusing the same one as the data type doesn't work.
14:40 <roconnor> oh, it's what's required for the Prelude ... plus System.IO ... I don't really get the criterion.
14:40 <reactormonk[m]> ... recursive import, etc.
14:41 bennofs1 joined
14:45 peterbec` joined
14:46 pera_ joined
14:47 takle joined
14:48 eklavya joined
14:49 epsilonhalbe joined
14:49 bvad joined
14:50 carlomagno joined
14:50 Jesin joined
14:50 kritzcreek_ joined
14:50 oisdk joined
14:53 tsani joined
14:53 jsgrant__ joined
14:54 epsilonhalbe left
14:54 aarvar joined
14:56 bvad joined
14:56 akegalj joined
14:56 takle joined
14:57 al-damiri joined
14:57 laplacian joined
14:57 <akegalj> hey guys. Are we maintainers of ircbrowse.net ? Seems like its down. Visiting http://ircbrowse.net/browse/haskell for example throws "libpq: failed (another command is already in progress)"
14:58 WarmCookie joined
15:00 <akegalj> ok, I contacted maintener. Thanks
15:02 <WarmCookie> Hi. I'm looking at dataflow languages / reactive programming and wondering something. In more familiar languages, people have some data (state, registers, whatever) and they manipulate the control-flow (if-else, short-circuiting, monads, etc) to transform the data... with dataflow/reactive, it's the opposite, the program stays still and it's the data that is passed around. A given block of code wont execute until all its inputs
15:02 <WarmCookie> Which leads to my question; how to one guarantees the effects are carrried out in the proper order?
15:03 eazar001 joined
15:04 jespada joined
15:04 uglyfigurine joined
15:06 nicknovitski joined
15:06 <bvad> WarmCookie: I think you question got cut off
15:06 asmyers joined
15:07 ft3 joined
15:08 <WarmCookie> http://lpaste.net/354680
15:09 <Tuplanolla> I can't talk much about reactive, but when monads are used for io, ordering is created by imposing an artificial dependency between computations.
15:09 <Tuplanolla> The dependent value itself, however, is erased by the compiler.
15:09 <WarmCookie> Tuplanolla: The thing is that monads are necessarily chained. So the sequencing of the IO actions is (more or less) easy to reason about.
15:10 baldrick joined
15:11 <Tuplanolla> It shouldn't be that different in data flow paradigms. Only the dependencies may form a dag instead of a chain.
15:11 <WarmCookie> But I believe you're able to have independent "dependency graphs" in a given application with reactive/dataflow, and coordinating the effects seems really hard.
15:11 gawen joined
15:11 hN joined
15:11 blender joined
15:11 <WarmCookie> Tuplanolla: Also, does it means that with a data flow paradigms, lazy evaluation is also preferred?
15:11 flatmap13 joined
15:12 litchblade joined
15:12 soniku joined
15:12 <Tuplanolla> Not necessarily.
15:12 akfp joined
15:12 takle joined
15:12 <WarmCookie> e.g. Imagine node A, B, C, D, E where A and B are connected to C, and then C and D are connected to E. What happens if C has effects?
15:13 <WarmCookie> *What happens if D has effects?
15:13 nakal_ joined
15:14 conal joined
15:14 <WarmCookie> Are the effects carried out right away but the resulting value isn't needed by E until C finishes too, or only when C finishes will D be evaluated?
15:14 orhan89 joined
15:14 <akfp> if I have a, b, c, d, e :: (Functor f, Monoid a) f a and I want to create a new `f a` that has mappended all of a..e, is there a way to lift <> to all of them in a simple manner? Some applicable syntax maybe?
15:14 orhan89_ joined
15:14 <byorgey> WarmCookie: yes, you typically want dataflow/reactive languages to be pure, because of exactly this problem.
15:14 giovanni joined
15:14 giovanni left
15:14 <WarmCookie> byorgey: But even if it's pure, don't you have this exact problem regardless?
15:15 <byorgey> WarmCookie: by "pure" I mean computations have no effects.
15:15 <WarmCookie> byorgey: Oh, nevermind, I see what you mean. You'd have your inputs and outputs (I/O) that are effectful necessarily be terminating nodes of the graph.
15:15 <WarmCookie> Not in the middle.
15:16 <byorgey> well, even if they are terminating nodes in the graph, if there is more than one you would have the same problem.
15:17 <WarmCookie> byorgey: Then maybe I can design it such that you have only one input and one output that's a magical `IO`.
15:17 <WarmCookie> Kinda like Haskell's realworld.
15:18 <byorgey> this actually sounds much more like Haskell's older model for I/O, where input and output are modeled as magic lazy lists
15:18 <fendor> hello guys, i could not install intero since terminfo seems to be missing, any idea what could have gone wrong
15:18 takle joined
15:18 <rotaerk> I need a function of type DreamWorld -> RealWorld
15:18 <geekosaur> fendor, what platform/distro?
15:19 <Tuplanolla> That's you, rotaerk.
15:19 <c_wraith> rotaerk: have you tried coffee?
15:19 <rotaerk> heh
15:19 <byorgey> rotaerk: I can give you a function of type DreamWorld -> IO (Maybe RealWorld), will that do?
15:19 <c_wraith> byorgey: that sounds almost like quantum suicide...
15:19 <fendor> geekosaur, solus
15:19 <byorgey> hehe
15:20 <WarmCookie> inception :: IO Dream(Dream(Dream(Dream Limbo))))
15:21 <WarmCookie> byorgey: Thanks for the food for thought. I'll try to work out the semantics and figure out the implications.
15:21 <byorgey> sure, have fun
15:21 <reactormonk[m]> stack build works, but cabal configure fails - it doesn't find anything.
15:23 <joneshf-laptop> How do you manage your hackage account?
15:24 <joneshf-laptop> This is the only link I see on the site: https://hackage.haskell.org/accounts
15:25 <hexagoxel> joneshf-laptop: http://hackage.haskell.org/user/$USER -> bottom link
15:25 jeltsch joined
15:26 forgottenone joined
15:26 ragepandemic joined
15:27 <joneshf-laptop> hexagoxel, thanks! How did you figure that out?
15:28 <hexagoxel> i was aware of the /user/ pages, and the rest is trivial.
15:29 obadz joined
15:29 <joneshf-laptop> k
15:29 <hexagoxel> so you think it is not very reachable from frontpage, you may be right :)
15:29 orhan89 joined
15:29 <hexagoxel> s/so you/so if you/
15:29 orhan89_ joined
15:30 tsani joined
15:31 <geekosaur> fendor, do you have the ncurses package installed? (OS package *not* haskell package)
15:31 yellowj joined
15:32 <reactormonk[m]> Can I somehow pull in arbitrary instances from the tests of another package?
15:32 <joneshf-laptop> hexagoxel, :)
15:33 urodna joined
15:33 <fendor> yep
15:34 guampa joined
15:35 BlueRavenGT joined
15:36 Ferdirand joined
15:37 iomonad joined
15:39 JagaJaga joined
15:39 <sternenseemann> reactormonk[m]: you can, but I wouldn't recommend it, if you don't already depend on that package
15:39 jgt1 joined
15:39 <sternenseemann> reactormonk[m]: because, dependency hell etc.
15:39 <geekosaur> then I think you need to provide more information. I'm not familiar with solus but I did trck down its ncurses package and it looks like it should work
15:39 <geekosaur> @paste full build log
15:39 <lambdabot> Haskell pastebin: http://lpaste.net/
15:39 <geekosaur> ^ pastebin, NOT into the channel!
15:40 aarvar left
15:40 <reactormonk[m]> sternenseemann: oke.
15:40 trism joined
15:41 <sternenseemann> reactormonk[m]: it is imported if you do something like import Module (Type (..)), then you should have the instances as well…
15:41 boombanana joined
15:43 <glguy> reactormonk[m]: No, you can't depend on the tests of another package
15:43 <glguy> at least if the tests are actually in their own tests component of the package
15:45 orhan89 joined
15:45 orhan89_ joined
15:47 zenware left
15:47 <reactormonk[m]> So there's no way to declare a non-orphan instance outside of the origin package of the data type?
15:48 revprez_atlanta joined
15:48 <hexagoxel> `reachable :: Ord a => [a] -> Map a [a] -> Set a` does not exist somewhere already, does it?
15:48 <ongy> to not be orphan you have to be in either the types or classes definition file
15:49 nicknovitski joined
15:49 yagtusharen joined
15:50 <cocreature> reactormonk[m]: an instance is already considered orphan if it is defined outside of the _module_ (not package) of either the class or the data type.
15:50 <geekosaur> 'orphan' is not a state you can set, 'orphan' is a description of it not being defined in the same place as either the class or the instance
15:50 hurkan joined
15:50 <Gurkenglas> Why don't we have orphan instances attached to the relevant modules by the compiler so searching for instances isn't a problem?
15:50 <Gurkenglas> Hackage could make links like with reverse dependencies, and ghci could say where instances come from
15:50 <joneshf-laptop> hexagoxel, oh wow, this is a thing: https://hackage.haskell.org/api
15:51 Guest12 joined
15:51 butterthebuddha joined
15:52 iulian joined
15:52 ilyaigpetrov joined
15:52 <joneshf-laptop> I don't understand half of what it's saying though.
15:52 <glguy> Gurkenglas: If you load the package with an orphan instance into GHC, then GHC knows about the orphan instance. It's not a compiler problem
15:53 <butterthebuddha> Hey peeps, was reading through Learn You Haskell. The chapter on types and type classes says that the "Double" type has "double the precision". Is this strictly true, or they really mean "double precision" (which doesn't really mean double the precision, just double the bytes needed to store the number)
15:54 <Gurkenglas> glguy, but wasn't there a problem with ghc not knowing what modules orphan instances define instances for, and then each instance search has to go through the modules of the class, the type and all orphan modules for anything?
15:54 <davean> Gurkenglas: You're missing the problem
15:54 <davean> Gurkenglas: The problem is conflicts
15:54 <geekosaur> yes, it's being loose. it means whatever the platform floating point hardware means, which is usually its interpretation of what IEEE754 says
15:54 <davean> Gurkenglas: The orphan instances rules are about guarrenteeing stability of resolution
15:54 <geekosaur> ^ butterthebuddha
15:55 <butterthebuddha> geekosaur: Shouldn't the book be clear about "double precision" vs "double the precision" then?
15:55 <Gurkenglas> davean, ah. Are there already instances today where you can't have too many dependencies because then you get double orphans?
15:55 <geekosaur> butterthebuddha, if you can find the author then yes, thats a valid complaint to make
15:56 <geekosaur> the author is not here
15:56 <mnoonan> that seems like a white lie, at least.. doubles have more than double the precision of singles, if you measure by mantissa
15:56 <geekosaur> the author has not been seen since publishing it, and there's a long list of issues with the book
15:56 <geekosaur> to the point that some of us disrecommend its use
15:56 azahi joined
15:56 <davean> Gurkenglas: Sure, but you're still missing hte problem
15:56 <butterthebuddha> Ah, in that case, is there a better book I should use?
15:56 <geekosaur> @where learnhaskell
15:56 <lambdabot> https://github.com/bitemyapp/learnhaskell
15:56 <geekosaur> ^ list of resources
15:57 <glguy> butterthebuddha: Floating-point numbers aren't the point of the book. If you're hoping to learn about the details of IEEE 754, there are much better resources.
15:57 <geekosaur> Gurkenglas, orphan instances are a matter of cognitive load, not compile failures
15:57 <butterthebuddha> glguy: I know that, but "double the precision" is just factually wrong, isn't it?
15:57 <tabaqui> I need a some really fast search structure, but GC makes my current IntMap much slower after some time
15:57 <tabaqui> I need about 4k requests per second
15:58 <tabaqui> typical loop - insert, 3-4 search and delete
15:58 <glguy> butterthebuddha: Probably, but it just doesn't matter in this context
15:58 <tabaqui> is there something much faster than IntMap?
15:58 <tabaqui> *3-4 searches
15:58 <geekosaur> well, they can be a source of compile failures when multiple orphans conflict, but that is again no a problem with the compiler, it's a problem with users of modules knowing what instances are where
15:58 conal joined
15:58 <geekosaur> tabaqui, often Map itself is faster, or HashMap from unordered-containers
15:58 <geekosaur> try it and benchmark
15:59 <davean> Gurkenglas: The orphan rules are about not being surprised by *which* instance you get
15:59 Destol joined
16:00 <tabaqui> geekosaur: yeah, I know about containers/unordered-containers
16:00 <Tuplanolla> It's "double the precision" if you accept that 52 is roughly 23 times two, butterthebuddha.
16:00 <davean> Gurkenglas: non-orphan instances *will always cause a conflict* with an orphan, leading to a compile error so you never are at risk of having a non-orphan instance vary due to your includes
16:00 mikecaruso joined
16:00 <davean> Gurkenglas: orphan instances can lead to various instance resolution by what you dependd on and include
16:00 <tabaqui> dunno, maybe somebody is working on *specific* library
16:01 orhan89 joined
16:01 orhan89_ joined
16:01 gcross_ joined
16:02 <cocreature> tabaqui: you only need search and not insert?
16:03 meck joined
16:03 Guest12 joined
16:03 cmsmcq joined
16:03 <davean> Gurkenglas: do you now understand the issue with orphan instances?
16:03 butterthebuddha joined
16:05 jgt1 joined
16:06 <butterthebuddha> Uh, I have a more conceptual question about functional programming. I haven't had much exposure to functional programming before, but as a C programmer, I'm a little uncomfortable with the idea of variables never changing their value
16:06 <tabaqui> cocreature: full pocket: insert, search, delete
16:06 <butterthebuddha> Doesn't this lead to a lot of memory wastage?
16:06 <cocreature> tabaqui: ah ok, then a sorted unboxed vector won’t work
16:06 <davean> butterthebuddha: why would it? ;)
16:07 <davean> butterthebuddha: it can lead to no wastage at all
16:07 <butterthebuddha> davean: I'm imagining a situation where I have a _reaaaalllly_ big list
16:07 <davean> butterthebuddha: ok, so what?
16:07 SpinTensor joined
16:07 hsk3 joined
16:07 <butterthebuddha> To simply double every element of said list, I have to declare a *new* list
16:07 <butterthebuddha> Which means I'm not using double the memory
16:07 <tabaqui> butterthebuddha: actually, haskell arrays make programmers cry
16:07 <geekosaur> not always
16:07 <davean> Nope, you're not
16:07 <davean> butterthebuddha: not if you only want the doubled list
16:08 <tabaqui> but usually you can avoid them
16:08 <davean> butterthebuddha: the first list is no longer referenced, so it doesn't have to be in memory
16:08 <butterthebuddha> I imagine haskell has some way of optimizing this, and I'd love to how
16:08 <davean> it might be in memory, it might not
16:08 <butterthebuddha> know how*
16:08 <geekosaur> purity means the compiler can detect that nothing else is using it and mutate it in place. you describe what you want and let the ocmpiler figure out how to do it, rather than spelling it out
16:08 <tabaqui> davean: QuickSort is still a problem
16:08 govg joined
16:08 <Gurkenglas> davean, because it can cause silent compilation errors when you include the wrong thing, like anything else can, but only rarely, because usually the type is also wrong?
16:09 <Gurkenglas> -compilation
16:09 <davean> Gurkenglas: bah, no, you've missed it entirely
16:09 <butterthebuddha> geekosaur: and I imagine the list isn't mutated in place I do reference the original list again?
16:09 <hsk3> Using Haskell Stack with Docker. Why do they make it sound like this complicated mess? https://docs.haskellstack.org/en/stable/docker_integration/
16:09 <hsk3> Shouldn't it just be as simple as 1. creating a new docker image based on ubuntu, 2. download the stack binary, 3. download (or use from mounted volum) and compile your stack program, and 4. launch your executable with stack?
16:09 <hsk3> Why do they complicate things so much with that other stuff there, such as permissions stuff?
16:09 <hsk3> What am I missing?
16:09 <geekosaur> butterthebuddha, it's not whether you reference it again, it's what *else* is referencing it
16:10 <Gurkenglas> hah, missed a "not" in your line davean
16:10 <butterthebuddha> OKay yeah, that makes sense. *sigh* the idea of trusting the compiler to do this for me still makes me uncomfortable as an imperative programming :)
16:10 <Gurkenglas> sure, if there's a non-orphan instance then you can't write orphans because they'd overlap
16:10 <butterthebuddha> programmer*
16:10 <davean> butterthebuddha: as soon as you no longer reference something, the system is allowed to free that memory, that memory might be instantly reused
16:10 <Tuplanolla> In C terms, butterthebuddha: if you have two `const` variables with disjoint use sites in scope, they'll most likely live in the same register.
16:11 danthemyth joined
16:11 Micamo joined
16:11 <Gurkenglas> If not knowing where to look for the orphan isn't the problem, and two orphans from different packages aren't the problem, what's the problem?
16:11 splanch joined
16:11 <Tuplanolla> You have to trust the compiler to do that too.
16:11 <EvanR> yeah you already rely on mysterious C compiler behavior to get performance
16:12 fotonzade joined
16:12 <EvanR> C runs on a virtual machine which people have vague ideas about performance, only becoming concrete through the compiler
16:12 <geekosaur> hsk3, I "love" it when "why complicate with ... permissions stuff" comes up, it demonstrates why some programmers are why websites get compromised all the time
16:13 <hsk3> geekosaur well in that case they're actually reducing security a bit, as explained..
16:13 soniku joined
16:14 <hsk3> i'm just wondering why they make things sound special. why build a "docker" command into stack? ("stack docker ...")
16:14 <hsk3> i wonder why it's not just like any other program that you happen to run inside of a docker image
16:14 <hsk3> i.e., why stack isn't totally unaware of docker
16:14 <hsk3> :)
16:14 <davean> EvanR: C is a lovely template language for ASM
16:14 <centril> butterthebuddha: you might be interested in Rust - which is sorta imperative but also pretty functional and is a systems programming language with stronger guarantees about mutation, no data-races, etc.
16:14 sz0 joined
16:14 <EvanR> no its not
16:15 <EvanR> except for the part where you can inline asm
16:15 <centril> davean: if C is a lovely template language for ASM, then so is Haskell...
16:15 <davean> centril: nah, that doesn't hold
16:16 <EvanR> so much asm cant be accessed with regular C code, assuming you know what the compiler will do
16:16 <butterthebuddha> EvanR: I do rely on compilers optimizing my code, but it's still lower level than Haskell
16:16 <centril> EvanR: usually you have intrinsics
16:16 orhan89 joined
16:16 orhan89_ joined
16:16 <butterthebuddha> (I have more control of what the hardware is gonna do in terms of memory etc.)
16:16 <centril> butterthebuddha: what do you mean by "lower level" ?
16:16 <EvanR> ghc has that
16:17 <EvanR> no doubt C is a lower level language, just that isnt very precise
16:17 <butterthebuddha> That said, my knowledge of Haskell doesn't extend beyond defining variables at this point
16:17 <EvanR> not to mention at one point C was considered high level !
16:17 <davean> EvanR: GHC doesn't really have intrinsics, see SSE/AVX issues for an example
16:17 <centril> butterthebuddha: manual memory manipulation + memory addressing doesn't mix well with purity
16:17 <EvanR> yes right about that
16:18 Sampuka joined
16:18 wildlander joined
16:18 <davean> EvanR: its really sad, if we *did* I'd do so much more
16:18 anohigisavay joined
16:18 <EvanR> centril: you can have a big blob of mutable bytes
16:18 <davean> but it doesn't really give you guarentees that lead to nice intrinsics
16:18 <EvanR> it just not the entire process space
16:18 <butterthebuddha> centril: Yep, I understand that. I am actually learning Rust right now.
16:18 burtons joined
16:18 <centril> butterthebuddha: Rust is strongly typed unlike C
16:18 <anohigisavay> hi. i'm submitting some haskell code on an OJ system. and it does not meet the time demand
16:19 <butterthebuddha> I was really intrigued by functional programming, which is why I'm learning Haskell right now
16:19 <EvanR> nice
16:19 <centril> EvanR: you can have a big blob of mutable bytes, but how are you going to mutate them outside of the IO monad and preserve purity ?
16:19 <rotaerk> anohigisavay, OJ system? time demand?
16:19 <EvanR> i hope your mind explodes regularly
16:19 <mauke> orange juice
16:19 <butterthebuddha> EvanR: that's the plan haha
16:19 <EvanR> centril: youre either not because its not important, or theres ST
16:20 <rotaerk> OJ System is innocent !
16:20 Brokenprogrammer joined
16:20 <Brokenprogrammer> zz
16:20 <mauke> programming exercise / online judge
16:20 <anohigisavay> rotaerk, online judge system. it has ghc which i have no idea which version
16:20 <centril> EvanR: well, that would involve RealWorld
16:20 <statusbot> Maintenance update: performing restart now -- http://status.haskell.org/pages/maintenance/537c07b0cf1fad5830000093/58f4e495c9a00f490e000589
16:20 <EvanR> centril: you can also do it purely, and lose efficiency
16:20 <anohigisavay> http://lpaste.net/354683
16:21 <EvanR> centril: RealWorld? i dont think that is correct
16:21 <Brokenprogrammer> @mauke is there online judges with exercises that accepts Haskell ?
16:21 <lambdabot> Unknown command, try @list
16:21 <anohigisavay> seems most of the time is spent on I/O
16:21 <centril> EvanR: the whole point of impure mutability is efficiency here
16:21 <EvanR> if you want to use haskell like C in the capacity that you have "control over memory" then you can in various ways
16:21 <centril> anyways... back to work...
16:22 <EvanR> just saying
16:22 <EvanR> i would argue thats not entirely the whole point, in some cases it actually just makes more sense to solve your problem that way
16:22 <mauke> Brokenprogrammer: http://www.spoj.com/
16:22 <EvanR> but you can also get efficiency in ghc
16:22 <Brokenprogrammer> mauke: Thanks buddy! :)
16:23 <anohigisavay> the question is about reversing a linked list every n elements
16:24 <Tuplanolla> The repeated calls to `putStr` worry me, anohigisavay.
16:25 <anohigisavay> Tuplanolla, i was using printf, but it gets worse
16:25 <statusbot> Maintenance update: hackage is up again! -- http://status.haskell.org/pages/maintenance/537c07b0cf1fad5830000093/58f4e495c9a00f490e000589
16:25 <Tuplanolla> It might be a better idea to concatenate the string and call `putStr` once.
16:26 <Tuplanolla> Using `shows`, that is.
16:26 <anohigisavay> Tuplanolla, thanks, will give it a try
16:26 <Tuplanolla> Not `show`, mind you.
16:27 <anohigisavay> Tuplanolla, shows :: Show a => a -> ShowS ?
16:27 Destol joined
16:27 albertus1 joined
16:27 <anohigisavay> thanks, first time i knew it
16:28 mjhoy left
16:29 HarveyPwca joined
16:29 mikecaruso joined
16:29 peterbecich joined
16:31 sam1902 joined
16:31 <sam1902> Hello, world !
16:31 fgaz joined
16:31 <lambdabot> Hello.
16:31 kadoban joined
16:31 Velpoman joined
16:32 orhan89 joined
16:32 orhan89_ joined
16:32 tristanp joined
16:34 revprez_atlanta joined
16:35 dc0de joined
16:36 C01nHnt3r joined
16:36 C01nHnt3r left
16:38 <sam1902> Haskell is awesome
16:40 Ferdirand joined
16:41 Destol joined
16:41 caumeslasal joined
16:41 sigmundv joined
16:41 <edwardk> sam1902: such is my experience as well
16:42 <anohigisavay> Tuplanolla, thanks! now it has huge speed boost, and total alloc is down by a half
16:42 <sam1902> edwardk: I'm learning (started 5 minutes ago) and following a tutorial. The author call the language "lazy", is that the term used in english to describe it ?
16:42 <anohigisavay> but still time exceeded
16:42 <anohigisavay> i now worry there's bug in my code
16:43 mada joined
16:43 <edwardk> sam1902: 'lazy' is referring to the fact that in most languages when I give you an Int or something it is a machine integer. in haskell it is instead some computation that will produce a machine integer when finally asked and won't do any work up until it is 'forced' to do so, whereupon it'll replace itself with its answer.
16:43 <edwardk> this means you can call functions with as-yet-undetermined values for arguments, and if the function doesn't use them it can still terminate, even if it
16:43 <butterthebuddha> How do you guys recommend unit testing in Haskell?
16:43 <edwardk> 'd take forever to compute those things
16:43 <edwardk> butterthebuddha: i tend to write doctests and use lots of parametricity to ensure that thats good enough
16:44 <sam1902> Ok that's what I thought, thanks for confirming my beliefs ^_^
16:44 <butterthebuddha> I was going through HUnit's documentation, and I'm having a hard time understanding :(
16:44 <anohigisavay> (i always wonder how to test IO. say HTTP requests and mock/shim stuff
16:45 <edwardk> sam1902: when everything in your language is lazy you have to care a lot about side-effects, this leads to all the initially weird seeming stuff about monads and the like, but once you get your head around it, you can find that algorithms tend to compose better when they are made out of lazy parts
16:45 <sam1902> Oh ok, that'll be interesting I think
16:45 <edwardk> anohigisavay: write a class for the operations you want to supply, then build a mocked up interface using a custom monad, test against that specification.
16:45 <srhb> butterthebuddha: You were just getting started right? Test driven development usually looks a lot different in Haskell. I wouldn't really spend my time there initially. :)
16:45 <srhb> Not that HUnit is hard or anything.
16:45 osa1 joined
16:45 osa1 joined
16:46 <srhb> There are just better ways to spend your time initially.
16:46 <edwardk> :t readFile
16:46 <lambdabot> FilePath -> IO String
16:46 <anohigisavay> edwardk, wow thanks that sounds promising :D
16:46 splanch joined
16:46 <edwardk> class Monad m => MonadReadFile m where readFIle :: FilePath -> m String
16:46 peterbec` joined
16:46 <edwardk> instance MonadReadFile IO where readFile = Prelude.readFile
16:47 <edwardk> now you can make your own mock monad with its own instance that, say, dumps fixed text out
16:47 <edwardk> or whatever you want
16:47 <anohigisavay> oh i see, looks easier than i thought :)
16:47 <edwardk> for a more advanced version you can use free monads and/or data types a la carte, etc.
16:48 <butterthebuddha> srhb: yeah makes sense
16:48 <butterthebuddha> I can't figure out which library to include to make "print" work though :/
16:48 <srhb> butterthebuddha: print is in Prelude, so imported by default.
16:48 <srhb> butterthebuddha: You may be confused because print isn't putStrLn ?
16:49 <sam1902> How to you exite ghci's "Prelude>" thing ?
16:49 <edwardk> anohigisavay: that said, there is also Test.QuickCheck.Monadic, etc. which can be used to test simple, reproducible IO actions
16:49 <butterthebuddha> sam1902: EOF (Ctrl-D)
16:49 <edwardk> anohigisavay: so you have more than one option here
16:49 <srhb> sam1902: :exit, :quit, Ctrl-d
16:49 <sam1902> Oh, so Ctrl-C don't qork
16:49 <butterthebuddha> srhb: aight. I am getting a "naked expression at top level" error that I'm not sure how to fix
16:49 <sam1902> and :exit don't work too
16:49 <sternenseemann> sam1902: yeah, Ctrl-C is for terminating the execution of things you entre there
16:49 <sam1902> but :quit do, thanks
16:49 <sternenseemann> sam1902: like endless recursion
16:50 <sam1902> ok
16:50 <srhb> butterthebuddha: You can't simply have expressions at the top level. Only name = value pairs (and some other things you'll get to)
16:50 <butterthebuddha> srhb: and it's on the line I am calling my print fuction on
16:50 <sam1902> I usually exit any program
16:50 <sam1902> too
16:50 <butterthebuddha> srhb: "print todigits 23 == [2, 3]"
16:50 <srhb> butterthebuddha: Oh.
16:50 fgaz_ joined
16:50 <srhb> butterthebuddha: You probably mean `main = print (toDigits 23 == [2, 3])
16:51 <byorgey> butterthebuddha: that looks like something you would enter at the ghci prompt. You can't just have expressions on a line by themselves in a .hs file
16:52 <butterthebuddha> Aight
16:52 <butterthebuddha> I'm also curious how the "print" function works without having any side effects
16:52 <butterthebuddha> Isn't printing by definition a side effect?
16:52 <srhb> butterthebuddha: Down the rabbit hole you go... :-)
16:53 <butterthebuddha> Can I assign to "main" multiple times if I want to have multiple print statements?
16:53 <srhb> butterthebuddha: No, but look up do notation. Do you have a reference book or something you're following?
16:54 <butterthebuddha> I'm working through this -> https://www.seas.upenn.edu/~cis194/spring13/lectures.html
16:54 <srhb> butterthebuddha: You'll get to it then. :)
16:54 <butterthebuddha> But I need to check if my function definitions work
16:54 <sam1902> What mean "NaN" ? I tried to do 8/0 and the prompt returned Infinity so I tried to do 8/0*0 and it said "NaN"…
16:54 feynhat joined
16:54 <srhb> sam1902: Not A Number
16:54 <sam1902> Oh
16:55 <sam1902> ok, great
16:55 <Hafydd> sam1902: that is specific to IEEE 754 floating point numbers: https://en.wikipedia.org/wiki/NaN
16:56 <sam1902> I don't have to read every docs
16:56 <Hafydd> Compare for integers:
16:56 <sam1902> I do read some (e.g. Haskell)
16:56 <Hafydd> > (1 `div` 0) * 0
16:56 <lambdabot> *Exception: divide by zero
16:56 <sam1902> > 8/0*0
16:56 <lambdabot> NaN
16:56 <EvanR> if you dont understand it, you cant control it
16:56 <sam1902> Oh so you've got an Haskell bot, that's great !
16:57 <EvanR> were lucky to have docs in some cases to help understanding
16:57 <sam1902> Yep, but no need to read all of them if you don't need "help to understand"
16:57 <geekosaur> ieee floating point is something you have to understand, really, and most programmers don't bother and then wonder why they get weird behavior
16:58 dsh joined
16:58 <srhb> butterthebuddha: Okay, I feel sort of bad giving you the "short story" but... :-P http://lpaste.net/5509242515804389376
16:58 <srhb> butterthebuddha: Basically it's a shorthand form of composing multiple "actions" (which, again, you'll get around to)
17:00 <srhb> butterthebuddha: week 8 of the spring 2013 version has the real story.
17:00 <srhb> butterthebuddha: It also answers your other question wrt. side effects somewhat, but I really recommend taking it in order :-)
17:03 fendor joined
17:04 flatmap13 joined
17:04 insitu joined
17:09 <butterthebuddha> Sooo I'm trying to return the reverse of a number as list of digits
17:10 <butterthebuddha> And I'm not sure how to go from 001 -> [1, 0, 0]
17:10 RoyalNightGuard joined
17:11 <butterthebuddha> This is what I have so far -> https://gist.github.com/awesomeaniruddh/a3dcd590d0e9233d42e68bc883f1263c
17:11 blender joined
17:11 <srhb> > 001
17:11 <lambdabot> 1
17:12 _sg joined
17:12 <cocreature> you can’t differentiate between the Integer 001 and the Integer 1
17:13 <sternenseemann> > 001 == 1
17:13 <lambdabot> True
17:13 <butterthebuddha> Aight, I won't worry about it then :P
17:13 <* geekosaur> wonders what language butterthebuddha is used to?
17:13 <sternenseemann> indeed
17:13 <cocreature> iirc they mentioned C
17:13 <butterthebuddha> I just kinda forgot that that was a thing :P
17:14 <srhb> :-)
17:14 <butterthebuddha> (I've been working a lot with strings lately)
17:14 <srhb> You ruined the "guess the weird language game" now, though :-P
17:14 <Hafydd> Perhaps bash.
17:14 <sternenseemann> I don't think C has that problem
17:14 <sternenseemann> It can't
17:14 <sternenseemann> as long as you store numbers in binary form…
17:14 <cocreature> if in doubt the answer is always bash, php or perl
17:14 <butterthebuddha> ++ JavaScript
17:15 <Hafydd> (But in bash, integer literals starting with 0 are octal.)
17:15 <sternenseemann> inb4 php $number="000001234"
17:15 <butterthebuddha> Although JavaScript doesn't do that either afaik
17:15 <Hafydd> -" literal"
17:16 <sternenseemann> haha
17:18 <srhb> Wow, the error messages get strange when you feed ghc invalid literals
17:18 <srhb> > 0o8
17:18 <lambdabot> error:
17:18 <lambdabot> • Variable not in scope: o8
17:18 <lambdabot> • Perhaps you meant one of these:
17:18 <mauke> > 0 o8
17:18 <lambdabot> error:
17:18 <lambdabot> • Variable not in scope: o8
17:18 <lambdabot> • Perhaps you meant one of these:
17:19 doomlord joined
17:19 <* geekosaur> was thinking tcl, actually :p
17:19 <mauke> > let xs = [1,2,3] in elem 2xs
17:19 <lambdabot> True
17:19 <srhb> I.. what.
17:19 <Hafydd> GHCi is offended by your insolence! >8o
17:19 <srhb> I never knew that was a thing. :-P
17:20 Denthir joined
17:20 <srhb> A whole new level of obfuscation awaits.
17:20 <mauke> it's also a thing in perl
17:20 <mauke> but not C, funnily enough
17:20 howdoi joined
17:20 <mauke> in C it's a preprocessing number IIRC
17:20 <sternenseemann> it is possible to make valid gif files, that are valid haskell files
17:20 <butterthebuddha> Can I get the index of an element in a list comprehension?
17:20 <mauke> which is then a hard error
17:20 <shapr> sternenseemann: I like that idea
17:21 <butterthebuddha> I need to perform a computation on every other element of a list
17:21 <shapr> sternenseemann: yeah, it's totally possible
17:21 <srhb> butterthebuddha: They don't have indexes, it's alinked list, but you can build one.
17:21 <geekosaur> butterthebuddha, we generally zip with an index in that case
17:21 <Hafydd> sternenseemann: especially if they are literate Haskell files.
17:21 <sam1902> > cos pi/2
17:21 <geekosaur> and yes, lists are linked lists, not arrays/vectors
17:21 <lambdabot> -0.5
17:21 <ongy> > 015
17:21 <lambdabot> 15
17:21 <mauke> butterthebuddha: zip [0 ..] yourListHere
17:21 <sam1902> cos (pi/2)
17:21 <sam1902> > cos (pi/2)
17:21 <ongy> what's used for base8 literals in ghc?
17:21 <lambdabot> 6.123233995736766e-17
17:22 <mauke> > 0o15
17:22 <lambdabot> 13
17:22 <srhb> ongy: 0o or 0O
17:22 <sam1902> isn't that supposed to be 0 ???
17:22 <ongy> oh, that was 0o8 earlier, /me fails to parse
17:22 <srhb> sam1902: Function application has higher precedence than operator application
17:22 <mauke> sam1902: welcome to floating point numbers
17:22 <Hafydd> 0ongy
17:22 <ongy> both exist, but the 0o fit's better with 0b and 0x
17:22 <sternenseemann> shapr: I've done it already for a ctf, you had to upload a gif to execute it. You have to make the gif header sequence a data type and a Num instance for it…
17:23 <srhb> sam1902: Oh, you saw that :)
17:23 <sternenseemann> Hafydd: it works with normal one as well.
17:23 <sternenseemann> Hafydd: but .lhs is probably easier, indeed :D
17:23 <mauke> sternenseemann: https://raw.githubusercontent.com/mauke/poly.poly/master/yes.c
17:23 <sam1902> srhb: why do you mean ? if I ask the cos of pi/2 I'm hoping to get 0 so is that a problem of floating point or og haskell ?
17:23 <geekosaur> > showFFloat (Just 6) (cos (pi / 2)) ""
17:23 <lambdabot> "0.000000"
17:23 yellowj joined
17:24 <geekosaur> sam1902, haskell is "at fault" in showing full precision by default
17:24 <sternenseemann> mauke: haha!
17:24 <geekosaur> floating point is not exact
17:24 <srhb> sam1902: I was answering regarding the difference between cos (pi/2) and (cos pi)/2, which you never asked for. ;-)
17:24 <butterthebuddha> Better way to write this? -> "doubleEveryOther n = [ c + c | i <- [0..], c <- reverse n, i `mod` 2 == 0 ]"
17:24 <sam1902> Ok so it's just floating point, ok fine
17:24 <EvanR> > cos (pi/2) :: CReal
17:24 <lambdabot> 0.0
17:24 <EvanR> hehe
17:24 <sam1902> srhb: Yeah I noticed something was wrong and I corrected it ^^
17:24 <sternenseemann> > 0.2 + 0.3
17:24 <lambdabot> 0.5
17:25 <sam1902> > cos(pi/2) * 5
17:25 <lambdabot> 3.061616997868383e-16
17:25 <geekosaur> see the showFFloat I did earlier which uses a specified precision for display
17:25 <sternenseemann> > 0.1 + 0.2
17:25 <lambdabot> 0.30000000000000004
17:25 <sternenseemann> sam1902: ^
17:25 <sternenseemann> welcome to ieee floating point
17:25 <mnoonan> butterthebuddha, I don't know that it's better, but you could do..
17:25 <sam1902> what does the other F stands for in showFFloat ?
17:25 <mnoonan> > [ f x | (f,x) <- zip (cycle [id, reverse]) (words "This is a test.")]
17:25 <EvanR> get real
17:25 <lambdabot> ["This","si","a",".tset"]
17:26 <EvanR> show Formatted Float
17:26 codesoup joined
17:26 <mnoonan> or
17:26 <mnoonan> > zipWith ($) (cycle [id, reverse]) (words "This is a test.")
17:26 <lambdabot> ["This","si","a",".tset"]
17:26 <Cale> geekosaur: Yeah, I wonder how many complaints would be saved by simply leaving out the last digit
17:26 <sam1902> Oh thanks EvanR
17:26 <EvanR> same as the f in printf
17:26 <srhb> Cale: Eek. :-P
17:27 <geekosaur> actually it's F vs. E vs. G corresponding roughly to printf's %f %e %g
17:27 <sternenseemann> > printf "%.3f" (0.1 + 0.2)
17:27 <lambdabot> error:
17:27 <lambdabot> • Ambiguous type variable ‘a0’ arising from a use of ‘show_M475656480139...
17:27 <lambdabot> prevents the constraint ‘(Show a0)’ from being solved.
17:27 <sternenseemann> > printf "%.3f" (0.1 + 0.2 :: Double)
17:27 <geekosaur> and indeed there are also showEFloat and showGFloat
17:27 <lambdabot> error:
17:27 <lambdabot> • Ambiguous type variable ‘a0’ arising from a use of ‘show_M225227277666...
17:27 <lambdabot> prevents the constraint ‘(Show a0)’ from being solved.
17:27 <sternenseemann> ahrg
17:27 <geekosaur> you need a type
17:27 <ongy> the result of printf is something weird in haskell
17:27 <geekosaur> because printf is an evil hack
17:27 <Tuplanolla> > printf "%.3f" (0.1 + 0.2 :: Double) :: String
17:27 <lambdabot> "0.300"
17:27 <EvanR> oh, so it doesnt correspond to any word
17:28 <geekosaur> floating, exponential, general, I think
17:28 <sternenseemann> Tuplanolla: thx!
17:28 <geekosaur> where floating means the "conventional" floating decimal point
17:28 <Cale> > showFFloat (Just 16) (0.1 + 0.2)
17:28 <geekosaur> and "general" switches between F and E depending on the size of the number
17:28 <lambdabot> <[Char] -> [Char]>
17:28 <Cale> > showFFloat (Just 16) (0.1 + 0.2) ""
17:28 <lambdabot> "0.3000000000000000"
17:28 <sam1902> geekosaur: Whut I think there is a problem with showFFloat
17:29 <sam1902> geekosaur: whe I try showFFloat (Just 6) (cos (pi / 2)) "" I got an error
17:29 <geekosaur> import Numeric
17:29 <sam1902> oh thanks
17:29 <geekosaur> lambdabot has it imported by default, but ghci doesn't
17:29 <sam1902> ok that's way better
17:29 <geekosaur> @index showFFloat
17:29 <lambdabot> Numeric
17:29 chlong joined
17:29 <ongy> Numeric has a few interesting functions that should be more popular
17:30 <Tuplanolla> Fractional modulo when?
17:30 <sternenseemann> sam1902: if you want to have exact floating points, have a look at exact-real or similar packages
17:30 <sternenseemann> iirc exact-real has poor docs
17:30 <sam1902> sternenseemann: ok dank ^^
17:30 <EvanR> exact-real is documented fine
17:31 <sternenseemann> EvanR: oh okay, maybe I mixed up something there
17:31 <ongy> exact floating points in finite memory? What did I miss?
17:31 <EvanR> the one in lambdabot is Data.Number.CReal in the numbers package
17:31 <EvanR> "exact floating point" is not right
17:31 <Cale> ongy: The secret is they're not floating point
17:31 <sam1902> > "sam1902 is going afk now"
17:31 <lambdabot> "sam1902 is going afk now"
17:32 RoyalNightGuard joined
17:32 <sam1902> > " > \"inception ?\" "
17:32 <lambdabot> " > \"inception ?\" "
17:32 <ongy> > text "> \"Hi\""
17:32 <lambdabot> > "Hi"
17:32 <Cale> ongy: They're more likely something along the lines of functions which, given n will produce a rational approximation within 1/2^n of the appropriate real number.
17:32 <Zemyla> Oh, someone mentioned something about ADTs with mutable variables to Haskell, like somehow, say, data Test s = Test (Mutable s Float) (Mutable s Int) or something along those lines?
17:33 <sternenseemann> ongy: CReal restricts the precision explicitly iirc
17:33 <Cale> sternenseemann: It's infinite precision.
17:33 <Cale> You only need to pick a precision to display at
17:33 <cocreature> Zemyla: there is a GHC proposal about that
17:33 <EvanR> one implementation of reals is a sequence of dyadic rationals that approaches some limit, so a Natural -> Rational, the bigger n, the more precise and the more computation it takes to give you an approximation
17:33 <sternenseemann> Cale: oh nice
17:34 vtomole joined
17:34 <Cale> Which makes sense, because otherwise if you tried to display 1, it wouldn't terminate
17:34 <EvanR> 1 is a rational so the approximation is trivial
17:34 <sternenseemann> Cale: My only encouter with CReal was me fixing quickcheck properties, that would fail with Double :D
17:34 <EvanR> but sin(p/2) wouldnt terminate
17:34 heurist`_ joined
17:34 <bollu> EvanR: wow, so you literally store the cauchy sequence?
17:34 <Cale> EvanR: But there's no way to tell that
17:34 <bollu> that's mad
17:35 <Zemyla> cocreature: Is there a link?
17:35 <EvanR> many exact real systems have a special case for rationals
17:35 <EvanR> known rationals
17:35 <EvanR> bollu: you dont store it, you express it as a program
17:35 <cocreature> Zemyla: https://github.com/ghc-proposals/ghc-proposals/pull/8
17:35 <bollu> EvanR: yeah, I meant that
17:35 <Cale> EvanR: it might be 0.999999999999999999999999999999999999999999999999999997 or something, and the first bunch of approximations you try will be indistinguishable from 1
17:35 <Cale> but you were supposed to have been printing 9's and not 1.00...
17:35 <Cale> and you can't know
17:36 <bollu> Cale: in general, testing if a number in R is computable or not is undecidable right?
17:36 <EvanR> youre talking about digit sequences
17:36 <EvanR> not rational approximations
17:36 <Cale> bollu: sure
17:36 <EvanR> reals are provably not synonymous with digit sequences
17:36 <Cale> EvanR: I'm talking about the function which displays the computable real
17:36 {emptyset} joined
17:37 replay joined
17:37 Discovery joined
17:37 <EvanR> you mean output digits?
17:37 <Cale> yes
17:38 ninjazoete joined
17:38 <EvanR> yeah you cant really do that
17:38 <Cale> It's not really possible to stream out digits, because it can be impossible to know ahead of time which side of 1 you're going to land on
17:38 <EvanR> but you can always output a rational approximation
17:38 <Cale> right
17:38 <EvanR> and we already know digits are a bad way to show that anyway
17:38 <Cale> I was just explaining why you need to tell it how many digits to show
17:38 <EvanR> since it doesnt terminate
17:39 <EvanR> you need to tell it how many digits, but they arent necessarily going to be all right
17:39 <Cale> bollu: Also, any nontrivial predicate on the computable reals is uncomputable.
17:39 <ongy> lambdabot is being mean. It sanitizes output :(
17:39 <EvanR> bollu: if its not computable, how would you even input it into a test program
17:40 <EvanR> in fact, once you start getting into this, i see the evidence of uncomputable reals even existing being pretty slim
17:40 <Cale> e.g. Checking if a computable real is positive is uncomputable
17:40 <Cale> hm?
17:40 guampa joined
17:40 <Cale> What do you mean by "existing"?
17:40 <EvanR> classical existence
17:40 <EvanR> i.e. who knows
17:40 <Cale> Well, they exist classically.
17:41 <EvanR> which i havent found a good meaning of
17:41 <Cale> I mean, they exist in ZFC's sense of the term
17:41 <EvanR> which is?
17:41 <EvanR> nevermind
17:41 <Cale> Which is first order logic's existential quantifier
17:41 govg joined
17:41 ubsan_ joined
17:41 <EvanR> uh huh.
17:42 <Cale> there exists a set in ZFC whose elements are exactly the computable elements of the real numbers
17:42 <reactormonk[m]> There's a few that define `leftMap` - or is it in base now? http://hayoo.fh-wedel.de/?query=%28a+-%3E+b%29+-%3E+Either+a+c+-%3E+Either+b+c
17:42 <Cale> Also, you can define them in Agda or Coq or many other intuitionistic theories.
17:42 <EvanR> the words are grammatical, and people say them, but it doesnt go anywhere in my mind
17:43 <EvanR> Cale: i said, uncomputable
17:43 <Cale> Sure, you can define the uncomputable reals in Coq.
17:44 <Cale> It'll be quite similar to how you'll do it in ZFC
17:44 pwnz0r joined
17:44 <cocreature> :t first
17:44 <lambdabot> Arrow a => a b c -> a (b, d) (c, d)
17:44 boombanana joined
17:44 <cocreature> :t Data.Bifunctor.first
17:44 <lambdabot> Bifunctor p => (a -> b) -> p a c -> p b c
17:44 <cocreature> reactormonk[m]: you can use that
17:45 <cocreature> Either is an instance of Bifunctor
17:45 <Cale> But probably you'll need to be more careful about what you mean by reals in the first place
17:45 <Cale> Since things tend to bifurcate a bit without LEM
17:45 <reactormonk[m]> cocreature: makes sense, thanks
17:46 MP2E joined
17:47 <EvanR> well, people seem to be expressing the opinion that there is more going on than something being just grammatically correct string of logic
17:47 <Cale> EvanR: For example, with most definitions of the reals, even in a system like Coq, it's still going to be possible to *define* a real number whose nth binary digit is 1 if the nth Turing machine halts.
17:47 chichou joined
17:47 peterbec` joined
17:47 <EvanR> that string of logic is usually not on topic when you talk about reals
17:47 <Cale> What do you mean?
17:48 <Cale> The real numbers aren't *literally real* -- there isn't physically out there somewhere a real line. This isn't even the case for natural numbers.
17:48 <EvanR> in a discussion, "the uncomputable reals, the non-recursive subsets of N, etc, *exist* period."
17:49 insitu joined
17:49 <Cale> Yeah, when I say that some mathematical object "exists", what I mean is that there is a proof of its existence in my favourite formalism.
17:49 sleffy joined
17:49 <EvanR> i dont doubt that
17:49 <Cale> (most of which are set up to be close enough to be equivalent that probably your favourite formalism will agree)
17:50 nilof joined
17:50 <Cale> and then if we disagree, then it will likely be because either one of us is wrong about the status of that proof, or we didn't pick the same formalism
17:50 <EvanR> but that seems rather empty, and wasnt what i was expressing
17:51 <Cale> I have no idea what you were expressing
17:51 <EvanR> right
17:51 <Cale> There's no sense in which mathematical objects exist beyond this one
17:51 <Cale> Or beyond this class of notions of existence
17:51 <EvanR> you defaulted to looking through ZFC
17:51 <Cale> at least, so far as I'm aware
17:51 <Cale> yeah
17:51 <EvanR> there is a sense in which they exist
17:51 forgottenone joined
17:51 coltfred joined
17:52 <Cale> Perhaps I shouldn't do that in #haskell, I should pick HoTT or something instead.
17:52 <Cale> :D
17:52 <Cale> I tend to default to ZFC because it's what most mathematicians will expect
17:52 <Cale> But they will agree on this anyway
17:53 <EvanR> the "number" pi for example, is the abstract form of any number of ways you could do a process whose output gets closer to the area of a unit circle
17:53 uglyfigurine joined
17:53 <EvanR> the informal language of weird things existing is like all these abstractions of math procedures losing something
17:54 <EvanR> i mean, losing even more
17:54 <Cale> Okay, and what about the number between 0 and 1 whose binary representation has a 1 in the nth place if the nth Turing machine halts?
17:54 <Cale> Is that not real enough? :)
17:54 <EvanR> that making any sense relies on markovs principle
17:54 <EvanR> which bauer seems to believe in, so it must be true!
17:55 <EvanR> in what sense to a turing machine either halt or not halt
17:55 <EvanR> s/to/does/
17:55 cdo joined
17:55 cdo left
17:56 cfricke joined
17:56 <EvanR> in what sense does "all turing machines either halt or not halt" make sense
17:56 <EvanR> "classically" and were back to where we started
17:57 ChaiTRex joined
17:57 afarmer joined
17:58 CoderPuppy joined
17:58 <Cale> Ah, so you want a real number which isn't computable, but which is definable without using LEM?
17:59 <Cale> Well, we'll need to be very particular about what the real numbers are for that to be possible.
17:59 <EvanR> well, that uses markovs principle which is weaker
17:59 <Cale> sure
17:59 <Cale> I only used one particular special case of LEM there
17:59 litchblade joined
18:00 <EvanR> you think you can do it?
18:00 <benzrf> what do you mean by "definable" there?
18:01 <Cale> benzrf: Well, that's still up in the air -- I'm not sure which formalism EvanR wants to be working in.
18:01 guampa joined
18:01 <EvanR> martin lof type theory
18:02 <EvanR> if you really need a formalism
18:02 <Cale> okay, and do you have a favourite definition of the real numbers?
18:02 sssilver joined
18:02 Guest12 joined
18:02 mojjo joined
18:02 <Cale> It's easily possible to constrain yourself to the computable reals from the outset.
18:02 <EvanR> sure
18:02 bungoman_ joined
18:03 <Cale> In which case, this becomes a bit of a moot point.
18:03 <EvanR> a complete ordered ring, plus whatever i just forgot
18:03 <benzrf> *field
18:03 <EvanR> hmm
18:03 butterthebuddha joined
18:03 <EvanR> ill be ok if cale does it without division
18:03 <Cale> Any Dedekind-complete ordered field?
18:03 <EvanR> since field axioms dont really work without LEM
18:03 ccomb joined
18:04 <benzrf> EvanR: Definition chaitin r = forall n, bin_digit n r = true <-> halts (turing_machine_enum n).
18:04 <EvanR> we just went over that
18:04 flatmap13 joined
18:04 <benzrf> yes, but im saying you have a definition right there
18:04 <benzrf> i don't know what else you could call a 'definition' if it's not computable
18:04 <EvanR> halts ?
18:05 <EvanR> "without using markovs principle"
18:05 <benzrf> chaitin : R -> Prop
18:05 <benzrf> it's a singleton, but not provably so without lem
18:05 <butterthebuddha> How do I use a list comprehension to perform a computation if a condition is true, but return the original value if it wasn't?
18:05 <benzrf> however you can prove that it has at most one element without lem
18:05 <EvanR> bin_digit makes sense?
18:05 <benzrf> sure
18:05 <EvanR> im skeptical of that
18:05 <Cale> butterthebuddha: In a contrived way?
18:05 <benzrf> depending on your representation, i suppose
18:06 <butterthebuddha> Cale: what would be a better alternative?
18:06 <Cale> butterthebuddha: Why do you want to use a list comprehension for that?
18:06 <Cale> An if/then/else expression perhaps?
18:06 <butterthebuddha> Cale: It's the only way I know of iterating over a list :(
18:06 flatmap13 joined
18:07 <Cale> Oh, if you want to iterate over a list, you can still use the list comprehension
18:07 <ongy> \p f xs -> map (\x -> if p x then f x else x) xs -- butterthebuddha something like this?
18:07 <Cale> it's just that the bit you described is sort of independent of that
18:07 flatmap13 joined
18:07 <Cale> > [if even x then x `div` 2 else x | x <- [1..10]]
18:07 <lambdabot> [1,1,3,2,5,3,7,4,9,5]
18:07 <Cale> butterthebuddha: ^^ like that?
18:07 <butterthebuddha> Ah, thanks
18:08 yellowj joined
18:08 danvet joined
18:08 cchalmers joined
18:09 <ongy> list comprehension. That feels like such a basic skill, and I just can't wrap my head around it
18:09 <EvanR> benzrf: i know that this chaitin thing, once precisely formulated, can be approximated to a couple bits by looking at proofs of particular small turing machines halting or not halting. but the assertion is that this could in principle be done for turing machines of all sizes, given enough time and intelligence
18:10 <EvanR> and it wouldnt cause a contradiction with other "known" mathematical facts in the process
18:10 <Cale> EvanR: Well, it's *not* computable, so you're not going to be able to approximate its value arbitrarily well
18:10 cpup joined
18:10 <benzrf> EvanR: i'm not sure what you're saying
18:10 <EvanR> or maybe the last part is not being asserted
18:11 <EvanR> Cale: not with a program no, but thats not what i was saying
18:11 <EvanR> the assertion is the number has some value regardless and we just dont know what it is
18:11 <Cale> Well, it doesn't matter if we're using a program or not :)
18:11 <EvanR> of course it does, because you get more bits by finding more proofs
18:12 heurist`_ joined
18:12 <butterthebuddha> Cale: does that look right? [ if i `mod` 2 /= 0 then c + c else c | i <- [0..(length n - 1)], c <- reverse n ]
18:12 <Cale> If just searching for proofs was sufficient, it would be computable
18:12 <butterthebuddha> Doubles every other element of a list from the back
18:12 <EvanR> youre being stubborn
18:12 <EvanR> you know what im talking about
18:13 <EvanR> time and intelligence, not just time
18:13 chef__ joined
18:13 ertesx joined
18:13 <Cale> butterthebuddha: sure
18:13 <Cale> EvanR: I'm not sure what you mean by intelligence
18:13 <Cale> Intelligence isn't going to help you
18:13 <EvanR> a human being sitting there thinking about turing machine 2873982743
18:13 <Cale> mhm?
18:14 <EvanR> this is where chaitin bits come from
18:14 <EvanR> they encode proofs
18:14 <Cale> So that human being will search the space of proofs and either find a proof that this Turing machine halts, or they will find a proof that it doesn't halt, or they will fail to find either.
18:14 sellout- joined
18:15 <EvanR> most of the time they fail
18:15 <EvanR> but they arent finding them by searching
18:15 <Cale> and we know that for some Turing machines they *must* fail.
18:15 <EvanR> its not an algorithm
18:15 <Cale> Because no such proof will exist either way
18:15 <EvanR> that is one reason why this number doesnt make sense
18:15 NeverDie joined
18:15 <EvanR> but i would like to see an example of that
18:17 Ferdirand joined
18:17 <EvanR> in what sense does the bit relying on that impossible proof or non proof have a value?
18:17 _main_ joined
18:17 <Cale> Well, okay, the thing is, the space of proofs is recursively enumerable. For any property P, you can simply enumerate all the valid proofs, until you find a proof of P or a proof of not P. If P is decidable, this will terminate.
18:17 <butterthebuddha> Cale: Hmm, that code is adding an arbitrary number of additional elements to the original list :/
18:17 <EvanR> yeah which isnt the case here
18:17 <EvanR> but we come up with proofs regardless
18:18 <Cale> butterthebuddha: Oh, sorry, I wasn't looking carefully enough
18:18 beanbagula joined
18:18 <Cale> butterthebuddha: You want zip [0..] (reverse n)
18:18 guampa joined
18:18 <Cale> butterthebuddha: If you make independent choices, it will enumerate all possible combinations
18:18 <Cale> > [(x,y) | x <- [1,2,3], y <- [4,5]]
18:18 <lambdabot> [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)]
18:18 GreySunshine joined
18:19 <butterthebuddha> Ah, but I can't figure out to destructure tuples
18:19 <Cale> EvanR: Well, but if *we* found the proof with intelligence, then a machine would eventually have found it without.
18:19 <Cale> (though it might take a very long time)
18:19 <Cale> butterthebuddha: (i,c) <- zip [0..] (reverse n)
18:20 <EvanR> Cale: and AI could conceivably just do it directly, but fine, lets turn the attention to these ones that supposedly cant be proved either way?
18:20 <Cale> right
18:21 <EvanR> how real a phenomenon is that?
18:21 xall joined
18:21 <EvanR> and what does that mean for the value of the relevant bit of chaitins numbers
18:22 <Cale> Well, that's about as real a phenomenon as you could hope for in this stuff.
18:22 <dolio> What is the value of the smallest busy beaver number whose value is not determined by ZFC?
18:22 blender joined
18:22 <reactormonk[m]> ... what's the recommended way to compose a few Strings for an error message? Use ++?
18:22 <thang1> Step 1 is to not use String /s
18:22 <cocreature> reactormonk[m]: use <> :)
18:22 <cocreature> because then it’s easy to swap out the String implementation
18:23 <EvanR> dolio: i would also like to know
18:23 <Cale> BB(1919) wasn't determined
18:23 <dolio> Why do you think it has one, or only one?
18:23 <Cale> There might have been a smaller one
18:23 <EvanR> i dont
18:23 <thang1> Oooh busy beaver functions
18:23 <splanch> Data.Text.Lazy.Builder is convenient for fast concatenation
18:23 <EvanR> i dont know what makes sense anymore
18:24 <EvanR> how would there be different smallest numbers
18:24 litchblade joined
18:24 <Cale> Oh, that wasn't necessarily the *smallest* BB which wasn't determined by ZFC
18:24 <dolio> Cale: I don't mean 1919, I mean what is BB(1919)?
18:25 laplacian joined
18:25 <dolio> Smallest doesn't really matter.
18:25 <thang1> Oh, a busy beaver function is the number that can be written by a turing machine of size X (I believe). Hold on, I'll link a scott aaronson blog on this. He's amazing at explaining it
18:25 <Cale> Stefan O'Rear found a 1919-state TM which searched for contradictions in ZFC.
18:25 <thang1> http://www.scottaaronson.com/writings/bignumbers.html
18:26 <EvanR> the longest runtime of the halting machines of a certain size?
18:26 <Cale> yeah
18:26 <thang1> http://www.scottaaronson.com/blog/?p=2725
18:26 <EvanR> that we can even begin to ask this relies on there being a clear distinction between the ones that halt and the ones that dont
18:26 <Cale> http://www.scottaaronson.com/blog/?p=2741
18:26 <dolio> Anyhow, the point is, "what is BB(1919)" presumably has different answers in different models of ZFC.
18:27 chlong joined
18:27 <EvanR> this is why ZFC makes no sense!
18:27 <thang1> ZFC makes plenty of sense though?
18:27 <Cale> EvanR: You can't expect ZFC to determine the answer to every mathematical question
18:27 <dolio> No, this is a problem with basically any formal system.
18:27 kamyar joined
18:27 <Cale> If it did, it would be inconsistent ;)
18:27 <rotaerk> no, Godel's just a stick in the mud.
18:28 <Cale> EvanR: as such, different models of ZFC might disagree on anything that ZFC leaves open
18:28 <thang1> Also ZFC is actually ZF + the axiom of Choice. You can build your own set theory; it kinda feels like using lego blocks
18:28 <EvanR> youre asserting that the machines either halt or dont, then deriving what youre calling actual numbers from it, without ever having the hope of doing real arithmetic
18:28 <dolio> What makes no sense, apparently, is your belief that any question you can pose in a formal system has a unique answer in that formal system.
18:28 <thang1> You pick this axiom, that axiom, this other thing and that other thing and once you're done, you build up everything else from your assumptions and see what results
18:28 <EvanR> numeric arithmetic always gives you a unique answer
18:29 <thang1> Numeric arithmetic always gives you an answer, it is not guaranteed unique or correct depending on how your numeric system is setup
18:29 <geekosaur> ^
18:29 <EvanR> and in this topic, the speech is about supposed actual numbers
18:29 <EvanR> and its not really, so thats my gripe
18:29 <Cale> Well, numbers that have a definition
18:29 <Cale> Not necessarily numbers which are computable
18:30 <EvanR> in what sense do these numbers have an actual value at all, basically is what ive been saying over and over
18:30 <thang1> EvanR: The truth of higher mathematics and everything else is that nothing has some biblical, god-given truth.
18:30 <EvanR> if you can do models which give actual results, then thats the answer. and if you dont have a model then its "none"
18:31 <thang1> The reason math works is because math itself is consistent. Assuming you set up your model the same way, the same operations give the same answers
18:31 pera joined
18:31 <thang1> So if I use ZFC and the normally defined natural numbers, 1+1 will always equal 2. If I use some other system and define my natural numbers weird, 1+1 might equal 3 or 4 or some other number
18:31 <EvanR> youre off the rails right now
18:31 <Cale> EvanR: Well, various models of ZFC will be able to compute *more* of the individual digits of this number.
18:31 <thang1> But the math itself isn't wrong or different
18:32 <Cale> EvanR: But it will remain uncomputable
18:32 mac10688 joined
18:32 <Cale> also, different models may disagree about various digits
18:32 <EvanR> Cale: this was asserted a few months ago in here, that all the models will give you different parts of the same answer, and they wont contradict
18:32 <dolio> Well, that's wrong.
18:33 <EvanR> ok, then you say it might not
18:33 <thang1> Who said that, anyway?
18:33 <EvanR> i dont know, might have been a random misunderstanding
18:33 <dolio> If all models agreed, then it'd be a theorem.
18:33 <EvanR> so if the "actual value" (word I am using gratuitously) depends on the model, that answers my question
18:33 <monochrom> I can believe that on the Internet there are a majority of random misunderstandings.
18:33 beerdrop joined
18:33 <dolio> Well, I suppose some could agree, and some could leave the answer open.
18:34 mda1 joined
18:34 <dolio> I don't think models are really supposed to do that, though.
18:34 <EvanR> in which case, talking about "the chaitin constant" (modulo setup) doesnt make sense
18:34 leat joined
18:35 <thang1> Why wouldn't it?
18:35 <EvanR> where setup is the language and the kind of turing machine, not the model of ZFC
18:35 <dolio> EvanR: I think people who talk like that probably believe that we are inhabiting some ultimate model that we care about, or something along those lines.
18:35 <EvanR> which model is that?
18:35 <thang1> "the real one"
18:35 <EvanR> uhg!
18:35 <Cale> EvanR: Don't try to make sense of that :D
18:35 <thang1> Comes from a misunderstanding of math and a refusal to let go of a belief in an absolute and perfect truth
18:36 <Cale> ^^
18:36 <thang1> Truth itself is a concept which has limits and flaws
18:36 <monochrom> @quote monchrom Kripke
18:36 <lambdabot> No quotes for this person. Are you typing with your feet?
18:36 <Cale> Truth is a (very effective) human invention.
18:36 <Cale> and it's not just one invention, but many
18:36 <dolio> So they believe if you built Turing machines (which you can't even do) and ran them, they'd either halt or not (which you couldn't know even by running them for a finite amount of time), and that answer would give you Chaitin's "constant".
18:37 <Gurkenglas> If we ever find a turing machine that'd simulate the universe, can we derive from that a model that'll decide all theorems whose truth can influence the world?
18:37 <reactormonk[m]> aeson default instance for Maybe Text description fails if the field is not present? Huh?
18:37 <reactormonk[m]> ... shouldn't it be Nothing?
18:37 fizruk joined
18:37 <thang1> Gurkenglas: not in any meaningful sense
18:37 <monochrom> Oh! I was missing an o in my nick
18:38 <monochrom> @quote monochrom Kripke
18:38 <lambdabot> monochrom says: There are truths, damn truths, and Kripke structures.
18:38 <monochrom> There!
18:38 <reactormonk[m]> I guess you'll have to be explicit via `.:?`
18:38 <cocreature> reactormonk[m]: yep
18:38 <thang1> haha that's a great quote
18:38 <Cale> monochrom: lol
18:38 <reactormonk[m]> :-/
18:39 <thang1> https://en.wikipedia.org/wiki/Chaitin%27s_constant this is also helpful, I think
18:39 cfricke joined
18:39 <hexagoxel> reactormonk[m]: https://hackage.haskell.org/package/aeson-
18:39 <thang1> Read the first paragraph. "Omega depends on the problem encoding used" ... "Each halting probability is a normal and transcendental real number that is not computable" ... "There is not even any algorithm which can reliably guess its digits"
18:40 <thang1> Anyway, do y'all have any ideas as to small to medium projects that the haskell community could benefit from?
18:40 <EvanR> the wikipedia article has been mildly unhelpful to me on this for at least 15 years
18:40 <reactormonk[m]> hexagoxel: not using generic
18:41 <EvanR> that language in the quotes is exactly what i was griping about
18:41 <sleffy> I'm mucking with lens. Is there any way to take several lenses side by side, all of which have the same types, and then glue them together into a fold?
18:41 <thang1> sleffy: What are you trying to achieve with that?
18:42 <cocreature> sleffy: the problem with gluing lenses together is that they can overlap and that will usually break the lenses
18:42 <cocreature> *lens laws
18:42 <sleffy> thang1, I have a record with a bunch of fields which I've named, because they're quite specific and the number of fields won't vary
18:42 <sleffy> I want to traverse over all the fields of the same type. I don't *think* makeLenses will generate folds/traversals that will let me do this
18:42 <sleffy> s/traverse/fold, but same difference
18:43 <sleffy> cocreature, getters then? I can ensure that they won't overlap
18:43 <dolio> thang1: That the number depends on the problem encoding is different than that the number is different in different models.
18:44 <dolio> For instance, there are multiple ways you could encode Turing machines as natural numbers, so that would affect the number.
18:44 <sleffy> oh whoop
18:44 <nshepper1> dolio: if the Turing machine halts, there would be a proof that it halts on zfc
18:44 alx741 joined
18:44 <sleffy> I missed it, it's *right* there on the Control.Lens.Getter docs. There's a monoid instance for it. That's magical
18:45 <dolio> But for any given encoding, different models can also give different answers about which Turing machines halt.
18:45 `^_^v joined
18:45 <EvanR> that issue is not addressed in wikipedia
18:45 <thang1> Right. But that's true for literally any sort of proof/computation/math/etc. It's a basic principle about math
18:45 <EvanR> and i wish it were
18:45 <nshepper1> The Turing machines whose halting status can't be proved, never halt
18:45 coot joined
18:45 <thang1> nshepper1: I thought you could prove either halting, non-halting, or undecideability?
18:45 <EvanR> nshepper1 has asserted that if it cant be proved one way or another if a given machine halts, then it doesnt halt. now listen to the justification
18:46 <nshepper1> But undecidability of halting is undecidable too
18:46 <dolio> For instance, there are models of ZFC (I think) that assert ZFC's consistency, and that negate ZFC's consistency. So they would disagree on whether a Turing machine that halts IFF ZFC is consistent halts.
18:47 <EvanR> dolio: if thats true, then it seems that the answer is up to us? does that make sense?
18:47 <dolio> What do you mean it's up to us?
18:47 <EvanR> otherwise, seems like ZFC is broken
18:47 <thang1> It seems like you just keep assuming that everything is knowable and that all answers can be found
18:47 <EvanR> that the halting status is a lucid dream
18:47 <thang1> or that every question out there can have an answer
18:47 Ferdirand joined
18:48 <nshepper1> thang1: no. You can't necessarily prove undecidability
18:48 <EvanR> thang1: i am exactly on the opposite side of this, i dont think youve been paying attention enough
18:48 <Gurkenglas> sleffy, you want http://hackage.haskell.org/package/lens-4.15.1/docs/Data-Data-Lens.html#v:template
18:48 <dolio> This is all predicated on the assumption that ZFC is consistent.
18:48 <EvanR> it is?
18:48 <dolio> Yes.
18:48 <EvanR> how
18:48 <dolio> Because we want it to have models.
18:49 <sleffy> Gurkenglas, that's perfect, thanks! While you're at it - is there a way I can use this to zip two structures together? I want to `mappend` all these fields from both records to create a new record.
18:49 <EvanR> meaning if it were inconsistent, all the models you came up with dont count somehow?
18:49 <dolio> Inconsistent theories don't have the models that model theorists like.
18:49 amut joined
18:49 PennyNeko joined
18:49 _ashbreeze_ joined
18:50 <thang1> It's the same line of reasoning for why, when solving differential equations, "zero" is a useless answer.
18:50 JagaJaga joined
18:50 <dolio> I mean, if you did come up with a notion of model, it'd be one where every proposition is both true and false.
18:50 <dolio> So what are you even talking about, then?
18:50 <EvanR> thang1: what? that seems off base
18:51 <dolio> The point is for some things to be true, and other things to not be true.
18:51 <EvanR> dolio: you were talking about the same thing as before, but now you know more about the model
18:51 <thang1> Nah, dolio got what I was coming at. In differential equations, you can solve any equation by zeroing everything. So y'' + y' + y = 0 works if y'' and y' and y is zero. But that's an unsatisfying answer that tells you nothing about the actual equation
18:51 locallycompact joined
18:51 <thang1> So why would you create a model that tells you nothing? It's unsatisfying and somewhat useless
18:52 <EvanR> well im finding a great deal of this unsatisfying
18:52 <thang1> Saying something is both true and false is the same as not bothering to say something at all
18:52 <EvanR> and lets not ask about useless
18:52 coltfred joined
18:53 akegalj joined
18:53 Itkovian joined
18:53 fgaz joined
18:54 <dolio> Anyhow, if ZFC is not consistent then consistency of ZFC is not independent of it.
18:54 <dolio> It is a theorem.
18:55 <dolio> And also the inconsistency is a theorem.
18:55 <EvanR> dolio: what i was asking was, if you have a choice of model, and in one you get the opposite answer to another, then it seems clear the answer is subjective. And since the machine can only behave one way in real life, since its deterministic, doesnt that indicate some sort of inapplicability of the whole franchise?
18:55 <dolio> So all models must validate both.
18:55 RoyalNightGuard joined
18:55 <dolio> So you can only have models that disagree if ZFC is consistent..
18:56 ChaiTRex joined
18:56 <dolio> Aren't Turing machines inapplicable to real life, because you can't build one?
18:57 <dolio> You can only build finite state machines.
18:57 <EvanR> you dont think so/
18:57 <dolio> That run for a limited amount of time before they break.
18:57 <EvanR> in any case, i dont mean actually build it and run it
18:58 <nshepper1> Istm that models these models saying whether Turing machines halt or not are doing so in a rather trivial manner
18:58 <EvanR> the abstract behavior that is the same regardless of how its implemented
18:58 Guest95631 joined
18:58 <EvanR> Istm ?
18:58 revprez_atlanta joined
18:59 <nshepper1> Simply answering "does this Turing machine halt" with 1 is rather different than actually enumerating the states of the machine from start to a terminating state
18:59 <nshepper1> "it seems to me"
18:59 amut left
18:59 <dolio> nshepper1: Well, actually, I think it gets pretty weird.
19:00 Shatnerz joined
19:00 <dolio> Because the ones that say it halt will probably have such 'enumerations' of the states.
19:00 <dolio> Because their 'natural numbers' will have non-standard elements.
19:01 <Gurkenglas> sleffy, I guess you could do "y & partsOf template %~ zipWith (<>) (x ^.. template)" but its kinda ugly?
19:02 CoderPuppy joined
19:02 <nshepper1> Yeah, that seems like cheating, doesn't it?
19:02 <dolio> Does it?
19:02 <nshepper1> Have a countably infinite enumeration of states, then say "see, it halts at +inf"
19:03 <dolio> But it is countably infinite, because coutability is about being equinumerous to the natural numbers, which are 'bigger' in this model.
19:04 <nshepper1> Sure, if your "natural numbers" include +inf that is in some technical sense saying that the machine halts
19:04 <dolio> And "+inf" is not really a good description. It's much weirder looking than that.
19:04 <nshepper1> But in ordinary natural numbers that's more of a proof that the machine doesn't halt
19:05 <nshepper1> Yeah, i know. But N + {inf} is just the simplest example of nonstandard naturals that i know
19:05 meoblast001 joined
19:06 <dolio> That isn't even a model of the nonstandard naturals, I think.
19:06 <Cale> N + {inf} doesn't quite work, because you need S inf /= inf
19:06 mellowmaroon joined
19:06 <EvanR> er, if you add one you get a lot of others
19:06 <EvanR> successors and predecessors of inf
19:07 <EvanR> im not sure if this seems silly when applied to turing machines
19:07 muzzle joined
19:08 Rodya_ joined
19:08 <muzzle> Is there a particular reason why there is no MonadMask m => MonadMask (MaybeT m) instance of the MonadMask typeclass in the exceptions package?
19:09 henriksod joined
19:09 <dolio> EvanR: Anyhow, maybe you can look at it like this. Model theory is about studying how applicable your formal system is to "real life". You care if you can use the results in the "real world," so it is like your "standard model." Things that aren't determined by the theory, and are different in different models are things you can't use. But that doesn't necessarily mean the whole thing in useless.
19:09 <cocreature> muzzle: yes, see https://stackoverflow.com/questions/41966893/why-is-there-no-monadmask-instance-for-exceptt/41977629#41977629 for an explanation for ExceptT
19:09 <nshepper1> Cale: oh, right. Well, you can use that as a generating set, i guess
19:09 <cocreature> muzzle: the reason why there is none for MaybeT is the same
19:09 <cocreature> muzzle: the short answer is that you can’t guarantee that finalizers are run because Nothing will shortcircuit everything
19:09 <dolio> But also, just the study of the models can be interesting, too.
19:10 eschnett joined
19:10 <muzzle> cocreature: makes sense, thanks
19:11 <Gurkenglas> It's like, if we ever figure out entropy and get immortality, you can start asking yourself what you'll be like at an equal-distribution random point in the infinite future, and whether there'll be an infinite amount of time in the past, and whether you should start optimizing that future now. Whether there will be such a point depends on your mathematical (!) model
19:11 <cocreature> muzzle: the fact that there is no MonadMask instance is the primary reason why I tend to avoid ExceptT/MaybeT
19:14 biglambda joined
19:14 dejanr joined
19:14 <mellowmaroon> Hopefully it's not a dumb question, but what's MonadMask? I've only recently learned about monad transformers
19:15 blender joined
19:15 <geekosaur> it's less about monads than about exceptions
19:15 <cocreature> mellowmaroon: it’s a typeclass that allows for things like "bracket"
19:15 <muzzle> mellowmaroon: it's a typeclass for monads that allow you to mask asynchronous exceptions
19:16 <muzzle> mellowmaroon and asynchronous exceptions are basically exceptions thrown into a thread from an other thread. Which can occur at any random time form a thread's point of view
19:17 <EvanR> dolio: would computable reals fall into this "can use" and "same in all models" bin?
19:18 butterthebuddha joined
19:18 Guest12 joined
19:18 <nshepper1> Anyway, i guess I'm more willing to believe that we know what we're talking about when we say "the standard model of the natural numbers" or "a finite enumeration" than that there is no fact of the matter about whether Turing machines halt
19:19 <dolio> EvanR: I'm not sure. It might depend on exactly how you define them.
19:19 Ferdirand joined
19:19 <EvanR> yeah markovs principle is attractive
19:20 <butterthebuddha> Not sure why this throws an compiler error: "sumDigits l = (foldr (+) 0 (foldr (toDigits) [] l))"
19:20 <EvanR> i guess theres many kinds of computability?
19:20 <EvanR> maybe that determines which reals there are
19:20 <butterthebuddha> l is an Integer that I'm trying to find the sum of the digits of
19:21 <Cale> mellowmaroon: It's a class for monads which support an operation that masks exceptions inside of some critical section (and gives you a way to undo the mask for some portion of that section)
19:21 <butterthebuddha> It doesn't like that toDigits is Integer -> [Integer]
19:21 <cocreature> :t foldr
19:21 <lambdabot> Foldable t => (a -> b -> b) -> b -> t a -> b
19:21 <cocreature> you are using toDigits for the "a -> b -> b" part
19:21 <cocreature> that won’t work
19:21 cpup joined
19:21 <cocreature> and you are using an integer for the "t a" part. that also will fail
19:22 <butterthebuddha> Im using an empty list for the t a part?
19:22 <dolio> EvanR: Well, if you define them like "there exists a halting Turing machine that accepts a natural n and gives you the nth digit", then it's possible that whether such a halting machine exists depends on the model.
19:22 <butterthebuddha> Oh wait you mean for the inner list
19:23 <Cale> mellowmaroon: The argument to mask :: ((forall a. m a -> m a) -> m b) -> m b is a function which produces an action that you want to run with exceptions masked, and it gets passed a function you can use to restore the exceptions for some part of that.
19:23 <butterthebuddha> cocreature: Why doesn't the integer work?
19:23 <EvanR> that definition is what turing did, but later he realized thats not great
19:23 <dolio> EvanR: Probably it's impossible to make it completely determined, but I'm not sure.
19:23 <EvanR> because of the freedom you have and have to have in redundant digit-based representations
19:24 <cocreature> butterthebuddha: how do you fold over an Integer?
19:24 <dolio> Sure, some type of approximation is probably better.
19:24 <cocreature> butterthebuddha: and no you are not using an empty list for the "t a" part. you are using it for the "b"
19:24 <butterthebuddha> cocreature: I thought that argument was the accumulator?
19:24 <cocreature> butterthebuddha: the first argument is the combining function, the second is the initial value of the accumulator, the third is the thing you want to fold over
19:25 <butterthebuddha> yep, isn't the second argument 0, cocreature?
19:25 <dolio> The important part of it isn't how you spit out the number, but how you define the criteria for 'computing'.
19:25 <cocreature> butterthebuddha: I’m taking about the inner call to foldr, i.e. "foldr toDigits [] l"
19:26 Aruro joined
19:26 Itkovian joined
19:26 <EvanR> i know theres higher order computation, but im not sure if it makes a difference to potential results
19:26 <dolio> I think even if you tried to put "it is a theorem of ZFC that this Turing machine halts" in the definition, it wouldn't be good enough.
19:26 nandub joined
19:27 <dolio> Because what things are provably theorems of ZFC (constructed internally in ZFC) are model-dependent.
19:27 <EvanR> why ZFC ?
19:27 <dolio> Pick anything you want.
19:27 <dolio> PA, whatever.
19:27 <dolio> Agda.
19:27 ziocroc joined
19:28 <cocreature> what’s PA?
19:28 <EvanR> N -> Q, function definable with lambda calculus-ish, with the proof of the cauchy criterion
19:28 <dolio> Peano arithmetic.
19:28 <cocreature> oh ofc
19:28 <EvanR> typed LC
19:28 Nick86x joined
19:29 <EvanR> but whether what you pick matters is exactly what i was wondering about
19:29 <dolio> It doesn't matter in the sense that they all have multiple models that can disagree.
19:30 <butterthebuddha> I'm thinking this is gonna work if I can flatten the list I'm iterating over: `sumDigits l = foldr sum 0 ([toDigits n | n <- l])`
19:30 xcmw joined
19:30 afarmer_ joined
19:30 <cocreature> butterthebuddha: you can’t use list comprehension on integers either
19:30 <cocreature> butterthebuddha: maybe you just want (toDigits l)?
19:30 <EvanR> dolio: i tried reading model theory, but my brain exploded. is there a point to models of typed LC ?
19:31 <butterthebuddha> cocreature: l is a list of integers
19:31 <butterthebuddha> sumDigits :: [Integer] -> Integer
19:31 <EvanR> it seems self evident
19:31 <cocreature> butterthebuddha: oh you said it’s an Integer before
19:31 <butterthebuddha> Did I? Sorry!
19:32 <cocreature> butterthebuddha: alright, so you are given a list of integers. what should sumDigits return?
19:32 <butterthebuddha> The sum of all the digits of all the integers in the list
19:32 <* EvanR> tries to look for a model theory book that isnt just ZFC stuff
19:32 darjeeling_ joined
19:32 fizruk joined
19:32 <cocreature> butterthebuddha: so it should return a single integer?
19:32 <butterthebuddha> Ueap
19:33 <butterthebuddha> Yeap*
19:33 <cocreature> butterthebuddha: alright, so first try to write a function Integer -> Integer that calculates the sum of a the digits of a single integer
19:33 <cocreature> butterthebuddha: then you can use that to implement sumDigits
19:33 <dolio> Agda is a little different, because ostensibly you aren't using it as a separate formal approximation to the real object you care about.
19:34 <dolio> You just care about what Agda does.
19:34 <dolio> And what results it spits out.
19:34 <dolio> Same with typed lambda calculi.
19:35 <EvanR> a separate formal approximation to the real object you care about? what thats a thing?
19:35 <EvanR> is that why all this is confusing, im missing that?
19:36 Remavas-Hex joined
19:36 <dolio> Yeah. Like, I use PA to think about natural numbers, which I care about because I use them to count my livestock.
19:37 <EvanR> thats an approximation? i figured it was an abstraction
19:37 <EvanR> maybe thats the same thing somehow
19:37 <dolio> Even though not every question I could ask about the natural numbers is a theorem (or the negation is a theorem) in PA.
19:38 tathougies joined
19:38 <EvanR> ok i though by real object you were getting at something intanglible
19:38 <butterthebuddha> cocreature "sumDigits l = foldr sumDigits' 0 ([toDigits n | n <- l])"
19:38 <butterthebuddha> That should totally work if I can figure out a way of flattening the list
19:38 <EvanR> like sets
19:39 <cocreature> butterthebuddha: what’s the type of sumDigits'?
19:39 <butterthebuddha> Integer -> Integer
19:39 <cocreature> then that won’t work
19:39 <cocreature> :t foldr
19:39 <lambdabot> Foldable t => (a -> b -> b) -> b -> t a -> b
19:39 <cocreature> you need a function of type a -> b -> b
19:39 <ij> How do I (IO a, b) -> IO (a, b)?
19:39 <butterthebuddha> Ohh
19:40 <cocreature> butterthebuddha: foldr is not particularly helpful here
19:40 <butterthebuddha> cocreature What do you suggest?
19:41 heurist_ joined
19:41 <ski> ij : `\(io,y) -> fmap (\x -> (x,y)) io'
19:41 <cocreature> butterthebuddha: try implementing sumDigits using "sum", "map" and "sumDigits'"
19:42 <EvanR> ij: f (act, y) = do{ x <- act; return (x,y) }
19:42 <EvanR> @djinn (IO a, b) -> IO (a,b)
19:42 <lambdabot> Error: Undefined type IO
19:43 <EvanR> @djinn Monad m => (m a, b) -> m (a,b)
19:43 <lambdabot> -- f cannot be realized.
19:43 <geekosaur> :exf "(IO a, b) -> IO (a,b)"
19:43 <exferenceBot> \ a -> let ((,) i3 d) = a in fmap (\ g -> (g, d)) i3
19:43 <dolio> EvanR: You could take "the natural numbers" to be the "real object", which is pretty intangible.
19:44 <geekosaur> slightly odd way of putting it...
19:44 Remavas-Hex joined
19:44 jmelesky joined
19:44 <dolio> Certainly it's all intangible when you're thinking about formal systems and models constructed inside another ultimately formal metasystem.
19:45 <nshepper1> Ooh, exferenceBot is here
19:45 <butterthebuddha> cocreature "sumDigits l = [sumDigits' a | a <- [sumDigits' n | n <- l]] !! 0"
19:45 <butterthebuddha> That seem like it'll work?
19:45 <dolio> But you might want to think about that because it applies to using formal systems to get your computer to put the right thing on a screen, too.
19:46 kamyar joined
19:46 Dr8128 joined
19:46 <kamyar> Please help me use MessagePack
19:47 <EvanR> natural numbers are tangible as hell, i can put them in TVars and lists and whatever all day!
19:48 ph88 joined
19:48 <Tuplanolla> You come here to ask that every day, kamyar.
19:48 <cocreature> butterthebuddha: well it typechecks but assuming I’ve understood what you want sumDigits to calculate this won’t work.
19:48 <Gurkenglas> :t _1 :: (IO a, b) -> IO (a, b)
19:48 <lambdabot> error:
19:48 <lambdabot> • Couldn't match type ‘s0 -> f0 t0’ with ‘IO (a1, b1)’
19:48 <lambdabot> Expected type: (IO a1, b1) -> IO (a1, b1)
19:48 <cocreature> butterthebuddha: try sticking to the functions I hinted you at
19:48 <kamyar> Tuplanolla: No one has answered me yet
19:48 <butterthebuddha> I just figured out that I need to sum the list
19:49 <butterthebuddha> For some reason I thought that the sum would end up as the first list
19:49 <butterthebuddha> It works now, thanks for all your help :)
19:49 peterbec` joined
19:49 <Tuplanolla> That's because your question is too vague, kamyar.
19:49 lush joined
19:49 jgt2 joined
19:49 thebardian joined
19:50 Wuzzy joined
19:50 balor joined
19:50 <Tuplanolla> There's nothing we can do if you want us to read your mind and "please give codes".
19:51 fotonzade joined
19:51 <Gurkenglas> :t _1 id :: (IO a, b) -> IO (a, b) -- ah right duh
19:51 <lambdabot> (IO a, b) -> IO (a, b)
19:51 insitu joined
19:54 <cocreature> Gurkenglas: that’s a nice solution!
19:54 dylukes joined
19:55 <ph88> out of curiosity .. does haskell rich information about a program help with optimizations as described here? http://article.gmane.org/gmane.comp.lang.lua.general/75426
19:55 egis joined
19:57 Wuzzy2 joined
19:59 Itkovian joined
20:01 baldrick joined
20:04 Sampuka joined
20:04 RoyalNightGuard joined
20:07 CoderPuppy joined
20:07 koitalel joined
20:09 heurist_ joined
20:09 fgaz joined
20:09 Guest12 joined
20:09 butterthebuddha joined
20:09 nycs joined
20:14 govg joined
20:17 thebardian joined
20:17 Kreest__ joined
20:20 kamog joined
20:21 <butterthebuddha> Not sure why this is an error on line 2: https://gist.github.com/awesomeaniruddh/bc29be2a471330ee86ded850533fe8b8
20:21 jeltsch joined
20:21 <butterthebuddha> Shouldn't that work according to the "Declarations and variables" section of https://www.seas.upenn.edu/~cis194/spring13/lectures/01-intro.html
20:21 <mauke> not enough information
20:22 <geekosaur> need context
20:22 <butterthebuddha> I updated the gist with the entire file
20:22 <mauke> you can't do that in a do block
20:22 xcmw joined
20:23 <butterthebuddha> why not :(
20:23 <geekosaur> you want either let or where
20:23 <mauke> what would it do?
20:23 yqt joined
20:23 <butterthebuddha> mauke: It's just a variable that stores the list
20:23 <glguy> there seem to be quite a few misunderstandings in that code
20:24 <glguy> what do notation is, that variables aren't things you update, types
20:25 <butterthebuddha> ?
20:25 <butterthebuddha> not quite sure what you mean
20:25 splanch joined
20:26 jud^ joined
20:28 tv joined
20:28 <glguy> butterthebuddha: You seem to be thinking of do { moves :: [Move]; moves = []; moves = moves ++ [move p1 p2]; moves } where "moves :: [Move]" declares a new variables that you can update the subsequent two lines
20:28 <butterthebuddha> Yep
20:29 <glguy> it's not that
20:29 replay joined
20:30 <butterthebuddha> What exactly is it?
20:30 <glguy> as is it's just invalid syntax
20:30 <butterthebuddha> How would I declare a variable that I can subsequently update?
20:30 <glguy> You don't
20:30 <geekosaur> you don't
20:30 <Tuplanolla> You could, but...
20:30 <glguy> You can't, but there are other things you can do
20:31 <geekosaur> not sure IORefs/STRefs count here
20:32 <butterthebuddha> I can't possible create that list in one step
20:32 <mauke> yes, you can
20:32 ph88_ joined
20:33 asmyers joined
20:33 <butterthebuddha> mauke: the computation I need to create the list is more complicated than the code i have right now
20:34 <monochrom> I might want to ask "what counts as 'one' 'step'?"
20:34 <monochrom> To be fair, we don't need to go that far yet.
20:34 <monochrom> But for example "xxx = [1,2,3,4,5]" is defining a 5-item list in one go.
20:35 <butterthebuddha> I'm working on the fifth exercise of https://www.seas.upenn.edu/~cis194/spring13/hw/01-intro.pdf
20:35 <monochrom> And "yyy n = [1 .. n]" is defining a long list in one go.
20:35 <geekosaur> I assure you that anything in that course does not require mutable variables
20:36 <geekosaur> it *will* likely require you to learn how to think functionally
20:36 <monochrom> And if you say you want something more general than [1..n], sure, [1..n] has a recursion behind, so you can use recursion to do general things.
20:36 <monochrom> The code for "map" is an example of doing a fairly general thing.
20:36 <monochrom> @src map
20:36 <lambdabot> map _ [] = []
20:36 <lambdabot> map f (x:xs) = f x : map f xs
20:37 oisdk joined
20:37 <monochrom> No mutable variables. Just recursion. Despite conventional wisdom "don't I need a mutable variable for the intermediate incomplete list?"
20:37 <Dr8128> :t (+)
20:37 <lambdabot> Num a => a -> a -> a
20:38 cyborg-one joined
20:38 <Dr8128> let double f x = f(f(x))
20:38 <monochrom> I don't know whether by your standard the code of map counts as "one" "step" but it surely counts as just two lines.
20:38 <Dr8128> :t show
20:38 <lambdabot> Show a => a -> String
20:38 <Dr8128> double subtract 4
20:38 <glguy> Dr8128: You can experiment with lambdabot in private message via /msg
20:38 Detrumi joined
20:39 <monochrom> Also, screw conventional wisdom.
20:39 <Dr8128> glguy: cool thx
20:40 <mauke> you can define hanoi directly as a recursive function
20:40 <geekosaur> also you need to prefix stuff to be run with "> ", and you can;t do definitions, just expressions
20:40 <geekosaur> although there is @let
20:40 <mauke> should only take two lines (base case; recursion)
20:40 <monochrom> Hanoi is actually harder in loops.
20:41 <monochrom> Ackermann is, too.
20:41 <monochrom> http://www.vex.net/~trebla/compsci/imperative-functional.html
20:41 <Dr8128> geekosaur: thx
20:41 cpup joined
20:42 <Dr8128> lambdabot is neat its like ghci
20:42 <butterthebuddha> I'm not sure how to define hanoi as a recursive function; each step seems to be very complicated
20:42 <geekosaur> except it's not ghci
20:42 <butterthebuddha> And I need to figure out which peg to move each disc to depending on the state
20:43 <dolio> What state?
20:43 <Tuplanolla> It's a sheep in a wolf's clothing, butterthebuddha.
20:43 <butterthebuddha> dolio: depending on where the other discs are
20:43 <ertes> i think Codensity should be in base
20:43 <butterthebuddha> i can't have a larger disc on a smaller disc for exampel
20:43 <monochrom> Take 3 parameters, which stand for the 3 pegs.
20:43 <ertes> and reexported from the Prelude
20:44 <monochrom> Also, the question already contains the solution, except in English.
20:44 <monochrom> Your job is to translate that English to code. Your job is not to come up with a novel solution.
20:44 <monochrom> And even then, you see how that piece of English is recursive.
20:46 jgt2 joined
20:46 <butterthebuddha> Yea but "move n − 1 discs from a to c using b as temporary storage" is a super high level description
20:46 <butterthebuddha> It's a different process for each disc
20:47 <monochrom> That is one of the two recursive calls.
20:47 <monochrom> Let me put it this way.
20:47 <monochrom> Suppose you ask me to write a program to sum up an array.
20:47 <monochrom> err, list! s/array/list/ !
20:48 <monochrom> I'm going to say, "to sum up 10 numbers, first sum up 9 of the numbers, then add the remaining one"
20:48 <mauke> butterthebuddha: your program doesn't have to manage state. it's already encoded in the algorithm
20:48 <monochrom> You are not going to complain that my "first sum up 9 of the numbers" is an awfully high level description.
20:49 <monochrom> Because it simply means f (x:xs) = x + f xs
20:49 <monochrom> It simply means recursive call.
20:50 peterbec` joined
20:51 <monochrom> Or how about I call it code reuse? That's cooler.
20:52 <monochrom> I am already writing code to sum up a list. Why don't I reuse this code by a simple call to sum up a sublist?
20:52 soLucien joined
20:53 afarmer joined
20:53 <butterthebuddha> Yea but when you're summing a list, you're doing the same exact operation every single time, just on a different input
20:54 <butterthebuddha> Unless I'm missing something, I can't move every peg in the same way
20:54 <butterthebuddha> To get them from a to c
20:54 zeroed joined
20:54 zeroed joined
20:54 <monochrom> OK, this is why I also said: You need 3 parameters, for the 3 pegs.
20:55 <glguy> butterthebuddha: Notice how the English solution doesn't need to provide different cases for all the different pegs
20:55 <monochrom> When you see "a" "b" "c" consider them to be peg parameters. "a" does not always stand for Peg #1.
20:55 <glguy> It's the same operation every time
20:56 <monochrom> In a typical recursive call it is very possible that "a" stands for Peg #3, "b" stands for Peg #1, "c" stands for Peg #2.
20:58 <butterthebuddha> No I understand that
20:58 <monochrom> In retrospect it does not have to be 3 parameters. It could be 6 mutually recursive functions instead.
20:59 <mauke> the exercise tells you to write hanoi :: Integer -> Peg -> Peg -> Peg -> [Move]
21:00 <* ski> . o O ( `Natural -> Iso Peg Peg -> [Move]' )
21:00 <monochrom> Suppose you ask me to write this program: input a list like [w,x,y,z], output w-x+y-z. In general toggle between (+) and (-).
21:00 cdg joined
21:01 Rodya_ joined
21:01 <monochrom> I am going to write this recursive helper: helper op1 op2 (x:xs) = op1 x (helper op2 op1 xs). My recursive call switches op1 with op2.
21:01 <monochrom> And my top-level function is going to be f xs = helper (+) (-) xs.
21:02 mizu_no_oto_work joined
21:03 leat joined
21:04 ompaul joined
21:04 <ertes> > foldr (\x ~(xs, ys) -> (x:ys, xs)) mempty ['a'..'z']
21:04 <lambdabot> ("acegikmoqsuwy","bdfhjlnprtvxz")
21:05 nakal joined
21:06 Rodya_ joined
21:09 razwelles joined
21:09 takle joined
21:09 <razwelles> I'm trying to remember but does haskell let you define an integer with a specific range of valid values? Like [7..23]? Or perhaps I was thinking of another language?
21:09 <monochrom> It's another language.
21:10 <monochrom> For example Pascal.
21:10 takle_ joined
21:10 edmundsecho joined
21:10 <razwelles> monochrom: ohh thank you, are there other languages with that feature? Does it have a specific name?
21:11 <monochrom> One day shapr is going to kick me for doing what palomer did, except I use an even more ancient language :)
21:11 des_ joined
21:11 jgt joined
21:11 beerdrop joined
21:11 <ChaiTRex> razwelles: You could create a type like that in a module that doesn't export the constructor but a function that checks bounds.
21:11 <monochrom> I think Ada also has it. I forgot the name.
21:11 <monochrom> (The name of this feature.)
21:11 <ertes> razwelles: you can do it in haskell with a few extensions
21:11 <monochrom> Maybe "subrange type"?
21:11 Wuzzy joined
21:12 <ertes> as long as the number range is static
21:12 <ertes> if it's dynamic, you can still do it, but you will wish you hadn't
21:12 <razwelles> haha
21:12 <razwelles> This is helpful, thanks everyone
21:13 <razwelles> subrange type was the correct name, monochrom
21:13 <razwelles> found it
21:13 <monochrom> neato
21:13 <monochrom> My 20th century education has some use afterall :)
21:13 <razwelles> haha
21:14 splanch joined
21:14 <ertes> if your range includes negative numbers, you will burn your hands while doing it
21:15 <ertes> if it includes fractions, you will be hearing satan's breath in your neck the whole time
21:15 <monochrom> I promise I will include Gaussian integers only.
21:16 <monochrom> I want the range from -4-5i to 3+7i.
21:17 bjz joined
21:17 <monochrom> Actually what's wrong with fractions? Dedekind did exactly that.
21:17 <geekosaur> and now you're going to be degaussed?
21:17 <monochrom> Haha
21:18 <ertes> monochrom: nothing, it's just satan will be watching you
21:18 <hexagoxel> butterthebuddha: maybe stop thinking of specific steps/moves. do you know how to move 0 discs? do you also know how to move n discs, given that you already know how to move (n-1) discs? note that moving (n-1) discs can be viewed as a single "step" there.
21:18 <ertes> but if your range includes real numbers, GHC might turn into a black hole
21:19 burtons_ joined
21:19 <monochrom> I'm OK with sticking to rational numbers.
21:20 <monochrom> Just allow me to specify a range like "those rational numbers whose squares are below 2" and I'll cope.
21:20 cyborg-one joined
21:20 dimitrovskif joined
21:20 leat joined
21:20 {emptyset} joined
21:22 <dimitrovskif> Why doesn't "log2 4" halt? log2 1 = 0; log2 x = 1 + log2 (quot x 2)
21:22 Basque joined
21:23 <monochrom> > let {log2 1 = 0; log2 x = 1 + log2 (quot x 2)} in log2 4
21:23 <Tuplanolla> Put it into a file, dimitrovskif.
21:23 <lambdabot> 2
21:23 <glguy> dimitrovskif: It does. Perhaps you wrote the two clauses on separate lines in GHCi?
21:23 <monochrom> worksforme
21:23 <dimitrovskif> glguy: Yeah I did. Why?
21:23 <dimitrovskif> It's my first program
21:23 hgad joined
21:23 <glguy> dimitrovskif: the first definition of log2 was overwritten by the second
21:23 <ertes> dimitrovskif: you wrote a function "log2 1 = 0", then you redefined it to "log2 x = …"
21:24 <glguy> dimitrovskif: You can't just paste a .hs file into GHCi and expect the same result, it's a different environment
21:24 <dimitrovskif> glguy: ertes: Yeah I get it
21:25 <ertes> dimitrovskif: you can write it like this in GHCi: log2 1 = 0; log2 x = …
21:25 <ertes> but a file is more convenient
21:25 <dimitrovskif> I added the colon so that I don't pollute the IRC chat
21:26 Spondyl joined
21:26 phyrex1an joined
21:26 <dimitrovskif> semicolon*. But it seems I accidentally did the right thing
21:26 e14 joined
21:27 <monochrom> semicolon is also good for ghci
21:27 <monochrom> semicolon is part of standard Haskell.
21:28 <dimitrovskif> So how do you type functions in GHCi without typing all the patterns at once?
21:28 <dimitrovskif> I guess it's impossible?
21:28 <ChaiTRex> dimitrovskif: Separate the patterns with a semicolon.
21:28 <monochrom> Ah I see what you mean. This is when you get to say: Great minds think alike, the designers of Haskell thought like you :)
21:28 <ertes> dimitrovskif: you can use the :{" syn… no, it's impossible
21:29 <ChaiTRex> > let zomg 0 = 1; zomg n = n + 1 in map zomg [1..10]
21:29 <lambdabot> [2,3,4,5,6,7,8,9,10,11]
21:29 <monochrom> Yeah if you enter one line ":{", then GHCi will wait for you to enter multiple lines. Then you end with ":}"
21:30 <monochrom> But very soon you will find that it is a useless trivia pursuit. It doesn't scale.
21:30 <monochrom> Because what happens if you want to edit a formerly entered line?!
21:30 <dimitrovskif> Seems to be a cool language... Not gonna ask about monads, haha.
21:30 <hexagoxel> dimitrovskif: :set +m
21:30 <monochrom> Only a real editor scales.
21:30 dcoutts_ joined
21:31 <hexagoxel> then it won't terminate the definition after your first "let" line
21:31 <Tuplanolla> You turn it on and it scales right out!
21:31 Remavas-Hex joined
21:31 <ertes> GHCi in isolation is a calculator… if you want to do programming, you should always have an editor open alongside GHCi
21:31 <ertes> if not even an editor with GHCi built in
21:31 <ChaiTRex> That would be nice :)
21:32 joe9 joined
21:32 <monochrom> Next April 1st project: Merge GHCi with sed.
21:32 <ChaiTRex> Have a bunch of source files opened in tabs of a text editor and one extra tab for GHCi.
21:33 <ChaiTRex> Or GHCi at the bottom or something.
21:33 takle joined
21:33 <zomg> ChaiTRex: u wot m8
21:34 <monochrom> Wait, +m exists? What does it do?
21:34 <ertes> breaking news: greatest threat to the earth since the LHC: GHC about to be merged into busybox
21:34 laplacian joined
21:34 <monochrom> Ah found it.
21:34 <joe9> I have a timezone string "EDT" that I want to convert UTCTime to. I cannot figure out how to build the TimeZone data type from just the "EDT" (no minutes or seconds offset). Any suggestions, please?
21:34 oisdk_ joined
21:34 <monochrom> Ah neato.
21:35 <monochrom> Against my philsophy, but neato, much more ergonomic now.
21:35 Itkovian joined
21:35 <ertes> joe9: there is minutesToTimeZone/hoursToTimeZone
21:35 <ertes> joe9: or you can construct the TimeZone value by yourself
21:36 <monochrom> ertes: I would love that! It means henceforth every home router will have GHC because it has busybox...
21:36 butterth_ joined
21:36 <monochrom> Hell, my Kindle will have GHC too because...
21:36 <joe9> ertes, the minutesToTimeZone, I need to build the minutes offset myself. I just know the zonename EDT. I can look up the minutes manually and hardcode it. But, I prefer the system does that conversion.
21:37 tomboy64 joined
21:38 cdg joined
21:39 `^_^v joined
21:39 <butterth_> So I guess I understand how to code it now, but how do I code it without any mutation
21:39 <butterth_> I still need a way to store the moves
21:40 <monochrom> This is why I showed you the example of "map" first.
21:40 <monochrom> @src map
21:40 <lambdabot> map _ [] = []
21:40 <lambdabot> map f (x:xs) = f x : map f xs
21:40 <monochrom> No one stores the "output list". Output it right away.
21:40 <thang1> oooh dat src command is awesome
21:41 <monochrom> It is actually hand-curated, thang1. It does not get synced with reality.
21:41 <monochrom> For example:
21:41 <monochrom> @src length
21:41 <lambdabot> Source not found. Sorry about this, I know it's a bit silly.
21:41 <thang1> aww, so sad
21:41 blender joined
21:41 <ertes> also be sure not to make typos, or you'll invoke tsunderebot
21:41 <monochrom> Hrm, that may actually be synced with reality. (Still, hand-synced, not automatic.)
21:41 <Zemyla> @src sort
21:41 <lambdabot> sort = sortBy compare
21:41 <Zemyla> @src sortBy
21:41 <lambdabot> -- The actual definition used by GHC is an optimised mergesort.
21:41 <lambdabot> sortBy cmp = foldr (insertBy cmp) []
21:42 <glguy> fortunately you can just click the 'Source' link in the haddocks of most packages
21:42 <thang1> Although I guess it's a good idea to prevent 500 line pasting by lambdabot
21:42 <ChaiTRex> thang1: lambdabot automatically cuts off after a few lines or so.
21:42 <thang1> glguy: Being lazy, I would've liked lambdabot to actually just search hackage for me and extract the source and paste it in here or give me a link if it's more than 2ish lines
21:43 <thang1> ChaiTRex: I figured. Good t'know for sure though
21:43 <glguy> thang1: that might encourage people to do that
21:43 <monochrom> Ah, emitting a link is actually a good idea.
21:43 <butterth_> Something like this? https://gist.github.com/awesomeaniruddh/814d57009b8132f6181d3d5ecdf2e607
21:43 <thang1> Yeah, exactly.
21:43 <monochrom> Yes butterth_
21:43 <joe9> Is there a way to lookup the minutes offset used by TimeZone when I just know the zonename?
21:44 <thang1> It doesn't need to duplicate code and make random links though, but just giving me a link to the source through haddock is fine
21:44 <monochrom> Except there are still blanks to fill in, and you need two recursive calls not just one.
21:44 <monochrom> But I think you know.
21:44 <thang1> joe9: There are tables online. Idk if there's a pretty package made yet
21:45 <thang1> Also, is there any concrete description of how GHC's testing suite and automated everything actually works?
21:45 <ertes> joe9: i don't see an interface in the 'time' package itself, but i found this: https://hackage.haskell.org/package/timezone-olson
21:45 <thang1> I'm looking at summer of haskell stuff and debating between fixing GHC's testsuite and using LH to prove the base
21:46 <joe9> ertes, Thanks. will check it out.
21:46 Destol joined
21:46 leat joined
21:46 <ChaiTRex> thang1: What's LH?
21:46 marr joined
21:46 <thang1> s/LH/LiquidHaskell
21:47 <thang1> joe9: http://projects.haskell.org/time-ng/ timezone-series looks more like what you want, though
21:47 <thang1> Unless you're actually using binary Olson timezone files
21:47 <ertes> timezone-olson has a timezone-series interface
21:49 chichou joined
21:49 <monochrom> thang1: I think fixing GHC's testsuite is both more reachable and has more longlasting benefits.
21:49 <thang1> That's what I was thinking too. Code moves pretty fast in haskell, but GHC is slower moving
21:50 biglambda joined
21:50 <monochrom> But is there some problem in the testsuite to fix?
21:50 <thang1> I don't have much of any information on how things are actually setup, though... Do people just run testsuites on their own computers?
21:50 azahi joined
21:50 <monochrom> The GHC devs certainly do.
21:50 <monochrom> I certainly don't.
21:50 <thang1> https://ghc.haskell.org/trac/ghc/ticket/12758
21:51 <butterth_> Okay, I don't really understand the code I just wrote, but it works - https://gist.github.com/awesomeaniruddh/814d57009b8132f6181d3d5ecdf2e607
21:51 <monochrom> Ah.
21:51 <butterth_> Can anyone explain how this works to me?
21:51 <thang1> But, like, whyyy. Test-suites should be run on servers using CI to ensure consistent measurements. Just push to test repo and then bam, metrics n shit
21:52 richi235 joined
21:52 <ertes> i can imagine what the vulcans will *really* think when they visit earth: "hmm… they're wasting 4.7 gigawatts a day for timezone computations, and their most advanced AI is telling them where to find restaurants… they're not ready, let's go"
21:52 <thang1> haha I can imagine
21:53 hiratara joined
21:53 dc0de joined
21:53 <thang1> butterth_: Your first line can be replaced with hanoi 1 p1 p2 _ = [(p1,p2)]
21:53 <monochrom> butterth_: It means: Use a recursive call to emit instructions for the first subproblem, then emit the instruction "move 1 disc from p1 to p2", then a recursive call to emit the instructions for the 2nd subproblem.
21:53 <glguy> thang1: The test suite is run by the CI server, too. People tend to like the immediate feedback of being able to run a test on their machine while they're working on a problem
21:54 <thang1> glguy: good to know. Is there anywhere where I can find an overview of how everything is setup and a good starting point to where revamps and fixes to the testsuite would be appreciated?
21:54 <butterth_> No like I know what the code itself does, but I still don't understand how the algorithm works :/
21:54 Krymise joined
21:55 mjz19910 joined
21:55 <monochrom> I am not entirely sure what you mean. But it is possible to use induction to prove that the emitted instructions are correct.
21:57 <thang1> butterth_: https://www.cs.cmu.edu/~cburch/survey/recurse/hanoiimpl.html http://stackoverflow.com/questions/1223305/tower-of-hanoi-recursive-algorithm
21:57 <thang1> do these help?
21:57 <thang1> (whoops forgot the space)
21:59 taksuyu joined
22:01 <* ski> . o O ( iterative hanoi )
22:04 <thang1> The other project I thought of doing would be to make a superior documentation system for Haskell somehow. Because haskell documentation generally sucks ass
22:05 mjz19910 joined
22:05 <ertes> does it?
22:05 <c_wraith> haskell documentation is generally excellent.
22:05 <thang1> I've repeatedly heard that it's a pain point for a lot of people, with thousands of libraries consisting of literally nothing but type signatures generated by haddoc
22:06 <monochrom> Is that a function of the authors or is it really a function of the system?
22:06 <monochrom> OK but that's a function of the authors.
22:06 <ertes> thang1: that's a social aspect, not a technical one… haddock is quite great
22:06 <thang1> monochrom: I feel it's both. If you look at the language Racket with its Scribble documentation setup, the entire ecosytem top to bottom has beautiful, comprehensive, amazing documentation compared to pretty much every other language
22:06 mjz19910 joined
22:06 <monochrom> If you inflicted Doxygen on me I would still not lift one single finger and the resulting doc would still be like that.
22:07 <c_wraith> ok, any time someone described documentation as "beautiful", I know they don't care about the right things.
22:07 <ertes> thang1: and i'm not even calling it a social *problem*… it's an aspect
22:07 <thang1> s/beautiful/useful
22:07 <thang1> to me, documentation is beautiful if it's useful and easily scannable. I don't care if the CSS is perfect
22:08 <ertes> but haddock has that
22:08 <c_wraith> type signatures are often all the documentation you need. I've written code using only type signatures to do decidedly non-trivial things. Haskell type signatures say a *lot*.
22:08 <Tuplanolla> Type signatures don't tell anything about exceptions or time complexity.
22:08 <monochrom> System-wise, I think it got all wrong right at the beginning with Javadoc (which subsequently everyone duplicates, including Doxygen and Haddock). The institutional problem is with the idea of per-method narrative.
22:08 <c_wraith> Sometimes they're not enough. But most libraries where signatures aren't enough actually document the rest.
22:09 <ertes> thang1: the problem is that programmers are so used to languages with simplistic or non-existent type systems that they expect everything to be explained in detailed prose
22:09 HoierM joined
22:09 <ertes> of course you would expect that, if the thing you're working with has side effects and global state everywhere
22:09 <ertes> now look at this:
22:09 <ertes> map :: (a -> b) -> [a] -> [b]
22:09 darjeeling_ joined
22:09 suzumiya_ joined
22:09 <ertes> i know exactly what this does, because the name and the type tell me
22:10 <glguy> obviously that returns an empty list of type [b]
22:10 <monochrom> Especially with OOP, the real meaning is with the interactions between objects and between methods, not with individual methods. True of FP and even more pressingly true of OOP, and ironically it's Javadoc which started this maximumly pessimistic system.
22:11 HoierM joined
22:11 <thang1> So, documentation should reflect that nature and should make it as easy to write documentation to that nature as possible, discouraging the stupid/worse way of doing things
22:12 <Tuplanolla> We have a name for the kind of documentation you desire, monochrom.
22:12 <Tuplanolla> Books.
22:13 <thang1> Do they automatically get updated when code changes, warn you of now incomplete documentation, and are there tools which help you write those books in any way shape or form?
22:13 iqubic joined
22:13 <c_wraith> thang1: that's why type signatures are such great documentation. The compiler checks them.
22:13 <ertes> haddock docs are part of the source code
22:13 <iqubic> Why does the typeclass Traversable have Foldable as a type constraint?
22:13 <c_wraith> iqubic: because Traversable is strictly stronger than Foldable
22:13 <ertes> and yes, haddock tells you documentation coverage
22:14 <iqubic> c_wraith: Why is that?
22:14 <c_wraith> iqubic: that is, you can trivially construct all the methods in Foldable from the ones in Traversable
22:14 <iqubic> You can?
22:14 <c_wraith> iqubic: Functor is a superclass for the same reason
22:14 <c_wraith> iqubic: yep!
22:15 <iqubic> Can I see you write Foldr using just Traversable methods?
22:15 <iqubic> Just as an example.
22:15 <ertes> thang1: here is a challenge: write documentation for the 'map' function such that you don't sound like a broken record
22:15 <c_wraith> iqubic: see the bottom of https://hackage.haskell.org/package/base-
22:15 <c_wraith> iqubic: fmapDefault builds fmap from Traversable, foldMapDefault builds foldMap (a complete definition of Foldable) from Traversable
22:16 <thang1> ertes: But map is exactly the type of trivial function that makes people think every single haskell function can be completely understood through type signatures alone
22:16 <Tuplanolla> :t alaf Const traverse -- Here it is, iqubic.
22:16 <lambdabot> (Monoid a', Traversable t) => (a -> a') -> t a -> a'
22:16 <Tuplanolla> It's not particularly enlightening in that form.
22:16 <iqubic> what does alaf mean
22:17 <glguy> Tuplanolla: What function is that?
22:17 <ertes> thang1: what i'm trying to say is: documentation is not good because it has lots of text in it
22:17 LnL joined
22:17 <iqubic> glguy: It's foldMapDefault from Data.Traversable
22:18 <thang1> ertes: I found this link to be pretty good at criticising haddock: https://lexi-lambda.github.io/blog/2016/06/12/four-months-with-haskell/
22:18 <iqubic> Challenge: Can someone write foldr by only using foldMap?
22:18 <ertes> thang1: emacs sometimes forgets that, and it has the same built-in, comprehensive documentation system as racket, perhaps even more than racket
22:18 soniku joined
22:18 <Tuplanolla> It's `alaf Const f g = getConst . f (Const . g)`, iqubic and glguy.
22:18 <glguy> Tuplanolla: I see. I thought foldr was asked for
22:18 <glguy> (hence my question)
22:18 <Tuplanolla> Ah.
22:18 <bbear> nobody uses emacs at work
22:19 <bbear> it's weird
22:19 <iqubic> Challenge: Can someone write foldr by only using foldMap?
22:19 <thang1> Really? I thought almost all professional haskell programmers were doing emacs still
22:19 <ChaiTRex> @src foldMap
22:19 <lambdabot> Source not found. Have you considered trying to match wits with a rutabaga?
22:19 <ChaiTRex> I haven't yet.
22:20 <c_wraith> ChaiTRex: foldMap is part of the Foldable class - it doesn't have a single implementation
22:20 <iqubic> No. I use Vim to write Haskell Code
22:20 jxv joined
22:20 <glguy> Tuplanolla: If you're going the lens route, 'views traverse'
22:20 <Tuplanolla> Nice.
22:20 <thang1> Vim + Intero is pretty great, too
22:20 <iqubic> What's Intero?
22:21 <jxv> sup lexi-lambda
22:21 <thang1> Intero is the best thing since sliced bread
22:21 <thang1> https://github.com/commercialhaskell/intero
22:21 <ChaiTRex> Unfortunately, the documentation for foldMap gives away the answer.
22:21 <jxv> why?
22:22 <ertes> intero is like haskell-mode, but with a stack sales pitch built in
22:22 <thang1> (or for vim: https://github.com/myfreeweb/intero.nvim )
22:22 <MP2E> hah :p
22:22 <iqubic> ertes: Can I get it as a vim plugin?
22:22 <jxv> but I don't even use ghc-mod :/
22:22 e14 joined
22:22 <thang1> Intero doesn't use ghc-mod. It uses stack, automatically installs itself if needed, and so on
22:22 <ertes> iqubic: if it didn't get across, i don't like it and don't recommend it ;)
22:23 <thang1> Much more useful than every other haskell plugin I've tried because of how easily it "just werkz"
22:23 <iqubic> ertes: What do you use?
22:23 <ertes> iqubic: haskell-mode
22:23 <thang1> Probably M-x butterfly on stone tablets
22:23 <iqubic> ertes: In Emacs?
22:23 <jxv> I mean having code helper plugins is not that important
22:23 <ertes> iqubic: yes
22:23 <iqubic> Ah. I use Vim.
22:23 <MarcelineVQ> I've been moving towards just ghcid lately, because it's reliable
22:23 <ertes> both haskell-mode and intero are for emacs
22:24 <thang1> (although intero is more of a universal backend that works with multiple text editors such as Atom, Neo-vim, emacs, etc)
22:24 <iqubic> ertes: This page says otherwise: https://github.com/myfreeweb/intero.nvim
22:24 <yushyin> that’s still nvim not vim
22:24 <ertes> ah, ok… well, the original intero was for emacs =)
22:24 <iqubic> I use nvim
22:24 <iqubic> So, what is ghc-mod?
22:25 <yushyin> another helper binary + editor plugin
22:25 <thang1> ghc-mod is a heavily hacked ghci with a ton of fancy shit added into it. In my experience, it tends to break semi-constantly because I'm not good enough at babysitting it
22:25 <Gurkenglas> :t alaf Endo foldMap -- iqubic, here (except the arguments are the right way round)
22:25 <lambdabot> Foldable t => (a1 -> a -> a) -> t a1 -> a -> a
22:26 pellegrino joined
22:26 <glguy> :t foldrOf traverse
22:26 <lambdabot> Traversable t => (a -> r -> r) -> r -> t a -> r
22:26 <yushyin> iqubic: very much the same idea as intero but less userfriendly maybe?
22:26 <iqubic> What's the best plugin(s) for editing Haskell code in Neovim?
22:26 <thang1> ertes: http://docs.racket-lang.org/lens/lens-guide.html vs https://hackage.haskell.org/package/lens#readme
22:26 <Gurkenglas> (Though it's understandable that foldr would more often be used with its current order - like (`evalState` sometrivialstartingstate)
22:27 <thang1> ertes: I find the Racket one way superior and an example of the kind of documentation I like to see
22:27 <ertes> thang1: https://hackage.haskell.org/package/pipes-4.3.2/docs/Pipes-Tutorial.html
22:28 <yushyin> iqubic: there is also vaporware like haskell-ide-engine!
22:28 sssilver joined
22:28 <iqubic> yushyin: What does that do? And why do you call it vaporware?
22:28 <ertes> thang1: the default stylesheet of haddock could be less brain-damaged, but yeah, you can have those things
22:29 <ertes> thang1: or to take an example of my own: https://hackage.haskell.org/package/progress-meter-0.1.0/docs/System-ProgressMeter.html
22:29 <Gurkenglas> :t foldrOf folded
22:29 <lambdabot> Foldable f => (a -> r -> r) -> r -> f a -> r
22:31 hc_ joined
22:31 justanotheruser joined
22:31 hiratara joined
22:31 Upsilambian joined
22:31 <thang1> Nice, ertes
22:31 <yushyin> iqubic: well I could just cite the readme or you read it yourself :) vaporware because it is so long in the making and no release in sight
22:33 Wuzzy2 joined
22:33 <thang1> So, to drop the documentation thing... Back to GHC testsuite
22:34 Uakh_ joined
22:35 soLucien joined
22:36 hc joined
22:36 zcourts_ joined
22:38 Uakh_ joined
22:39 Uakh joined
22:41 cdg_ joined
22:42 zcourts joined
22:43 Wuzzy2 joined
22:47 xcmw joined
22:47 Uakh joined
22:48 mimi_vx joined
22:51 benl23 joined
22:52 peterbec` joined
22:52 robertkennedy joined
22:53 detrumi joined
22:54 <robertkennedy> Did that lpaste come through?
22:55 anuxivm joined
22:55 <lpaste> robertkennedy revised “Odd FunctionalDependencies rejection”: “Odd FunctionalDependencies rejection” at http://lpaste.net/354696
22:58 <robertkennedy> There we go. Anyone have an idea why this fundeps fails? Possibly related to the undecidable super class, or more simply an overloaded instance collapse (which this pattern hacks around(
22:59 revprez_atlanta joined
23:00 biglambda joined
23:01 IanKelling joined
23:01 <monochrom> "a" basically overlaps with everyone in the world.
23:01 coltfred joined
23:01 <monochrom> in "instance Trek's NotP a"
23:03 Wizek_ joined
23:04 nakal_ joined
23:05 <robertkennedy> Right, that's why I do the `Trek' aisp a` and fork on aisp. The functional dependency holds, and the code works great - I was surprised I couldnt add the trivial dependency
23:06 AntiSpamMeta joined
23:06 <monochrom> a -> aisp? aisp -> a?
23:06 Shatnerz joined
23:06 markus1189 joined
23:06 <robertkennedy> a -> aisp (aisproduct in the code, sorry)
23:07 markus1199 joined
23:07 <glguy> robertkennedy: since the 'a' parameter doesn't actually uniquely determine the 'aisproduct' parameter, you can't use a functional dependency there
23:07 <nshepper1> robertkennedy: (a :&&: b) has two Trek' instances in that code
23:08 koala_man joined
23:08 orhan89 joined
23:08 orhan89_ joined
23:09 biglambda joined
23:09 <nshepper1> Your functional dependency asserts that there is only one
23:10 crobbins joined
23:10 <robertkennedy> How do you figure? In particular, this module ends up only exporting `type Trek a = Trek' (CheckP a) a`, and `CheckP (a :&&: b) = IsP`
23:10 theDon_ joined
23:10 doomlord joined
23:10 <glguy> It doesn't matter what you export
23:11 koala_man joined
23:13 <monochrom> instances are always exported. There is no export control over this.
23:14 jmcarthur joined
23:16 hc_ joined
23:19 <robertkennedy> Right, but there is no remaining ambiguity. And I don't mean to focus on the import barrier as if it were magical, only to help elucidate my API, which this design may not be the most conducive to
23:19 baetheus joined
23:19 coltfred joined
23:20 <glguy> you have two dependencies: 'x -> NotP' and 'y :&&: z -> IsP'
23:20 <glguy> Now given some type 'a :&&: b' you've asserted that aisproduct is both NotP and IsP
23:21 hc joined
23:23 <robertkennedy> Ahhhh. You're saying that the functional dependency asserts `further instances will clarify the dependency`, not that they should conform to it
23:23 tel joined
23:25 ziarkaen joined
23:25 <ij> Are exceptions comparable?
23:25 <robertkennedy> I'm not sure I communicated that well, but I think I see my problem in understanding
23:27 orhan89 joined
23:27 orhan89_ joined
23:28 zcourts_ joined
23:29 soniku joined
23:31 <EvanR> ij: yes, since exceptions are all dynamically typed
23:31 <EvanR> thats the last resort when trying to handle exceptions precisely
23:32 arpl joined
23:33 <ij> So how do I know that «e :: SomeException» is ThreadKilled?
23:33 nomicflux joined
23:34 <EvanR> :t toException
23:34 <lambdabot> Exception e => e -> SomeException
23:34 <EvanR> :t fromException
23:34 <lambdabot> Exception e => SomeException -> Maybe e
23:34 <EvanR> fromException
23:34 <EvanR> make sure you really need to catch that exception
23:35 <EvanR> i mean, specifically
23:35 <ij> It's the last resot for printing errors, so I'll catch all but ThreadKilled.
23:35 <EvanR> huh?
23:35 <ij> Why shouldn't I catch all exceptions?
23:36 <ij> In this case, that is.
23:36 <EvanR> you shouldnt catch all exceptions generally, but doing cleanup in case of any exception then rethrowing is another story
23:36 <EvanR> and is easier
23:36 <EvanR> Control.Exception bracket, finally
23:37 <ij> I've a server and I don't want crappy code to kill the server and close the connection.
23:37 <EvanR> why would it?
23:37 <EvanR> are you handling the connection in a separate thread?
23:37 <ij> Yes.
23:37 <EvanR> so the thread will die
23:37 <ij> I want reports.
23:37 <EvanR> not the whole server
23:37 <EvanR> yes the thread monitoring your connection threads can wait for death exceptions from the children
23:37 arpl joined
23:38 <EvanR> and log it
23:38 <ij> Hmm, so I don't need to add a catchJust in the (perhaps) dying thread, but in the monitoring thread?
23:38 KindOne1 joined
23:38 <EvanR> ThreadKilled can be caught (if youre really using that mechanism) in the child thread to quit normally instead of crashing
23:39 <EvanR> the thread that spawned the thread in the first place can arrange to get the final exception from the connection threads, and the async library has a really nice wrapper for doing that
23:39 <EvanR> by get the exception, i dont mean crash, but get it as a value
23:40 <ij> :)
23:41 <EvanR> see exceptions were designed to be mostly ignored in your code, and perhaps handled at some central point (or not) to simplify your code. using them for complex flow control is going backwards
23:42 orhan89 joined
23:42 orhan89_ joined
23:42 <ij> So you're saying I'm doing that? — Using them for complex flow control?
23:43 <EvanR> doing alot of work with exceptions at all basically is going backwards
23:43 <EvanR> i say
23:43 <EvanR> the async library helps with removing exception management from your application code
23:44 darjeeling_ joined
23:44 <ij> Do you really hate exceptions?
23:45 afarmer joined
23:45 zero_byte joined
23:45 biglambda joined
23:46 <EvanR> no
23:46 <EvanR> they are awesome
23:46 <EvanR> because by default they dont enter into the code... they are exceptions!
23:47 <hpc> there's a lot to not like about exceptions, but they're convenient at times
23:47 <hpc> i would feel better about them if they behaved more like java's managed exceptions
23:47 <hpc> whatever it was possible to throw being captured in the type
23:48 <iqubic> How does haskell handle exceptions?
23:48 <EvanR> that type would be ginormous
23:48 YongJoon joined
23:48 <hpc> yeah, main's type would be utter hell
23:48 raynold joined
23:48 <hpc> but i want it anyway
23:48 <EvanR> most IO primitives
23:48 <Tuplanolla> My main objection to that is that the type would leak abstraction details all the way down from the hardware implementation.
23:48 <EvanR> mains type is ideally "cant throw an exception"
23:49 <EvanR> because its handled (mostly by the default handler)
23:49 <ij> EvanR, So is there any particular function you want to suggest from async regarding catching exceptions?
23:49 <iqubic> How does Haskell manage exceptions?
23:49 <iqubic> Like can I throw an exception, and catch it later?
23:49 <EvanR> ij: the central function there, async
23:49 dibblego joined
23:50 <EvanR> other functions in there let you wait on the child threads
23:50 <ij> And thenn poll?
23:50 <EvanR> no
23:50 <EvanR> no polling ever!!!
23:50 <ij> Sorry, waitCatch.
23:51 flatmap13 joined
23:51 Wuzzy2 joined
23:51 <ij> Okay, I've no idea what your suggestion was. I got that no one should write exception code though.
23:52 <EvanR> not very much
23:52 kfish joined
23:52 <EvanR> its just balloons if you try to do things the hard way
23:52 <hpc> if you think about it, exceptions are effectively invisible gotos to anywhere in your program
23:53 <EvanR> heres another suggestion, when you fork your connection thread, use forkFinally and do the logging of the exception from there
23:53 <hpc> (if you don't think about it, they are still that anyway)
23:53 <EvanR> from the cleanup action
23:53 peterbec` joined
23:54 <iqubic> Does Haskell have exceptions at all?
23:54 <iqubic> I haven't run into them yet.
23:54 <ij> Yes, https://hackage.haskell.org/package/base-
23:54 <geekosaur> considering we discussed this in your presence last night I start to think you are a troll
23:55 <iqubic> Geekosaur, I was not reading the logs last night.
23:55 <monochrom> ij: I recommend my http://www.vex.net/~trebla/haskell/exception-tutorial.xhtml
23:55 Wuzzy3 joined
23:56 <ij> geekosaur, me?
23:56 <geekosaur> ij, no, not you
23:57 <sveit> due to laziness of (++), isn't it efficient to use a list as a FIFO queue by appending to the end?
23:58 <monochrom> ij: More specifically, for ThreadKilled, you can first nail the type to AsyncException, and then pattern-match (ThreadKilled is a data constructor of the AsyncException ADT).
23:58 <monochrom> And sometimes you may enjoy combining both steps into one single tryJust.
23:59 filterfish_ joined
23:59 <monochrom> But see my article for how to nail the type and how to use tryJust.
23:59 <monochrom> If you prefer catch* to try*, there is catchJust too.
23:59 filterfish_ joined