<     May 2017     >
Su Mo Tu We Th Fr Sa  
    1  2  3  4  5  6  
 7  8  9 10 11 12 13  
14 15 16 17 18 19 20  
21 22 23 24 25 26 27  
28 29 30 31
00:00 <monochrom> glguy, what if you don't make g a top-level definition?
00:00 <edwardk> i basically start with free definitions, either using Free or a boring data type that should be, then replace things in uppercase with lowercase stuff and inline my interpreter
00:01 <erisco> what is inherently the problem with Free?
00:01 <monochrom> I am also interested in reallyUnsafePtrEquality# (either id id) (either id id)
00:01 <glguy> monochrom: It's not magic! ;) Then you get 0
00:01 <robkennedy> glguy: ty based SPJ
00:01 <glguy> monochrom: but with the two (either id id)'s it works out
00:01 <edwardk> erisco the only real problem is you need to construct that intermediate data type then interpret it in 2 steps
00:01 <edwardk> if you get lucky it might fuse away
00:01 thunderrd_ joined
00:02 <erisco> you need to construct Fix? but it is a newtype, yes?
00:02 <edwardk> free isnt fix
00:02 <* ski> would like unboxed variant types
00:02 Tallgeese_ joined
00:02 infinity0 joined
00:02 <erisco> oh derp
00:02 govg joined
00:02 YongJoon joined
00:02 <erisco> well they both start with F, so there :P
00:02 jer1 joined
00:03 <robkennedy> ekmett: That's what I meant by the inline failure. But if you prototype in Free, it can't be too bad
00:03 <erisco> I don't think you can be so sure it is strictly a negative
00:04 <robkennedy> I'd thought Free was the deeper program, but if the goal is a simpler interface for experimenting, that's interesting
00:04 <edwardk> i dont write free cod for performance i write because i can be sure i havent boxed myself in with a bad assumption
00:05 infinity0 joined
00:05 sellout- joined
00:05 juanpaucar joined
00:06 juanpaucar joined
00:06 <erisco> what if we make the functor component strict?
00:06 JeanCarloMachado joined
00:07 <erisco> and, can we use pragmas to specialise?
00:07 juanpaucar joined
00:07 <glguy> What are you hoping to make strict to which effect?
00:08 <glguy> That won't change the representation, it will only change the behavior of the constructor when used as a value
00:08 <monochrom> Strictness may beget nontermination for this.
00:08 juanpaucar joined
00:08 halogenandtoast joined
00:09 <monochrom> Because (>>=) goes: Free x >>= f = Free (stuff here)
00:09 <erisco> well instead of chasing that let me instead say that there should be some way to have Free as a meta-ADT
00:09 <halogenandtoast> So as someone who is relatively new to Haskell (only one Yesod app online), does it make sensse to try and learn something like the Free monad
00:09 <halogenandtoast> Oh good, I'm already jumping into a Free conversation
00:10 <erisco> for example, we can manually inline the Functor into the definition of Free and this obviates the possibility of automation
00:10 infinity0 joined
00:10 infinity0 joined
00:11 <monochrom> Yeah. Which is why ski brought up unboxed sums for the same goal.
00:11 <erisco> halogenandtoast, nope I wouldn't say a beginner needs to know Free
00:11 SkyPatrol joined
00:12 <Welkin> I still don't really understand Free
00:12 <Welkin> but I have bookmarks for it when I need it (if ever)
00:12 <erisco> I am learning of recursion schemes now and that provides a good reason to understand Free and Cofree
00:12 JeanCarloMachado joined
00:12 <erisco> and at some point everyone needs to learn recursion schemes I think. based on what I am seeing in it
00:13 infinity0 joined
00:13 sellout-1 joined
00:13 <erisco> monochrom, unboxed sums? like tagged unions C-style?
00:14 <monochrom> I learned them because I researched in formal methods and I needed to know all theory and practice of fixed points.
00:14 hybrid joined
00:15 <monochrom> I really doubt that programmers outside formal methods need to care as much.
00:15 <robkennedy> halogenandtoast: I made it about a year before I felt the need for a real function of type `lookupM :: (Monad m, C v) => T -> K -> m v` (where case indicates concreteness). You can get far without real abstractions.
00:16 infinity0 joined
00:16 juanpaucar joined
00:17 gabe4k joined
00:17 jedws joined
00:19 <erisco> I imagine the challenge is finding some way to define Free so that Free f is semantically the same as the manually inlined version while also fitting into our usual syntaxes (pattern matching, constructors, etc)
00:20 JeanCarloMachado joined
00:20 <erisco> you could imagine banging something out with TH but you really still want it so that you can talk generically about Free
00:21 juanpaucar joined
00:21 <halogenandtoast> erisco: robkennedy: Thanks, I'm getting the feeling that there is some motivation of Free (at least as represented in the articles I've been reading) that have a lot of value perhaps outside of Free
00:21 <erisco> the moral of the story is to remove the wedges between performance and genericity
00:21 <halogenandtoast> The idea of representing your problem as some algebra sounds revolutionary to my OOP mind.
00:21 louispan joined
00:22 <halogenandtoast> But that probably isn't exclusive to Free.
00:22 <Myrl-saki> halogenandtoast: I've "exclusively" used Haskell for 2 years, and everything still blows my mind.
00:22 <EvanR> halogenandtoast: yes! a tiny language to describe solutions which are correct by construction!
00:23 <EvanR> though it seems that Free is specifically for imperative style solutions
00:23 jer1 joined
00:24 <ski> erisco : "unboxed sums? like tagged unions C-style?" -- no, not at all
00:25 <ski> the *continuation* should be unboxed
00:25 tromp joined
00:25 <erisco> what is the continuation in this context?
00:25 <ski> the context expecting to receive a value of the type in question
00:26 juanpauc_ joined
00:26 <erisco> I don't see it... I don't know enough about the internals, I imagine
00:27 <ski> the context of a value of type `Either a b' will typically involve using a `case', with two branches, one for `Left', and one for `Right'
00:28 <ski> the expression of type `Either a b' will need to package up the result in one location, and then the `case' will need to look there and unpack, choosing the branch
00:28 aring joined
00:28 tommd joined
00:28 juhp joined
00:28 <ski> i want to avoid this, i want to pass the two branches directly to the computation of type `Either# a b', so that as soon as it uses `Left#' or `Right#', it selects the appropriate one of the two given continuations (discarding the other one)
00:28 yrdz joined
00:29 <ski> there is never a value of type `Either# a b' materialized
00:29 <monochrom> yikes, you're going to do bi-continuation passing style
00:30 <erisco> this is the dual of unboxed tuples, then? am I getting it right?
00:30 <erisco> I am not sure what the implications of this are
00:30 juanpaucar joined
00:31 <ski> there's a paper by Olin Shivers', "Multi-return Function Call" <http://ccs.neu.edu/home/shivers/papers/mrlc-jfp.pdf>, that's about this idea
00:31 <ski> erisco : yep
00:31 <erisco> so, say we write f (Left x) then I expect the optimiser to evaluate f to the Left branch
00:31 <ski> however .. it's not that clear to me how to generalize this nicely to recursive types (e.g. lists, so that one is *guaranteed* that it's "fused", that there is no intermediate representation ..)
00:31 <monochrom> Err, wth is "capsule review"? :)
00:33 eacameron joined
00:33 <erisco> but the same could be said of tuples
00:33 <erisco> so I don't know enough about the compiler optimisations... maybe it doesn't do these things
00:34 <edwardk> erisco making the functor in free strict and changing the free constructor to match jst makes left associated binds both slow and cache inefficient rather than just slow
00:34 <ski> erisco : well, this wouldn't be an optimization, per se. it would be a guarantee
00:34 louispan joined
00:35 juanpaucar joined
00:37 nighty-- joined
00:38 Mutter joined
00:38 <erisco> how does unboxed sums connect to Free?
00:39 fotonzade joined
00:39 juanpaucar joined
00:41 <ski> <http://lpaste.net/13302> is an example of it could possibly look (translated from the example <http://lpaste.net/13299> from the paper)
00:43 <ski> .. the idea here is that we (for whatever reason) want a `filter' that will share as long a tail as possible with the input list
00:43 sproingie joined
00:43 sproingie joined
00:44 jer1 joined
00:44 juanpaucar joined
00:44 <ski> so the worker has two alternative return cases, one indicating that no element was dropped from the input list (and therefore no new list is returned), the other alternative indicating the changed list
00:46 <ski> the interesting thing is that we get what's called "semi-tail calls" : we call (recursively) with *one* of the two continuations being the same as the one we got ourselves, and the other not
00:46 tommd joined
00:46 <ski> one could write this explicitly, using CPS .. but that's a bother. i'd rather write it in direct style
00:47 afarmer joined
00:48 <ski> (in the explicitly CPS version, the type of the worker `recur' would be `[a] -> ([a] -> o) -> o -> o')
00:48 augur joined
00:49 juanpaucar joined
00:49 <ski> there almost surely needs to be syntactic restrictions of some kind regarding how things of type `Either# a b' (or other unboxed variant types) can be handled; in order to be able to guarantee that the continuations will be unboxed
00:49 <ski> (cf. restrictions for unboxed tuples)
00:49 <shlevy> suppose I have 'instance Foo a => C a' and 'instance Bar a => C a', is there any way with the overlapping mechanisms ghc has to get an error when both Foo and Bar are met and we try to solve for C but succeed when only one is met?
00:49 mjora7 joined
00:51 <erisco> I don't know of it and I don't think that makes sense with the open nature of type classes
00:51 andyhuzhill joined
00:52 <erisco> you can't generally say that an instance is impossible and if you merely want that an instance is not defined that is dubious
00:52 <shlevy> Why not? type classes are open yes but a change that breaks something that used to work would not just require a new instance, it would require a new orphan
00:52 <ski> anyway, `Free' is recursive. i suspect that if one could handle recursive unboxed variants, then such a version of `Free' would remove the overhead (or at least some of it) of using `Free' over a specialized version
00:53 <shlevy> I already have Foo, Bar, C, and a in scope at the relevant call site so the only way an extra import breaks things is if it defines an orphan for Foo or Bar a.
00:53 eacameron joined
00:53 juanpaucar joined
00:53 LHoT10820 joined
00:54 <erisco> yes, that is a problem with it
00:54 <erisco> but also it is a problem with what this constraint would mean as I outlined above
00:54 louispan joined
00:54 <erisco> it is like saying "foo is not a function"
00:55 JeanCarloMachado joined
00:55 <erisco> well, yeah, we can technically look at the list of functions we have defined, or are in scope, but this is a strange and dubious thing
00:56 <erisco> if we could be stronger and say "this is not implementable" that would be much better
00:56 <shlevy> If X has no Show instance and I call "show x" for "x :: X", I get an error. If I then import a module that defines an orphan Show instance for X, the error goes away
00:56 <erisco> unfortunately that is also much more work
00:57 Swizec_ joined
00:57 alx741_ joined
00:58 alx741_ joined
00:58 <erisco> yes, but in that case your program either has a meaning or none
00:59 <erisco> versus having different meanings depending on whether an instance is defined
00:59 <shlevy> That's the exact dichotomy I want
00:59 <erisco> no, it is different
00:59 <erisco> if your program compiles then it is a valid program and so has some meaning
00:59 <shlevy> There are no different meanings in my case
00:59 <erisco> if you get an error then your program is nonsense, i.e. has no meaning
00:59 <shlevy> "error" meant compile time error in my original question
01:00 codesoup joined
01:00 revprez_ joined
01:00 akemot joined
01:01 <erisco> sorry I must have been distracted with these chocolate chip cookies :P
01:01 Jesin joined
01:02 athan joined
01:02 lambdamu_ joined
01:02 juanpaucar joined
01:03 <erisco> let me explain it this way
01:03 revprez_atlanta joined
01:03 exarkun joined
01:04 <shlevy> Related but different question: If some term matches the head of two instances, but only satisfies the constraint of one, why is that an overlapping instance in the first place?
01:04 <erisco> say we have class C x and class D x and instances instance C x => D x, instance ~(C x) => D x
01:04 <erisco> where the ~ is standing in for our desired "doesn't have an instance" constraint
01:04 <erisco> can you see now that depending on whether x has an instance of C that we change meanings?
01:05 jer1 joined
01:05 <shlevy> erisco: But that's not what I'm asking for :D I don't think you can turn my actual example which doesn't rely on a fictitious "doesn't exist constraint" into allowing that
01:06 <EvanR> heh hackage package Stream and stream are different
01:06 <erisco> shlevy, I don't know what you are asking for then, because it seems to be the same thing to me
01:07 <erisco> you are asking for the instances of Foo excluding Bar and Bar excluding Foo
01:07 juanpaucar joined
01:07 <erisco> what is your proposed change to the language?
01:08 <shlevy> erisco: See my "related but different question" above
01:08 <shlevy> erisco: Or, to restate: If some term matches the head of two instances, but only satisfies the constraint of one, it should not be considered an overlapping instance and thus should compile fine
01:08 <geekosaur> it can't reliably check that across modules
01:09 <shlevy> geekosaur: Because of orphans?
01:09 <shlevy> geekosaur: We already allow changing compile status due to orphans. If X has no Show instance and x :: X, show x will fail to compile unless I import a module defiing an orphan
01:10 <erisco> shlevy, because that would be answering the same kind of question
01:10 filterfish joined
01:11 <erisco> instance A x => F x, instance B x => F x
01:11 revprez_atlanta joined
01:11 <erisco> this would let us answer whether x has an A instance or a B instance
01:11 <erisco> my point that even if this was all possible it is still aesthetically unpleasing as a system
01:12 juanpauc_ joined
01:12 <erisco> the intent of type classes are to be open and to that end we can't be talking about the non-existence of things
01:12 <shlevy> But you can't change behavior based on non-existence
01:12 <Welkin> open source typeclasses
01:12 <shlevy> You either compile or you don't
01:12 <Welkin> free and open source
01:12 <geekosaur> but you can compile separately
01:13 <geekosaur> if I compiled one module 6 months ago and it made a decision about nonexistence, then link against that 6 months later in aprogram that *does* define the instance...
01:13 Supersonic112_ joined
01:13 <geekosaur> (we do this with packages all the time. heck, it's stack's main schtick)
01:13 <shlevy> Ah, fair
01:13 <shlevy> OK
01:14 <erisco> instance A x => F x, instance B x => F x, instance (B x, C x) => F x my program is different if I only have instance B X versus having both instance B X and instance C X
01:14 alx741 joined
01:15 <shlevy> I mean, I hate that haskell allows orphans and if it didn't this wouldn't be an issue, but this does break modularity given that it does
01:15 <erisco> your resolution scheme is depending on the non-existence of instances
01:15 seagreen joined
01:15 <geekosaur> this isn't even orphans
01:15 <erisco> by the very nature of saying "why does it match if it doesn't satisfy this context"
01:15 <erisco> that is exactly saying "these instances do not exist"
01:15 DarKPhoeniX joined
01:16 scav joined
01:16 Philonous joined
01:16 <shlevy> erisco: I'm agreeing this feature is bad, but note that under my desired semantics the third instance could never be satisfied since it would always overlap
01:16 <shlevy> I'm *not* asking for the most specific constraint
01:16 juanpaucar joined
01:17 <geekosaur> I define a new type somewhere and give it instances, these are not orphans. And then link against your package that made a nonexistence decision when it was compiled.
01:17 <shlevy> My package can't have made a nonexistence decision for your new type
01:18 JeanCarloMachado joined
01:18 matuszak_ joined
01:18 <geekosaur> instance Foo x => Bar (Maybe x) where...
01:18 <shlevy> If my call site is too polymorphic to be sure a given constraint isn't satisfied then again it would fail
01:19 <shlevy> But anyway
01:19 <shlevy> A new orphan down the road would break modularity
01:19 <shlevy> So this is a bad idea regardless
01:19 <edwardk> shlevy: in general learning a new instance would mean that existing fully compiled code should change semantics if you allow discrimination on whether or not an instance exists. this violates the open world assumption that adding new instances and new data types doesn't affect modules that have already been compiled, which is key to incremental compilation
01:20 scopedTV joined
01:20 <shlevy> edwardk: But modulo orphans, if the only semantics change is failing to compile or not, and we only allow compilation when we *know* the given constraints aren't met, wouldn't this still be modular?
01:21 juanpauc_ joined
01:21 <edwardk> the usual whipping boy is something like instance Monad m => Applicative m
01:22 <edwardk> which overlaps every alternative definition
01:22 systadmin joined
01:22 <edwardk> but would let you fill it in
01:22 qlkzy joined
01:22 <edwardk> but in the absence of backtracking instance selection forces us to believe that all instances arise from this form
01:23 <c_wraith> is there a connection between the linear and affine as used to describe substructural typing and the linear and affine used to describe transformations?
01:24 <edwardk> but if you can backtrack then you get cases where adding the instance changes semantics. now that instance would have to live with the data type or else be an orphan, but only because Monad and Applicative are so high in the partial order of module imports
01:24 <edwardk> c_wraith yes
01:25 NeverDie joined
01:25 <c_wraith> edwardk, is there a convenient reference discussing the connection anywhere?
01:25 <edwardk> mx. vs b + mx. the former the x is used, in the latter its buried in a sum
01:25 jer1 joined
01:26 juanpaucar joined
01:26 tromp joined
01:26 Mibaz joined
01:27 nicootto joined
01:27 <edwardk> affine traversals are of the form s ~ b + m*x for instance. lenses are linear traversals s ~ m*x for some pseudo complement m
01:27 <edwardk> traversals look like more general polynomials
01:27 <edwardk> relevant traversals drop the x^0 term
01:27 Wizek joined
01:28 Wizek_ joined
01:28 <Mibaz> There are a few different implementations of the state monad in the platform, it seems. Is there a rule of thumb for selecting one to use?
01:28 <edwardk> c_wraith maybe old chat logs that shouldnt exist of #haskell-lens?
01:29 <edwardk> control.monad.state is laziest control.monad.state.strict is less lazy but less leaky
01:29 fkurkows1 joined
01:29 <c_wraith> and everything in mtl is a re-export of the versions in transformers
01:29 <Mibaz> edwardk: so stick to control.monad.state in applications that aren't performace critical?
01:29 <c_wraith> so those aren't actually different.
01:29 <edwardk> and yeah the mtl just reexports the transformer code with some instances attached
01:30 <edwardk> mibaz or where you might have tricky recursion
01:30 <Mibaz> Got it. Thanks guys
01:30 juanpauc_ joined
01:31 <edwardk> foo = do foo; modify (1:) -- works with C.M.S despite folks intuitions
01:31 <edwardk> but with the .strict variant bottoms out
01:31 <edwardk> head recursion!
01:31 <nicootto> Hi, how can I know what is reffering a type synonyms. I mean, String makes reference to [Char], but how can I see that in ghci?
01:31 <edwardk> if i wasnt on an ipad i'd feed that to lambdabot here
01:33 <ChaiTRex> nicootto: :i String
01:33 shlevy left
01:33 <Axman6> where :i is short for :info
01:34 <ChaiTRex> :i String
01:34 flatmap13 joined
01:34 <nicootto> Thanks you! I was traing with :t but without success
01:34 <ChaiTRex> lambdabot is on vacation.
01:34 satire joined
01:34 <edwardk> :t is asking the type of a value, you have a type there
01:34 <lambdabot> error: parse error on input ‘type’
01:34 Guest53231 left
01:34 <ChaiTRex> nicootto: You're welcome.
01:34 <edwardk> :t undefined :: String
01:34 <lambdabot> String
01:35 <edwardk> ^- not helpful
01:35 juanpaucar joined
01:35 <edwardk> :t "wat"
01:35 <lambdabot> [Char]
01:35 <edwardk> ^- slightly more helpful
01:35 <nicootto> okay, I got it
01:35 <geekosaur> lambdabot has no :i
01:35 <edwardk> but :i is the way to go
01:36 <edwardk> @i String
01:36 <lambdabot> Maybe you meant: id ignore index instances instances-importing irc-connect irc-password irc-persist-connect v @ ? .
01:36 <edwardk> drat
01:36 flatmap1_ joined
01:36 <edwardk> int-e: you should add :i :)
01:37 <nicootto> that makes sense
01:37 <nicootto> thanks again!!
01:37 <edwardk> of course me asking that backfires as he'll probably start bugging me to fix lens up for safehaskell again
01:37 ekinmur joined
01:37 <geekosaur> heh
01:38 <erisco> tit for tat
01:38 <ezyang> Anyone here have recommendations for Haskell libraries for generating C programs involving loops?
01:38 <* Clint> squints.
01:39 jer1 joined
01:39 juanpaucar joined
01:39 takle joined
01:40 <* edwardk> suddenly finds himself in a western
01:41 gugah joined
01:41 theDon joined
01:42 nomotif joined
01:42 FreemanXiong joined
01:44 juanpaucar joined
01:44 ddere joined
01:47 dan_f joined
01:47 hybrid joined
01:47 fosterite joined
01:49 juanpaucar joined
01:50 DataComputist joined
01:51 xcmw joined
01:51 imalison joined
01:51 geekosaur joined
01:52 augur joined
01:53 juanpaucar joined
01:53 dmwit_ joined
01:56 phaji joined
01:57 LHoT joined
01:57 takle joined
01:58 juanpaucar joined
01:58 alx741 joined
02:00 <erisco> the world stops spinning when lpaste stops responding
02:00 <Clint> nooooooooooo
02:00 hucksy joined
02:00 lambdamu joined
02:02 <erisco> 2/2 paste sites are timing out lol
02:02 juanpaucar joined
02:03 <Welkin> even github gist?
02:04 <erisco> Welkin, that's a reasonable one, thanks
02:05 <erisco> edwardk, here are the initial thoughts I had for a compiler extension to give a more efficient Free. Not sure if this just goes in a big useless circle... hoping your superior knowledge of the internals can give me a clue https://gist.github.com/erisco/65e2d098172ba86c8324f28053e76721
02:06 jer1 joined
02:07 takle joined
02:07 juanpaucar joined
02:08 acarrico joined
02:08 <edwardk> have you seen the work that is going into unboxed sums?
02:08 andyhuzhill joined
02:08 jsgrant_om joined
02:08 <erisco> the goal is to have your cake (the generic Free) and eat it too (the performance of inlining)
02:09 <erisco> ski just talked about it but I didn't see the obvious connection here
02:09 <edwardk> you're only getting rid of the overhead between Free and f here
02:09 <edwardk> not the overhead between the interpreter and the separate construction
02:09 <cheshircat> does anyone have a good setup for ghc-mod and vim in nixos with nix-shells?
02:10 xall_ joined
02:10 <erisco> edwardk, because I reconstruct with Just and Nothing anyways?
02:11 <edwardk> if you could ask ghc to do data Free f a = Pure a | Free {-# unpack #-} !(f(Free f a)). then you'd be getting the same as your proposal
02:11 <erisco> right, that was as far as I was thinking about it
02:11 <edwardk> but that would need unboxed sums and the ability to unpack polymorphic things
02:11 juanpaucar joined
02:12 lambda-11235 joined
02:12 <edwardk> the former is coming, the later is hard
02:12 <edwardk> er latter
02:12 <edwardk> ut that still doesnt address the needless data co struction followed by a separate interpretation step
02:12 <erisco> well I also intended Pure&&Maybe, Pure&Nothing, Pure&Just to be actual constructors as well, but I am not sure how small of a point this is
02:12 louispan joined
02:12 <edwardk> er sorry for typos, walking with ipad
02:13 <erisco> yes you have Free . Just and Free Nothing but generally I didn't see GHC figuring this out
02:13 <erisco> so instead when you're working concretely you have those constructors available
02:14 <glguy> The issue is that there are any constructors at all
02:14 <edwardk> the issue is what happens when f is unknown
02:14 augur joined
02:14 <erisco> yes, so then you're working with Free generically
02:14 <edwardk> but the other issue is why are we constructing anything just to interpret it separarly later like glguy said
02:14 <erisco> so that is when you use Pure and Free and the pattern matching implementations I gave
02:15 ludat joined
02:15 jsgrant_om left
02:15 <edwardk> the point is constructing anything produces overhead
02:15 <erisco> which, yes, don't seem to provide any benefit, but I am not sure how you'd have any benefit in the generic case
02:16 <erisco> hm? how are we going to construct nothing at all? we're still talking about some data type
02:16 chao-tic joined
02:16 <erisco> I thought the issue was that we have two layers of constructors
02:16 <erisco> one for Free and another for the Functor
02:16 juanpaucar joined
02:17 afarmer joined
02:17 dfordivam joined
02:17 <erisco> okay, so I see where unboxed sums can fit in on line 57/58 of my example
02:17 <erisco> if n takes an unboxed sum then we automatically select the correct branch in n
02:17 jsgrant_om joined
02:18 <erisco> I am still thinking the optimiser is going to easily pick up on the constant Just or Nothing, but I don't know how hairy it can get
02:19 <edwardk> the overhead of free is vs instead using combinators that build whatever thr final intepretation you were going to use in the first place
02:19 <edwardk> the fact that free adds a little overhead on top of the base functor is just adding insult to injury
02:19 <edwardk> the patient is already dying
02:19 <erisco> okay, I've missed the plot entirely then
02:20 <edwardk> np
02:21 <edwardk> the hell with free is picking one of 4 implementations, the adding the interpreter overhead
02:21 <erisco> how does this relate to combinators? we can construct Free from combinators... not sure where that is headed
02:21 juanpaucar joined
02:22 <edwardk> i can work with Free MyTerminal a with GetLine and PutStrzln constructors or i can call getLine and putStrLn directly
02:22 kyle1320 joined
02:22 <edwardk> if all im going to do is interpret the latter is a win
02:22 laplacian joined
02:22 <edwardk> if that is the only interpretation i need that is
02:23 <edwardk> if i need introspection / alternate usecases i need somehing closer to the former free construction
02:23 <edwardk> but if all i want to do is interact wi the user the latter is less than half price
02:23 <erisco> okay... so is this something like a fusion problem?
02:23 <edwardk> yes
02:24 jer1 joined
02:24 <erisco> what I am not sure on then is what Free has to do with it
02:24 <edwardk> going finally tagless with specialization you might convince he compiler to compile down from conmbinators in classes to whatever form. you want to interpret with, offering a middle ground
02:25 <erisco> it seems you can come up with the same dilemma with any intermediate representation
02:25 <edwardk> free is just 'as close to an initial encoding as possible for a given set of operations'
02:25 <erisco> such as any AST
02:25 <glguy> Finally tagless and specializations on everything works well enough, except that you have to specialize everything
02:25 <glguy> (manually)
02:26 juanpaucar joined
02:26 <edwardk> the discussion was generally about building an adt and interpreting vs. directly calling through final encoding via combinators
02:27 <edwardk> free is a shorthand for talking about the former approach in all its myriad forms
02:28 <erisco> I see... well that is a problem I can appreciate
02:29 codygman joined
02:30 juanpaucar joined
02:30 <codygman> Are there any notes or documentation on the implementation of template haskell?
02:30 exferenceBot joined
02:30 <edwardk> the hell of it is there are like 5-6 different tricks to use here, and each of them sucks at something different
02:31 takle joined
02:31 sleffy joined
02:31 <edwardk> Free f sucks at left associated binds, the church free fixes that but has multiple interpretation overhead, finally tagless sucks for multiple interpretation and MAY suck for left associated binds depending on the specialization, codensity is too big, reflection without remorse gives you massive constants
02:32 <edwardk> pick your poison
02:32 <glguy> If you want two interpretations of tagless, you jsut interpret it as two interpretations!
02:32 <glguy> with some more specializations
02:33 <edwardk> same issue as multiple interpretation under church free or codensity though
02:33 <glguy> It's not so good at inspecting it while you're building it
02:33 <edwardk> getting one constructor out costs full price
02:34 <edwardk> that is what i'm getting at
02:34 <c_wraith> have you tried Scott encoding? I figure it must be isomorphic to one of those.
02:34 hexagoxel joined
02:35 <edwardk> see church free
02:35 juanpaucar joined
02:35 Bhootrk_ joined
02:35 <c_wraith> Scott supposedly has the advantage of not having to pay full price to examine the outermost layer.
02:35 <edwardk> any of the cps'd free encodings suffers the "full price inspection" problem
02:36 <edwardk> you either pay to inspect the outermost constructor or you pay to >>= or you explicitly manage a catenabke output restricted deque
02:37 tromp joined
02:37 <edwardk> so the scott encoding would be equivalent to the basic Free version then
02:37 juhp joined
02:37 <c_wraith> that seems right.
02:37 <erisco> funny because it doesn't sound so hard without knowing anything about it
02:38 <EvanR> did he say catenabke or
02:38 safe joined
02:38 <c_wraith> he's typing on an iPad. :P
02:38 <edwardk> 99.9% of the time you never notice nor care
02:38 <edwardk> catenable
02:38 <EvanR> what is it supposed to say
02:38 <glguy> catenable
02:39 <* EvanR> gets out the dictionary
02:39 <c_wraith> and is really quite fast at it. :)
02:39 <edwardk> can be concatenated
02:39 <glguy> (efficiently)
02:39 juanpauc_ joined
02:40 <edwardk> O(1) worst-case catenable output restricted deques exist
02:40 <edwardk> even without output restriction
02:40 <EvanR> yet another way to lose at scrabble
02:40 ekinmur joined
02:41 <c_wraith> EvanR, the official Scrabble dictionary rejects it.
02:41 <edwardk> i have only ever suffered one defeat at "words with friends", sadly most of my day to day vocabulary is rejected by it
02:41 <erisco> Scrabble Programmer's Edition
02:41 <erisco> all words plus all abbrevations plus all jargon plus all the previous with vowels removed
02:41 zuz joined
02:42 <edwardk> and rot13 versions
02:42 <edwardk> like funpuns
02:42 <glguy> rot13 scrabble sounds rough
02:42 systadmin joined
02:42 <edwardk> so many more z and q words
02:42 <erisco> and reversed, fi, dne, etc :)
02:42 ystael joined
02:43 <glguy> cte? ;-)
02:43 <EvanR> ktp
02:43 <edwardk> hungarian notation lets you prefix each word with lp, etc
02:43 <erisco> compile-time evaluation
02:44 juanpaucar joined
02:44 sproingie joined
02:44 sproingie joined
02:45 jer1 joined
02:48 FreemanXiong joined
02:48 Michaelt293 joined
02:48 juanpaucar joined
02:49 darlan joined
02:52 takle joined
02:53 afarmer joined
02:53 juanpaucar joined
02:55 Goplat joined
02:56 permagreen joined
02:56 torgdor joined
02:57 takle joined
02:57 juanpaucar joined
02:58 avalokite joined
02:58 dan_f joined
03:00 pavonia joined
03:02 juanpauc_ joined
03:03 revprez_atlanta joined
03:03 takle joined
03:03 <thang1> Hungarian notation has always been something I disagree with. It was fine for languages that weren't sane unless you used it... but really, c'mon.
03:04 Argue joined
03:06 <edwardk> thang1: thats a what a decent type inference engine and tool support are for, after all
03:07 czyborra joined
03:07 matuszak_ joined
03:07 juanpaucar joined
03:07 ZuluKing joined
03:08 jer1 joined
03:09 <ZuluKing> how can I combine two lists, ['1','2','3'] and ['a','b','c'] as ['1','a','2','b','3','c']? I tried zipWith (:) list1 list2, doesnt work
03:09 Hunter1_ joined
03:10 tromp joined
03:11 juanpaucar joined
03:12 <edwardk> twist (a:as) bs = a:twist bs as; twist [] bs = bs
03:12 Bhootrk_ joined
03:12 <Welkin> > flatten $ zip ['1','2','3'] ['a', 'b', 'c']
03:12 <lambdabot> error:
03:12 <lambdabot> • Couldn't match expected type ‘Tree a’
03:12 <lambdabot> with actual type ‘[(Char, Char)]’
03:12 <erisco> > (\xs ys -> concat (zipWith (\x y -> [x, y]) xs ys)) ['1','2','3'] ['a','b','c']
03:12 <Welkin> > concat $ zip ['1','2','3'] ['a', 'b', 'c']
03:12 <lambdabot> "1a2b3c"
03:12 <lambdabot> error:
03:12 <lambdabot> • Couldn't match type ‘(Char, Char)’ with ‘[a]’
03:12 <lambdabot> Expected type: [[a]]
03:13 takle joined
03:13 <Welkin> ZuluKing: the short answer is `concat . zip`
03:13 <erisco> is it now
03:13 louispan joined
03:13 <edwardk> concat doesnt work with tuples the way you want
03:13 <Welkin> oh, oops
03:13 <Welkin> I have been writing too much javascript
03:14 <erisco> I also give this definition for it https://github.com/erisco/acrid-parser/blob/master/parser/common.hs#L100
03:14 <edwardk> the teist thing above interleaves and keeps going after one cuts short
03:14 <erisco> not sure how the strictness compares... wrote that a long time ago when I was learning
03:14 <edwardk> erisco's version does exactly wha is asked
03:14 <ZuluKing> I see
03:14 <edwardk> what you want lis at one extreme or the other
03:15 <ZuluKing> thanks, I need to implement a function then, thanks!
03:15 <edwardk> er twist thing
03:15 <erisco> yeah, the interleave I linked keeps going too
03:16 <ZuluKing> erisco, please take a look at this http://stackoverflow.com/questions/3938438/merging-two-lists-in-haskell
03:16 juanpauc_ joined
03:16 <ZuluKing> erisco, is the second answer better in anyway to your solution?
03:16 <edwardk> > let twist (a:as) bs = a:twist bs as; twist [] bs = bs in twist ['1','2','3'] ['a', 'b', 'c']
03:16 <lambdabot> "1a2b3c"
03:17 etehtsea joined
03:18 <czyborra> > words "my name is lambdabot"
03:18 <lambdabot> ["my","name","is","lambdabot"]
03:18 <edwardk> the second answer is my twist above, notice the question asks with lists of different lengths, so erisco's version would cut off the extra bits
03:18 <czyborra> cool!
03:18 <edwardk> if that is what you want then great
03:18 <edwardk> if not then use the other
03:19 Xanather joined
03:19 <ZuluKing> thanks both of you
03:20 Maxdaman1us joined
03:21 juanpaucar joined
03:22 balor joined
03:22 darjeeling_ joined
03:23 krok_ joined
03:24 systadmin joined
03:24 Oliphaunte joined
03:25 dsfox1 joined
03:25 juanpauc_ joined
03:25 yamadapc joined
03:28 jer1 joined
03:29 felixsch_ joined
03:30 juanpaucar joined
03:30 flatmap13 joined
03:32 dan_f joined
03:32 pgiarrusso_ joined
03:33 balor joined
03:33 juhp joined
03:34 juanpaucar joined
03:36 louispan joined
03:37 takle joined
03:37 Rodya_ joined
03:39 mmachenry joined
03:39 ryantm joined
03:39 juanpauc_ joined
03:40 kyle1320 joined
03:42 xormor joined
03:43 balor joined
03:44 juanpaucar joined
03:46 sergey_ joined
03:46 eklavya joined
03:48 augur joined
03:48 juanpauc_ joined
03:49 <Mibaz> If I made a function that should be private in an OOP language, should it just be in a where clause?
03:49 jer1 joined
03:49 xall_ joined
03:50 <EvanR> or you don't export it from the module
03:51 andyhuzhill joined
03:51 <EvanR> otoh in real life people want access to this stuff so you could put it in an My.Module.Internal other module
03:52 filterfish joined
03:52 louispan joined
03:53 <Mibaz> Alright thanks
03:53 Welkin joined
03:53 juanpaucar joined
03:55 otto_s_ joined
03:56 <thang1> Mibaz: I also find that generally in FP vs OOP, you don't really need to hide your functions in the same way.
03:58 juanpaucar joined
03:58 <EvanR> you certainly have the implementation vs the interface
03:58 <Mibaz> thang1: Makes sense, since the whole point of objects is hiding functions
03:58 <Mibaz> ("The whole point") ;)
03:58 <EvanR> it is?
03:58 <Mibaz> EvanR: Beat you to it
03:59 <thang1> Objects aren't meant to hide functions, they're meant to hide "global" variables/data. Think of them as really terrible namespaces if you want
03:59 <EvanR> i do vaguely remember that introduction to C++ classes a jillion years ago
03:59 <EvanR> "hide your shit"
03:59 <thang1> The reason certain functions should be private in objects is because they deal with data that shouldn't be exposed (ie, implementation details that are irrelevant to the app)
03:59 <Mibaz> thang1: EvanR: If you do some mental gymnastics the statement makes more sense. But obviously you guys are right.
04:00 <thang1> A classic example: A binary tree class often has a "root" pointer. This should be private of course, as all data should be. However, while a getData() function might be public, a recursive add(data) function would call a helper function add(data,root) which would be private.
04:00 halogenandtoast joined
04:00 <EvanR> later in ruby it was explained differently, "use all the global state you want, locally"
04:01 xcmw joined
04:01 <thang1> The add(data,root) is private because it's an implementation detail that's irrelevant to the concept of adding data to a data structure (which is the point of the BST class)
04:01 Bhootrk_ joined
04:02 <EvanR> the Data.Map implementation is probably a more relevant subject for this hiding discussion
04:02 <EvanR> it contains lots of routines that arent in the API
04:03 {emptyset} joined
04:06 <thang1> And all of the stuff not in the API is in Data.Map.Internal, yes?
04:07 juanpauc_ joined
04:07 sproingie joined
04:07 sproingie joined
04:08 <EvanR> yeah
04:08 <EvanR> "use at your own risk"
04:09 <Lokathor> people ping me in channel
04:09 <Lokathor> why oh why do they do that instead of sending me a PM
04:09 <Lokathor> i don't get it
04:09 <EvanR> get a plugin to help
04:09 <Lokathor> bleh
04:09 takle joined
04:09 augur joined
04:10 descender joined
04:10 <thang1> Lokathor: why can't I just ping you if it's a public question? :p
04:10 Bhootrk_ joined
04:11 <Lokathor> thang1, well you can as long as you don't ever expect a response
04:11 tromp joined
04:11 juanpaucar joined
04:11 <Lokathor> for example, i got home just now and the hexchat window had a notification effect on it, but the message that pinged me was no longer in the history buffer, so i will never know what it was about, and can't respond to it
04:12 <EvanR> plugin
04:12 <Lokathor> poo
04:12 <thang1> /plugin/
04:12 <thang1> *plugin intensifies*
04:12 ystael joined
04:12 <dyreshark> i think you could solve this problem with unsafePerformIO
04:13 <thang1> I have a plugin that turns all >text into green meme text because I'm stupid like that
04:13 jer1 joined
04:13 <dyreshark> 03>what about the >text i turn into the green meme on my own?
04:13 <thang1> s/plugin/simple regex filter/
04:13 <thang1> That's actually dark red to me... But anyway, it'll show up fine, I guess?
04:13 <* dyreshark> shrugs
04:14 <thang1> anyway see y'all. Time to journey to my girlfriend's house
04:15 ilyaigpetrov joined
04:15 chao-tic joined
04:16 juanpaucar joined
04:17 sproingie joined
04:17 sproingie joined
04:18 brynedwardz joined
04:19 takle joined
04:19 ADG joined
04:20 Oliphaunte joined
04:20 flatmap13 joined
04:20 leat joined
04:20 juanpauc_ joined
04:21 ironhide00_ joined
04:24 flatmap13 joined
04:25 juanpaucar joined
04:25 <* hackage> hpack-convert 0.14.7 - Convert Cabal manifests into hpack's package.yamls https://hackage.haskell.org/package/hpack-convert-0.14.7 (yamadapc)
04:26 <ADG> I have a function `Int -> IO Int` how to check x = f(f(x))
04:27 ortmage joined
04:27 juhp joined
04:28 <edwardk> ADG: you'd need to know _something_ about what it does. it isn't exactly safe to probe in that form
04:28 <ADG> It reads a textfile of primes and then returns the sum of divisors using that
04:29 <ADG> I had to make it IO Int because generating primes was quite tedious and slow rather than directly reading them
04:29 <edwardk> might make sense to split it into two parts, one being the 'read the file' part and the other being the 'use the file part'
04:29 <edwardk> then you can test the latter using something more like quickcheck, etc.
04:29 CurryWurst joined
04:30 juanpaucar joined
04:30 <ADG> indded I have a function `getPrime :: [Int]` and `f :: Int -> Int` which uses get Prime
04:31 <jle`> ADG: is 'f' the Int -> IO Int ..?
04:31 <ADG> let me paste it... w8
04:32 <edwardk> anyways if you have getPrimes :: IO [Int] and f :: Int -> IO Int because f x = f' x <$> getPrimes you could factor out the call to getPrimes and test f'
04:32 jer1 joined
04:33 <ADG> Here it is https://hastebin.com/asufamodux.hs
04:33 <edwardk> do you mean product of divisors?
04:34 systadmin joined
04:34 andyhuzhill1 joined
04:34 Welkin joined
04:34 falafel joined
04:34 juanpauc_ joined
04:35 <edwardk> modify sumOfproperDivisors n = do to take 'primes' as an input and then you can test it as a pure function
04:35 <edwardk> what you are passing to 'return' is the function you want to test
04:36 darjeeling_ joined
04:36 <edwardk> hard to exhaustively check of course, but you can quickcheck, smallcheck, etc. it
04:36 <edwardk> each of those will help you gain confidence in its correctness
04:36 revtintin joined
04:39 juanpaucar joined
04:39 jdt joined
04:39 Oliphaunte joined
04:39 <* hackage> hpack-convert 1.0.0 - Convert Cabal manifests into hpack's package.yamls https://hackage.haskell.org/package/hpack-convert-1.0.0 (yamadapc)
04:43 dcoutts joined
04:43 juanpaucar joined
04:47 eacameron joined
04:48 juanpaucar joined
04:49 <Lokathor> do many people find "do-blocks" distracting?
04:49 takle joined
04:49 matuszak_ joined
04:49 <Lokathor> i'm reading a blog post where at least one person does
04:49 <erisco> I avoid them where I can
04:50 <EvanR> the phrase "do-blocks" ?
04:50 <Lokathor> they present "(+) <$> Just 4 <*> Just 5" as an example, which to me is a borderline gross expression that i'd rather have in do notation most of the time
04:50 <erisco> those are not equivocal
04:50 jdt joined
04:50 <EvanR> liftA2 (+)
04:50 <erisco> your example requires only Applicative whereas do requires Monad
04:51 <EvanR> unless you have ApplicativeDo
04:51 <Lokathor> well ignore that for one moment, since Maybe implements both :P
04:51 <erisco> yes, unless you have that :)
04:52 <erisco> but that's not even how you'd see it
04:52 <Lokathor> it's not?
04:52 <erisco> you're more likely to see (+) <$> x <*> y
04:52 <erisco> or as EvanR said liftA2 (+) x y
04:52 <Lokathor> hmmm
04:52 <pavonia> I find do-bocks distracting when they introduce unnecessary boilerplate (as they would in the example about)
04:52 <erisco> no one is going to write the expression you gave because they'll just simplify to Just 9 ;)
04:52 <Lokathor> well I guess just I'd never write it like that :P
04:53 juanpaucar joined
04:53 <erisco> if we're talking aesthetics of syntax it matters
04:53 <Lokathor> erisco, it's just an example after all :P
04:53 <ADG> how to get words from "apple","ball","cat", something like `wordsBy (not . isLetter)` ?
04:53 jer1 joined
04:54 <Lokathor> pavonia, can you elaborate on the word "distracting"?
04:54 <EvanR> or perhaps aesetics of syntax
04:55 <* hackage> stack-run - An equivalent to cabal run for stack. https://hackage.haskell.org/package/stack-run- (yamadapc)
04:55 <Lokathor> i would often like to see it as a 3 line block myself.
04:55 fluffystub joined
04:56 Dance joined
04:56 darjeeling_ joined
04:56 <pavonia> Lokathor: It's like when I read a do-block I expect something with monads, but often ist's just an Applicative expression bloated with additional variables
04:56 <Lokathor> yamadapc, what are the odds that stack-run will ever switch to haskeline instead of vty?
04:57 Mutter joined
04:57 <Lokathor> pavonia, fair point. I'm perhaps guilty of having very "vertical" haskell code
04:58 peter joined
04:58 <Lokathor> lots of lets, lots of expressions that could probably be compressed down
04:58 Argue_ joined
04:58 mjora7 joined
04:59 govg joined
04:59 czyborra joined
05:02 <pavonia> Clearly a matter of personal preference. But I've also seen things like "do { x <- doSomething; return x }" being used a lot in package code (probably for consistency with other code) which I found somewhat confusing
05:02 juanpaucar joined
05:02 <Lokathor> i catch myself doing that, and cut it back down
05:02 <Lokathor> i think, possible, that block *used to be* bigger with more in between
05:03 <Lokathor> and iterations cut it down until they forgot to do the final cut down
05:04 paolino joined
05:06 dec0n joined
05:06 mbuf joined
05:06 juanpaucar joined
05:07 <Cale> pavonia: It makes sense if you expect to add additional actions there
05:09 xall_ joined
05:11 mrkgnao joined
05:11 <pavonia> Hhm, I would probably still skip the do-block then until the additional actions actually have been added
05:11 juanpaucar joined
05:12 insitu joined
05:13 <jle`> Lokathor: do blocks are sometimes more readable and sometimes less readable
05:13 <jle`> ^ pavonia
05:13 <jle`> it's not an always better or always worse kind of thing
05:14 jer1 joined
05:14 systadmin joined
05:14 conal joined
05:14 <Lokathor> I'm not often writing code where I can imagine how to write it without a do block
05:14 <Lokathor> because i end up writing big batches of IO code
05:15 <jle`> `(+) <$> x <*> y` is probably more readable because it doesn't introduce extra points
05:15 <jle`> compared to the do block version
05:15 <jle`> or liftA2 (+) x y
05:15 <jle`> the points here would mostly be line noise
05:16 <jle`> but sometimes extra variable names make things more readable
05:16 juanpauc_ joined
05:16 <Lokathor> well yeah
05:16 <Lokathor> i almost never think about Applicative >_>
05:17 <EvanR> lots of things turn out to be applicative
05:17 <EvanR> anything you can thing of zipping is a kind of applicative in that way
05:17 <EvanR> any functor you can think of zipping
05:17 <Lokathor> uh
05:17 <Lokathor> hmm
05:18 <Lokathor> let's get out my most recent haskell example
05:18 <Lokathor> oh no
05:18 <Lokathor> lpaste is being slow!
05:18 <Lokathor> 504!
05:20 fosterite joined
05:20 juanpaucar joined
05:20 <Lokathor> https://gist.github.com/Lokathor/75dfac554bae514fd1e32a9385441027 alright EvanR, I invite you to advise me on any Applicatives I'm missing out on
05:21 vlatkoB joined
05:22 <halogenandtoast> Why does lpaste frequently seem to have issues.
05:22 <halogenandtoast> s/./?/
05:22 Swizec joined
05:22 <Lokathor> you can only ask so much of the gods
05:22 <Lokathor> they have their ways
05:22 <EvanR> Lokathor: most of this code is basically FFI
05:22 <Lokathor> EvanR, I could pick another example, but I end up writing a lot of FFI crap I think
05:23 <EvanR> youre not really using any data structures except IO (which is applicative) and Ptr
05:24 conal joined
05:24 <Lokathor> well this is my problem i suppose
05:25 juanpaucar joined
05:25 Computist joined
05:25 andyhuzhill joined
05:25 xall_ joined
05:26 <EvanR> youre doing OpenGL so theres not any obvious ways to do any abstraction here
05:26 <EvanR> i mean, theres making a DSL for shaders, which exist
05:26 <EvanR> but thats not even what your code is concerned with
05:26 mmachenry joined
05:26 xtreak joined
05:26 <Lokathor> yeah once i've done more i'll probably throw some abstractions on. at the moment i want it to look as close to the C++ examples as possible for when i need to fix bugs
05:27 <EvanR> youre in the crunchy outer shell of the app at this point
05:27 <EvanR> you want to get to the nice pure interior ;)
05:27 <jle`> Lokathor: on line 52, those let things can be where declarations
05:28 insitu joined
05:28 <Lokathor> jle`, i've experimented with "where" a few times
05:28 <jle`> line 60-62 can be `(,) <$> newArray [linesPtrs] <*> newArray [linesLength]`, or `liftA2 (,) (newArray [linesPtrs[) (newArray [linesLengths])` i suppose
05:28 <Lokathor> usually drift back to let
05:29 <Lokathor> ah, now that's interesting
05:29 <jle`> not that it's a huge gain
05:29 seliopou joined
05:29 <EvanR> thats stretching.. but its definitely an example of applicative syntax
05:29 <jle`> since you're already in a do block
05:29 <jle`> but, it prevents you from thinking of frivolous names like linesPtrsPtr and lengthsPtr
05:29 <jle`> don't tell me that it wasn't painful to think of those names
05:30 <EvanR> gratuitous <$><*> where its "not appropriate" is a good way to frighten or annoy non haskellers
05:30 <Lokathor> what, i like those names >_>
05:30 <Lokathor> i like names on things
05:30 <EvanR> put a name on it
05:30 <jle`> names are usually good
05:30 <Lokathor> nomopihlia?
05:30 <jle`> some names are painful
05:30 zuz joined
05:31 <jle`> case x of Just x' -> case x' of Just x'' -> x'' + 3
05:31 <heath> is it really possible to get away with using https://hackage.haskell.org/package/extensible-effects and avoiding monad transformers? :)
05:31 <Lokathor> the best part about those names is that the GL docs are usually kinda bad, so I name my things what I'm actually attempting to do
05:31 <EvanR> what gl docs are you ready
05:31 <EvanR> reading
05:31 <Lokathor> jle`, sounds like time for (fmap.fmap.fmap) (+3)
05:31 <Lokathor> EvanR, the official spec ones
05:32 <EvanR> i mean, at least youre reading the actual docs
05:32 <heath> i'm curious what other opinions are on this
05:32 <Lokathor> as someone who lacks a period of C coding in their history, lots of C docs are all gibberish
05:33 <EvanR> i had the exact opposite experience back when i had no experience with C or pretty much anything
05:33 <EvanR> man pages and big library docs were very impressive by PHP standards (which i didnt even know yet)
05:34 fosterite joined
05:34 <Lokathor> "const GLchar **string" is something i have to stop and think about every single time
05:34 <EvanR> that doesnt even look right
05:34 <Lokathor> that's an exact quote my buddy
05:34 juanpauc_ joined
05:34 <Lokathor> https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glShaderSource.xhtml
05:34 <EvanR> ill ask you again, what docs are you rea...
05:34 <EvanR> ok
05:35 <EvanR> ok now its right, missing context ;)
05:35 <Lokathor> :P
05:35 <EvanR> that argument is to return a pointer to an array of strings
05:35 <EvanR> welcome to C
05:35 <EvanR> ive been using these http://docs.gl/
05:35 <Lokathor> ah well
05:36 andro_ joined
05:36 <Lokathor> i only need to look at the actual C stuff every once in a while if it's not immediately how the C++ tutorial should be in Haskell
05:36 <Lokathor> marashaling strings, fiddling pointers, etc
05:37 nomotif joined
05:38 jer1 joined
05:38 zuz joined
05:38 incHaskell joined
05:39 juanpaucar joined
05:39 darjeeling_ joined
05:39 <Lokathor> https://github.com/Lokathor/pcgen-hs/blob/master/src/Data/PCGen.hs EvanR, this is the least-IO code i've written lately
05:40 incHaskell left
05:40 <EvanR> i would use mostly where rather than let in there
05:41 meba joined
05:41 <EvanR> besides that, its all numbers and nothing with the right kind to be applicative. If your generator could output random values of any type however
05:41 <Lokathor> i favor let over where because then it's all "forward", and also because do block are already using lets some of the time, so it's more consistent to me
05:41 <EvanR> its not really forward though
05:41 <Lokathor> EvanR, perhaps i'll never be applicative :P
05:41 <Mibaz> Anyone use "Haskeline"?
05:42 <EvanR> the way you wrote your lets are all mutually recursive
05:42 caumeslasal joined
05:42 <EvanR> to get "forward" you need to do this
05:42 incHaskell joined
05:42 <EvanR> let x = foo in
05:42 <EvanR> let y = bar in
05:42 <EvanR> z
05:42 <EvanR> but theres not really any need in your code
05:42 <Lokathor> EvanR, they're.. not really? like that stepGen is a very literal translation from a C version, so i'm confident it's not mutually recursive
05:43 <EvanR> it totally is
05:43 <EvanR> if you rearrange the lines, itll still work
05:43 <Lokathor> Mibaz, I've looked at it a little. what's the question?
05:43 juanpauc_ joined
05:44 <Lokathor> EvanR, oh, well, they're orderless sure, but they're still not recursive.
05:44 <EvanR> > let {x = y + 1; y = 1} in x
05:44 <lambdabot> 2
05:44 <Mibaz> Lokathor: Trying to get at console keystrokes, but my value is wrapped in "MonadException". I can't for the life of me figure out where to go next
05:44 <EvanR> Lokathor: well, until you mess up and use a variable name twice ;)
05:44 <EvanR> you get recursion instead of shadowing
05:44 <Lokathor> Mibaz, MonadException is a class, you're actually working within some monad that implements MonadException
05:44 <EvanR> > let {x = y + 1; y = x + 1} in x
05:44 <Lokathor> probably InputT, in this case, wrapped over IO
05:45 <lambdabot> mueval-core: Time limit exceeded
05:45 <Lokathor> care to make a paste of your situation?
05:46 <EvanR> Lokathor: i tend to write complex algorithms out with a = answer where, and put the equations in order of "what will they want to know the definition of next"
05:46 <EvanR> but its not not having to worry about the order
05:46 <Lokathor> an earlier version of this exact library did that actually
05:46 <EvanR> also you can define functions easier that way
05:46 <EvanR> new functions with let is annoying
05:46 <Mibaz> Lokathor: Ah, right, it is a class. Are you asking me to paste or the other fellows here?
05:46 <Lokathor> next gen = outInt where ...
05:46 Computist_ joined
05:47 muesli4 joined
05:47 <Lokathor> Mibaz, you should paste the function you've got partly written, and any compile error if you have one
05:47 ali_bush joined
05:48 xall_ joined
05:48 Cooler joined
05:48 juanpaucar joined
05:49 <Lokathor> lpaste is down, but a gist or a pastebin will also work
05:49 tommd joined
05:49 incHaskell left
05:49 incHaskell joined
05:50 insitu joined
05:50 <Mibaz> Lokathor: I'll try the jist first: :t runInputT defaultSettings (getInputChar "") :: MonadException m => m (Maybe Char) I'm trying to get at that Char.
05:50 GGMethos joined
05:51 <Lokathor> ah, a classic question
05:51 <Mibaz> gist* ;)
05:51 <Lokathor> so what you want to do is similar to the example in the docs
05:51 jutaro joined
05:51 <jle`> Mibaz: it's polymorphic for all MonadExceptions
05:52 <jle`> Mibaz: so just pick an instance you want
05:52 <jle`> preferably a convenient instance
05:52 <Lokathor> http://hackage.haskell.org/package/haskeline- the loop part there
05:52 osa1 joined
05:52 osa1 joined
05:52 <Lokathor> except you'll be getting a Maybe Char instad of a Maybe String out of the action of course
05:53 juanpaucar joined
05:53 <Mibaz> Lokathor: Yeah, that's what I was trying to get done.
05:53 <Lokathor> then you can case match or whatever on the Maybe Char to get at the Char inside (when it's there)
05:53 <Mibaz> jle': How do I "Pick an instance"?
05:53 <jle`> kind of like sort :: Ord a => [a] -> [a]
05:53 <jle`> sort is polymorphic for any instance of Ord
05:54 <jle`> so what you gave can be used for any instance of MonadException
05:54 <Mibaz> jle': ah, got it
05:54 <Mibaz> Lokathor: Once I have the Maybe I can handle it. Let me look at that example again.
05:54 <Lokathor> https://gist.github.com/Lokathor/f67eff00afc705c963c4144044112e06 perhaps like this
05:54 <jle`> https://ghcguide.haskell.jp/libraries/haskeline-
05:55 <jle`> it looks like 'IO' is a proper instance
05:55 <jle`> so it can be an IO (Maybe Char)
05:55 Rodya_ joined
05:55 <Mibaz> Lokathor: wow didn't know you could put type signatures in where clauses. Neat.
05:55 <EvanR> its a good way to figure out wtf ghc is talking about sometimes
05:56 <Lokathor> Mibaz, the signature just has to start at the same indentaiton as the definiton it goes with like with a normal func and GHC will accept it
05:56 <EvanR> otherwise what it infers from your where clauses may be nothing what you intended and you can be confused
05:56 <Lokathor> note that the signature on loop is also not actually required in this case, GHC can figure that much on its own if you want
05:57 jer1 joined
05:57 <Mibaz> EvanR: That's how I spend most of my Haskell time tbh
05:57 juanpauc_ joined
05:57 <Lokathor> yes to what EvanR said, if your stuff starts stacking several layers deep it can be hard to understand what typo GHC has misunderstood and turned into a wild type
05:58 balor joined
05:58 takle joined
06:00 nshepperd joined
06:00 <Lokathor> https://github.com/Lokathor/ludolib/blob/master/src/Util/PPFOV.hs EvanR here I'm using a little more data structure.. but I've gone and done the whole thing in ST so :/
06:02 juanpaucar joined
06:02 conal joined
06:02 <EvanR> not only are you now not only using unparameterized data structures, but they also unboxed ;)
06:03 <Lokathor> assuming you're using a data type that can be unboxed, is an Unboxed Vector somehow better than a Storable Vector? or is there no difference?
06:03 xall joined
06:03 <Lokathor> for example, if you have Int
06:03 <Mibaz> Alright, I got it to compile. I'll hopefully understand it completely at some point.
06:03 <Mibaz> thanks guys
06:03 exarkun joined
06:04 <EvanR> unboxed vector is for unboxed items, which is limited to primitives and unboxed tuples (i think), while storable vector works with any storable
06:05 <Lokathor> well i get that unboxed are a subset of storable, but does it go faster?
06:05 <Lokathor> otherwise, why have it at all instead of having only storable?
06:05 revprez_atlanta joined
06:05 <EvanR> i looked into unboxed vector to see if your unboxed computations around it somehow avoid boxing Ints
06:05 <EvanR> i either didnt figure the answer out or the answer was, it doesnt and seemed pointless
06:06 juhp joined
06:06 cschneid_ joined
06:06 <Lokathor> neato, i'll just stick to storable then
06:06 juanpaucar joined
06:10 xall_ joined
06:10 soniku joined
06:11 rkazak joined
06:11 hurkan joined
06:11 juanpauc_ joined
06:11 hurkan left
06:11 wolfsif joined
06:12 eatman joined
06:12 mjora7 joined
06:15 Younder joined
06:15 <wolfsif> anyone know if there are any physics libraries (2D or 3D) that don't resort to FFI bindings?
06:15 danvet_ joined
06:15 foolswoo1 joined
06:15 juanpaucar joined
06:17 laplacian joined
06:17 halogenandtoast joined
06:17 <wolfsif> I'd like to be able to do physics inside an FRP system, and having all the calls be unsafe would kinda defeat the purpose
06:19 exferenceBot joined
06:20 juanpaucar joined
06:20 <cocreature> wolfsif: I sadly don’t know of a pure Haskell implementation. can you explain why having the calls marked as unsafe causes problems for you? it seems like that should work just fine
06:20 <jle`> it would not necessarily defeat the purpose
06:20 <jle`> as long as it exports a pure API
06:21 padfoot_maudrer joined
06:21 yunhe joined
06:21 <wolfsif> true -- although aren't all FFI calls impure?
06:21 <EvanR> or if it doesnt, because FRP could conceivably allow hooks into an impure system
06:22 <wolfsif> I'm looking at hipmunk, and the interface is certainly not pure
06:22 <EvanR> after all how else would `mouse' work
06:23 <conal> every "pure" operation in Haskell (e.g., Int addition) is essentially FFI'd and then declared pure.
06:24 <jle`> wolfsif: not necessarily
06:24 <jle`> pure API's can be implemented using FFI
06:24 <conal> if the foreign physics library has pure denotation, then declare it so. if not, wrap it in one that does. or maybe find a different physics library.
06:24 <jle`> and yeah, you can also itnerface with external IO sources in FRP as well
06:25 juanpaucar joined
06:25 yunhe joined
06:25 <conal> it'd be a shame to treat physics as imperative. it's naturally mathematical & continuous.
06:25 <EvanR> structure and interpretation of classical mechanics
06:26 <wolfsif> conal: yeah, that was my intuition, it seems there's no reason to have to do it imperatively
06:26 <conal> also, once you go imperative, you lose the compositionality and reasoning power of denotative/functional programming.
06:26 patbecich joined
06:26 Hunter1_ joined
06:26 <conal> wolfsif: many libs package for imperative languages are imperative in nature, just by habit.
06:26 sizeofchar joined
06:27 <wolfsif> i wasn't aware you can implement pure APIs using FFI though
06:27 <conal> and the imperative paradigm inescapably treats time discretely, and so doesn't fit physics.
06:28 geekosaur joined
06:28 alfredo joined
06:29 juanpaucar joined
06:29 Xanather joined
06:31 codesoup joined
06:31 <wolfsif> conal: what do you mean by pure denotation?
06:31 ZuluKing joined
06:31 <jle`> wolfsif: like conal mentioned, almost all pure API's in haskell are implemented with FFI's underneath at some level
06:32 <ZuluKing> can someone help me use this: https://hackage.haskell.org/package/iCalendar- ?
06:32 <ZuluKing> I cannot understand how to use the parseICalendar function
06:33 <wolfsif> jle: yeah, that's interesting, I wasn't aware. can you point me to more info about how I might do that myself?
06:33 <cocreature> wolfsif: basically “unsafePerformIO” :)
06:33 <jle`> it's basically just FFI + unsafePerformIO
06:33 <wolfsif> ah i see
06:33 <jle`> reasoning with the purity is up to the person who designs/implements the API
06:34 takle joined
06:34 <cocreature> in fact FFI was the original reason why unsafePerformIO was included in the haskell standard afaik
06:34 <jle`> the operations don't become magically pure because you use unsafePerformIO
06:34 juanpaucar joined
06:34 <wolfsif> right, of course
06:34 WF-BATCH joined
06:34 <wolfsif> what happens if something goes wrong in a function you've wrongly declared pure
06:34 <jle`> but, if the operation *behaves* externally pure, then unsafePerformIO lets you 'declare' it to the world
06:34 <jle`> yeah, hence 'unsafe'
06:34 <conal> wolfsif: a denotation is a precise interpretation of a language, expression, type, etc as a mathematical value, e.g., function, pair, etc. what people often call the "pure" subset of Haskell is those parts that have such an interpretation/meaning/denotation. Haskell's IO & friends have no such denotation. They're essentially Fortran.
06:35 xtreak joined
06:35 albel727 joined
06:36 <cocreature> now we only need to make them as fast as Fortran and then Haskell can conquer hpc
06:36 takuan joined
06:36 <conal> wolfsif: functional programming was about giving programming a precise & tractable basis. So-called (misleadingly named) "monadic IO" is not functional in this sense and so muddied the waters.
06:37 eacameron joined
06:37 moongazer joined
06:37 <wolfsif> right
06:38 <ReinH> conal: hi
06:38 Hithroc joined
06:38 <conal> ReinH: howdy!
06:38 <ReinH> :)
06:38 <wolfsif> my understanding was that IO is basically a type constructor like any other, except for there is some magic going on underneath that allows interaction with the external world
06:39 juanpauc_ joined
06:39 <Cale> If you like, it's the execution of IO actions which is impure
06:39 <wolfsif> and now that you've pointed out that all pure functions are basically FFI calls + unsafePerformIO, that distinction seems less meaningful
06:39 <Cale> their representation could be pure
06:39 <cocreature> Cale++ the fact that execution is a separate concept in Haskell took me way too long to understand
06:40 <adarqui> anyone here good with esqueleto ?
06:40 <cocreature> adarqui: do you have some concrete question? if so just ask that directly :)
06:40 <mniip> how do I make ghci print kinds in explicit foralls?
06:41 <mniip> I'm currently at :set -fprint-equality-relations -fprint-expanded-synonyms -fprint-explicit-coercions -fprint-explicit-foralls -fprint-explicit-kinds -fprint-explicit-runtime-reps
06:41 <mniip> and it doesn't
06:41 <Cale> The monad operations and construction of IO actions doesn't need any effects -- it's carrying out the effects which are thus described which does. It's a little bit of a shame that IO is an opaque type (and internally implemented using low level hackery rather than some pure representation). Of course, it does probably buy us a whole bunch of good performance to do that hackery.
06:41 takle joined
06:41 <Cale> But yeah, morally, it could be an algebraic data type much like any other
06:42 <wolfsif> Makes sense
06:42 <conal> wolfsif: it's that "magic" that I'm talking about. IO has an implementation but no denotation. If you only think about execution, and only in terms of an imperative model of computation, then it's hard to appreciate the fundamental divide between IO and the "denotative"/"genuinely functional" heart of Haskell (to use Peter Landin's terms). If instead you think about what programs mean in simple & precise math terms---independent
06:43 <conal> from execution---it becomes much clearer.
06:43 <wolfsif> Right, that makes sense
06:43 FreemanXiong joined
06:43 juanpaucar joined
06:43 MolluskEmpire joined
06:44 <wolfsif> and you say "monadic IO" is a misleading term because 'monadic' kind of implies purity, and haskell's IO is not pure?
06:44 laz joined
06:44 <MarcelineVQ> mniip: what are you examining?
06:44 <mniip> hmm
06:44 <mniip> not much just impredicative kind polymorphism
06:45 <Cale> I think "monadic IO" is misleading just because the fact that IO happens to be a monad is a bit of an afterthought to what it is.
06:46 Yuras joined
06:46 <wolfsif> ah
06:46 <Cale> The more interesting distinction is that there is a type of IO actions at all -- the fact that you can implement the Monad operations is nice, but even if we didn't recognise this, there would be some other means of combination available.
06:46 <conal> wolfsif: "monadic IO" is misleading because it's not at all clear what it would mean for Haskell's IO to be a monad, let alone whether it's true.
06:46 jgertm_ joined
06:46 <Cale> hm?
06:46 <adarqui> cocreature: trying to lpaste my stuff but lpaste is lagging ;d
06:46 torgdor joined
06:46 <mniip> alright
06:46 <Cale> conal: IO can just be a free monad on a functor which is able to describe various primitive interactions with the outside world
06:46 <conal> wolfsif: because the monad laws are equational, and equality is undefined for IO.
06:46 <mniip> I'll just -dppr-debug
06:46 Guest73017 joined
06:47 <wolfsif> ahh, that is true
06:47 <conal> wolfsif: for all types with a denotation, there is a natural notion of equality, namely equality of denotations.
06:47 <Cale> The IO type *can* have a denotation.
06:47 <adarqui> ok so i'll use hastebin: https://hastebin.com/elibewupew.vbs so basically, i'm trying to figure out how to add some 'grouping' in my where clause, so i have the proper precedence and stuff with my query.. The esqueleto code at the top, becomes the first query
06:47 <adarqui> but the AND's are all grouped together
06:47 <conal> Cale: IO could be a lot of things, but it isn't.
06:47 <Cale> I could invent one which would be sufficient, anyway.
06:48 <Cale> By the same measure, Haskell hasn't had a denotation since Haskell 1.0
06:48 <Cale> since nobody's bothered to keep that up to date
06:48 juanpaucar joined
06:48 <Cale> (which is sad!)
06:49 <mniip> can I TypeApplications on kind level?
06:49 <Cale> But in principle, it wouldn't be too hard -- certainly not a whole lot harder than giving any other aspect of the language a denotation.
06:49 <wolfsif> that is sad, I assumed there was some formal specification for everything except IO
06:49 <conal> The purpose of IO is as a repository for everything that we do not understand (denotationally) --- the "sin bin" as Simon PJ put it.
06:49 <wolfsif> hahah
06:49 <Cale> But then giving the *execution* of IO actions a denotational semantics, that would be something else.
06:49 <adarqui> maybe i can rework my query to get the desired result, without having the AND / OR grouping stuff
06:49 <cocreature> I think the deepspec people, specifically the ones at upenn are working on formal specs of at least GHC core
06:50 <conal> sure, one can give anything a trivial denotation that offers no insight --- essentially taking syntax and calling it semantics.
06:50 <Cale> Right.
06:50 <conal> remember, e.g., that IO is concurrent and non-deterministic.
06:51 <Cale> Yep, I'm thinking of IO as being something like:
06:51 <wolfsif> conal: do you think IO, as implemented in haskell, should have been done differently?
06:51 jer1 joined
06:51 <conal> having any old denotation isn't the important part. rather having a denotation that is precise, simple, and useful.
06:51 <Cale> data IO a = Pure a | GetChar (Char -> IO a) | PutChar Char (IO a) | ForkIO (IO ()) (ThreadId -> IO a) | ...
06:52 <mniip> hm, this is bad
06:52 <Cale> Presumably what you'd actually want to do is to find some basic FFI primitives which would be sufficient, and make constructors for those rather than really having GetChar/PutChar, but that gives some sort of idea
06:52 <mniip> impredicative polymorphism in kinds
06:52 juanpaucar joined
06:53 <mniip> does neither work nor give you any sort of warning before exploding with an undecipherable type errror
06:53 <conal> Cale: yes, that's an example of trivial "syntax-as-semantics" denotation. which also applies to Fortran and C.
06:53 slomo joined
06:53 <Cale> That type will have a denotation which is still *somewhat* useful. More useful than nothing.
06:53 <Cale> and more useful than the CPP stuff, due to the fact that it involves the semantics of functions
06:54 <conal> Cale: remember that that data type has hundreds of thousands of constructors, growing all the time via FFI.
06:54 <Cale> You can still compute *some* things mathematically about the behaviour of IO actions, just from this quasi-syntactic level
06:54 <Cale> It's not quite the same as source-level syntax
06:54 halogena1dtoast joined
06:54 <conal> wolfsif: in the 80s, we were really searching for denotative understandings of I/O, OSs, etc. that progress slowed to a crawl with the invention of the current non-denotative alternative.
06:55 <Cale> conal: Well, you'd have some constructors which take descriptions of how FFI is to be done, and whose types depend on those descriptions. Probably needs a GADT
06:56 Rodya_ joined
06:56 insitu joined
06:56 <Cale> You wouldn't just keep adding constructors really -- you'd just have some which were sufficiently general to capture the interface to C calls.
06:56 <Cale> I think Idris actually does this, doesn't it? Maybe not. I forget.
06:56 <conal> Cale: still, what you describe is just a side-stepping of denotation. all of those imperative operations/constructors are valuable exactly because their specific operation, and you're ignoring those specifics.
06:57 <Cale> Yes, what I'm suggesting does miss *most* of the point of talking about IO actions, to be sure.
06:57 juanpaucar joined
06:57 kuribas joined
06:57 <Cale> and usually you would want to strive for something better
06:57 splanch joined
06:57 <Cale> But while there are a lot of C libraries out in the world we might want to take advantage of, it does help to have a well-specified language to describe communication with them.
06:58 <wolfsif> Interesting
06:58 <Cale> I'd still like to see all this *properly* written out.
06:58 <Cale> rather than just existing informally in our mental models of what's going on :)
06:58 <wolfsif> I'm having trouble imagining what formal denotation for IO would even look like, intuitively it seems like a black box by nature
06:58 <conal> This is an old conversation, going back further than my old posts http://conal.net/blog/posts/the-c-language-is-purely-functional and http://conal.net/blog/posts/notions-of-purity-in-haskell .
06:58 takle joined
06:59 <Cale> wolfsif: Well, did you see my fake data declaration?
06:59 <Cale> data IO a = Pure a | GetChar (Char -> IO a) | PutChar Char (IO a) | ForkIO (IO ()) (ThreadId -> IO a) | ...
06:59 <wolfsif> No, I haven't
06:59 <wolfsif> oh, that, yes
06:59 <Cale> wolfsif: So that's rather oversimplified, but not by too much!
06:59 <Cale> We would actually need to have a type which describes all the details of making an FFI call
06:59 Itkovian joined
06:59 <conal> wolfsif: as I mentioned IO is very unlikely ever to have a (nontrivial) denotation, because its purpose is exactly to handle what we don't understand denotationally.
07:00 <Cale> and it would be incorporated into IO's algebraic data type in a similar fashion
07:00 splanch_ joined
07:00 <Cale> and since algebraic data types have a denotation, so would this IO type
07:00 <conal> wolfsif: as we develop mathematical/denotational understandings, we pull things *out* of IO.
07:00 <Cale> Even if it's not a denotation which would satisfy Conal's (and to be honest, anyone's) desire to understand what IO actions mean fully.
07:00 <conal> Cale: yes, in the same sense that C is purely functional/denotative.
07:01 <Cale> conal: I think you're being a little overly dismissive of its value there though.
07:01 <Cale> It's a much better denotation than CPP has, for example.
07:01 <Cale> It explains a lot more about what's going on
07:01 <conal> we can always say that something means itself, but it's not useful.
07:01 <Cale> It leaves out a lot of important details still
07:02 juanpauc_ joined
07:02 <Cale> But for example, there are going to be functions in there, whose denotations are mathematical functions
07:02 <Cale> The fact that it's higher order abstract syntax does buy you a little
07:03 <Cale> So you can perhaps at least explain mathematically how the next primitive action to be carried out depends on the result of the previous.
07:03 kuribas` joined
07:03 <conal> Cale: i do agree Haskell+IO is a better Fortran than the original Fortran, but our sights used to be set much higher.
07:03 <conal> another old related post: http://conal.net/blog/posts/can-functional-programming-be-liberated-from-the-von-neumann-paradigm
07:04 <Cale> They still are set much higher
07:04 <conal> (we've been having this conversation for years.)
07:04 <Cale> haha
07:04 <Cale> yes
07:05 freusque joined
07:05 <Cale> My day job now involves FRP every day -- and it's FRP with reasonable semantics too (though it's one that assumes less about time than your FRP did)
07:06 raichoo joined
07:06 juanpaucar joined
07:06 <wolfsif> Thanks for the links and the explanations, I'll read through these
07:06 <wolfsif> Also conal, I've been going over your early papers / blog posts on FRP as I learn, they've been helpful
07:07 <conal> wolfsif: glad to hear it :)
07:08 ventonegro joined
07:08 BartAdv joined
07:09 jer1 joined
07:09 dm3 joined
07:09 micmus joined
07:10 guiben joined
07:11 soniku joined
07:12 eacameron joined
07:13 ali_bush joined
07:13 ali_bush joined
07:13 tromp joined
07:13 fizruk joined
07:13 guillaum2 joined
07:14 vlatkoB_ joined
07:15 Hithroc_ joined
07:15 xtreak joined
07:15 juanpauc_ joined
07:16 fizruk joined
07:16 eacameron joined
07:17 eklavya joined
07:19 <* hackage> 2 packages (gtsteel): https://qbin.io/bp8kidac0
07:20 juanpaucar joined
07:21 <kuribas`> what's a good alternative to regexps?
07:21 Argue__ joined
07:21 <kuribas`> or, is haskell a good replacement for perl/ruby?
07:23 <Cale> kuribas`: attoparsec
07:23 <kuribas`> isn't that overkill?
07:23 <Cale> no
07:24 <kuribas`> ok :)
07:24 takle joined
07:25 hackage joined
07:25 juanpaucar joined
07:25 jzeus joined
07:25 xtreak joined
07:25 pellenation joined
07:26 <kuribas`> would you use haskell instead of sed, awk?
07:26 <Cale> Sometimes
07:27 <Cale> It doesn't take much for an application of sed or awk to become an unmaintainable mess
07:27 ragepanda joined
07:27 <Cale> It's often better just to write it from the beginning in a sensible way
07:27 <johnw> and especially if you write such things often, you end up with templates that make future sensibile solutions much quicker to write
07:28 nickolay joined
07:28 yoneda joined
07:29 coot joined
07:29 bennofs joined
07:29 xificurC joined
07:29 juanpauc_ joined
07:29 conal joined
07:30 paolino joined
07:30 <mauke> haskell is not a good replacement for perl IMO
07:30 halogenandtoast joined
07:30 jer1 joined
07:30 <kuribas`> yuck perl
07:30 <mauke> and I'd say attoparsec is underkill for regexes
07:31 <kuribas`> mauke: you mean overkill?
07:31 <mauke> no
07:31 <kuribas`> mauke: it's /less/ powerfull?
07:31 <mauke> yes
07:32 fizruk joined
07:32 mattyw joined
07:33 <mauke> for example, attoparsec parses bytestrings
07:33 <mauke> I usually use regexes on text, not binary data
07:33 <mauke> so that's not very useful
07:33 <Cale> attoparsec can also parse Text
07:33 dfordivam joined
07:34 <Cale> https://hackage.haskell.org/package/attoparsec
07:34 juanpaucar joined
07:34 bram_ joined
07:34 thc202 joined
07:34 <[exa]> fun fact-- binary data tend to be regular more frequently than text
07:35 <osa1> IIRC cabal had a flag for formatting .cabal files, anyone remember it? I can't find it in --help
07:35 <kuribas`> [exa]: so we need a fuzzy matching library?
07:36 <Cale> Yeah, it's one thing if you actually need to exploit the fact that your language is regular in order to get an efficient automaton for processing your input, but I think most people who use "regexes", not to mention most regex implementations, don't seem to care much for that.
07:36 <[exa]> yep :]
07:37 indi_ joined
07:37 <kuribas`> Also most regular expressions aren't regular.
07:37 <mauke> ok, so how do you do e.g. s/(\X)/[$1]/g with attoparsec?
07:37 <Cale> I don't know, give me 10 minutes to figure out what it means
07:38 <mivael> conal: Thank you for writing (and mentioning) "Notions of purity in Haskell". It was a useful reading for me. (And I think I share the principles you describe.)
07:38 pie_ joined
07:38 <[exa]> anyway, is anyone aware of how parsec/attoparsec works internally? does it create flex/bison-style tables or is it haskellish?
07:38 <Athas> [exa]: no tables; Haskellish.
07:38 <mauke> Cale: it puts [ ] around every grapheme cluster
07:38 <Athas> That's the biggest limitation of the parser combinator approach.
07:38 juanpaucar joined
07:39 quchen joined
07:39 <[exa]> I'm thinking about writing something that can partially evaluate to the table
07:39 <[exa]> probably not as rich as parsec though, but still quite powerfull imho
07:39 <Athas> That would be cool, but also impossible if the parser is a monad I think.
07:39 <Athas> Maybe you can do it for one that is merely Applicative.
07:41 PennyNeko_ joined
07:41 <[exa]> good point
07:42 <[exa]> well, it might be interesting, adding to todo list. :]
07:42 sproingie joined
07:42 sproingie joined
07:42 meba joined
07:43 <Athas> The only reason I sometimes use traditional table-driven parser generators is for debugging grammars. They are a PITA besides.
07:43 juanpaucar joined
07:43 <Cale> mauke: I guess I'd write a graphemeCluster parser using Data.Text.ICU or something, and then fmap (T.concat . map (\x -> "[" <> x <> "]")) (many graphemeCluster)
07:44 <[exa]> Athas: extremely fast PITA though.
07:44 <Cale> mauke: I've never had to care about grapheme clusters :P
07:44 connrs joined
07:44 <Athas> [exa]: sometimes, but Attoparsec can be pretty fast too.
07:44 <mauke> Cale: that's about 5 times longer and even less readable
07:44 taksuyu joined
07:45 <Cale> mauke: It should be, it's a weird operation.
07:45 patbecich joined
07:45 <mauke> not really; grapheme clusters came up when I had to implement message splitting for IRC
07:46 Cooler joined
07:46 <Cooler> is there a javascript to haskell compiler?
07:46 xtreak joined
07:46 <Cale> Cooler: hahaha
07:46 <mauke> AFAIK no
07:46 Argue_ joined
07:47 <Cooler> i am having trouble converting my javascript program to haskell
07:47 <Cooler> how do you make a table?
07:47 <Cooler> a 2d array, indexed by strings
07:47 juanpauc_ joined
07:48 <Athas> How is it 2D if it is indexed by strings?
07:48 <mauke> if it's indexed by strings, it's not an array
07:48 <osa1> maybe you index it by two strings
07:48 <Taneb> Cooler, why are you converting JS to Haskell? The languages are very different and you need to think about them differently to program well
07:49 <Cooler> well you know about lr parsing tables?
07:49 <mauke> no
07:49 <Cooler> where you have a table whos rows are indexed by state number and columns which are indexed by terminals and non-terminas
07:49 <[exa]> Cooler: so it is indexed by token or by char?
07:49 tommd joined
07:50 merijn joined
07:50 <Cooler> whose*
07:50 <Lokathor> Cooler, there's a Map type that's in the containers package, you could index that by whatever you want as long as it's got an Ord instance
07:50 takle joined
07:51 <Cooler> like this https://image.slidesharecdn.com/cc-parsing-101209190947-phpapp02/95/compiler-components-and-their-generators-lr-parsing-65-638.jpg?cb=1357625270
07:51 darjeeling_ joined
07:51 orhan89 joined
07:51 <Taneb> Cooler, the way parsing is normally done in Haskell is with parser combinators, which is a rather different way to go about it to LR tables
07:52 <mauke> > inRange ('a', 'z') 'x'
07:52 <lambdabot> True
07:52 <mauke> if you want to, you can index an array with Char
07:52 juanpaucar joined
07:52 <Cooler> well no the tokens are strings, not just a single char
07:53 <Athas> Cooler: parser tables are indexed by pairs of states and terminals. Usually the terminals are represented by an integer.
07:53 <Athas> But yeah, use a Map.
07:53 <Athas> Then the tokens can be whatever you want.
07:53 fizruk joined
07:53 eacameron joined
07:53 jer1 joined
07:54 <Cooler> Athas, a Map for each row?
07:55 biglama joined
07:56 dec0n joined
07:56 <Lokathor> Cooler, probably a Map entry per cell
07:56 <Athas> Cooler: no, a Map instead of the table.
07:56 <Lokathor> and you can index by tuples for (row,col)
07:57 <Athas> You want the table to have type 'Map (StateId,Token) StateId'.
07:57 juanpauc_ joined
07:57 insitu joined
07:58 Rodya_ joined
07:58 haxx0r joined
07:59 <mauke> Cale: in fact, the IRC message splitting problem is a good one. you want to split a string into chunks, subject to several constraints. you don't want to split grapheme clusters if you can avoid it. you want to split at whitespace if possible. chunks should be neither too short nor too long, so splitting at non-whitespace is unavoidable sometimes. if (for some reason) you can't split between grapheme
07:59 Gurkenglas joined
07:59 <mauke> clusters, fall back to codepoints. but all length constraints on chunks are in terms of bytes (when encoded as UTF-8).
08:00 <Athas> The issue here is that Haskell does not have a good Unicode processing library, isn't it?
08:00 <Athas> My impression is that many languages are without such a thing. Swift gets it right, as I understand.
08:01 <merijn> Athas: Text does better than average (i.e. compared to other languages), but if you *really* want to do locale aware unicode you want to use text-icu
08:01 <merijn> Which are just bindings for the icu C implementation
08:01 juanpaucar joined
08:01 <mauke> well, in perl you have "native" unicode support, which is 100% integrated with e.g. regexes
08:01 <Cooler> which Map btw
08:02 <mauke> which is why I think "just use attoparsec" doesn't cut it
08:02 <Athas> mauke: does it help you deal sanely with things like bidirectional text?
08:02 <mauke> Athas: ah, good one. I don't know because I never had to deal with that
08:02 zzz joined
08:02 augur joined
08:02 <dysfun> there is 'sane' with bidi text?
08:03 <mauke> my current message splitting code doesn't handle directionality changes at all, e.g.
08:03 <Cooler> there are a lot of maps
08:03 <Lokathor> mauke, as i understand it, the message frames of IRC are split by \r\n byte sequences, but that sequence won't show up as part of a multi-byte character in UTF-any
08:03 <Lokathor> Cooler, https://hackage.haskell.org/package/containers-
08:03 zariuq joined
08:04 <mauke> Lokathor: ... what does that have to do with anything?
08:04 takle joined
08:04 <Lokathor> mauke, well you can split the message frames when you've purely got bytes, and worry about unicode or not after that
08:04 <Athas> dysfun: I thought the same thing after I wrote that remark...
08:04 <mauke> Lokathor: we're talking about outgoing messages, not incoming
08:04 <Cooler> Data.Map.Strict ?
08:04 <mauke> we're producing IRC, not consuming
08:04 <Athas> I'm just a poor parallel compiler researcher, and I long ago realised I'm not smart enough to handle human text.
08:04 <Lokathor> mauke, ahh, my mistake
08:05 <Athas> Cooler: yes.
08:05 <mauke> Lokathor: the problem is that IRC has a message size limit of 512 bytes, including the terminating CR/LF
08:05 <Athas> There is also Data.Map.Lazy, but you probably want Strict for a parser table (and the difference is small).
08:05 <mauke> Lokathor: so when you want to send something longer, you have to split it across multiple messages
08:05 <Lokathor> mauke, true, true. guess the answer is to only ever produce ASCII so that you can always predict your message size :P
08:06 <merijn> Athas: So, is NVidia's Volta stuff trying to obsolete your research too? ;)
08:06 <Athas> merijn: not at all! What are they doing?
08:06 <Lokathor> actaully you can encode the final arg of the privmsg, check how many bytes that is... ah.. then you're kinda hosed if you went over :/
08:06 <Athas> Unless they managed to make nested parallelism work efficiently, I think I still have a job.
08:06 juanpaucar joined
08:06 <merijn> Athas: I've only skimmed a few headlines. They're basically throwing out the whole "schedule things as a warp" idea
08:07 <merijn> Athas: And just sticking 32 independent program counters/schedulers into their SMs
08:07 <merijn> Athas: I'm not actually sure that's going to obsolete my research, tbh. But it'd have made a lot of my work much easier to make fast than it was so far
08:08 flatmap13 joined
08:08 <mauke> ooh, glob matching is also fun
08:08 <mauke> I might actually write a haskell implementation later
08:09 <Athas> merijn: er, what? It no longer executes in lockstep?
08:09 mekeor joined
08:09 <merijn> Athas: I'm not sure of the details, but it is possible to execute stuff out of lockstep, yes
08:09 yellowj joined
08:10 <mauke> task: decide whether a string matches a given glob pattern (where ? matches any char, * matches any amount of any char, and no escapes)
08:10 ertes-w joined
08:10 <eklavya> I have a small utility (converter) that I need to give to a team
08:10 acidjnk22 joined
08:10 <mauke> this is probably easier to do manually in haskell, but one possible implementation is to use a regex to convert the glob pattern into a regex :-)
08:10 juanpaucar joined
08:11 <eklavya> what is the best way to create standalone executables for windows, mac and linux?
08:11 <Athas> merijn: there has to be a catch. Tremendous amounts of CUDA code depends on free synchronisation within warps.
08:11 <mauke> eklavya: run ghc on the corresponding platform?
08:11 <eklavya> oh
08:11 <eklavya> I only have access to a mac
08:11 <eklavya> :(
08:11 andyhuzhill joined
08:12 <eklavya> mauke: anything I should be aware of or if you would like to suggest something?
08:12 <merijn> eklavya: Download a VM like VirtualBox and install linux/windows into the VM and built on there
08:12 <Lokathor> eklavya, ask a person on each other platform within the team to do the build for you and share among that platform
08:12 <Athas> 100 TFLOPS is crazy performance (even if it's FP16).
08:12 <mauke> perl implementation: $pat =~ s{(\W)}{ $1 eq '?' ? '.' : $1 eq '*' ? '(*PRUNE).*?' : '\\' . $1 }eg; $pat = qr/\A$pat\z/s;
08:13 xanadu_ joined
08:13 <eklavya> Lokathor: that might not be a bad idea but I fear I might have to do a lot of environment debugging/handholding
08:13 <Lokathor> eklavya, if you're not using much FFI, stack on windows is pretty easy
08:14 <eklavya> let me try that
08:14 <merijn> Athas: Oh! I get what they're doing. It's just misleading headlines by incompetent people :)
08:14 <eklavya> thanks Lokathor mauke merijn :)
08:14 <Athas> merijn: so what's going on?
08:14 <merijn> Athas: So basically, before you had one PC and stack per warp, right?
08:15 <Athas> merijn: well, "stack".
08:15 <Athas> But one PC, sure.
08:15 <merijn> Athas: Which means that when you diverge you *have* to run both divergent computations in one single run, since you can't actually track where you are in the middle
08:15 juanpaucar joined
08:15 jer1 joined
08:16 <Athas> Yeah.
08:16 <Athas> Oh, they run them concurrently now or what?
08:16 <merijn> Athas: Since they're storing the PC *per thread* they can actually interleave different divergent branches
08:16 <Athas> You still have to synchronise after the branch, don't you?
08:16 <merijn> Athas: Well, suppose we head "if (threadIdx.x < 4) { A; B; } else { X; Y; }"
08:17 <Athas> Storing a PC per thread sounds like a waste of register space to me, but whatevs. I don't do optimisation at this level, so this is unlikely to affect me much.
08:17 <merijn> Previously they'd basically run "A; B; X; Y" in a row, with just sections of the warp masked
08:17 dfordiva` joined
08:17 <merijn> Athas: Now they can run "A; X; B; Y;" interleave == better latency hiding
08:17 tomphp joined
08:18 <merijn> Athas: Since they store the state of both branches per thread, and thus remember "where" to continue
08:18 xall_ joined
08:18 <Athas> How deep does this go?
08:19 <merijn> But you're basically still screwing up your efficiency until you reconverge
08:19 <Athas> You can have multiple nested branches, after all.
08:19 kolko joined
08:19 fluffystub left
08:19 <Athas> It sounds like a minor (but useful) improvement to branch divergence cost.
08:20 juanpauc_ joined
08:20 <merijn> Yeah, I got suckered by the headlines saying "independent scheduling" while it's way more minor than that
08:20 mjora7 joined
08:20 <Athas> I definitely want one of these things, though.
08:20 ph88^ joined
08:20 Kreest__ joined
08:21 <ph88^> anyone have a clue why this guys https://softwareengineering.stackexchange.com/a/173442 claims "Compared to Lisp, Haskell (for example) is a lot friendlier" ?
08:21 dfordivam joined
08:21 <Lokathor> compile time checks are nice, for one
08:21 <merijn> One of colleague was trying to convince me to write a proposal to get a GTX1080Ti for my home desktop so I could "wrok from home" >.>
08:22 <Athas> Hmm, NVIDIA used to send free GPUs to researchers...
08:22 <Athas> That's how I got my K40.
08:23 <merijn> I doubt they're giving me a 1080Ti for free :p
08:23 <Athas> ph88^: Haskell has a better standard library, in particular for functional programming and OS interaction.
08:23 pgiarrusso joined
08:23 <zomg> merijn: I just bought one of those yesterday :P
08:23 <merijn> Also, type system :)
08:24 <merijn> zomg: I'm still telling myself they're to expensive
08:24 <Athas> merijn: a K40 is near 3000 euros.
08:24 <merijn> But I'll probably cave somewhere in the coming months...I hope to last maybe one price drop
08:24 <zomg> well, I work from home so it's a 50% tax writeoff for me :D
08:24 juanpaucar joined
08:24 Proteus joined
08:24 <Athas> https://developer.nvidia.com/academic_gpu_seeding
08:24 <zomg> that's my justification for it anyway!
08:24 <zomg> lol
08:25 jhrcek joined
08:25 chrisM_1 joined
08:26 <merijn> Athas: Did you just list yourself as researcher?
08:26 <Athas> merijn: I got my advisor to apply.
08:26 <kuribas`> ph88^: not sure I agree, LISP is more imperative, so probably more familiar. But it could be that s-exps turns people off.
08:27 <merijn> Athas: I'm not sure mine will, given that we already have a couple in the shared cluster :)
08:27 bigos joined
08:27 Sampuka joined
08:27 <Athas> merijn: upgrade your advisor!
08:27 aaronmcadam joined
08:28 <merijn> Athas: I suspect nearly any other advisor will be a downgrade :)
08:28 andyhuzhill joined
08:29 Faucelme joined
08:30 marr joined
08:33 lep-delete joined
08:33 juanpauc_ joined
08:34 gehmehgeh joined
08:34 takle joined
08:35 jer1 joined
08:37 <merijn> One of these days I need to invent a language where converting between integer types isn't such a pain...
08:37 Faucelme_ joined
08:37 <mniip> so like C?
08:37 <mniip> no wait
08:37 <mniip> php
08:37 <merijn> mniip: C *is* a pain
08:37 slomo joined
08:37 slomo joined
08:37 <merijn> I want *safe* conversion, not "pray we don't all die" conversions
08:37 sfcg joined
08:38 oish joined
08:38 <merijn> replicateM_ wants Int, but I have Int64, but there's no easy functions to do anything remotely safe
08:38 juanpaucar joined
08:38 juhp joined
08:39 <seequ_> I mean, the preferred conversion depends on the use case
08:39 <merijn> I want like
08:39 <seequ_> And platform, heh
08:39 cloudhead joined
08:40 padfoot_maudrer joined
08:40 tomphp joined
08:40 padfoot_maudrer joined
08:40 <kuribas`> merijn: it's not a pain, because everything is an integer!
08:40 <kuribas`> in C
08:40 <merijn> "(Integral a, Integral b) => a -> (b, a)" which gives you either: 1) maxBound of 'b' and a remainder as 'a' or 2) 'a' as type 'b', with remainder of 0
08:40 <merijn> kuribas`: Except it's not
08:40 <seequ_> You can cut the bits in half, convert to MAXINT if it goes over or wrap around
08:41 <seequ_> Or that
08:41 <kuribas`> merijn: it has both types until observed.
08:41 <merijn> kuribas`: And I once had to fix a bug in the Haskell RTS three times, because my fixes kept being fuckups, despite 3 reviewers looking over them each time and not seeing an issue >.>
08:42 Faucelme joined
08:42 fizruk joined
08:42 swistak35 joined
08:42 <seequ_> kuribas`: that is absolutely not true - C allcates exactly 4 bytes for av32-bit int
08:42 tefter joined
08:43 juanpaucar joined
08:43 <merijn> What C allocates for an int is absolutely unknown and platform dependent
08:43 <seequ_> A 32-bit*
08:43 <Athas> Might not allocate anything!
08:43 <merijn> Aforementioned bug I fixed came from the fact that GHC uses 64bit Int on *all* 64bit platforms and there was a lacking (safe) conversion to CInt
08:44 <merijn> Which meant it worked fine IFF the 64bit C also used 64bit int
08:44 <merijn> Fun fact: OSX ABI has a 32bit in for 64bit C...
08:44 Silox| joined
08:45 <cocreature> merijn: 32bit ints on 64bit systems is pretty common. clang does that as well on my system
08:45 <cocreature> (archlinux)
08:45 <Athas> Almost all operating systems behave that way.
08:46 <merijn> cocreature: eh...your compiler shouldn't decide that. That's based on the ABI. Afaik linux ABI uses 64bit int
08:46 patbecich joined
08:46 <cocreature> merijn: I’ve never been on a system where it 64bit
08:47 <Cooler> how do you clear the console in ghci?
08:47 juanpaucar joined
08:50 andyhuzhill1 joined
08:51 aring joined
08:51 xall_ joined
08:51 <Cooler> also does main not get executed when loading in ghci?
08:51 michi7x7 joined
08:52 juanpaucar joined
08:52 <Athas> Cooler: no, main does not get executed.
08:52 <Athas> I don't know if you can clear the console.
08:53 <Cooler> keep having to quit out of ghci to clear it
08:53 shlevy joined
08:54 yobohohoz joined
08:54 <shlevy> Would it be safe to allow type synonym family applications in instance heads when they're injective in all of the otherwise unconstrained type variables?
08:55 aloiscochard joined
08:55 <mniip> shlevy, unlikely
08:56 <mniip> shlevy, wait you mean fully applied families right?
08:56 <shlevy> mniip: Yes
08:56 jer1 joined
08:56 <shlevy> The type family is fully applied
08:56 <merijn> hmm
08:56 <mniip> do you have a simplified usecase in mind?
08:56 <shlevy> mniip: Lemme try to whip one one
08:56 <shlevy> up
08:56 juanpaucar joined
08:57 <mniip> do you want to rewrite something like 'instance (Fam a ~ TyCon b) => Cxt (TyCon b)'
08:57 <mniip> with 'instance Cxt (Fam a)'
08:57 <merijn> How do I check where a function gets imported from? afaik replicateM_ comes from Control.Monad, but it's in scope even if I don't import it
08:57 <Athas> merijn: define your own, use it, and see what the error says.
08:58 <merijn> Athas: Well, I did define my own, but it's ignore that one and not saying why :p
08:58 <mniip> merijn, :info tells you where it is defined
08:58 <mniip> also, replicateM_ is not in Prelude
08:58 <merijn> mniip: I know, hence my confusion...
08:58 <mniip> not in scope by default
08:58 <mniip> are you exporting it?
08:58 Boomerang joined
08:58 <merijn> oh, I see my error elsewhere
08:59 Rodya_ joined
08:59 <ertes-w> is there something simpler than optparse-applicative for very simple UIs?
09:00 <ertes-w> "simpler" in the sense of "i need to write less boilerplate code"
09:00 <shlevy> mniip: merijn: http://sprunge.us/Qfjh
09:00 <merijn> ertes-w: What's boilerplatey about optparse?
09:01 <shlevy> I need the DifferentReader in the head to avoid the spurious overlap
09:01 <osa1> I guess you could get a arg parser from a Generic instance
09:01 juanpaucar joined
09:02 mmn80 joined
09:03 <Cooler> for Data.Map.Strict is there a version of lookup thats k -> Map k a -> a?
09:03 jchia1 joined
09:04 <Athas> Cooler: no. What if the key is missing?
09:04 <phadej> Cooler: (!)
09:04 <Cooler> i would prefer it just crash rather than having to deal with Maybe
09:05 <Athas> Oh yeah, I guess there is (!).
09:05 balor joined
09:05 <Cooler> thx
09:06 juanpaucar joined
09:06 <seequ_> fromJust is nice too when it can be proven the thing exists
09:07 Filip__ joined
09:07 <mniip> unsafeCoerce @Maybe @Identity
09:07 <mniip> ;)
09:08 <mniip> no wait Identity only has one con...
09:08 <phadej> and is newtype
09:08 <ertes-w> merijn: this: execParser (info (helper <*> pure Options) mempty)
09:08 <ertes-w> merijn: i have to look those things up every time i use it
09:08 <quchen> mniip: Identity has zero constructors
09:08 <quchen> Ah, phadej beat me to it.
09:09 xtreak joined
09:09 <ertes-w> merijn: and remember to use 'helper', etc., which, BTW, is kinda stupid =)
09:09 <ertes-w> osa1: optparse-generic already exists, but it's awkward to use
09:09 <osa1> ah, cool. I didn't know it
09:10 juanpauc_ joined
09:11 valkyr2e joined
09:12 tobiasBora joined
09:13 xtreak joined
09:15 michaelw joined
09:15 juanpaucar joined
09:15 Xanather_ joined
09:16 filterfish_ joined
09:16 ptek joined
09:17 jer1 joined
09:20 juanpauc_ joined
09:21 <Cooler> show Data.Map.Strict needs better formatting
09:21 kantokomi joined
09:21 <Cooler> maybe put each entry on a new line
09:23 <mniip> don't use show
09:23 exarkun joined
09:24 <merijn> Show is not for pretty printing
09:24 <mniip> ^
09:24 juanpaucar joined
09:25 <Cooler> well it auto uses show when you ask for a variable in ghci
09:25 <merijn> You can change what ghci uses to print things
09:25 <phadej> Cooler: http://hackage.haskell.org/package/pretty-show-1.6.12/docs/Text-Show-Pretty.html
09:25 <sbrg> It's also pretty easy to just do something like: mapM_ print $ M.toList yourMap
09:25 <sbrg> or some such
09:26 <Cooler> yeah that works
09:26 Itkovian_ joined
09:27 oish joined
09:28 kritzcreek joined
09:28 <Cooler> sbrg, why mapM_ instead of map?
09:28 benl23 joined
09:29 shlevy left
09:29 <sbrg> `map print` will give you a list of type [IO ()], which is a list of IO actions which haven't been performed yet.
09:29 Yuras joined
09:29 juanpaucar joined
09:29 <sbrg> :t map print [1..10]
09:29 <lambdabot> [IO ()]
09:29 <sbrg> :t mapM_ Print [1..10]
09:29 <lambdabot> error:
09:29 <lambdabot> • Data constructor not in scope: Print :: Integer -> m b0
09:29 <lambdabot> • Perhaps you meant variable ‘print’ (imported from Prelude)
09:29 <sbrg> oops
09:29 <sbrg> :t mapM_ print [1..10]
09:29 <lambdabot> IO ()
09:33 juanpaucar joined
09:34 <kuribas`> Is there a library for doing shell scripting? For example calling "find", and acting on each file?
09:34 <suppi> there's turtle and shelly
09:36 <kuribas`> turtle looks nice
09:37 jer1 joined
09:38 juanpauc_ joined
09:39 kfollesdal joined
09:40 zero_byte joined
09:40 <Cooler> is this fine? data Tree = Node Int [Tree]
09:40 <mauke> @src Tree
09:40 <lambdabot> Source not found. I don't think I can be your friend on Facebook anymore.
09:41 <mauke> aw
09:41 <kuribas`> Cooler: if you want only an infinite tree?
09:41 <Cooler> actually data Tree = Node String String [Tree]
09:41 indi_ joined
09:41 <merijn> kuribas`: How is that infinite?
09:41 <kuribas`> Cooler: disregard that, you can set [Tree] to []
09:41 <merijn> kuribas`: List could be empty
09:41 <kuribas`> merijn: yeah
09:41 <mauke> Cooler: looks a lot like http://hackage.haskell.org/package/containers-
09:41 <mauke> Tree (String, String)
09:43 juanpaucar joined
09:43 <Cooler> @src Data.Tree
09:43 <lambdabot> Source not found.
09:43 <Cooler> why?
09:43 <mauke> no one added it
09:43 meba joined
09:43 <Taneb> @src is something that is not as cool as it sounds
09:43 <Cooler> its on hackage
09:43 <merijn> lambdabot's @src just look inside a small text file
09:44 bishop_neaster joined
09:45 xall_ joined
09:45 indi_ joined
09:47 darjeeling_ joined
09:49 insitu joined
09:50 tommd joined
09:50 shangxiao joined
09:51 patbecich joined
09:51 tomphp joined
09:52 juanpauc_ joined
09:53 conal joined
09:56 juanpaucar joined
09:57 pie_ joined
09:58 pgiarrusso joined
09:58 Proteus joined
09:59 Yuras joined
09:59 Rodya_ joined
10:01 shesek joined
10:01 jer1 joined
10:01 juanpaucar joined
10:01 uglyfigurine joined
10:02 pgiarrusso_ joined
10:03 augur joined
10:05 treaki joined
10:05 juanpauc_ joined
10:06 <Cooler> i get an error https://hastebin.com/wohesataba.vbs
10:06 revprez_atlanta joined
10:06 splanch joined
10:07 <Cooler> trying to import qualified Data.Stack as Stack
10:08 indi_ joined
10:09 <Cooler> do i need to install Data.Stack?
10:09 <Cooler> i thought it came with the haskell platform
10:09 splanch_ joined
10:10 kamyar joined
10:10 <kamyar> Hello fellows
10:10 <Cooler> oh wow theres actually 1505 people here?
10:10 <sbrg> Cooler: why not just use a list?
10:10 <Cooler> sbrg, hmm?
10:10 <kamyar> Please help me with Stack guild:
10:10 <sbrg> for a stack
10:10 juanpaucar joined
10:10 <kamyar> How to specify (any version) in extra-deps
10:10 indi_ joined
10:11 <Cooler> sbrg, well theres already a type in Data
10:11 <sbrg> I've never heard of Data.Stack before
10:11 <kamyar> extra-deps: [CBOR-, random-strings-, persistent-uuid-any] fails
10:11 bram_ joined
10:11 <kamyar> extra-deps: [CBOR-, random-strings-, persistent-uuid] fails either
10:11 <Cooler> doesn't tail take O(n) time?
10:11 <sbrg> nope.
10:12 <mniip> tail is O(1)
10:12 splanch joined
10:12 <sbrg> tail (x:xs) = xs
10:12 <Cooler> no not tail
10:12 <Cooler> uh... last?
10:12 <sbrg> but you don't append, you prepend.
10:12 <sbrg> yes
10:12 <mniip> why would you use last
10:12 <sbrg> push x xs = x:xs
10:12 silver joined
10:12 <sbrg> pop (x:xs) = x
10:12 <mniip> :t (:)
10:12 <lambdabot> a -> [a] -> [a]
10:13 <sbrg> or rather, pop (x:xs) = (x, xs)
10:13 <mniip> :t uncons
10:13 <lambdabot> [a] -> Maybe (a, [a])
10:13 <sbrg> yeah, that's nicer
10:13 <Cooler> that doesn't explain the error
10:13 bram_ joined
10:14 entuland joined
10:14 whoisxy joined
10:14 <Boomerang> What error are you refering to Cooler? Trying to pop an empty stack?
10:14 <Boomerang> That's why uncons can return Nothing
10:14 <Cooler> https://hastebin.com/wohesataba.vbs
10:14 gehmehgeh joined
10:14 <Boomerang> Oh :o
10:15 splanch_ joined
10:15 <sbrg> Cooler: yes, that is because you don't have the library installed. but there is no reason to install some package for a stack since you can just use lists
10:15 <mauke> it's in MissingK
10:15 juanpaucar joined
10:15 <Boomerang> Have you install the Stack package before trying to import Data.Stack?
10:15 <mauke> http://hackage.haskell.org/package/MissingK-0.0.1/docs/Data-Stack.html
10:15 <Cooler> i didn't have to install anything for Data.Map or Data.Tree
10:15 <mauke> Boomerang: what
10:15 <kamyar> Hey anyone here to reply me?
10:15 <sbrg> that's because data.stack is not in base
10:15 <sbrg> while those are
10:16 <mauke> it gets better: type Stack a = [a]
10:16 <Boomerang> Is it not this one: https://hackage.haskell.org/package/Stack-0.3.2/ ?
10:16 <sbrg> ^
10:16 jedws joined
10:16 <mauke> oh, could be
10:16 <Cooler> https://hackage.haskell.org/package/Stack-0.3.2/docs/Data-Stack.html
10:16 <mauke> well, then
10:17 <Cooler> oh there are Maybes
10:17 <mauke> the only thing that gives you is automatically tracking sizes
10:18 <mauke> over [], I mean
10:18 <Cooler> well also is it mutable?
10:18 <Cooler> instead of making a lot of lists
10:18 <mauke> what
10:19 <Cooler> when you push and pop, is it making a lot of lists?
10:19 <mauke> nothing makes "a lot of lists"
10:19 quinor joined
10:19 netheranthem joined
10:19 juanpaucar joined
10:20 <quinor> hello, looking for advice on parser libraries; I'd like to parse into AST a programming language with syntax similar to Haskell
10:20 <mauke> here's the source: https://hackage.haskell.org/package/Stack-0.3.2/docs/src/Data-Stack.html#Stack
10:20 <quinor> which library would be the best? I'm thinking parsec but I'm novice and not sure
10:20 jer1 joined
10:21 <sbrg> quinor: you could go with a parser generator. there's happy for that, and alex for lexing
10:21 <sbrg> they can work together pretty easily. they're very similar to bison and flex, if you're familiar with those
10:21 Maxdaman1us joined
10:21 <Cooler> mauke, well is the list immutable, wouldn't push and pop make copies then?
10:21 <quinor> I don't like generators, prefer libraries (I'm not familiar with bison/flex yet)
10:22 <quinor> also, the grammar is not entirely context-free (indentations!)
10:23 <Boomerang> Cooler, the compiler will optimise your list "copies". Since they are immutable you can refer to them from a "new" list.
10:23 <mauke> Cooler: ... no?
10:23 <mauke> Cooler: why would you ever need to copy an immutable structure?
10:24 <quinor> sbrg: also, features like my own operators aren't particularly easy in parser generators
10:24 im0nde joined
10:24 juanpaucar joined
10:24 <sbrg> why?
10:25 ziocroc joined
10:25 <Boomerang> mauke: I think Cooler is refering to pop (uncons) which returns the new stack, while you still have access to the old one. This may look like a copy, while it's not
10:25 <Cooler> Boomerang, i guess a linked list type of scenario going on
10:25 beerdrop joined
10:25 <mauke> Cooler: [] is a singly linked list
10:26 shivansh joined
10:26 <Boomerang> Cooler, it is a linked list. if you change (x:xs) into (y:xs) the xs is not copied
10:26 <quinor> sbrg: operators defined in the source file? how would you manage that (usually grammar with precedences and associativenesses parses ops directly to AST)
10:27 shivansh left
10:27 treaki joined
10:27 <sbrg> quinor: sure, but defining a new operator is just like definining a new function, except the operator can use a different set of characters. pretty sure it's no biggie
10:28 <sbrg> caveat: I haven't implemented custom operators using a parser generator, but I don't think it would be a problem
10:28 <quinor> so you definitely recommend parser generators vs parsing libraries?
10:29 juanpaucar joined
10:29 <Cooler> i hate one line documentations http://hackage.haskell.org/package/containers-
10:29 <sbrg> well, from what I've gathered, if you use something like parsec and such, you have to ensure that you don't run into infinite left recursion and such.
10:29 <sbrg> I'm kind of working on a compiler on and off, in Haskell, and I started using parsec and such, but ended up using happy/alex
10:29 <sbrg> it just felt simpler
10:29 <Athas> quinor: if you already know that your grammar is correct, then Parsec can be fine.
10:29 <mauke> I don't like parser generators
10:29 <Athas> But the nice thing about Happy is that it will tell you about ambiguities.
10:30 <quinor> sbrg that's very valuable opinion
10:30 <Athas> Although Happy is a total PITA in many other ways. The errors are terrible, the UTF-8 handling is wonky, it's hard to run on top of your own monad...
10:30 <mauke> Cooler: what are you looking for?
10:30 osa1 joined
10:30 osa1 joined
10:30 <Athas> (Some of these are alex issues.)
10:30 <quinor> luckily I'm quite good with formal grammars and it's supposedly not ambiguous
10:30 <Athas> I've also written a compiler in Haskell for the past few years, and I use Happy/Alex.
10:30 <Cooler> whats the first argument to unfoldtree
10:30 <Cooler> ?
10:31 <mauke> Cooler: a builder function
10:31 <sbrg> Athas: yeah, the documentation for running your own monad through the whole thing is not the best.
10:32 <Cooler> ohhhh
10:32 <Cooler> ok
10:32 <mauke> Cooler: it takes a "seed" value and returns values for constructing a Node
10:33 <Cooler> yeah
10:33 <quinor> hmm, are there any more fun parser libraries than parsec?
10:33 juanpaucar joined
10:33 <quinor> have read of some but couldn't reason whether they are better
10:34 <quinor> ie. https://www.reddit.com/r/haskell/comments/46u45o/what_is_the_current_state_of_parser_libraries_in/
10:36 <sbrg> I usually use megaparsec these days
10:36 <sbrg> or just ReadP when it's enough, since it's in base
10:36 fotonzade joined
10:36 eacameron joined
10:38 koserge joined
10:38 juanpaucar joined
10:38 <quinor> thanks sbrg :)
10:40 balor joined
10:40 <kuribas`> is there a better way to do this? view $ grep (has "opencl") $ fmap (unsafeTextToLine . format fp) $ ls "/usr/src"
10:40 splanch joined
10:40 gmcabrita joined
10:41 c4r50nz joined
10:41 jer1 joined
10:42 nighty-- joined
10:42 juanpaucar joined
10:42 quinor left
10:44 <kuribas`> it seems more verbose than "ls /usr/src | grep opencl"
10:44 zariuq joined
10:44 <mauke> ls /usr/src/*opencl*
10:45 <kuribas`> even better
10:47 juanpaucar joined
10:49 ziocroc joined
10:51 kamyar joined
10:52 whoisxy joined
10:52 juanpaucar joined
10:53 bennofs joined
10:53 <ZuluKing> can someone please explain how do I use this https://hackage.haskell.org/package/iCalendar-, I just can't figure out!
10:54 <Cooler> i thought you needed to do let in ghci to define variable
10:54 <Cooler> use*
10:54 <Cooler> apparently not
10:54 torstein joined
10:56 <Geekingfrog> ZuluKing: do you have anything more precise ?
10:56 juanpauc_ joined
10:57 <kamyar> Hey fellows
10:57 <kamyar> please help me in Stack build
10:58 <kuribas`> Cooler: not anymore
10:58 <mekeor> ZuluKing: use read the icalendar file as bytestring, then use `parseICalendar def filepath bytestring`
10:59 <Cooler> why did they change that
10:59 <Cooler> ?
10:59 <mekeor> ZuluKing: DecodingFunctions is an instance of the Default type class, so you can just use `def` (for utf-8, apparently)
10:59 <ZuluKing> mekeor how do I get the def?
10:59 <Geekingfrog> ZuluKing: import Data.Default (def)
10:59 <mekeor> ZuluKing: it's defined in that module
11:00 <mekeor> ... or what Geekingfrog said
11:00 <Geekingfrog> and then you can use `def` to supply the DecodingFunction argument
11:00 <ZuluKing> I have to be the biggest idiot alive
11:00 <ZuluKing> thanks a lot guys
11:00 <Geekingfrog> nah, it took me some times to understand what was this "default" thing as well
11:00 Rodya_ joined
11:01 soniku joined
11:01 juanpaucar joined
11:01 FreemanXiong joined
11:02 darlan joined
11:02 Snircle joined
11:05 juanpauc_ joined
11:06 cschneid_ joined
11:06 gabe4k joined
11:06 paulsamw` joined
11:08 filterfish joined
11:09 __paul0 joined
11:09 venkat24 joined
11:10 juanpaucar joined
11:10 paulsamways` left
11:10 yrdz joined
11:12 fendor joined
11:13 wonko7 joined
11:14 Wuzzy joined
11:14 tromp joined
11:14 juanpaucar joined
11:16 Sampuka joined
11:17 <Cooler> omgggg they brought ubuntu to the windows store
11:18 oisdk joined
11:19 quchen joined
11:19 juanpaucar joined
11:20 sillyotter joined
11:23 moongazer joined
11:24 juanpaucar joined
11:24 <* hackage> threepenny-editors - Composable algebraic editors https://hackage.haskell.org/package/threepenny-editors- (PepeIborra)
11:25 <moongazer> What are some good resources to learn functional programming for a complete beginner? Any good books which teach functional programming theory(lambda calculus) as well as the language itself?
11:26 <hpc> @where learnhaskell
11:26 <lambdabot> https://github.com/bitemyapp/learnhaskell
11:26 gehmehgeh joined
11:26 <hpc> ^ this has a breakdown of a number of resources
11:26 <merijn> For type theory (including lambda calculus) Pierce's "Types and Programming Languages" is good, but all the code examples in it are written in OCaml, so it does assume you already know the basics of functional programming
11:26 oisdk joined
11:27 <hpc> i don't know of one that specifically has both λcalc and haskell taught at the same time
11:27 <hpc> but you tend to pretty quickly pick up both from most haskell resources
11:27 <hpc> with a trip to wikipedia maybe for the names of some concepts
11:27 <Philonous> The examples are easy enough to understand if you know Haskell.
11:28 <Philonous> (In TAPL I mean)
11:28 <Philonous> Ocaml isn't that different
11:28 <merijn> Philonous: Sure, which is why I said you need the basics of FP, not OCaml ;)
11:28 paulsamways joined
11:29 <Philonous> Yes, I just wanted to clarify, because it's not obvious that you can read OCaml just because you know Haskell
11:29 <hpc> and yeah, TAPL isn't exactly what you asked for but it'll be good to read
11:31 <Philonous> If you want to get really into lambda calculus I can recommend Hindley/Seldin: "Lambda-Calculus and Combinators: An Introduction"
11:31 <moongazer> http://www.seas.upenn.edu/%7Ecis194/spring13/lectures/01-intro.html : This course is completely text based, right?
11:32 <Philonous> I've heard very good things about Barendregt "The Lambda Calculus, Its Syntax and Semantics" too, but I haven't read it
11:32 <opqdonut> it's pretty hard to come by
11:33 juanpaucar joined
11:33 <moongazer> Is the course I posted completely text based or are other things available elsewhere?
11:33 <Philonous> libgen has both
11:34 Big_G joined
11:35 ent joined
11:37 Cooler joined
11:38 juanpauc_ joined
11:41 <Cooler> test, did i dc?
11:42 juanpaucar joined
11:44 jer1 joined
11:45 balor joined
11:47 sdothum joined
11:47 juanpaucar joined
11:47 JeanCarloMachado joined
11:48 dfordivam joined
11:49 <* hackage> http-streams - An HTTP client using io-streams https://hackage.haskell.org/package/http-streams- (AndrewCowie)
11:51 Sigyn joined
11:51 juanpauc_ joined
11:52 <* hackage> http-streams - An HTTP client using io-streams https://hackage.haskell.org/package/http-streams- (AndrewCowie)
11:52 soniku joined
11:52 Yuras joined
11:53 ccomb joined
11:54 patbecich joined
11:54 jedws joined
11:54 muesli4_ joined
11:55 fizruk joined
11:55 <* hackage> haskeline-repl - https://hackage.haskell.org/package/haskeline-repl- (reinvdwoerd)
11:56 juanpaucar joined
11:57 michaelw joined
11:57 <kuribas`> hm, turtle isn't that convenient.
11:58 <kuribas`> With so much conversion: FilePath, Line, Text, String
11:58 asmyers joined
12:00 Filip__ joined
12:00 juanpaucar joined
12:01 jedws joined
12:02 <Cooler> read "99" gives an exception but read "99" :: Int works
12:02 <Cooler> why
12:02 <merijn> Cooler: in ghci?
12:02 <tdammers> read "99" shouldn't even compile
12:02 <Cooler> yeah
12:02 <merijn> tdammers: Extended defaulting ;)
12:02 <tdammers> merijn: oh right
12:02 <merijn> Cooler: GHCi defaults everything to ()
12:02 bloogie joined
12:02 <merijn> so it's interpreting 'read "99"' as 'read "99" :: ()'
12:02 <tdammers> :t read
12:02 <lambdabot> Read a => String -> a
12:02 <merijn> which fails, for obvious reasons
12:03 <Cooler> ok
12:03 <Cooler> so should i use read if i know something is going to be int?
12:03 <tdammers> Cooler: normally, it wouldn't compile, because the type of `read` doesn't tell the compiler enough to figure out which Read instance to use
12:03 <merijn> Cooler: If you'd done this in a .hs file the compiler would've told you "can't figure out which type this should be"
12:03 <kuribas`> :t read @Int
12:03 <lambdabot> error:
12:03 <lambdabot> Pattern syntax in expression context: read@Int
12:03 <lambdabot> Did you mean to enable TypeApplications?
12:03 <merijn> Cooler: In generaly you should use "readMaybe" rather than read :)
12:03 ziocroc joined
12:03 <kuribas`> :set -XTypeApplications
12:04 <kuribas`> :t read @Int
12:04 <merijn> > readMaybe "foo" :: Maybe Int
12:04 <lambdabot> error:
12:04 <lambdabot> Pattern syntax in expression context: read@Int
12:04 <lambdabot> Did you mean to enable TypeApplications?
12:04 <lambdabot> error:
12:04 <lambdabot> Variable not in scope: readMaybe :: [Char] -> Maybe Int
12:04 <merijn> > Text.Read.readMaybe "foo" :: Maybe Int
12:04 <lambdabot> error:
12:04 <lambdabot> Not in scope: ‘Text.Read.readMaybe’
12:04 <lambdabot> No module named ‘Text.Read’ is imported.
12:04 <merijn> bleh
12:04 <merijn> @let import Text.Read (readMaybe)
12:04 <lambdabot> Defined.
12:04 <merijn> > readMaybe "foo" :: Maybe Int
12:04 <lambdabot> Nothing
12:04 <bloogie> is "actually, we just took a bunch of laws we liked and grouped them and named that group <CLASS>" a valid answer to "where do <CLASS> laws come from"?
12:04 <merijn> > readMaybe "99" :: Maybe Int
12:04 <lambdabot> Just 99
12:05 JeanCarloMachado joined
12:05 danza joined
12:05 <tdammers> bloogie: bit tongue-in-cheek, but pretty much yes - "we liked them" means "we liked them because they turned out useful"
12:05 <Cooler> well it works in ghci, i have an array arr of objects, and i wanna do arr !! read idx
12:05 juanpaucar joined
12:05 <Cooler> where idx is String
12:05 <merijn> Cooler: if you use !! then ghc infers you meant Int
12:05 <Cooler> not sure if it works because ghci defaulted it
12:05 <tdammers> Cooler: that's because type inference tells ghci that read in this case must return Int
12:06 <Cooler> ok
12:06 <tdammers> but without the extra context that determines the return type, ghci can't figure it out, and defaults to ()
12:06 <tdammers> (while plain ghc will instead raise a compiler error)
12:07 <tdammers> `read` basically says, "give me a String, and I'll give you any type you want, as long as that type has a Read instance"
12:07 Silox| joined
12:07 <tdammers> but in order for that to work, you have to actually tell it what type you want
12:07 <tdammers> either by annotating explicitly, or by feeding the output to another function that determines the type
12:07 <tdammers> in this case, (!!) says that its RHS operand must be Int
12:08 <tdammers> which automatically establishes that what you want from `read` must also be Int
12:08 oisdk joined
12:10 <ertes-w> incoming rant…
12:10 juanpauc_ joined
12:10 <ertes-w> > intToDigit 15
12:10 <lambdabot> 'f'
12:10 <ertes-w> > intToDigit 16
12:10 <lambdabot> *Exception: Char.intToDigit: not a digit 16
12:11 <Cooler> shouldn't that be called intToHex?
12:11 petermw joined
12:11 <tdammers> intToHexDigit -- problem solved
12:11 <Cooler> ^
12:11 <ertes-w> that's bullshit
12:11 <Philonous> Still partial
12:11 <ertes-w> why limit it in the first place?
12:11 <tdammers> actually yes, it's still bad
12:11 <tdammers> because there's no hex digit of value 16
12:12 <tdammers> but then, why have Int as the domain
12:12 <tdammers> should be HexDigit
12:12 jedws joined
12:12 <Cooler> or Hex
12:12 <tdammers> or, alternatively, that function might take the lowest 4 bits and just ignore the rest
12:12 <Cooler> Hex :: Int -> [Char]
12:13 <ertes-w> no, why cut off at 'f'? it's an arbitrary restriction, so now that i need a function that goes to 'z' i need to write my own
12:13 <tdammers> ertes-w: yes, I understand your gripe
12:13 <tdammers> ertes-w: just saying that it *might* make sense to have a function that only ever produces valid hex digits
12:13 shangxiao joined
12:14 Hithroc joined
12:14 <ertes-w> i hate PHP… you know i do… but there are *some* things we can learn from it =)
12:14 juanpaucar joined
12:15 <tdammers> like what? "implement unicode strings before your language implementation becomes so messy that nobody dares touch the string code"?
12:15 <ertes-w> yeah, like that
12:15 oish joined
12:15 roconnor joined
12:16 jutaro joined
12:16 tromp joined
12:16 <tdammers> "when somebody tells you that your exception handling implementation lacks a 'finally' keyword, listen to them"
12:16 coot joined
12:17 Sampuka joined
12:17 <merijn> ertes-w: We already have on like that
12:18 <merijn> :t Numeric.readInt
12:18 <lambdabot> Num a => a -> (Char -> Bool) -> (Char -> Int) -> ReadS a
12:18 <ertes-w> yes, i know
12:19 <ertes-w> also more liek showIntAtBase
12:19 <ertes-w> like
12:19 <merijn> oh, for show, yes
12:19 juanpauc_ joined
12:20 <merijn> > Numeric.showIntAtBase 36 ((['0'..'9']++['a'..'z'])!!) 4971947
12:20 <lambdabot> <[Char] -> [Char]>
12:20 <merijn> > Numeric.showIntAtBase 36 ((['0'..'9']++['a'..'z'])!!) 4971947 ""
12:20 <lambdabot> "2ykdn"
12:21 takle joined
12:22 <ertes-w> merijn: yeah, exactly…
12:22 <ertes-w> > showIntAtBase 36 intToDigit 500 ""
12:22 <lambdabot> "*Exception: Char.intToDigit: not a digit 32
12:22 <roconnor> I was looking for the canonical isomorphism between Bool and Maybe (). It turns out to be guard and is Just. Looks like isJust is useful afterall. :D
12:23 <ertes-w> it would fit perfectly, but no… intToDigit thinks that programmers are stupid and need to be patronised
12:23 <merijn> roconnor: Why not "fromMaybe False (const True)" ?
12:23 <roconnor> That's fine too, but isJust is shorter.
12:23 <merijn> ertes-w: Not sure I agree
12:23 <merijn> ertes-w: Who decides what digits >9 should be
12:24 phaji joined
12:24 balor joined
12:24 xall_ joined
12:24 fendor joined
12:25 <ertes-w> merijn: i'm happy with the arbitrary choice of using letters
12:26 nickolay joined
12:27 shoopaloop joined
12:27 <kuribas`> > 3464222640803604219751913774552677603 ^. re (base 35)
12:27 <lambdabot> "allyourbasearebelongtous"
12:27 juanpaucar joined
12:29 <merijn> I don't suppose anyone's written a tool to output grouped criterion numbers sorted by performance?
12:29 <merijn> i.e. I have a large number of benchmarks and would like to turn them into ranking, but doing so by hand each time is annoying
12:29 jdnavarro joined
12:29 extra- joined
12:30 mattyw joined
12:30 juanpaucar joined
12:30 petermw joined
12:31 <kuribas`> > 121241300170824412702092713388346906099 ^. re (base 35)
12:31 <lambdabot> "allaboutthatbasenotrouble"
12:31 <merijn> *treble :p
12:33 <kuribas`> lol
12:39 jedws joined
12:40 ik joined
12:41 extra- joined
12:41 kyle1320 joined
12:42 HoierM joined
12:44 exarkun joined
12:45 <liste> what's the easiest way to count Trues in a list?
12:45 <liste> (or any values with Eq)
12:46 <lyxia> length . filter id
12:46 <liste> lyxia: thanks
12:48 guardianx joined
12:50 indi_ joined
12:50 chocopuff joined
12:51 Sampuka joined
12:51 pratch joined
12:52 jedws joined
12:52 CoolerZ joined
12:56 pratch joined
12:56 fsestini joined
12:57 ZuluKing joined
12:57 <ZuluKing> hey, can anyone tell me how can I apply a filter function that takes two arguments?
12:58 <Clint> what would the two arguments be?
12:58 <ZuluKing> one is obviously the item in list and then one another generic type
12:58 <ZuluKing> i need to compare item to that, cannot hardcode
12:58 patbecich joined
12:59 <merijn> Not sure what "another generic type" means
12:59 <ZuluKing> Like List.filter(a -> a.Equals(x))
12:59 <merijn> ZuluKing: so... just "filter (==x)"?
12:59 <ZuluKing> I need to pass that x to filter function as well, which is obviously not allowed
13:00 <merijn> > filter (/=3) [1..10]
13:00 <lambdabot> [1,2,4,5,6,7,8,9,10]
13:00 <exarkun> Remember that all functions actually only take one argument. Functions that look like they take more actually just take one argument and return another function.
13:00 <ZuluKing> merijn that was a simplification, x is a record and I need to extract some fields from it
13:00 <exarkun> (that takes an argument and returns ...)
13:00 <ZuluKing> Yeah, I know. I just want to know how to do it
13:00 <merijn> I still don't understand what the problem is
13:01 <ZuluKing> List.filter(a -> a.Blah.Blah.q.Equals(x.Blah.Blah.q))
13:01 <ZuluKing> Its a nested record
13:01 <ZuluKing> I need to extract the fields inside the filter function
13:01 <exarkun> So you just need a function that takes `a` and `x` and does `a.Blah.Blah.q.Equals(x.Blah.Blah.q)`
13:02 <ZuluKing> yes
13:02 <exarkun> `f x a = a.Blah.Blah.q.Equals(x.Blah.Blah.q)` (except that doesn't look like Haskell but ...)
13:02 <exarkun> And then `g = f some_x` gives you a function `g` that takes one argument, an `a`. now `g` is your filter.
13:04 <ZuluKing> exarkun, ahh I get it, passing partial arguments to functions
13:04 <merijn> wow...I'm impressed, async's wait is surprisingly cheap
13:04 <ZuluKing> Sorry for the dumb questions, I am still learning Haskell.
13:05 <exarkun> ZuluKing: np! glad I could help.
13:05 <merijn> Keeps up very well with my AtomicCounter/IORef spinloops, but without the ridiculous inconsistency at high contention
13:06 <CoolerZ> pika pika pika pi pika pika pikachu
13:06 <* exarkun> has plenty of his own dumb questions
13:06 splanch joined
13:07 <ik> hey guys, I'm trying to use mainland-pretty. I want to be able to have an overlapping instance for some lists of my data types (instance {-# OVERLAPPING #-} Pretty [MyType] where...). How do i hint GHC to favor a specific overlapping instance? Or does the (Pretty [a]) instance have to be marked explicitly as overlappable? Or am I completely misusing these pragmas and should just use foldMap on my lists to do whatever I want?
13:07 <CoolerZ> can you not have multiple statements in a let block?
13:09 <CoolerZ> getting an error on line 3
13:09 <CoolerZ> https://hastebin.com/minoboteki.hs
13:09 <mauke> CoolerZ: bad indentation
13:09 <mauke> remove space before 'entry'
13:10 flatmap13 joined
13:10 <CoolerZ> what?
13:10 <CoolerZ> by how much?
13:10 <ik> CoolerZ: entry is below the second paren
13:10 FreeBirdLjj joined
13:10 <mauke> one space
13:10 <mauke> so the two definitions line up
13:10 <CoolerZ> its already lined up
13:11 <mauke> no
13:11 <CoolerZ> oh nvm
13:11 halogenandtoast joined
13:11 Tazca joined
13:11 unK_ joined
13:11 <lyxia> ik: {-# OVERLAPPING #-} should be sufficient
13:12 <lyxia> ik: you might need a few annotations
13:12 SkyPatrol_ joined
13:13 <ik> lyxia: annotations?
13:13 nickolay_ joined
13:14 <lyxia> Type annotations, to help the type checker
13:14 <ik> lyxia: oh, ok. thanks
13:14 extra- joined
13:15 Cooler joined
13:15 fosterite joined
13:17 cdg joined
13:20 juanpauc_ joined
13:22 nerdboy1 joined
13:22 govg joined
13:23 dustmote joined
13:23 indi_ joined
13:23 DragonWolf joined
13:23 Rodya_ joined
13:24 JeKs joined
13:25 JeKs left
13:26 c_my_nick joined
13:28 fendor joined
13:28 carlomagno joined
13:28 xanadu_ joined
13:28 eschnett joined
13:29 Cooler joined
13:32 jangsutsr joined
13:33 oisdk joined
13:35 pranitbauva1997 joined
13:35 a3Dman joined
13:36 bennofs joined
13:36 runde joined
13:39 indi_ joined
13:41 <Cooler> why is drawTree :: Tree String -> String http://hackage.haskell.org/package/containers-
13:41 <Cooler> ?
13:41 <Cooler> why not drawTree :: Show a => Tree a -> String?
13:41 vk_ joined
13:41 vk_ left
13:41 ystael joined
13:42 <c_wraith> Cooler: they're just an fmap show apart...
13:42 <c_wraith> Cooler: and actually, that sort of is why.
13:43 <c_wraith> > show "hello"
13:43 <lambdabot> "\"hello\""
13:43 Hunter1_ joined
13:43 <c_wraith> Cooler: I think drawTree didn't want to insert quotes that weren't already present
13:43 LKoen joined
13:43 <Cooler> oh
13:43 <Cooler> ok
13:43 <Cooler> why does show do that?
13:44 <Cooler> Show on string can't just return string?
13:44 <c_wraith> because the general idea with show is to produce Haskell code.
13:44 <c_wraith> show on a String should produce Haskell code to generate that String
13:44 <Cooler> what/
13:44 nycs joined
13:44 <Cooler> i don't understand
13:45 <ongy> The derived show instances are valid haskell iirc. Also read . show should be id (it isn't always, but it's good if it is)
13:45 oish joined
13:45 <lyxia> > show (Just "Hello") -- you wouldn't want to see "Just Hello"
13:45 <lambdabot> "Just \"Hello\""
13:46 <fsestini> Cooler: think of the “” as a constructor for String
13:46 <ongy> > text . show $ Just "Hello"
13:46 <lambdabot> Just "Hello"
13:47 <c_wraith> Cooler: the output of show *generally* should be a string that if used as haskell source, is an expression that produces the value shown.
13:47 <ongy> lambdabot shows a 2nd time, which makes it look more confusing than it actually is
13:47 raduom joined
13:48 <ongy> > text . show $ "Hello" -- Cooler Show is actually this. And a string obviously should get "" added
13:48 <lambdabot> "Hello"
13:48 <ongy> show "Hello" I mean
13:49 dsh joined
13:49 ChristopherBurg joined
13:49 <ongy> what happened earlier is exactly why Tree String is better than Show a => Tree a, since it's easy enough to apply show yourself, but messes up strings
13:50 <Cooler> ok but why does show have to produce valid haskell code
13:50 <Cooler> ?
13:50 a3Dman joined
13:50 <c_wraith> that's what is defined as the best behavior for it.
13:50 <merijn> Because then you can easily copy/paste things
13:50 <ongy> it doesn't *have* to, but the derived instances do and it's a general good idea
13:50 <c_wraith> So the question is kind of like asking why 1+1 is 2. Because that's what we've defined 2 as.
13:50 hvr joined
13:50 hvr joined
13:51 <ongy> well, Monads don't *have to* follow monad laws either, I guess saying it's not enforced doesn't say much about type classes
13:51 <ongy> I would really love that feature in haskell. Enforce some proveable properties about type classes...
13:52 <c_wraith> Maybe after DependentHaskell lands. And then, of course, we'd still need TotalHaskell to land..
13:53 <vegai> would using QuickCheck be enough?
13:53 <c_wraith> There's actually a library for testing type class properties with something like quickcheck. I can't recall the name..
13:54 <Cooler> is there a context free grammar for Haskell?
13:54 <c_wraith> Well, now. Haskell's grammar isn't context-free.
13:54 <c_wraith> *no
13:54 <ongy> I hate doing tests, mostly because I'm never content with mine. Either I'm missing stuff or it's just way to much effort imo. But that's probably just me
13:54 <merijn> ongy: Word :p
13:54 <Cooler> whats an example of that?
13:54 <c_wraith> The ability to define operators with custom fixities means that parsing haskell code depends on the result of parsing haskell code.
13:55 <merijn> ongy: I keep thinking I should just sucker newbies to write tests for me as "haskell practice" ;)
13:55 oisdk joined
13:55 Tazca joined
13:55 <ertes-w> i don't test with 100% coverage… not even if you count GHCi experiments as testing
13:55 <c_wraith> I type-check with 100% coverage.
13:55 <ertes-w> "it compiles, it's probably fine"
13:55 <ongy> merijn: hehehe. I actually have a test-system for layer2 protocols for my work (well, we test toy implementations by our students) and this really shows how many tests are required for a full coverage
13:56 oisdk joined
13:56 <ongy> most problems that escape me come up on different systems that do weird things... like antivirus removing files -.-
13:57 <ongy> but I don't write big projects either, I like my little things :)
13:58 meba joined
13:58 CoolerZ joined
13:58 <c_wraith> Cooler: the expression "a ^& b ^& c" will parse as "(a ^& b) ^& c", "a ^& (b ^& c)", or it won't parse at all. Knowing *which one* it parses as requires the result of parsing any fixity declarations for ^&.
14:00 <c_wraith> Cooler: This is a proof that parsing haskell is context-sensitive. Parsing it requires information resulting from parsing it.
14:00 eacameron joined
14:01 <CoolerZ> so is every language that allows you to add operators context sensitive?
14:01 ryandv joined
14:02 <CoolerZ> add operators as in define new ones
14:02 <c_wraith> Not necessarily. The important part is that Haskell allows you to specify fixity
14:02 <merijn> CoolerZ: Not if the operators all have predefined fixity
14:02 <CoolerZ> right
14:02 <c_wraith> In scala, the fixity is determined by first character in the operator from a static table
14:02 dni joined
14:02 <c_wraith> fixity/precedence, that is
14:03 <c_wraith> So it only depends on the text of the operator to know how to parse it. And that means you can still make that part of the grammar context-free
14:03 a3Dman joined
14:04 <Axman6> is there an infix version of traverse?
14:04 mmachenry joined
14:04 <orion> I'm reading an article which says, "If a structure `g a` does not support the fmap operation..." What is the difference between a structure `g a` and a structure `f g a`?
14:04 <CoolerZ> so a lalr parser wouldn't be able to parse Haskell?
14:04 <orion> I'm hung up on the word "structure".
14:04 <byorgey> orion: don't be
14:05 <byorgey> orion: it seems vague at best
14:05 <c_wraith> CoolerZ: not by itself. GHC actually uses a LALR parser, though. It just... cheats a bit. It does a post-processing step that fixes up the parse tree for expressions involving multiple operators.
14:05 juanpaucar joined
14:06 <CoolerZ> all of the hackiness
14:06 <c_wraith> It actually works well enough in practice.
14:06 <byorgey> orion: I would think 'structure' means something like 'value', i.e. 'data structure'. But that doesn't make sense since values can't in and of themselves support or not support fmap.
14:06 <byorgey> orion: I guess it is really talking about 'g' supporting fmap or not
14:07 systadmin joined
14:08 revprez_atlanta joined
14:09 chlong joined
14:11 mizu_no_oto joined
14:13 hackebeilchen joined
14:13 ogrady joined
14:14 raichoo joined
14:15 nitrix joined
14:16 tromp joined
14:19 mada joined
14:22 Ciquattro joined
14:22 cretiq joined
14:23 ZuluKing joined
14:24 exarkun joined
14:24 <quchen> What’s the »equality prism« to access only elements equal to something else? For example, I’d like to change all the numbers »2« in a list »xs«.
14:25 HarveyPwca joined
14:25 <quchen> myList & traverse . equal 2 .~ 5
14:25 <quchen> Something like that
14:25 <quchen> [1,2,2,3,2] & traverse . equal 2 .~ 5 ====> [1,5,5,3,5]
14:25 mmo joined
14:26 cods joined
14:26 <Philonous> I'd be surprised if you could do that
14:26 ziocroc joined
14:27 <mmo> Does anybody know why I can't post anything in the haskell subreddit. I am new to the community and created my account yesterday. Neither my comments nor my posts can be seen by public visitors or other members.
14:27 slackman joined
14:27 <Philonous> I'd expect there to be a law that states that xs & s .~ x & s .~ y === xs & s .~ y
14:27 revprez_atlanta joined
14:28 <mauke> sounds like you're shadowbanned
14:28 <mauke> or in a moderation queue
14:29 <quchen> Ah, filtered!
14:29 <quchen> > [1,2,2,3,2] & traverse . filtered (== 2) .~ 5
14:29 <lambdabot> [1,5,5,3,5]
14:29 waleee joined
14:29 Rodya_ joined
14:29 <Philonous> Heh
14:29 jathan joined
14:29 <lyxia> mmo: wait a day or two
14:29 <ZuluKing> hey, guys I am back, one more question, how do you go about implementing an infinite if condition then action else sleep loop?
14:29 <Philonous> I stand corrected
14:30 <mmo> Do I have to do some test of courage to be accepted :-D? This was really annoying, as I was giving really long advice in the comments and was wondering why nobody actually cared about it.
14:30 <ZuluKing> I tried forever but it doesn't execute, just keeps creating an infinite function call stack
14:30 jcjf joined
14:31 <lyxia> forever (b <- getCondition ; if b then action else sleep)
14:31 <ZuluKing> mmo, haskell community is one of the nicest, no tests of courage required, you completed that when you tried to install stack :P
14:32 <mmo> ZuluKing: Haha :) I am using cabal. Currently I am attending a course by hvr in university and he is a cabal contributer
14:33 <ZuluKing> lyxia, if my action happens to be a function call, it never actually executes it
14:33 <ZuluKing> mmo, even stack uses cabal internally, there is no haskell without cabal
14:34 <c_wraith> filtered is the best illegal traversal ever.
14:34 <lyxia> ZuluKing: can you paste your attempt
14:35 <c_wraith> mmo: hvr has time to teach in addition to fixing upper bounds on hackage all day? I'm impressed. :)
14:35 <Axman6> he's the people's hero
14:36 Yuras joined
14:36 <c_wraith> mmo: the wikis have had a *lot* of spam problems. I'd say that one of the anti-spam measures is what has caught you, and it's probably not even something you did in particular.
14:36 <Philonous> c_wraith, So it's not a lawful traversal after all? Thank goodness. I was really confused
14:36 a3Dman joined
14:36 <ZuluKing> lyxia, okay, gimme a min
14:36 <c_wraith> Philonous: it's only lawful as a Fold. But it's *so handy* as a traversal...
14:37 Wamanuz joined
14:37 Cooler joined
14:38 Cooler joined
14:38 <lpaste> ZuluKing pasted “forever FooBar” at http://lpaste.net/355448
14:38 <ZuluKing> lyxia, can you take a look?
14:39 ryandv joined
14:40 dfeuer joined
14:40 <lyxia> ZuluKing: you should be using forever specialized at IO, not at (->)
14:40 atomi joined
14:40 <ZuluKing> lyxia, I don't understand, sorry
14:41 <lyxia> ZuluKing: forever (reminderOrSleep (timeforReminder jstTime) jstTime)
14:41 tommd joined
14:42 <ZuluKing> lyxia, can you explain the difference, sorry I am new
14:42 <lyxia> forever applied to a function (reminderOrSleep :: _ -> _) will loop, as you have observed. by adding the parentheses, forever is instead applied to a value of type IO ()
14:43 jzeus joined
14:43 <ZuluKing> lyxia, ahh, I get it
14:43 <ZuluKing> lyxia, thanks for the taking time to explain, cheers!
14:44 <lyxia> you're welcome
14:44 afarmer joined
14:44 noan_ joined
14:44 sssilver joined
14:45 thimoteus joined
14:45 arcanine joined
14:46 bennofs1 joined
14:47 mmo left
14:48 sampuka joined
14:49 hpd_m joined
14:50 <quchen> I need a function »Fold' a (b,c) -> Fold' a b«. Unfortunately, \myFold -> myFold . _2 does not do the trick :-( Any tips?
14:50 juanpaucar joined
14:50 <quchen> I’m randomly sampling combinations of lens definitions at this point
14:50 uglyfigurine joined
14:50 <quchen> s/_2/_1/
14:51 <c_wraith> In what way does that not do the trick?
14:52 <quchen> Does not typecheck
14:53 <quchen> Let me get the type error online
14:54 <quchen> http://lpaste.net/355449 c_wraith
14:55 <lyxia> something composed with _2 can't be a prism
14:56 <quchen> Why not?
14:56 mohsen_ joined
14:56 <quchen> Oh.
14:56 <quchen> Right.
14:56 <quchen> It’s hard to construct a 2-tuple given only one element.
14:56 fotonzade joined
14:57 freusque joined
14:59 eklavya joined
15:00 <ertes-w> :t join (,)
15:00 <lambdabot> b -> (b, b)
15:02 thunderrd joined
15:02 <* hackage> bound 2 - Making de Bruijn Succ Less https://hackage.haskell.org/package/bound-2 (ryanglscott)
15:02 18VAA5TCT joined
15:02 patbecich joined
15:03 <* hackage> servant-py - Automatically derive python functions to query servant webservices. https://hackage.haskell.org/package/servant-py- (erewok)
15:03 oisdk joined
15:04 <hpd_m> is it normal that aeson needs >15GB of memory to parse a 839M json file or am I doing something wrong? (That's just decode'ing to a Value and forcing the result)
15:04 ryandv joined
15:08 <Axman6> Value isn't exactly a particularly space efficient data type
15:09 <cocreature> I guess it depends on what makes that json file 839M big
15:09 <Axman6> and you may not want to force it, I've seen really good results just making good use of laziness
15:09 Luke_ joined
15:09 darjeeling_ joined
15:10 afarmer joined
15:10 <lyxia> aeson is not lazy
15:11 fizruk joined
15:13 juanpaucar joined
15:13 al-damiri joined
15:14 <* hackage> servant-py - Automatically derive python functions to query servant webservices. https://hackage.haskell.org/package/servant-py- (erewok)
15:14 FreeBirdLjj joined
15:15 <hpd_m> the file contains many objects with short strings. So if you say value is not ideal: Does aeson always parse a Value into memory before calling parseJSON or is the conversion done on the fly?
15:15 dsfox1 joined
15:15 albertus1 joined
15:15 flatmap13 joined
15:16 <* hackage> servant-py - Automatically derive python functions to query servant webservices. https://hackage.haskell.org/package/servant-py- (erewok)
15:16 zariuq joined
15:16 cschneid_ joined
15:17 soniku joined
15:18 juanpaucar joined
15:19 <Cooler> is this the datatype for graphs with cycles?
15:19 <Cooler> https://hackage.haskell.org/package/containers-
15:20 <Cooler> directed graph
15:20 <Cooler> with cycles
15:21 Gurkenglas joined
15:22 oish joined
15:22 unsymbol joined
15:23 mbuf joined
15:25 codesoup joined
15:26 slentzen joined
15:27 <lyxia> hpd_m: it parses a while Value
15:27 <lyxia> whole
15:27 sssilver joined
15:28 slentzen joined
15:28 <lyxia> Cooler: there's also fgl. I have no idea how they compare
15:28 urodna joined
15:30 <hpd_m> lyxia: ok, thanks
15:31 <cocreature> in a lot of cases an IntMap is the easiest solution for graphs
15:31 <cocreature> or if you don’t need to modify them vectors
15:31 <EvanR> with a nice inductive interface on top?
15:31 <cocreature> nah
15:31 <EvanR> T_T
15:32 <cocreature> I mean if those inductive interfaces help you, by all means go for it. but personally I haven’t found them particularly useful
15:32 skeet70 joined
15:33 burtons joined
15:34 xall_ joined
15:35 mmn80 joined
15:35 cloudhead joined
15:36 NeverDie joined
15:36 bennofs joined
15:36 zuz joined
15:40 pratch joined
15:40 Cheaterok_ joined
15:41 <Cheaterok_> hey guys
15:41 <Cheaterok_> help me please, just started to learn haskell, trying to write pi function using nilakhanta series
15:41 <Cheaterok_> https://pastebin.com/DvLXSiPM this is the code
15:41 <Cheaterok_> https://pastebin.com/nwCfWD6b this is error log
15:42 hvr joined
15:42 hvr joined
15:42 <Cheaterok_> seems like interpreter cant print Fractional or something
15:43 <EvanR> thats the error message but what did you type into the interpreter
15:43 <Cooler> lyxia, fgl?
15:43 <Cheaterok_> calculate_pi 3
15:43 sproingie joined
15:43 <Cheaterok_> after loading my module
15:44 <lyxia> Cooler: http://hackage.haskell.org/package/fgl
15:44 <EvanR> it may not know what Fractional a and Integral a you want
15:44 <EvanR> what a is, could be several things and what prints out depends on the choice
15:44 <Axman6> I there any type which actually instanciates both?
15:45 <EvanR> good point
15:45 <Cheaterok_> type signature is (Integral a, Fractional a) => a -> a
15:45 <EvanR> so whats an example a you would pick?
15:45 <Axman6> I'm pretty sure that doesn't make any sense except in the case where is symbolic
15:45 pratch joined
15:45 <Cheaterok_> Fractional, i quess
15:45 <EvanR> thats not a type
15:45 <EvanR> its a class
15:45 <Cheaterok_> Float then
15:45 <EvanR> thats not Integral
15:46 <Cheaterok_> oh thats hard
15:46 <EvanR> i know right
15:46 pavonia joined
15:46 javjarfer joined
15:46 <EvanR> what an algorithm
15:46 <Cheaterok_> https://pastebin.com/DvLXSiPM here it is
15:47 <Cheaterok_> i think parameter should be Int, but return value could be int and float
15:47 <EvanR> youre not really using Integral methods
15:47 juanpaucar joined
15:47 <Cheaterok_> and i dont know a type that represents both
15:47 <EvanR> this is a good example to show why theres no one true number type
15:47 fkurkows1 joined
15:47 <EvanR> you have to pick what aspects you want from your numbers more carefully
15:48 Kuros` joined
15:48 juanpaucar joined
15:48 test_znc_8845 joined
15:48 <Cheaterok_> so i cant return either int or float from function, i should choose one of them?
15:48 <EvanR> Cheaterok_: youre not using Integral methods
15:49 <javjarfer> Hi! Anyone knows which is the most idiomatic way of triggering one event, when one event stop being emitted (timeout) in FRP?
15:49 <EvanR> and your algorithm uses / which requires Fractional
15:49 Cooler joined
15:49 <EvanR> Cheaterok_: for the depth component youre just using Num. at the point where they interact you can just convert the argument type to the result type with fromIntegral
15:49 <EvanR> oh uh... then youd be using Integral, but itd be ok
15:50 <EvanR> calculate_pi :: (Integral a, Fractional b) => a -> b
15:50 kmels joined
15:50 dan_f joined
15:50 <Cheaterok_> EvanR: thanks)
15:50 <EvanR> it doesnt make sense to return an integral number if youre trying to calculate pi o_O
15:50 kamyar joined
15:50 jdnavarro joined
15:51 <EvanR> the interplate between Integral and Fractional really is a great brain exploding aspect of haskell. many languages muddy the numerics, cause confusion
15:52 <Cheaterok_> yeah, coming from python background it was quite a suprise how this all works in haskell
15:53 <EvanR> python has several number types too, but it autoconverts between them in surprising ways
15:53 <EvanR> well theyd hope its not surprising, but it is to me
15:54 <kamyar> Anyone here help me in Stack build?
15:54 teggi joined
15:54 Destol joined
15:54 ragepandemic joined
15:54 macrover joined
15:55 <glguy> kamyar: As usual, you'll have to ask your question before you can get help with it
15:55 sssilver joined
15:56 <Cheaterok_> one more thing: is there a type that can hold infinitely large float?
15:56 <hvr> Cheaterok_: Rational?
15:56 quobo joined
15:56 <kamyar> glguy: I asked twice hours ago no one answered!
15:56 <EvanR> thats not a float
15:56 <EvanR> theres Data.Scientific but that only works for base ten
15:57 <hvr> EvanR: how do you define a float?
15:57 <EvanR> theres bindings to MPFR which has arbitrary precision floats
15:57 <kamyar> I wanna add a depencendy which is not in cabal or stackage, I have downloaded and installed it. I want to use 'any' as version in extra-deps part. How it is?
15:57 afarmer joined
15:57 flatmap13 joined
15:57 <kamyar> extra-deps: [CBOR-, random-strings-, persistent-uuid-any] raises error!
15:57 <kamyar> it is in stak.yaml
15:57 <kamyar> stack.yaml
15:57 <glguy> kamyar: Right, you never use an "any" version. The point of the stack.yaml is to manually specify exactly which versions you're using
15:57 tzh joined
15:58 <kamyar> I have inatalled the package and checked version but it does not work
15:58 <EvanR> hvr: the numbers are of the form m * b^i
15:58 <kamyar> extra-deps: [CBOR-, random-strings-, persistent-uuid-]
15:59 flatmap13 joined
15:59 <kamyar> The following package identifiers were not found in your indices: persistent-uuid-
15:59 <glguy> kamyar: If you're using a local checkout of the source code, you can list that in your `packages` section
15:59 <kamyar> glguy: Ok lets try
16:00 <kamyar> glguy: No it is not local! I have installed it in .cabal and .stack directories
16:00 <EvanR> Cheaterok_: you can also check out two exact real number packages, these dont use floating point, but they arent limited to just rationals either
16:00 <glguy> kamyar: That's now how it works
16:01 <kamyar> glguy: How can I use the installed version?
16:01 <glguy> no
16:01 <kamyar> What ae .cabal and .stack meant for?
16:01 <Cheaterok_> EvanR, thank you
16:02 ragepandemic joined
16:02 <kamyar> glguy: How can I check the stack indices? what is the command line?
16:02 <glguy> I don't know that there is one. You can look at a resolver's contents on stackage.org
16:02 adfadtttt joined
16:04 <hvr> EvanR: ok, but then if you equate b^i to 1/d, isn't m*(b^i) and m/d effectively isomorphic to each other?
16:05 Sonolin joined
16:05 adfadtttt left
16:05 adfadtttt joined
16:05 <hvr> (except for the d=0 anomaly)
16:05 sfcg joined
16:05 adfadtttt left
16:07 patbecich joined
16:08 SuprDewd joined
16:08 <EvanR> hvr: no
16:08 <EvanR> 1/3 has no form m*2^i
16:09 <EvanR> > pi :: CReal -- Cheaterok_
16:09 <lambdabot> 3.1415926535897932384626433832795028841972
16:09 <EvanR> should have a ... after that
16:10 descender joined
16:11 juanpaucar joined
16:11 <Axman6> > showCReal 80 pi
16:11 tommd joined
16:11 <lambdabot> "3.1415926535897932384626433832795028841971693993751058209749445923078164062...
16:11 joelburget joined
16:11 ertes joined
16:12 <EvanR> now thats what im talkin about
16:12 doomlord joined
16:12 wolfsif joined
16:13 meandi_3 joined
16:14 rkazak joined
16:14 litchblade joined
16:15 zariuq joined
16:15 tommd joined
16:15 ludat joined
16:15 eklavya_ joined
16:16 osa1 joined
16:17 acarrico joined
16:19 zariuq joined
16:19 krok_ joined
16:21 acertain joined
16:21 zariuq joined
16:21 pera joined
16:22 pera joined
16:24 <hvr> EvanR: for b=3 it does
16:25 <EvanR> hvr: with rational you can represent any rational
16:25 <EvanR> no base involved, no floating-point as such
16:26 <EvanR> but floating point lets you reach much more distant or close-to-zero dynamic range
16:27 Rodya_ joined
16:27 Hunter1_ joined
16:27 <EvanR> hvr: you choose a fixed base, like Scientific is b=10, other libraries may be b=2
16:28 <EvanR> 1/3 feels neglected
16:28 sproingie joined
16:28 <hvr> this only because we have an even number of fingers...
16:28 <* hackage> relational-query-HDBC - HDBC instance of relational-query and typed query interface for HDBC https://hackage.haskell.org/package/relational-query-HDBC- (KeiHibino)
16:29 <EvanR> one of my professors was into trinary logic hardware and arithmetic
16:30 ADG joined
16:30 sleffy joined
16:30 wolfsif joined
16:31 whoisxy_ joined
16:31 juanpaucar joined
16:32 afarmer joined
16:32 oish joined
16:35 tomphp joined
16:36 <ADG> I want to do something like this `set.insert(x+y) where x<-list, y<-list` and then `print $ keyNotIn set`
16:36 <* hackage> relational-query-HDBC - HDBC instance of relational-query and typed query interface for HDBC https://hackage.haskell.org/package/relational-query-HDBC- (KeiHibino)
16:36 ^bschafer1 joined
16:36 <EvanR> ADG: maybe you should make sets of out the lists and do unions
16:36 <orion> EvanR: Yesterday I asked, "Under what conditions would you use the free package, and when would you use the monad-coroutine package?" and you said, "or would you make your own based on thethe oleg freer monad tutorial". I read the tutorial but I failed to comprehend its meaning.
16:36 <orion> Why is that more useful than using, say, the free package?
16:37 <* hackage> structs 0.1 - Strict GC'd imperative object-oriented programming with cheap pointers. https://hackage.haskell.org/package/structs-0.1 (ryanglscott)
16:37 <EvanR> orion: well, the free package depends on 12 other packages and the freer monad implementation on that page is about a page in size
16:38 <glguy> orion: The free package offers more than just the Free type. Are you specifically asking about the Free type?
16:38 <EvanR> so if you just want a dumb free monad...
16:38 <EvanR> the free package does provide a fancy church encoded version
16:38 <EvanR> and transformers
16:39 <orion> glguy: Yes. I have a very specific goal: suspend and resume a Free Monad-based DSL interpreter, while being able to output values upon suspend and receive values upon resume.
16:40 <orion> Now, I currently found success with the monad-coroutine package, but when I had lunch with Ed Kmett, he said I could use the free package instead.
16:40 <orion> Even though my code works, it looks awful and complicated. I feel like I need to refactor it.
16:40 <EvanR> i just made something like that
16:40 <orion> Thus, I am reevaluating my design decisions.
16:41 nshepperd joined
16:41 theelous3 joined
16:41 <EvanR> http://lpaste.net/355452
16:41 zariuq joined
16:42 <orion> https://github.com/centromere/cacophony/blob/master/src/Crypto/Noise/Internal/NoiseState.hs#L121 <-- all of this looks nasty. It's what I'm trying to rewrite.
16:42 replay joined
16:43 <EvanR> i wanted to write suspendable scripts, 53 lines is the DSL, 30 lines is the free monad which could go in a separate file
16:43 <EvanR> DSL+interpreter
16:44 <orion> EvanR: Wow, that's pretty neat. Do you have an example program you can share?
16:45 <ADG> how would I write this in haskell `int[] arr1 ... int[] arr2 ... bool[] arr = new bool[n]; for(int x: arr1){ for(int y:arr2){ arr[x+y] = true; }}`
16:45 ryandv joined
16:46 <EvanR> orion: i mean, i pasted the code
16:46 <orion> EvanR: Oh, I meant to ask about an actual script you've written.
16:47 <EvanR> not beyond tests, just do notation which test drives each effect
16:47 <orion> Ah, I see.
16:47 <EvanR> and does a recursion to loop
16:47 <WarmCookie> edwardk: ping
16:47 <EvanR> so there might be some lingering space leaks or soemthing
16:48 sdothum_ joined
16:48 <orion> "The following Freer monad is not (yet) extensible and not very optimal Either."
16:48 <EvanR> yeah
16:48 <EvanR> thats what i heard ;)
16:48 <orion> heh
16:49 <EvanR> when you want performance, you rewrite your DSL without a free monad
16:49 zuz joined
16:50 <EvanR> by implementing the effects as whatever the interpreter would have done
16:50 acertain joined
16:50 xall_ joined
16:50 <orion> You ditch the free monad? At what cost? Type safety?
16:50 juanpaucar joined
16:50 mk-61 joined
16:50 <EvanR> same safety
16:50 javjarfer joined
16:51 <EvanR> the cost is your brain doing donuts to actually write the code, and then its not as maintainable i imagine
16:51 <EvanR> if you wanted to change the DSL
16:51 <WarmCookie> edwardk: Apologies for the trouble, mniip just applied the requested cloak on `nitrix` but I've never liked the name because in the recent years, a pharmeutical company named a product the same. I went for something more permanent and I did a nick and account change just now, but I'm stuch with nitrix's cloak and have to ask you again ask them to get it renamed.
16:52 <* EvanR> graph[nitrix] = forward(WarmCookie)
16:53 <MarcelineVQ> nitrixinolocytocologloblin?
16:53 jcjf joined
16:53 <orion> EvanR: Ah, I see. Since my DSL describes high-level cryptographic operations, I place a high value on code auditability. I suppose the actual crypto operations will be the bottleneck, not the interpreter.
16:53 <WarmCookie> Make it a functor! :)
16:53 revprez_atlanta joined
16:53 <EvanR> orion: then good
16:53 <orion> Thus, it might make sense to stick with the free monad.
16:54 <orion> One thing still is unclear though: What does "encoding" mean in "Church encoding"?
16:54 jcjf joined
16:54 <EvanR> youre writing down the same thing in some sense, but in a different way
16:54 <c_wraith> orion, the machine level representation of a semantic concept.
16:55 <c_wraith> orion, the free monad is a concept. how it's represented in the machine is an independent issue.
16:57 alx741 joined
16:57 tomphp joined
16:58 <orion> The Free Monad *is* the AST, right? And that would make the Church encoded version just a more efficient data structure to represent the AST?
16:58 <EvanR> a value of your DSL's type isnt an AST
16:59 <EvanR> its got closures in there, introduced by >>=
16:59 <EvanR> its not syntax
17:00 <orion> Oh, because I'm not parsing anything?
17:00 <EvanR> no
17:00 tsmish joined
17:00 alx741 joined
17:01 <EvanR> an AST would have concrete tokens in it representing program on the page
17:01 <orion> Are you saying that in the Free Monad design pattern there is no AST because you're literally creating values directly in the code?
17:01 <EvanR> but in a free monad, you have the top level effect followed by a function, and you dont know what the function will return
17:01 <EvanR> until you run it
17:02 <EvanR> if you had an AST you could print it out and view it
17:03 juanpaucar joined
17:04 <orion> I suppose I could derive a Show instance for the DSL.
17:06 <EvanR> i think youll run into problems in most DSLs doing that
17:06 <EvanR> you cant follow continuations, you dont get variable names
17:06 epsilonhalbe joined
17:06 epsilonhalbe left
17:07 <orion> Ah, good point.
17:07 justin_ joined
17:07 <glguy> orion: My config-schema package is an example of using a free applicative instead of a free-monad so that I can print my program without running it
17:07 jcjf left
17:08 <EvanR> but i did see a paper where the representation let you do that... using quotation https://www.andres-loeh.de/LambdaPi/LambdaPi.pdf
17:08 stphrolland joined
17:08 Sheogorath joined
17:08 <Sheogorath> is this a thing i can write? type TRead = forall a. (Int, TVar a)
17:08 osa1 joined
17:08 sampuka joined
17:08 Swizec joined
17:09 <EvanR> starting on page 1010
17:09 <glguy> Sheogorath: You can write that with extensions, it probably doesn't mean what you want it to
17:09 <orion> EvanR: Thank you.
17:09 drostie joined
17:09 <orion> glguy: Interesting! What power did you lose by using a Free Applicative instead of a Free Monad?
17:10 <glguy> orion: The structure of your program can't depend on values produced by interpreting your program
17:10 {emptyset} joined
17:10 patbecich joined
17:10 <stphrolland> HI, there seem to be several package for MaybeT. They even link to this more widely used, but I can't find the package corresponding to: https://wiki.haskell.org/New_monads/MaybeT
17:10 <stphrolland> Wht do you use when you want MaybeT ?
17:10 <Sheogorath> actually could i just drop the forall? that's probably what I mean
17:10 <glguy> stphrolland: transformers
17:10 <orion> glguy: Ha, that seems obvious in retrospect.
17:11 <EvanR> Sheogorath: type TRead a = (Int, TVar a) would work
17:11 <sproingie> is there a decent Free monad tutorial out there? i only have the vaguest idea what those puppies are.
17:12 <Sheogorath> My intent is to throw away the a so I can put it in a list with different "a"s
17:12 <EvanR> Sheogorath: i thought as much
17:12 <sproingie> (free monads, monads i get just fine)
17:12 <EvanR> how do you intend to make use of the elements of that collection if you dont know what the types are?
17:12 <EvanR> beware trick question
17:13 Hunter1_ joined
17:13 <orion> sproingie: I too struggle(d) with the concept, but I found this to be enlightening: http://stackoverflow.com/questions/13352205/what-are-free-monads
17:13 <splanch> i've been using the ideas from 'PHOAS for Free' enough that it would be more convenient in library form
17:14 <EvanR> P HOAS?
17:14 <splanch> https://www.schoolofhaskell.com/user/edwardk/phoas
17:15 <orion> glguy: Your config-* packages are interesting. Are you happy with them?
17:15 <sproingie> Sheogorath: the problem is you have no downcasting, so if you have a list of different "a"s, the only thing you can do with them is whatever constraint satisfies all a's
17:15 <Sheogorath> as a side note TVar isnt the builtin TVar. I don't need to know a. I just care about a timestamp in the TVar a
17:15 <glguy> orion: Yeah, so far so good. I use them to provide configuration to a couple different projects
17:15 <sproingie> which is not a problem if you write OO-style polymorphism, but it does bite you pretty hard eventually
17:16 connrs joined
17:16 <EvanR> Sheogorath: erm, then you should fmap those TVars to TVar Timestamp?
17:16 <* hackage> partial-isomorphisms - Partial isomorphisms. https://hackage.haskell.org/package/partial-isomorphisms- (schernichkin)
17:16 <Sheogorath> data TVar a = TVar Timestamp a
17:16 <EvanR> or wrap them so be an IO Timestamp
17:16 <EvanR> Timestamp doesnt change?
17:16 Destol joined
17:16 matuszak joined
17:16 <Sheogorath> going with TVar as a name was quite the mistake
17:17 <EvanR> indeed
17:17 ryandv joined
17:17 <EvanR> it sounds like you want a container of Timestamps not TVar a's
17:17 <Cooler> how do i use Data.Graph
17:17 dan_f joined
17:17 <Cooler> ?
17:17 <orion> glguy: Do you consider it production ready?
17:18 <Sheogorath> but that's what im trying to make. eh, probably need an MVar in there for changing it yeah.
17:18 dm3 joined
17:18 <jle`> Sheogorath: what would you expect to do with a list of different types of TVar's
17:18 APic joined
17:18 <EvanR> or a TVar ;)
17:18 eklavya joined
17:18 <jle`> Sheogorath: becuase of parametric polymorphism, you can't do anything useful with what is inside them
17:18 <jle`> you can store a list of Int's though
17:19 <splanch> https://hackage.haskell.org/package/compdata-param is somewhat similar to what i want except they don't church/yoneda, dated, the alacarte stuff is extraneous...
17:19 <Sheogorath> isNew (Var time _) time' = time == time'
17:19 <Cooler> guyeez
17:19 <EvanR> that function is polymorphic enough to operate on TVar of any type a
17:19 <Cooler> how do i use Data.Graph?
17:19 <EvanR> so you could indeed wrap them to hide the a and put them all in a container
17:19 <glguy> orion: I'm not sure what qualifieds a small configuration file parser as production ready or not, but I use it for stuff every day. I don't expect it to change very much at this point
17:20 jship joined
17:20 <Sheogorath> but needs some change. isNew mvar time = do {time <- fmap getTime . readMVar $ mvar; return ...}
17:20 <sproingie> Cooler: that kind of question never gets answered. are you having a specific problem with it?
17:20 <EvanR> Sheogorath: you might need to rethink what youre trying to do
17:20 <Cooler> do you know about LR(0) items?
17:20 oisdk joined
17:20 <sproingie> orion: thanks for the link BTW, that answer explained it pretty well
17:21 <Sheogorath> check the current timestamp of some Vars against the time they were read
17:21 <orion> sproingie: You're welcome.
17:21 <EvanR> Sheogorath: you can do that without any crazy types
17:21 <orion> glguy: I see. I've never worked with Free Applicatives before. Is this one such data structure: https://github.com/glguy/config-schema/blob/master/src/Config/Schema/Spec.hs#L85 ?
17:21 <EvanR> but i think implicitly youre trying to put them all in a container for some reason?
17:21 zariuq joined
17:22 <Cooler> i wanna make a slr parsing table, so i need to make the state graph of lr(0) items
17:22 <EvanR> checkTimestamp :: Timestamp -> MVar (Timestamp,a) -> IO Bool
17:22 <glguy> orion: Ap is a free applicative and is used here https://github.com/glguy/config-schema/blob/master/src/Config/Schema/Spec.hs#L97 The type you linked to is used with Ap
17:22 <Sheogorath> yeah, gather the Vars up during a transaction and then check them all atomically
17:22 <Cooler> but Data.Graph seems to be for storing Ints
17:22 <EvanR> Sheogorath: i think youd do better to gather up all the results of checking instead?
17:23 <sproingie> i suspect Data.Graph is very polymorphic and perhaps its examples only use Ints
17:23 <EvanR> you cant check a bunch of MVars atomically anyway
17:23 <EvanR> or its a pain in the ass... maybe you want TVars
17:23 <Cooler> really? cause here it says Vertex = Int https://hackage.haskell.org/package/containers-
17:23 <orion> glguy: Thanks. I'll dig deeper in to the code.
17:23 cretiq joined
17:24 <Sheogorath> yes, like i said im trying to make STM though. So using them would be a bit too easy :)
17:24 juanpaucar joined
17:24 <EvanR> o_O
17:24 <EvanR> making STM with MVars
17:24 bigos joined
17:24 <EvanR> i dont think Timestamps is the way to go wtih that
17:25 <Cooler> your making a Silly Time Machine?
17:25 pera joined
17:25 <Sheogorath> well, logical timestamps to check if someone changed something since the read.
17:25 <EvanR> have you read the STM paper
17:25 <sproingie> Cooler: so it is. Data.Graph looks a bit more like a proof of concept, there might be more mature libraries out there
17:26 _flow_ joined
17:26 WhiskyRyan joined
17:27 <Sheogorath> some time ago yeah. cant see how that would eeever be relevant :p
17:27 <sproingie> hackage is s...l...o...w today
17:27 gienah joined
17:28 <EvanR> Sheogorath: you can collect a bunch of IO Bools
17:28 <Cooler> so do i have to make my own?
17:28 <EvanR> then within an mutex, run them all
17:28 <EvanR> you can also do something more complicated to accomplish exactly what you said
17:29 <Sheogorath> good point
17:29 bvad joined
17:29 Rodya_ joined
17:29 zariuq joined
17:30 M-wamaral joined
17:30 fosterite joined
17:30 sampuka joined
17:31 jcjf joined
17:31 agjacome joined
17:31 jcjf left
17:32 shangxiao joined
17:33 zaquest joined
17:33 tromp joined
17:33 juanpaucar joined
17:34 <Cooler> how would you make a directed graph with cycles?
17:35 <EvanR> use the fgl package?
17:35 <EvanR> i just found this slideshow on graphs http://jelv.is/talks/inductive-graphs-at-wagon
17:35 <cocreature> index your vertices by ints and keep an adjaceny list/vector/intmap for each of them.
17:35 <splanch> cycles can be encoded with functions
17:36 CoolerZ joined
17:36 <splanch> https://www.cs.utexas.edu/~wcook/Drafts/2012/graphs.pdf
17:36 <EvanR> knot tying exists...
17:36 <EvanR> but that seems even worse than inductive graphs
17:37 jcjf joined
17:37 <splanch> it's awkward for cross edges, but how is it bad for cycles?
17:38 <EvanR> you cant easily change such a graph
17:38 jcjf joined
17:38 <EvanR> and to traverse it you need to remember where you have been
17:41 <CoolerZ> EvanR, i dced, use fgl?
17:41 <CoolerZ> i think i need cabal for that
17:41 <EvanR> you missed a whole discussion
17:42 <EvanR> how are you doing anything without cabal?
17:42 <CoolerZ> i am compiling manually through the terminal
17:42 replay joined
17:43 <CoolerZ> actually just loading the single .hs file into ghci
17:43 <EvanR> have you heard any discussion of graphs today?
17:43 jcjf joined
17:44 <EvanR> you can review the public logs of the channel linked in the topic
17:44 <* hackage> threepenny-editors - Composable algebraic editors https://hackage.haskell.org/package/threepenny-editors- (PepeIborra)
17:47 <CoolerZ> 10:36:16 <cocreature> index your vertices by ints and keep an adjaceny list/vector/intmap for each of them.
17:47 JuanMiguel joined
17:47 <EvanR> that will allow cycles
17:47 <CoolerZ> you mean use Data.Graph in conjunction with Data.Map Int VertexData ?
17:48 <Athas> I am quite sure Data.Graph supports cycles.
17:48 <EvanR> cocreature's suggestion was for doing it without a library
17:48 <cocreature> I was more thinking of rolling your own graph representation instead of using Data.Graph
17:49 <CoolerZ> but that would require pikachu and pika pi of pichu
17:49 <cocreature> what?
17:49 <orion> I've read that Functors compose, but Monads do not. Do Applicatives compose?
17:49 <cocreature> orion: yes
17:49 <CoolerZ> sorry i need sleep
17:50 <CoolerZ> wouldn't that be slow?
17:50 <glguy> orion: You can look at the instances for http://hackage.haskell.org/package/base-
17:50 <CoolerZ> to make my own adjacency list
17:50 patbecich joined
17:50 <EvanR> you asked how to make a graph
17:50 laplacian joined
17:51 <Philonous> Hrmpf, why can't we have "foo" :: Sing "foo" :(
17:52 <cocreature> it really dependes on the operations you want to perform. if your graph doesn’t change you can just use unboxed vectors for everything and it will be quite fast
17:52 exarkun left
17:52 <CoolerZ> EvanR, i am looking at that slideshow you posted, something about inductive graphs?
17:52 oisdk joined
17:53 <EvanR> thats a way to construct and deconstruct graphs in a more functional way
17:53 <sproingie> Philonous: {- LANGUAGE OverloadedStrings -} perhaps?
17:53 <CoolerZ> cocreature, well i will be creating new vertices and checking if they already exist in the graph
17:53 <CoolerZ> if they exist just link to that vertex instead of creating a new one
17:53 kamyar joined
17:53 <CoolerZ> and that needs to be done over and over several times
17:53 <sproingie> or better yet, {-# LANGUAGE ...
17:53 <Philonous> sproingie, I don't think you can write IsString instances for Sing (a :: Symbol)
17:54 dm3 joined
17:54 <kamyar> Hello friends!
17:54 <kamyar> please check my code and the error!
17:54 <kamyar> http://lpaste.net/355457
17:54 pgiarrusso joined
17:54 <kamyar> I dunno what this error is "can not deduce..."
17:54 <tdammers> Philonous: why not?
17:55 <Philonous> What would the instance look like?
17:55 tomphp joined
17:55 <Philonous> You need fromString :: String -> Sing a -- for each a
17:55 <sproingie> Philonous: hm, not via another IsString i suppose, no
17:56 <tdammers> you can have IsString Symbol, and then IsString a => IsString (Sing a)
17:56 Eduard_Munteanu joined
17:56 ziocroc2 joined
17:56 <tdammers> the latter would also cover Sing String and Sing Text etc.
17:56 juanpaucar joined
17:56 fsestini joined
17:56 <kamyar> Hey please help me
17:57 <tdammers> in fact, you could use GeneralizedNewtypeDeriving to not have to write that second instance yourself
17:57 dm3_ joined
17:57 jbalint joined
17:57 jbalint joined
17:57 <Philonous> What do the values of Symbol look like?
17:58 <CoolerZ> what is the :& operator
17:58 <Philonous> Is Symbol even considered a type? I thought it was only a kind
17:58 <CoolerZ> ([4, 5, 6], 1, []) :& graph
17:58 <EvanR> its an infix data constructor
17:59 <EvanR> > 3 :+ 1
17:59 <CoolerZ> you mean like :
17:59 <lambdabot> 3 :+ 1
17:59 <CoolerZ> cons
17:59 <EvanR> pretty much
17:59 <CoolerZ> ok
17:59 <EvanR> you can pattern match on it
17:59 <glguy> Yeah, any value-level operator symbol starting with a : is a constructor
17:59 <sproingie> Philonous: Data.Symbol. in source, they're just another String, they just associate an int with it
17:59 <kamyar> Anyone talking to me?
17:59 <Philonous> tdammers, Even if you could do that, you'd have fromString "abc" :: Sing "def" and that can't be right
18:00 <cocreature> kamyar: have you tried doing what GHC suggests, i.e., adding PersistQueryRead backend to the context of validateUser?
18:01 <CoolerZ> thats not saying much, you can pattern match on anything
18:01 <EvanR> you can only pattern match on constructors
18:01 <kamyar> cocreature: I should not! I just need a pool! Why do I have to?
18:01 <Philonous> sproingie, I think that's a different Symbol, I mean the one from GHC,TypeLits
18:01 permagreen joined
18:01 <cocreature> kamyar: you don’t need to add an argument. you just need to add a typeclass constraint on the pool you can accept
18:02 <cocreature> kamyar: because selectFirst requires that
18:02 <kamyar> cocreature: I know! But I meant the constraint
18:02 <CoolerZ> i guess you can't pattern match into a Data.Map
18:02 <cocreature> kamyar: well selectFirst requires the constraint so it needs to come from somewhere
18:02 <EvanR> correct because the constructors are hidden
18:02 <sproingie> Philonous: ohhh i'm a silly bunt. only thing i ever used from that is TypeError :)
18:03 <EvanR> in cases like that sometimes they provide "view" data types to pattern match on a particular view of the structure
18:03 <EvanR> that is whats going on in the graph slideshow
18:04 <CoolerZ> data Context =
18:04 <CoolerZ> Context [Node] Node [Node]
18:04 <CoolerZ> data View =
18:04 <CoolerZ> Context :& Graph
18:04 <CoolerZ> is this right?
18:04 <CoolerZ> data View = Context :& View
18:04 <CoolerZ> to be recursive
18:04 <EvanR> im not sure which one you mean
18:04 sssilver joined
18:05 sigmundv__ joined
18:05 <CoolerZ> http://jelv.is/talks/inductive-graphs-at-wagon/#/slide-sec-8
18:05 <EvanR> you copy pasted then change it
18:05 <CoolerZ> Graph isn't even defined
18:05 <CoolerZ> it should be data View = Context :& View
18:06 <EvanR> i dont think so
18:06 <CoolerZ> what is Graph
18:06 juanpaucar joined
18:06 <EvanR> a graph is either the empty graph or the combination of a node with a context
18:07 Yuras joined
18:07 <CoolerZ> its not in the slides
18:07 <splanch> the slides have links to papers at the end
18:07 <splanch> they go into more detail
18:08 <CoolerZ> why not data Graph = Context :& Graph | NilGraph
18:08 chaosmasttter joined
18:09 <CoolerZ> and data Context = Context [Node] Node [Node]
18:09 <EvanR> that might work
18:09 WhiskyRyan joined
18:10 <EvanR> look at the pictures on this page if you cant read scala http://blog.higher-order.com/blog/2016/04/02/a-comonad-of-graph-decompositions/
18:10 <CoolerZ> maybe replace Node with a to be polymorphic
18:10 <stphrolland> I try to use MaybeT from the transformers package. https://hackage.haskell.org/package/transformers- But I do not see the simple lift function. How can I lift a getLine for example ?
18:10 <EvanR> this is for undirected graphs though
18:11 <EvanR> Context a { incoming :: [Node a], outgoing :: [Node a], me :: Node a }
18:11 <sproingie> stphrolland: for lifting getLine in particular, you want liftIO
18:12 <stphrolland> but it is not present in Control.Monad.Trans.MaybeT ?
18:12 <stphrolland> I saw it in MonadIO if I recall correctly
18:12 bennofs joined
18:12 <EvanR> CoolerZ: one idea here is that Graph is not literally that data type, it just looks that way because of your view. the underlying structure would be something more efficient for adding contexts and splitting at nodes
18:13 <EvanR> an index of adjacencies
18:13 robotroll joined
18:14 <stphrolland> yep, liftIO works nicely
18:14 <CoolerZ> EvanR, whats the point of View if its slow and useless?
18:15 <EvanR> sounds like a trick question
18:15 <Sheogorath> can someone help me not hate haskell's module hierarchies? What's Control supposed to mean? And isn't everything Data?
18:15 <CoolerZ> no....
18:15 <* hackage> hsyslog 5 - FFI interface to syslog(3) from POSIX.1-2001 https://hackage.haskell.org/package/hsyslog-5 (PeterSimons)
18:15 <EvanR> you have nice interfaces for things that are complex and efficient, but whose details dont pertain to what youre doing
18:15 <sproingie> Sheogorath: it's pretty vague, but more categories would make things even harder to find
18:15 <EvanR> so thats the opposite of slow and useless
18:15 mizu_no_oto joined
18:15 <Cale> Sheogorath: I hate Control and Data in particular as well
18:16 <CoolerZ> whats the point of pattern matching, if doing that would be really slow
18:16 insitu joined
18:16 <Cale> Sheogorath: It's like two miscellaneous junk drawers
18:16 <Philonous> Sheogorath, I try to skip nonsensical prefixes like that in my packages
18:16 <mauke> well, Data is like Misc and Control is like Util
18:16 <Sheogorath> sproingie: less is more. MVar is a fine name for a module. Control.Concurrent.MVar is not
18:16 <EvanR> CoolerZ: if ?
18:16 uglyfigurine joined
18:16 matte454 joined
18:16 <Philonous> Sheogorath, Aye
18:16 <sproingie> Sheogorath: flat namespaces screw everyone pretty quickly
18:17 <Cale> Sheogorath: I started programming in Haskell just before hierarchical modules came into existence, and was pissed off by the arbitrary decisions that were made there almost immediately.
18:17 <cocreature> Sheogorath: I don’t think anybody really likes the current status but it’s too late to change it
18:17 <Sheogorath> mauke: ah yes. reminds me of the 20k util files i've been getting the pleasure to work with recently
18:17 <CoolerZ> EvanR, i mean you just said you would use a different data structure underneath
18:17 <sproingie> haskell98 doesn't even have hierarchical modules
18:17 <Sheogorath> 20k lines
18:17 <sproingie> i think that's one thing that went into haskell2010
18:17 <Philonous> sproingie, Package imports
18:17 <c_wraith> Sheogorath, but Concurrent.MVar is better than just MVar
18:17 <Cale> sproingie: Literally the only thing that "hierarchical modules" changed about the spec was to say "hey, allow '.' in module identifiers"
18:18 <CoolerZ> EvanR, and i guess you would just use some functions that work with that data structure to do inserts and deletes
18:18 halogenandtoast joined
18:18 <sproingie> Cale: yeah i think we can all agree haskell's module system could use some love
18:18 <EvanR> CoolerZ: this is haskell, most of your code is written with pattern matching
18:18 <Cale> It *really* wasn't a big deal
18:18 <mauke> we could've done that with _ instead
18:18 <sproingie> isn't backpack supposed to deal with some of that?
18:18 <CoolerZ> instead of functions that operate by pattern matching on view
18:18 <EvanR> if you havent seen how nice that is... try writing more haskell
18:18 <orion> What is a concrete example of Haskell's weakness when it comes to modules, and how would that be solved?
18:19 <Sheogorath> guys, you didnt help. at least I feel mroe righteous in my anger tho
18:19 <Cale> I mean, there's one common thing which would be solved by a better module system perhaps
18:19 <mauke> Sheogorath: sorry :-)
18:19 <sproingie> i've never written anything all that big in haskell so i've little experience with getting screwed by the module system
18:19 <Cale> There are lots of packages which define separate versions of the same thing for lazy and strict ByteString and for lazy and strict Text
18:19 <EvanR> CoolerZ: as an example, the Data.Sequence structure has O(1) access to both ends, but its an abstract data type. so there are views for the left and right to decompose it
18:19 <Cale> (and maybe String also)
18:19 <CoolerZ> EvanR, it would be like Data.Map where you are provided functions in the library that deal with the implementation
18:19 <Cale> backpack might solve some of that
18:20 <CoolerZ> instead of pattern matching
18:20 <EvanR> you do the equivalent of pattern matching on Map when you use split
18:20 matuszak_ joined
18:20 <CoolerZ> hmm
18:20 <Cale> Otherwise, it's not like we're really having much in the way of trouble with module namespace.
18:21 <Cale> Maybe someday we will, I don't know
18:21 <EvanR> splitLookup :: Ord k => k -> Map k a -> (Map k a, Maybe a, Map k a)
18:21 <sproingie> the odds of needing two modules with the exact same in the same program tends to be pretty low
18:21 javjarfer joined
18:21 <EvanR> you get the left tree, the right tree, and maybe whatever was exactly at k
18:21 <sproingie> at which point there's package imports anyway
18:22 <CoolerZ> what is this? foo (matchAny -> ctx :& rest) = ...
18:22 <mauke> oh hey, the return value is a data structure you have to pattern match on
18:22 <CoolerZ> http://jelv.is/talks/inductive-graphs-at-wagon/#/slide-sec-14
18:22 <EvanR> a view pattern
18:22 <mauke> CoolerZ: that looks like a view pattern
18:22 <CoolerZ> is that new?
18:22 <mauke> sort of
18:22 <EvanR> its an extension
18:23 justinfokes joined
18:23 <kamyar> Can I write this better? (IsSqlBackend backend, PersistQueryRead backend) => ...
18:23 <sproingie> not terribly new, not often used. it's syntax sugar for a case statement
18:23 <sproingie> CoolerZ: https://ghc.haskell.org/trac/ghc/wiki/ViewPatterns
18:24 <Cale> View patterns have been around since GHC 6.10
18:24 <kamyar> Can I make contraction?
18:24 <mauke> kamyar: I don't think so
18:25 flatmap13 joined
18:26 flatmap13 joined
18:27 Luke joined
18:29 shangxiao joined
18:31 mmn80 joined
18:31 <lyxia> kamyar: if you use the same constraints a lot you can make a constraint synonym
18:31 <kamyar> lyxia: How?
18:31 <Philonous> OK, so because I was tired of defining types for my servant interfaces I came up with my own HashMap-based extensible record system. But I'm not sure this is a good idea :/
18:32 <EvanR> is it really big enough to bring in hashmaps?
18:32 oisdk joined
18:32 <sproingie> kamyar: use ConstraintKinds, then it's basically a type statement
18:33 <sproingie> type Stringy a = (Read a, Show a)
18:33 <orion> What is meant by "type alignment" in relation to "sequences"?
18:33 <kamyar> Thnx fellows!
18:34 <lyxia> kamyar: http://lpaste.net/355458
18:35 <kamyar> lyxia: thnx
18:36 Icewing joined
18:36 <EvanR> :k (Read a, Show a)
18:36 <lambdabot> error: Not in scope: type variable ‘a’
18:36 <lambdabot> error: Not in scope: type variable ‘a’
18:36 <kamyar> Actually there is one! And I found it : SqlBackendCanRead
18:37 <sproingie> :k Show
18:37 <lambdabot> * -> Constraint
18:37 <EvanR> lambdabot: a is some type gdmmit
18:38 <sproingie> :k Show String
18:38 <lambdabot> Constraint
18:38 <EvanR> so (Constraint, Constraint) is a Constraint?
18:39 <sproingie> it's syntax for multiple constraints
18:39 Xnuk joined
18:39 acertain joined
18:39 <sproingie> :k (Show String, Read String)
18:39 <lambdabot> Constraint
18:39 <mauke> :k (Show ?a)
18:39 <lambdabot> error: parse error on input ‘?a’
18:40 matte454 left
18:40 <EvanR> cool
18:40 <EvanR> :k (Show String, (Read String, Num String))
18:40 <lambdabot> Constraint
18:42 <sproingie> can't think of any intereting kinds for constraints themselves
18:42 <sproingie> but i'm sure someone's done some wizardry on higher order constraints
18:43 <* hackage> sbp 2.2.1 - SwiftNav's SBP Library https://hackage.haskell.org/package/sbp-2.2.1 (jgross)
18:44 <sproingie> :k (Show _, Read _)
18:44 <lambdabot> Constraint
18:44 <sproingie> good old underscore
18:44 trism joined
18:45 <CoolerZ> i don't understand the example given here https://ghc.haskell.org/trac/ghc/wiki/ViewPatterns
18:46 doomlord joined
18:46 <CoolerZ> what are they saying is inconvenient?
18:46 <sproingie> having to write all the conversion boilerplate yourself is inconvenient
18:47 <CoolerZ> they eliminated the case of line but added parantheses and some extra characters to each pattern
18:47 <Philonous> EvanR, It's not about the HashMap per se, but AFAICS, the obvious way to implement extensible records is more akin to a HList than a Map
18:47 <EvanR> right
18:48 <CoolerZ> sproingie, what conversion boilerplate? you still need the function view even if you use view patterns
18:48 <sproingie> in scala you might use an implicit conversion where you'd use a view pattern in haskell
18:48 <Philonous> EvanR, And I wanted Record [ ("foo", Int), ("bar", Bool)] ~ Record [("bar", Bool), ("foo", Int)] or at least as close as I could get
18:48 <sproingie> CoolerZ: it doesn't have to be a function named view, and it doesn't even have to be a separate function
18:48 <CoolerZ> no it doesn't have to be named view obviously
18:48 <sproingie> it can be any expression. usually you'll have a specific view in mind though, so you'll probably already have that function anyway
18:49 mckeankylej joined
18:49 unK_ joined
18:49 <CoolerZ> well i guess you could define a separate expression for each pattern
18:49 <CoolerZ> still seems really niche
18:50 <EvanR> i see it used in ffi code
18:50 <mckeankylej> Just curious why did everyone decide that <*> = ap? All the rest of the monad and applicative laws make sense to me but I dont get why applicative must be a subclass of monad
18:50 <EvanR> monad is a subclass of applicative
18:50 <CoolerZ> ffi?
18:50 pgiarrusso joined
18:51 <EvanR> foreign function interface
18:52 <sproingie> the "Erlang-style parsing" example in the wiki is probably the most "real-world" application of view patterns on that page
18:52 fsestini left
18:52 <mckeankylej> EvanR: yea sorry applicative is a super class that was a typo
18:52 michaelw joined
18:52 fsestini joined
18:52 <EvanR> mckeankylej: monad used to have all the support that applicative was used for, it happens that for any monad you get an applicative for free, and now its known that plenty of things are applicative without being monads, so theres a new class for it
18:52 <CoolerZ> that makes this even weirder data View = Context :& Graph
18:52 <Philonous> mckeankylej, Every monad is also an applicative functor, that is, you can implement all the functions just using the fact that it is a monad and do so in a way that will necessarily respect the applicative laws
18:53 <CoolerZ> why isn't View a function?
18:53 <CoolerZ> http://jelv.is/talks/inductive-graphs-at-wagon/#/slide-sec-8
18:53 <EvanR> so you can pattern match on its constructor
18:53 <CoolerZ> view :: GraphDataStructure -> Graph
18:53 <EvanR> thats not right
18:54 <Philonous> mckeankylej, Now some types allow for different ways make them Applicative, but one of them is always compatible with monad (if it can be a monad), so it makes sense to demand that they are compatible, doesn't it?
18:54 <EvanR> it needs to review View
18:54 <EvanR> return View
18:54 <Sheogorath> :k Read _ => Show _
18:54 <lambdabot> error:
18:54 <lambdabot> Wildcard ‘_’ not allowed in a constraint
18:54 <lambdabot> except as the last top-level constraint of a type signature
18:54 <CoolerZ> sure
18:54 <Sheogorath> :k Read a => Show a
18:54 <lambdabot> error: Not in scope: type variable ‘a’
18:54 <lambdabot> error: Not in scope: type variable ‘a’
18:54 <mckeankylej> Philonous: The reason I am curious about it is I can make the Validation applicative an applicative but I cant make it a monad because it would violate the <*> = ap law but the monad instance is nice sometimes
18:54 <CoolerZ> view :: DataStructure -> GraphView
18:54 <glguy> Sheogorath: You can play with lambdabot in /msg
18:54 <mckeankylej> what bad things would happen if I made an instance of monad for validation?
18:55 <Philonous> mckeankylej, I don't know that type. Are you sure the Monad instance would be lawful?
18:55 <Cale> mckeankylej: Which instance were you hoping to write?
18:55 <Philonous> mckeankylej, Might be an oversight, then
18:55 <sproingie> mckeankylej: you'd be duplicating existing work, most likely. on the other hand, you'd know inside and out how it worked.
18:56 ptek joined
18:56 <glguy> mckeankylej: Then when you made refactorings that should preserve the meaning of your program according to the laws of Applicative and Monad, the meaning of you rprogram might not be preserved
18:56 takuan joined
18:56 cloudhead joined
18:56 <mckeankylej> Philonous: data Validation e a = Failure e | Success a seen in this package: https://hackage.haskell.org/package/validation
18:56 <CoolerZ> EvanR, isn't the whole point that you have view functions and you pattern match on the result of those?
18:57 <mckeankylej> the idea behind it is the applicitive instance mappends errors together instead of short circting
18:58 <mckeankylej> sometimes its useful to have a function like bind which short circuits like either
18:59 pie_ joined
18:59 <Philonous> mckeankylej, I don't see the mappend, tbh.
18:59 <* hackage> ersatz 0.4 - A monad for expressing SAT or QSAT problems using observable sharing. https://hackage.haskell.org/package/ersatz-0.4 (ryanglscott)
18:59 <sproingie> it's kind of like WriterT Either
18:59 <Philonous> Looks like short-circuiting to me
19:00 ph88_ joined
19:00 martingale joined
19:00 <bloogie> In 'Generalising monads to arrows', Hughes says "It is simply impossible to find a definition of >>= which does this", in reference to combining static parts of Swierstra and Duponcheel's LL1 parser, but then points out the solution they used, which looks exactly like an Applicative - and hesitates in departing from the monadic signature. Is this notion ill-conceived, from not having had explored Applicatives then?
19:00 <Philonous> mckeankylej, Do you mean AccValidation perchance?
19:00 <sproingie> or EitherT Writer ... the short circuiting makes it hard
19:02 dni joined
19:02 juanpaucar joined
19:03 <Philonous> mckeankylej, Well, you're right, the Monad instance would clash with the Applicative instance. However, the (===) in <*> === app is equivalence, not equality. So you can implement your monad instance as long as you're OK with ending up with equivalent values
19:03 <monochrom> bloogie: Right, Applicative was not thought of back then.
19:03 <bloogie> monochrom: does that make Arrows redundant?
19:04 <monochrom> The parsing example is better off as Applicative. But later the circuit example is a good Arrow example.
19:04 <bloogie> oh cool, thanks
19:04 ctag joined
19:05 <ph88_> how many papers did swierstra put out ?
19:05 mizu_no_oto joined
19:05 <Sheogorath> Does "if it compiles it works" apply to concurrent stuff like TVar implementations? With some unsafePerformIO for flavor.
19:06 <Philonous> Sheogorath, Hah, you wish. It doesn't even apply to sequential programs without unsafePerformIO (except maybe in a very narrow but boring sense)
19:07 Itkovian joined
19:08 theorbtwo joined
19:08 <bloogie> also, can someone explain this https://twitter.com/PieCalculus/status/858634919215599616/photo/1
19:08 coot joined
19:08 cyborg-one joined
19:08 RSun joined
19:08 <bloogie> does it mean anything more specific than dependent types are awesome?
19:08 <RSun> grep >
19:09 <RSun> grep -sirl test
19:09 <Tuplanolla> [sudo] password for rsun:
19:09 <RSun> lmao
19:10 kreetx joined
19:12 <RSun> Tuplanolla you are funny.
19:12 ChaiTRex joined
19:12 RSun left
19:13 <kreetx> hello, channel! I'm looking for a haskell tool which's announcement I remember reading, but can't remember the name of. In a git repo it allowed to leave tags (e.g "[todo]") in comments, and it would produce a summary
19:13 <kreetx> anyone remembers the name? it was some weird word, but for the life of me I can't find it on hackage..
19:14 darjeeling_ joined
19:15 twomix joined
19:15 Achylles joined
19:16 takle_ joined
19:17 chaosmasttter joined
19:17 <mauke> s/which's/whose/g
19:17 fredmorcos joined
19:18 uglyfigurine joined
19:19 mmachenry joined
19:21 Cooler joined
19:21 moet joined
19:22 caumeslasal joined
19:22 <moet> is there any active linear algebra library which supports physical dimension checking? dimensional-homo, dimensional-dk-linalg, DimMat, dimensional-vectors all seem deadish
19:23 <moet> i've been trying to use vanila `linear` with `dimensional` and found them to be pretty fundamentally incompatible.. on their own, both are great libraries!
19:25 Cooler joined
19:26 CoolerZ joined
19:26 justinfokes joined
19:27 <Tuplanolla> I can't find any of those on Hackage, moet.
19:28 <moet> Tuplanolla: yeah, i found them by going to the hackage package `dimensional` and looking at the author's github
19:28 <dolio> kreetx: lentil?
19:29 <Tuplanolla> The problem with linear algebra is that dimensions may vary within a matrix, so you can't just combine two libraries, moet.
19:30 <moet> Tuplanolla: yes, insofar as my project is concerned i've just said i'll keep all dimensions the same in a given vector
19:31 justinfokes joined
19:31 <moet> dimensional-homo also makes this assumption, but it looks reeeeal rough around the edges
19:31 Rodya_ joined
19:31 <moet> but heterogeneous tensors seems to be the root problem.
19:32 <Sheogorath> EvanR: Here's STM, maybe. http://lpaste.net/101465647430500352
19:33 <Sheogorath> IO Bool for reads lead to an elegant retry implementation
19:33 <kreetx> dolio: yes!!
19:33 <kreetx> thanks!
19:33 FreeBirdLjj joined
19:34 jbalint joined
19:34 jbalint joined
19:36 Yuras joined
19:36 <Sheogorath> Philonous: "if it compiles it works" was true for this large file and rigorous testing
19:37 justanumber joined
19:39 Hithroc_ joined
19:39 <davean> Sheogorath: when I think it won't, I just get more precise with the types
19:40 <Sheogorath> well it was concurrency and unsafePerformIO that was most fishy, not sure how to type that.
19:40 <davean> well, you *don't* type unsafePerformIO, it can break anything, thats why its unsafe
19:40 <davean> Concurrency rarely requires extra typing
19:41 <davean> the type system generally protects everything relivent
19:41 Rodya_ joined
19:41 Hunter1_ joined
19:41 <greymalkin> Is there a way to make a typeclass cause derivation of other typeclasses?
19:41 <davean> unsafePerformIO is specificly bipassing it tohugh
19:41 coot joined
19:41 <davean> greymalkin: default implimentations?
19:41 <davean> greymalkin: or do you mean actually create the instances?
19:41 <greymalkin> Specifically, I'd like a typeclass that implements both ToJSON and FromJSON .
19:42 <davean> greymalkin: you can create an instance "instance AllJSON a => ToJSON a", etc
19:42 <davean> greymalkin: you'll run into overlapping instance issues of course
19:42 <greymalkin> Yes. Too many of them.
19:42 <davean> no, not really?
19:43 <davean> just don't create AllJSON for anything that already has instances
19:44 <cocreature> gnah, I just spend 10 minutes staring at my code trying to figure out why GHC couldn’t find a symbol only to figure out that I was using it at the typelevel and it was a value
19:44 hololeap joined
19:44 <davean> cocreature: lol, welcome to our new era
19:44 fosterite joined
19:45 <cocreature> davean: we need an error message that says “did you mean to use this as a value instead?” :)
19:45 <davean> cocreature: I've thought that before too
19:46 <greymalkin> davean: It prompts me about "UndecidableInstances"
19:46 <greymalkin> And then everything becomes an overlapping instance.
19:46 <davean> greymalkin: you've added something you shouldn't then
19:46 <davean> The rule I provided was decidable
19:47 <greymalkin> Ah.. No, I've chosen a name that already exists.
19:47 <greymalkin> And done that repeatedly.
19:47 <hololeap> i'm trying to solve this challenge but i can't come up with an algorithm that is efficient enough. my original idea was to use a HashSet to store the "safe" positions and then add queens, deleting any now-unsafe positions, using a recursive bind within the List monad: https://www.hackerrank.com/challenges/super-queens-on-a-chessboard
19:47 kirillow joined
19:47 <greymalkin> Or not.
19:48 juanpaucar joined
19:48 <hololeap> i have heard that you can simplify the original n queens problem by simply keeping track of the rows/columns, but the ability for the "super queen" to move like a knight complicates that.
19:49 JeanCarloMachado joined
19:49 silver_ joined
19:50 <EvanR> wait, super queen
19:50 sillyotter joined
19:50 jbalint joined
19:50 jbalint joined
19:50 <EvanR> what socery is this
19:50 dni joined
19:50 Gurkenglas joined
19:51 lknows joined
19:51 jangsutsr joined
19:51 twanvl joined
19:52 Ryozuki joined
19:52 <greymalkin> davean: The constraint 'JSONString a' is no smaller than the instance head (Use UndecidableInstances to permit this)
19:52 <greymalkin> Based on: 
19:52 <greymalkin> https://pastebin.com/cE5pKmmu
19:52 leat joined
19:52 xcmw joined
19:53 Bassetts joined
19:54 <hololeap> i was thinking that i could have a more efficient way to delete entire rows or columns at a time, but then i realized that i was thinking in terms of mutable state
19:54 [[[[[ExTRa]]]]] joined
19:55 <hololeap> since there aren't individual delete actions, but rather it creates a new, modified set and then passes it on, i don't really know how to model the efficiency of this new method in my mind
19:56 <hololeap> any ideas?
19:56 <* hackage> forest - Tree and Forest types https://hackage.haskell.org/package/forest- (ShaneOBrien)
19:56 <hololeap> here is my current code, if it helps anyone understand my question: https://gist.github.com/hololeap/0e0e72d3c4b5010c5f62938090c8ed51
19:57 <davean> greymalkin: you're not removing a layer of wrapping, which is how the compiler proves its converging. You want a wrapper to witness you're doing the right thing.
19:57 Hithroc joined
19:59 <greymalkin> davean: I don't understand, is this something I can only do with specifically `newtype`ed types?
19:59 dni joined
19:59 mmachenry joined
19:59 sillyotter joined
20:00 jship joined
20:00 Jesin joined
20:01 sillyotter joined
20:03 angelos joined
20:03 augur joined
20:04 revprez_atlanta joined
20:05 jzeus joined
20:06 takle joined
20:06 juanpaucar joined
20:07 <greymalkin> Is it because of the Proxy?
20:08 gawen joined
20:08 <greymalkin> (which, I've just realized, isn't necessary)
20:10 acertain joined
20:11 jer1 joined
20:12 <orion> How come hardly anyone uses extensible-effects?
20:12 unipe joined
20:12 carlomagno joined
20:15 Itkovian joined
20:15 cdg joined
20:16 CoderPuppy joined
20:16 unipe joined
20:17 lambda-11235 joined
20:18 justinfokes joined
20:20 coot____ joined
20:24 moet joined
20:24 fresheyeball joined
20:25 <moet> is there any relationship between Data.Function.on and the applicative world
20:26 mattyw joined
20:26 thimoteus joined
20:26 Xandaros joined
20:27 pgiarrusso joined
20:27 sillyotter joined
20:27 cpup joined
20:27 sillyotter joined
20:28 LHoT10820 joined
20:29 <kamyar> Hello again
20:29 <kamyar> please help me with this code and the error: http://lpaste.net/355460
20:29 drewbert joined
20:30 <lyxia> kamyar: please paste a complete file reproducing the error
20:31 <glguy> kamyar: Perhaps you have a restrictive import list that doesn't include the methods of the FromJSON class
20:32 rcat joined
20:32 <kamyar> glguy: U r right! Sorry! Fixed! thnx
20:33 <* hackage> concurrent-output 1.8.0 - Ungarble output from several threads or commands https://hackage.haskell.org/package/concurrent-output-1.8.0 (JoeyHess)
20:34 sillyotter joined
20:35 preyalone joined
20:35 juanpaucar joined
20:37 jangsutsr joined
20:38 sillyotter joined
20:38 flatmap13 joined
20:40 unipe left
20:40 {emptyset} joined
20:41 Anonymous joined
20:44 myfreeweb_ joined
20:44 <Sheogorath> How does one do monad transformery things on IO and Maybe. what's the recommended techniques?
20:44 afarmer_ joined
20:45 <tommd> `MaybeT IO`
20:45 <fresheyeball> :q
20:45 <fresheyeball> exit
20:45 uglyfigurine joined
20:45 <fresheyeball> \q
20:46 <Cale> Sheogorath: That's kind of vague -- what problem are you trying to solve?
20:46 <Sheogorath> thanks, on second thought i probably just need >>
20:46 <Sheogorath> so, ill just write that
20:46 funrep joined
20:48 stevenxl joined
20:48 stevenxl joined
20:48 stevenxl joined
20:51 JeanCarloMachado joined
20:51 justinfokes joined
20:52 metaporia joined
20:52 cretiq joined
20:53 sfcg joined
20:56 <dgpratt> so spacemacs (and I assume emacs) has decent support for Haskell, including type "tooltips" and autocomplete; can one get similar functionality in vim?
20:56 myfreeweb joined
20:57 <dgpratt> I was hoping to use the console version of emacs/spacemacs in WSL, but it's too wonky to be usable
20:57 flatmap13 joined
20:58 carl_ joined
20:58 Wizek_ joined
20:59 kamyar joined
20:59 Deide joined
20:59 <kamyar> Hello fellows
21:00 <shiona> hello
21:01 <kamyar> I just need to json UUID
21:01 <kamyar> tojson works well
21:01 <kamyar> but I have no clue how to implement parsejson
21:01 <davean> kamyar: Those are already implimented for UUID
21:02 <kamyar> davean: knwo but they do not implement json nor generic
21:02 <davean> yes they do
21:02 <kamyar> davean: Which?
21:02 <davean> ToJSON and FromJSON
21:02 <kamyar> https://hackage.haskell.org/package/uuid-1.3.13/docs/Data-UUID.html
21:02 <davean> they've been in aeson since 1.1
21:02 <davean> yes
21:03 <davean> aeson already has instances
21:03 <kamyar> davean: Aeson does not support UUID
21:03 <kamyar> davean: wait! I am wrong
21:04 <kamyar> davean: I have to use uuid-types instead of uuid package
21:04 whoisxy joined
21:05 ystael joined
21:06 LKoen joined
21:06 <kamyar> davean: But I cant! Since persistent-uuid does not use it!
21:06 <hexagoxel> kamyar: if you use uuid you already use the types from uuid-types. former depends on latter.
21:10 justinfokes joined
21:11 `^_^v joined
21:12 jarno_ joined
21:12 fsestini joined
21:12 <jarno_> >
21:12 <jarno_> Hi
21:12 fsestini left
21:12 machinedgod joined
21:12 <kamyar> davean: Does not work!
21:12 justan0theruser joined
21:13 <kamyar> davean: http://lpaste.net/355460
21:13 sproingie joined
21:14 xanadu_ joined
21:14 nicootto joined
21:15 <jarno_> @help
21:15 <lambdabot> help <command>. Ask for help for <command>. Try 'list' for all commands
21:15 <jarno_> @list
21:15 <lambdabot> What module? Try @listmodules for some ideas.
21:15 <jarno_> @listmodules
21:15 <lambdabot> activity base bf check compose dice dict djinn dummy elite eval filter free fresh haddock help hoogle instances irc karma localtime metar more oeis offlineRC pl pointful poll pretty quote search
21:15 <lambdabot> slap source spell system tell ticker todo topic type undo unlambda unmtl version where
21:16 dhruv_ joined
21:17 dddddd joined
21:17 juanpaucar joined
21:17 <kamyar> http://lpaste.net/355460
21:18 <kamyar> please help
21:18 simukis_ joined
21:18 acarrico joined
21:18 <* hackage> concurrent-output 1.9.0 - Ungarble output from several threads or commands https://hackage.haskell.org/package/concurrent-output-1.9.0 (JoeyHess)
21:21 <sproingie> kamyar: you'll need to provide a ToJSON instance for UUID, like the message says
21:21 <kamyar> sproingie: It is provided in Aeson
21:21 <glguy> instance ToJSON UUID; -- Defined in ‘aeson-’
21:21 <glguy> which version of aeson are you using?
21:22 phyrex1an joined
21:22 <kamyar> glguy:
21:22 jzeus joined
21:23 <glguy> OK, that one doesn't have an instance
21:23 meadowlark joined
21:23 <kamyar> glguy: How can I upgrade using Stack install?
21:23 sampuka joined
21:24 bennofs1 joined
21:24 <sproingie> put the dependency explicitly in your cabal file and run stack solver?
21:25 mojjo joined
21:25 <sproingie> could maybe copy-paste the instance from the newer version, but that'll screw you when you do upgrade
21:26 dni joined
21:26 <mojjo> hi.. hi! I'm writing a function that picks a random element from a list, since this only makes sense for non-empty lists, I'm using the Non-Empty-List pkg. My type is `randEl :: NE.NonEmpty a -> IO a` and the implementation is here http://lpaste.net/355463
21:27 <mojjo> anybody knows why I'm getting this error: `randEl $ NE.fromList [1,2]` ---> *** Exception: NonEmpty.fromList: empty list
21:28 bennofs joined
21:28 <glguy> mojjo: Make a file that reproduces that error
21:28 <glguy> and add it to your paste
21:28 <mojjo> alright.. wait..
21:29 <kamyar> PLeas ehelp me implement it!
21:29 <kamyar> apparently Aeson 1.2.*.* is not Stackage compatible
21:29 rockfordal joined
21:31 P1RATEZ joined
21:32 <mojjo> glguy: dont't know what it was... restarting the repl did the job...
21:32 <mojjo> glguy: so it works actually
21:32 <drostie> i mean, it *is* stackage-compatible, but it's not in the LTS Haskell 8.13 stackage snapshot...
21:32 BlueRavenGT joined
21:33 tommd joined
21:34 <drostie> kamyar: this code is low-level enough that you can probably switch to a nightly if you wanted to?
21:36 hc joined
21:36 <drostie> kamyar: see https://www.stackage.org/nightly-2017-05-12 and whether the aeson- that's there meets your needs.
21:37 <drostie> the FromJSON instances are in the Data.Aeson.Types class IIRC.
21:37 jzeus joined
21:39 <Tuplanolla> They left, drostie.
21:39 <drostie> ::slowpoke_image::
21:42 acertain joined
21:42 Rodya_ joined
21:42 HoierM joined
21:44 Achylles joined
21:45 darjeeling_ joined
21:47 jzeus joined
21:48 whoisxy joined
21:49 rkazak joined
21:49 justinfokes joined
21:52 moet joined
21:52 hiratara joined
21:53 mjora7 joined
21:53 theorbtwo joined
21:53 emotions joined
21:54 laplacian joined
21:57 llamma joined
21:57 pera_ joined
22:01 funrep joined
22:03 mmachenry joined
22:04 krok_ joined
22:05 OnkelTem joined
22:06 DTZUZU joined
22:11 jzeus joined
22:12 dual joined
22:12 ^bschafer1 joined
22:13 HotSauce joined
22:15 alhariel joined
22:15 patbecic` joined
22:15 dm3 joined
22:17 xcmw joined
22:17 afarmer joined
22:17 revprez_atlanta joined
22:23 Fukki2 joined
22:23 hotsauce joined
22:23 Fukki2 left
22:25 <mojjo> it might be a too general question, anyways.. when dealing with IO, is it advisable to keep the IO wrapper to be the outermose, e.g. `IO (Maybe x)` instead of `Maybe (IO a)`?
22:26 dm3 joined
22:26 <Rembane> mojjo: It depends on what you want to do.
22:26 albertus1 joined
22:27 <Rembane> mojjo: ...is the general and maybe useless answer.
22:27 <Rembane> mojjo: In any case, your types need to line up and it will usually sort itself out.
22:27 <Rembane> mojjo: And sequence is your friend.
22:28 <Rembane> :t sequence
22:28 <lambdabot> (Monad m, Traversable t) => t (m a) -> m (t a)
22:28 <Rembane> :t sequenceA
22:28 <lambdabot> (Applicative f, Traversable t) => t (f a) -> f (t a)
22:28 <Rembane> mojjo: Or maybe even sequenceA depending on what things you want to inverse
22:29 <mojjo> alright...
22:29 <monochrom> IO (Maybe x) and Maybe (IO x) are so different that "it depends" is the only correct answer.
22:29 cschneid_ joined
22:30 <EvanR> its two totally different things!
22:30 <EvanR> not just a choice of style
22:30 <monochrom> It's on the order of "which one should I use, Emacs or Minecraft?"
22:31 exarkun joined
22:31 flatmap13 joined
22:31 <exarkun> I'm having trouble parsing some json with an object with a list of objects using Data.Aeson
22:31 <hpc> specifically, IO (Maybe x) is the type of IO actions that might produce a result
22:32 <hpc> Maybe (IO x) is the type of "maybe you have an IO action"
22:32 <exarkun> https://github.com/LeastAuthority/s4-wormhole-convergence-agent/blob/haskell/MagicWormholeModel.hs#L52 is what I have now. I mistakenly though `nameplates` would be like `["x", ...]` but it's actually `[{"id": "x"}, ...]`.
22:32 <exarkun> I don't see how to deal with this, though.
22:32 <Rembane> monochrom: Definitely emacs. Meta-x Minecraft
22:33 pwnz0r joined
22:33 ContessaTP joined
22:34 <mojjo> well, I'm writing a function that takes a value from a map (this returns a maybe) and then does some IO with this.. I figured out that it can be modeled both ways, this would be my `IO Maybe ..` version: http://lpaste.net/355464
22:34 sssilver joined
22:34 jship joined
22:35 <bennofs> mojjo: there is a function to go from Maybe (IO a) to IO (Maybe a) but not the other way around
22:36 <mojjo> that makes sense..
22:37 <mojjo> so actually I think now, that the other way would be more appropriate in my example..
22:37 kelzaa joined
22:37 <monochrom> Initially yes.
22:37 <lyxia> exarkun: (x .: "nameplates" >>= mapM (\np -> np .: "id")) -- get the list, and map over it
22:38 <monochrom> Until you realize that somewhere in your program you will turn Nothing into a dummy IO action anyway.
22:39 <mojjo> ahaa. true, it must at one point...
22:40 <exarkun> `v .: "nameplates"` /me stares at mapM's type
22:42 fotonzade joined
22:42 yellowj joined
22:42 safe joined
22:43 bigos joined
22:43 Rodya_ joined
22:45 <* hackage> moving-averages - This is a library for calculating moving averages on lists of numbers. https://hackage.haskell.org/package/moving-averages- (joshuaclayton)
22:48 dmwit joined
22:50 justinfokes joined
22:51 halogenandtoast joined
22:52 joobus joined
22:53 doomlord joined
22:53 jzeus joined
22:56 mjora7 joined
22:56 dni joined
22:57 eacameron joined
22:58 jsgrant_om joined
23:02 alveric1 joined
23:02 ego joined
23:06 <Profpatsch> mkMap :: forall k ik v. (Ord k, Ord ik, Enum ik, Bounded ik)
23:06 <Profpatsch> => (Proxy ik) -> MKMap k v
23:06 <Profpatsch> mkMap _ = MKMap mempty (minBound :: ik) mempty
23:06 <Profpatsch> I suspect it’s not really possible to build a Monoid instance for MKMap here?
23:07 <Profpatsch> Unless I pin it down to a specific Bounded type that is.
23:07 carlomagno joined
23:10 flatmap13 joined
23:11 lambda-11235 joined
23:14 doomlord joined
23:15 <Sheogorath> STM is freaking cool.
23:15 <Rembane> Indeed! :D
23:15 tromp joined
23:16 jimmyrcom joined
23:18 flatmap1_ joined
23:20 mojjo joined
23:20 dustmote joined
23:21 <mojjo> I'm wondering why there's no (++) function defined in the Data.List.NonEmpty module... does anyone have an answer to this?
23:22 <glguy> You can use <> from Data.Semigroups
23:22 <glguy> so no new operator was needed
23:24 <hotsauce> :t <>
23:24 <lambdabot> error: parse error on input ‘<>’
23:24 <hotsauce> :t (<>)
23:24 <lambdabot> Monoid m => m -> m -> m
23:24 <mojjo> nice.. yes.. now it makes kind of sense. semigroups are monoids without an empty element, no? which are.. well non-empty-lists..
23:25 nakal_ joined
23:26 yamadapc joined
23:27 LHoT10820 joined
23:28 juanpaucar joined
23:28 moet joined
23:29 <mojjo> my ghci says `(<>) :: Semigroup a => a -> a -> a`
23:30 fosterite joined
23:30 meba joined
23:30 SkyPatrol joined
23:31 <kelzaa> i heard this is the best channel on freenode
23:31 jzeus joined
23:33 <ReinH> mojjo: yeah, the free semigroup is (almost) the non-empty list.
23:33 dfeuer joined
23:35 <ReinH> it's actually the list (again, almost), you just don't know that [] is neutral
23:35 <ReinH> (it's actually finite lists)
23:38 im0nde joined
23:38 <ReinH> formally, the free semigroup over a set A is the set of all finite sequences (often called words) of the elements of A (often called letters) with concatenation as the product. The free monoid is the free semigroup with the empty sequence as identity.
23:38 <ReinH> hmm, actually I think the free semigroup is non-empty finite sequences.
23:38 kelzaa left
23:38 <ReinH> it's A+, while the free monoid is A*
23:39 <nshepperd> i don't see why the free semigroup would include []
23:39 <ReinH> (that's where + and * in regexp come from)
23:39 WhiskyRyan joined
23:39 <ReinH> nshepperd: yeah, I corrected myself
23:39 <ReinH> I corrected my correction
23:39 <ReinH> and the free monoid adjoins the empty sequence as identity
23:39 <nshepperd> heh
23:40 theDon_ joined
23:41 <ReinH> the * is called the Kleene star, after Stephen Kleene (not to be confused with the weird bottle guy, Felix Klein)
23:41 <nshepperd> i still haven't quite succeeded in understanding the general definition of "the free X on the set A"
23:42 <nshepperd> something something adjunctions
23:42 <ReinH> Yeah, that's how it's presented in category theory
23:42 markus1209 joined
23:42 markus1219 joined
23:42 <ReinH> The free functor from A to X is left-adjoint to a forgetful functor from X -> A
23:43 <ReinH> There are also cofree functors, which are right-adjoint to forgetful functors
23:44 ali_bush joined
23:44 ali_bush joined
23:44 <ReinH> They are sometimes called fascist functors (yes, really) because mathematicians are hilarious
23:45 <ReinH> sorry, that's not right
23:46 <ReinH> the free functor from sets to the category C is from Set -> C and the forgetful functor is from C -> Set
23:46 Rodya_ joined
23:46 jsgrant_om joined
23:46 viralstitch joined
23:46 doomlord joined
23:47 <nshepperd> in this case the category C is the category of monoids? with monoid homomorphisms as the arrows?
23:47 <ReinH> the forgetful functor selects the carrier set
23:47 <nshepperd> or semigroups
23:48 acertain joined
23:48 <ReinH> The free functor that takes A to A* is from Sets to Mon, the category of monoids, yeah
23:49 <ReinH> nshepperd: the key thing that makes it 'free' is a universal property
23:50 darlan joined
23:50 tromp joined
23:51 <ReinH> which I am going to have to look up since clearly my category theory is rusty
23:51 funrep joined
23:53 justinfokes joined
23:56 t7 joined
23:57 infinity0_ joined
23:57 infinity0_ joined
23:58 <ReinH> nshepperd: oh this is good https://math.stackexchange.com/questions/58553/why-is-the-free-monoid-free
23:58 dni joined
23:59 <EvanR> heh
23:59 <EvanR> i tried this
23:59 <EvanR> pureSleep i x = unsafePerformIO (threadDelay i) `seq` x
23:59 <EvanR> to try and simulate slowness of a computation
23:59 <EvanR> ghci is not amused