<     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 atk joined
00:00 bydo joined
00:02 WhiskyRyan joined
00:03 infinity0 joined
00:05 infinity0 joined
00:06 WhiskyRyan joined
00:06 fantasticsid joined
00:07 romank joined
00:08 infinity0 joined
00:09 umib0zu joined
00:11 infinity0 joined
00:12 romank joined
00:14 infinity0 joined
00:16 infinity0 joined
00:17 Big_G joined
00:17 primal_ joined
00:17 romank joined
00:19 fantasticsid joined
00:20 takle joined
00:23 nighty-- joined
00:24 Netwolf joined
00:25 cschneid_ joined
00:26 jship joined
00:27 jbiesnecker joined
00:28 davr0s joined
00:28 primal joined
00:28 juanpaucar joined
00:29 filterfish joined
00:32 joco42 joined
00:32 anemecek joined
00:34 takle joined
00:36 et09 joined
00:37 Oxit_ joined
00:39 tromp joined
00:39 romank joined
00:40 takle joined
00:41 Reshi joined
00:41 markasoftware joined
00:43 revtintin joined
00:44 wroathe joined
00:48 montagy joined
00:49 PotatoCo_ joined
00:50 mac10688 joined
00:51 romank joined
00:53 plutoniix joined
00:53 SeMas joined
00:55 plutoniix joined
00:55 eSVG joined
00:58 mizu_no_oto joined
01:01 vaibhavsagar joined
01:02 romank joined
01:02 rblaze joined
01:02 dxld joined
01:03 joco42 joined
01:04 cpennington joined
01:05 im0nde_ joined
01:05 mjs2600 joined
01:05 thebardian joined
01:08 beekill95 joined
01:08 darjeeling_ joined
01:08 whaletechno joined
01:12 romank joined
01:13 dfeuer joined
01:15 <Koterpillar> @hoogle Monad m => ConduitM a o m [a]
01:15 <lambdabot> Conduit asumC :: (Alternative f, Monad m) => ConduitM (f a) o m (f a)
01:15 <lambdabot> Text.XML.Stream.Parse ignoreAnyTreeContent :: MonadThrow m => ConduitM Event o m (Maybe ())
01:15 <lambdabot> Text.XML.Stream.Parse ignoreAllTreesContent :: MonadThrow m => ConduitM Event o m (Maybe ())
01:15 <Koterpillar> Is there a shortcut for foldMapC (:[])?
01:19 TheFuzzball joined
01:19 halogenandtoast joined
01:20 lambdamu joined
01:20 filterfish joined
01:20 zRecursive joined
01:22 <lyxia> sinkList ?
01:23 radi joined
01:27 romank joined
01:27 juanpaucar joined
01:28 meba joined
01:28 hololeap joined
01:31 anemecek joined
01:31 zuck05 joined
01:32 mocte joined
01:33 mac10688 joined
01:35 WhiskyRyan joined
01:37 wroathe joined
01:45 umib0zu joined
01:46 wroathe joined
01:49 dfeuer joined
01:52 <Koterpillar> yes, that's it! Thanks!
01:52 <Koterpillar> :t sinkList
01:52 <lambdabot> error:
01:52 <lambdabot> • Variable not in scope: sinkList
01:52 <lambdabot> • Perhaps you meant ‘shrinkList’ (imported from Lambdabot.Plugin.Haskell.Eval.Trusted)
01:57 <halogenandtoast> If I were to make a tutorial video of how to make a twitter clone is Yesod, would anyone be irritated if I avoided using an auth plugin and just wrote the auth in the app itself?
01:58 <halogenandtoast> None of the auth plugins work in the same manner, I just wonder if it's irresponsible of me to write potentially insecure code and release a tutorial showing others how to introduce the same potentially insecure code out into the while.
01:58 <halogenandtoast> Granted I have some experience writing authentication for websites.
01:58 simukis joined
01:59 <halogenandtoast> s/while/wild/
02:00 Sonderblade joined
02:00 beerdrop joined
02:00 hucksy joined
02:01 romank joined
02:03 WhiskyRyan joined
02:05 <EvanR> it sounds like a standard problem with tutorials
02:05 <EvanR> who are we to stand in the way
02:06 WhiskyRyan joined
02:06 kyle1320 joined
02:06 sleffy joined
02:07 tristanp joined
02:09 WhiskyRyan joined
02:10 Johan_L joined
02:10 <Koterpillar> consider naming it lousyAuthenticationPlugin
02:12 nshepperd joined
02:13 gugah joined
02:14 xcmw joined
02:14 dquarks_ joined
02:16 <halogenandtoast> Koterpillar: lol, I was planning on avoiding the plugin architecture entirely
02:16 <halogenandtoast> easier just to code it in the app itself.
02:17 <Koterpillar> then lousyAuthSomethingElse
02:17 fragamus joined
02:17 <halogenandtoast> I just feel like all of the current auth plugins are rather rigid and don't seem to handle the very simple case of signing up with a username, email, and password without having to send a verification email.
02:18 <halogenandtoast> I promise I won't md5 the passwords
02:18 <halogenandtoast> So far this seems to be the closest: https://hackage.haskell.org/package/yesod-auth-account
02:18 <halogenandtoast> but again it's rather rigid
02:19 cschneid_ joined
02:20 <* hackage> xmonad-vanessa - Custom xmonad, which uses stack and sets various defaults https://hackage.haskell.org/package/xmonad-vanessa- (vmchale)
02:22 sophiag joined
02:22 <halogenandtoast> I guess I'll make the video and see what feedback I get, I'd be happy to rerecord if someone mentions something critical (or better)
02:23 anemecek joined
02:23 darlan joined
02:24 uniclown joined
02:25 mzf joined
02:25 <sophiag> so i just read up on profunctors, which always seemed complicated to me, but turns out they're just a twist on a bifunctor. the thing i'm struggling with (similar to when i first learned about bifunctors) are examples
02:25 <sophiag> i can see some contrived ones on the school of haskell page, but i assumed they occurred in the actual language somewhere. it does say "The simplest and most common Profunctor is (→)," but i'm having trouble understanding how (->) outside of dimap flips the arguments of the first function
02:26 jgertm joined
02:27 wroathe joined
02:27 juanpaucar joined
02:28 Argue joined
02:29 anemecek joined
02:29 <halogenandtoast> sophiag: don't know if you've still blocked me, but when I asked someone, I think they pointed me at the Reader monad (which I'm not sure if a profunctor because it was a while ago and I never seem to use it directly)
02:29 <halogenandtoast> I'm searching now to confirm
02:29 <sophiag> halogenandtoast: i blocked you?
02:30 <sophiag> oy
02:30 <halogenandtoast> Maybe?
02:30 <sophiag> i hope not...
02:30 <halogenandtoast> I used some harsh language at some point.
02:30 <halogenandtoast> Might have been someone else
02:30 <* halogenandtoast> shrugs
02:30 <sophiag> welp, if such an incident occurred it seems like we're mutually over it :)
02:30 <halogenandtoast> If it was you, sorry for the harsh language, if not, party on
02:32 <mniip> wait
02:33 <mniip> internal lambda calculus in a category
02:33 <mniip> is that what Arrow is about
02:35 <sophiag> hmm, can't find anything about Reader being a profunctor on Google it doesn't have a profunctor instance
02:35 <halogenandtoast> yeah :[
02:35 WhiskyRyan joined
02:35 <halogenandtoast> sorry for that rabbit hole
02:35 teggi joined
02:35 <halogenandtoast> I've forgotten the conversation I had...
02:35 <halogenandtoast> I wish I could remember now
02:36 owickstrom joined
02:41 <sophiag> halogenandtoast: i'm reading this: http://blog.sigfpe.com/2011/07/profunctors-in-haskell.html
02:41 <sophiag> it explains that comment about (->)
02:42 <halogenandtoast> sophiag: This is a neat example of a profunctor (contrived but neat) https://carlo-hamalainen.net/blog/2015/10/21/note-to-self-profunctors
02:42 takle joined
02:43 <sophiag> i don't have much trouble understanding stuff like that. just trying to wrap my head around how type constructors are profunctors
02:43 exferenceBot joined
02:44 primal_ joined
02:44 <Welkin> :k (->)
02:44 <lambdabot> * -> * -> *
02:44 cschnei__ joined
02:44 WhiskyRyan joined
02:44 <halogenandtoast> sophiag: Do you understand how they are bifunctors?
02:44 <halogenandtoast> (not saying I do, but I suppose that's step 1)
02:45 <Welkin> I still don't know about profunctors yet
02:45 <sophiag> yes
02:45 <sophiag> i think...
02:45 <halogenandtoast> So the next step is proving they are contravariant on the first argument, and covariant on the second.
02:45 <sophiag> to be able to map between exponentials they need to be bifunctors
02:45 <sophiag> i'm not sure the above is the correct argument though
02:46 <sophiag> right, and really just the contravariant part
02:46 <halogenandtoast> so to be contravariant it can be seen as changing the fmap order right
02:46 <halogenandtoast> we can't do (a -> b) -> f a -> f b
02:46 <halogenandtoast> it is instead (b -> a) -> f a -> f b
02:46 <mniip> 1496025878 [05:44:38] <halogenandtoast> sophiag: Do you understand how they are bifunctors?
02:47 <mniip> but (->) is not a bifunctor
02:47 <sophiag> it's a profunctor. that's what we're trying to figure out
02:47 <mniip> not Hask x Hask -> Hask
02:47 <mniip> it's Hask^op x Hask -> Hask
02:47 <mniip> hence profunctor
02:47 hexagoxel joined
02:48 <sophiag> (a -> b) -> (c -> d) -> f a b -> f c d
02:48 <sophiag> ^ bifunctor version
02:48 <sophiag> but i don't understand how the first is flipped
02:48 <sophiag> mniip: would you mind explaining what Hask^op is in terms of the actual language?
02:49 <uniclown> bimap is (a -> b) -> (c -> d) -> f a c -> f b d
02:49 <mniip> newtype Op a b = Op (b -> a)
02:49 <halogenandtoast> mniip: sorry my understanding of profunctor, is that it's a bifuntor that is contravariant on the first argument, and covariant on the second. Is this wrong?
02:49 <mniip> halogenandtoast, a profunctor from C to D is a bifunctor from C^op and C to D
02:49 <halogenandtoast> s/bifuntor/bifunctor/
02:49 <mniip> that much is correct
02:49 <sophiag> uniclown: you're right. i was confused because the inputs on school of haskell are written oddly
02:50 <mniip> sophiag, Hask^op has all the same objects, but the morphisms are backwards
02:51 juanpaucar joined
02:51 <mniip> a morphism from Int to Char is 'Op Int Char'
02:51 <Welkin> halogenandtoast: you mean
02:51 <Welkin> ^(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[13-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$
02:51 <mniip> a function from Char to Int
02:51 <Welkin> ?
02:51 <sophiag> that's what i figured, but i don't follow how that means (->) is contravariant on the first argument
02:51 wroathe joined
02:51 <mniip> sophiag, do you know what a contravariant functor is
02:51 <sophiag> yes
02:51 <halogenandtoast> Welkin: I'm missing a large amoutnt of mental context to understand what you've just posted, except that it's a large regular expression.
02:51 <Welkin> halogenandtoast: exactly :P
02:51 <halogenandtoast> I could parse that, but I don't want to.
02:52 <mniip> a contravariant functor from C to D is a functor from C^op to D
02:52 <mniip> mentally, you could imagine it as
02:52 <sophiag> yup got that
02:52 <mniip> contramap :: Op a b -> f a -> f b
02:52 <mniip> for example,
02:52 <mniip> data Pred a = Pred (a -> Bool)
02:52 <mniip> Pred is not a functor from Hask to Hask
02:52 <mniip> hence not an instance of Functor
02:53 <sophiag> which Pred?
02:53 <mniip> the one I just defined
02:53 <sophiag> well you duplicated the data and type constructors
02:53 <mniip> which of the two do you think we call a "functor"
02:54 <sophiag> the type constructor
02:54 <mniip> right
02:54 <halogenandtoast> Oh good, my guess was correct as well.
02:54 <iqubic> What are we talking about here?
02:54 <halogenandtoast> halogenandtoast++
02:54 <sophiag> iqubic: profunctors
02:54 <halogenandtoast> iqubic: profunctors
02:54 <mniip> iqubic, profunctors
02:55 <iqubic> What's a profunctor?
02:55 <halogenandtoast> I love this channel
02:55 <sophiag> ha
02:55 <mniip> sophiag, do you see why Pred is not a Functor?
02:55 <mniip> iqubic, google it
02:55 <halogenandtoast> It's a functor that's really good at its job.
02:55 <halogenandtoast> hence pro functor
02:55 <iqubic> Pred can't be a functor. How do you map a function f over a Pred a?
02:55 <uniclown> mniip: I understand Hask is the category of types in haskell (basically) but why is Pred not a functor from Hask to Hask?
02:55 <iqubic> You can't really do that.
02:56 <sophiag> it's not a functor because it just takes one type variable
02:56 skeuomorf joined
02:56 <mniip> sophiag, ???
02:56 <sophiag> unless i'm supposed to think of the rhs somehow
02:56 sherub1 joined
02:56 <halogenandtoast> @faq Is Predicate a functor?
02:56 renzhi joined
02:56 <mniip> uniclown, if it were a functor, then there would be a mapping from (a -> b) to (Pred a -> Pred b)
02:56 <halogenandtoast> @faq Is Predicate a functor?
02:56 <lambdabot> https://wiki.haskell.org/FAQ
02:56 <mniip> natural in a, b
02:56 <sophiag> ah ok
02:56 <mniip> there can't be such a mapping
02:57 <sophiag> so we need to flip (a -> Bool) when mapping over Pred
02:57 <mniip> if you need to know why? I'd need to check
02:57 <uniclown> got it. It is a contravariant functor though (I think that's the point haha)
02:58 <sophiag> but what if you have: data foo a b = bar (a -> b) ?
02:58 <mniip> uniclown, I think it follows from the free theorem somehow
02:58 <sophiag> then it's not immediately obvious to me that (->) needs to be contravariant
02:58 <mniip> the only definition you can write is fmap _ _ = const False/True
02:58 <mniip> which doesn't satisfy laws
02:58 <c_wraith> sophiag: it's contravariant in a, covariant in b
02:59 <c_wraith> sophiag: which is exactly what Profunctor is
02:59 wroathe joined
02:59 <sophiag> aha!
02:59 <uniclown> that's why partially applied arrow is a functor ((->) e)
02:59 <mniip> sophiag, so, do you see why Pred is not a Functor?
03:00 <sophiag> mniip: because it sends a to Bool rather than another input?
03:00 <mniip> uhh
03:00 <mniip> no
03:00 <sophiag> lol ok
03:01 <iqubic> ?info do { foo; x <- bar; baz }
03:01 <lambdabot> foo >> bar >>= \ x -> baz
03:01 <iqubic> ?undo do { foo; x <- bar; baz }
03:01 <lambdabot> foo >> bar >>= \ x -> baz
03:02 systadmin joined
03:02 <iqubic> Looks like info gets "corrected" into undo
03:02 <mniip> sophiag, remembering the definition of a functor, it is a mapping of objects (in our case from X to F X), and a mapping of morphisms from (a -> b) to (F a -> F b)
03:02 <mniip> if we substitute F = Pred
03:02 <mniip> we find that such a mapping of morphisms is impossible
03:02 <iqubic> I thought a functor was something that allowed for fmap.
03:02 <halogenandtoast> can you break that down for me?
03:02 <iqubic> :t fmap
03:02 <lambdabot> Functor f => (a -> b) -> f a -> f b
03:02 taksuyu joined
03:02 <sophiag> (a -> Bool) -> (b -> Bool) ?
03:02 spacecadetbrown joined
03:02 <mniip> iqubic, I did not say otherwise
03:03 <mniip> sophiag, (a -> b) -> (a -> Bool) -> (b -> bool)
03:03 <sophiag> right
03:03 <halogenandtoast> I see
03:03 <iqubic> But where do the Bools come from?
03:03 <mniip> sophiag, that function cannot be written in a lawful form
03:03 <iqubic> It can't? Why not?
03:03 <iqubic> What are the fmap laws?
03:03 <mniip> fmap id = id; fmap f . fmap g = fmap (f . g)
03:04 <vaibhavsagar> sophiag, have you seen Fun with Profunctors: https://www.youtube.com/watch?v=OJtGECfksds? I hate that it's 2 hours long but it's a useful 2 hours
03:04 <vaibhavsagar> also hi!
03:04 <iqubic> And you can't write an functor instance for Pred?
03:04 <sophiag> hi vaibhav!
03:04 <mniip> iqubic, yes
03:04 joco42 joined
03:04 <iqubic> Why not?
03:04 <sophiag> you'd need to be able to send Bool -> Bool correct?
03:05 <mniip> iqubic, try it
03:05 <mniip> sophiag, what no
03:05 <iqubic> fmap f p = _
03:05 <uniclown> what are some of the best resources for learning lens?
03:05 <iqubic> I can't do it.
03:05 <mniip> it follows from parametrism, the free theorem
03:05 <mniip> the only two fmaps you can write are
03:05 <mniip> fmap _ _ _ = True
03:06 <mniip> fmap _ _ _ = False
03:06 <mniip> and neither of them is lawful
03:06 <iqubic> Why not?
03:06 jedws joined
03:06 <iqubic> Why aren't they lawful?
03:06 <sophiag> yeah, i'm struggling with the same question tbh
03:06 <mniip> fmap id /= id
03:06 <halogenandtoast> if Pred a is Pred (a -> Bool) if we plug that into fmap (a -> b) -> f a -> f b is a here actually (a -> Bool)?
03:07 <c_wraith> Due to parametricity, fmap id = id is the only lens law you need to check.
03:07 <halogenandtoast> and f Pred
03:07 <c_wraith> and surprisinly, people forget it all the time
03:07 <mniip> halogenandtoast, we're using Pred in place of f
03:07 <mniip> that's the whole point
03:08 <halogenandtoast> so for f to remain pred, b has to be (b -> Bool) ?
03:08 <mniip> sophiag, if something was not clear on the way here it's best to ask
03:08 <sophiag> i'm still squinting at it
03:08 <iqubic> If Pred is not a functor, how come State gets to be a functor. It's type signature is even more complex
03:08 <sophiag> through reduction, you do end up just sending Bool to Bool, yes?
03:08 <halogenandtoast> ((a -> Bool) -> (b -> Bool))
03:09 <sophiag> ^ that
03:09 <sophiag> it's pretty clear to me how that's not id
03:09 <iqubic> Yeah, alright I get it.
03:09 <mniip> sophiag, no?
03:09 <sophiag> yes
03:09 <Gurkenglas> sophiag, no
03:09 <sophiag> oh
03:09 <mniip> it could be an id
03:10 <sophiag> it *could*
03:10 <mniip> if we had id :: b -> a
03:10 <sophiag> but not necessarily, which i assumed is what we're looking for
03:10 <mniip> ugh
03:10 <mniip> this is getting confusing
03:10 <EvanR> id :: b -> a, somethings not right here...
03:10 <sophiag> no, i understand
03:10 <Gurkenglas> halogenandtoast, "data Pred a = Pred (a -> Bool)" means that values of type Pred a are constructed by applying the constructor Pred to a value of type (a -> Bool), not that a means (a -> Bool)
03:10 <iqubic> Now, here's a tangent: What's the best way to make a pretty printer for a custom data type.
03:10 <sophiag> it only follow the functor laws if id :: b -> a
03:10 <mniip> EvanR, I'm implying a constraint on a and b
03:11 <Gurkenglas> halogenandtoast, it does mean that you can see "Pred a" as "a -> Bool" modulo wrapping.
03:11 <sophiag> i'm saying that *if* is not good enough
03:11 <EvanR> iqubic: dont and use Generic pretty printer instaed
03:11 umib0zu left
03:11 <EvanR> and certainly dont use Show
03:11 cpup joined
03:11 <Gurkenglas> halogenandtoast, f is indeed Pred, so modulo wrapping you can see fmap as "(a -> b) -> ((a -> Bool) -> (b -> Bool))"
03:11 <mniip> thanks Gurkenglas
03:11 <mniip> I was lost in trying to make sense of it
03:12 <* halogenandtoast> needs to look up module wrapping
03:12 <halogenandtoast> modulo
03:12 augur joined
03:12 <sophiag> mniip: am i correct in that the necessity of the constraint id :: b -> a is what makes it not a functor?
03:12 <sophiag> because with that, it seems to follow the laws
03:12 <mniip> forget id :: b -> a
03:12 <mniip> I didn't express myself clearly
03:12 Reshi joined
03:13 <sophiag> sure
03:13 <iqubic> How does one create a new stack project?
03:13 <halogenandtoast> iqubic: stack new projectName templateName
03:13 <mniip> sophiag, if we have fmap :: (a -> b) -> Pred a -> Pred b
03:13 <mniip> it naturally follows that we have to have
03:14 <mniip> fmap f (Pred p) = Pred (\x -> ...)
03:14 <Gurkenglas> halogenandtoast, "modulo" can be roughly translated as "up to". "You can see A as B modulo wrapping" means that you need only do wrapping/unwrapping operations to convert between A and B. In this case, those are Pred, which turns (a -> Bool) into Pred a, and its inverse, which turns Pred a into (a -> Bool).
03:14 Wamanuz joined
03:14 <mniip> now, f :: a -> b, p :: a -> Bool x :: b
03:14 <mniip> you cannot do *anything* with these
03:14 <mniip> so the only thing you can plug for '...'
03:14 <mniip> is a literal True, or False
03:14 <mniip> fmap f (Pred p) = Pred (\x -> False)
03:14 <sophiag> ah right
03:15 <mniip> does not make a lawful fmap
03:15 <mniip> fmap id != id
03:15 <mniip> because
03:15 <mniip> fmap id = \(Pred p) -> Pred (\x -> False)
03:15 <mniip> fmap id (Pred (\x -> True)) = Pred (\x -> False)
03:16 <sophiag> ah ok. hence wy you even used this example
03:16 <mniip> != id (Pred (\x -> True))
03:16 cschneid_ joined
03:16 <mniip> if you didn't realize, when we say 'fmap id = id'
03:16 <mniip> we mean 'fmap (\x -> x) = \y -> y'
03:16 dfeuer joined
03:17 <mniip> anyway
03:17 <mniip> Pred is not a Functor
03:17 <mniip> that is, it's not a functor from Hask to Hask
03:17 <sophiag> ah, so it's not that a would have to equal b, but that just with a it would have to be literally True or False
03:18 <mniip> haskell's Functor (capital F) denotes a functor (mathematical) from Hask to Hask
03:18 <sophiag> but we can still compose it by pulling out the a, which requires a functor that's contravariant on the first argument
03:19 <sophiag> yup, i know functor here == endofunctor
03:19 <sophiag> ah, wait that does mean a lot in this case
03:19 <sophiag> because Hask^op -> Hask is not an endofunctor
03:19 <mniip> haskell's Contravariant denotes a contravariant functor from Hask to Hask
03:19 <halogenandtoast> What does the notation Hask^op mean?
03:19 <mniip> which is, by mathematical definition, a functor from Hask^op to Hask
03:20 <sophiag> it's starting to come together for me...
03:20 <mniip> halogenandtoast, C^op = C with arrows reversed
03:20 <halogenandtoast> Gurkenglas: Thanks for explaining modulo, I could not find such a definition online
03:20 <mniip> sophiag, the 'mapping function' for a functor from Hask^op to Hask
03:20 <mniip> would look like
03:21 <mniip> Op a b -> Pred a -> Pred b
03:21 <mniip> aka
03:21 <sophiag> right
03:21 <mniip> (b -> a) -> Pred a -> Pred b
03:21 <mniip> aka the type of contramap
03:21 <sophiag> but really the core for me is just understanding why Op a b
03:21 taksuyu joined
03:21 <EvanR> still not quote sure what the meaning of arrow reversal is
03:21 <sophiag> which i'm maybe 50% there as far it sticking tomorrow :)
03:21 <EvanR> beyond syntactic style
03:22 <mniip> EvanR, you could write a uniform Functor class for both
03:22 <mniip> see edwardk's Hask or mine
03:22 <sophiag> the best i can express it is you need Op a b just to do anything with a
03:22 <mniip> sophiag, it doesn't have to have a short explanation
03:22 <sophiag> if (a -> b) isn't a functor that is
03:22 <mniip> the explanation I have in my mind is,
03:22 <Cale> When is the Boston Haskell thing taking place this year?
03:22 <sophiag> i'm just trying to think of it in a way it'll stick when i wake up tomorrow...
03:23 <mniip> 1) you can't write a function (a -> b) -> Pred a -> Pred b
03:23 <halogenandtoast> Cale: which Boston Haskell thing, I'd love an excuse to go back to Boston.
03:23 <mniip> 2) it follows from a theorem that because 'v' appears contravariant in the definition of 'Pred v' such a function cannot be written
03:23 sleffy joined
03:23 robotroll joined
03:24 whaletechno joined
03:24 benl23 joined
03:24 <mniip> sophiag, ((->) a) is a valid functor
03:24 <Cale> halogenandtoast: There's usually a very casual "hackathon"
03:24 <mniip> a valid Functor even
03:24 Aleph9 joined
03:25 <sophiag> that makes sense
03:25 gmhafiz_ joined
03:25 <mniip> sophiag, now, about co/contravariance of certain arguments,
03:25 qwertydvorak left
03:25 <mniip> if you look at the pattern above with a->b vs b->a
03:25 saussure joined
03:26 <mniip> we say that 'F abc v xyz' is covariant in 'v' if you can write (v -> w) -> F abc v xyz -> F abc w xyz
03:26 <mniip> and contravariant in 'v' if you can write (w -> v) -> F abc v xyz -> F abc w xyz
03:26 <mniip> for some set of variables abcxyz
03:27 <iqubic> What is the right way to make a pretty printer for a data type?
03:27 <mniip> 'Maybe a' is covariant in 'a'
03:27 <mniip> 'Pred a' is contravariant in 'a'
03:27 <mniip> '(->) a b' is covariant in 'b' and contravariant in 'a'
03:28 <mniip> that's the stuff
03:28 <iqubic> Is there a recommended Pretty Printing library I should use, or now??
03:28 <iqubic> s/now/no/
03:28 meba joined
03:29 <sophiag> mniip: i'm still not sure if it'll stick tomorrow, but makes sense now
03:30 <sophiag> it's quite simple once you clarified the definitions of contravariant and covariant to apply to data types rather than just functions
03:31 <mniip> was a bit of mindfuck for me too when I was exploring CT and saw mentions of 'transformations natural in "a"' too
03:32 <sophiag> right
03:32 <iqubic> So is there no recommended library for making pretty printers?
03:32 <sophiag> it's actually somewhat of an arguement for the clarity of Haskell's syntax for data types vs. MLs
03:33 <Aleph9> Hi, I'm new to haskell and I'm confused by some types. If I use a random librar and I get a RVar [String] type, how do I turn that into [String] again?
03:33 <uniclown> so I'm reading code in a haskell project and it has instance statements without a 'where' and no function definitions. What gives?
03:33 <iqubic> Can I see an example?
03:33 <c_wraith> Aleph9: there are probably some functions in the library that have exactly that type.
03:33 <uniclown> https://github.com/aviaviavi/legion/blob/master/app/Main.hs#L51
03:33 <mniip> uniclown, all function definitions are defaulted
03:34 <iqubic> It just takes exactly the default function definitions and nothing else.
03:34 <Aleph9> c_wraith: thanks, I'll look through the documentation!
03:34 <tfc[m]> hi there, i have the following problem with my cabal file: " conduit-combinators- must match ==1.1.* (latest applicable is 1.1.1)" which i don't understand. isn't 1.1.1 within 1.1.* ?
03:34 <mniip> do note that there might be 0 of them, too
03:34 <* hackage> pub 3.0.0 - Pipe stdin to a redis pub/sub channel https://hackage.haskell.org/package/pub-3.0.0 (ParnellSpringmeyer)
03:34 <mniip> that constitutes "all" as well
03:34 <c_wraith> Aleph9: hmm. There isn't an exact match. You're going to want something like sampleRVar
03:35 gillesmajor joined
03:35 gillesmajor left
03:35 pavonia joined
03:36 <c_wraith> Aleph9: actually, that library looks like a complete pain in the butt for a beginner. Using it will require a lot of knowledge compared to something like the random library
03:36 <iqubic> Why doesn't anyone want to tell me about haskell Pretty Printers?
03:36 <vaibhavsagar> iqubic: what would you like to know?
03:37 <Aleph9> c_wraith: Yeah I already noticed, which one would you recommend if I want to get random samples out of lists?
03:37 <vaibhavsagar> quchen made https://github.com/quchen/prettyprinter recently
03:37 <iqubic> Data Piece = X | O | Blank
03:37 <iqubic> type Board = [[Piece]]
03:37 <vaibhavsagar> like a tic-tac-toe board?
03:38 isenmann joined
03:38 <iqubic> Yeah, I'm making a tic-tac-toe game, and I want to print that out with some pretty lines.
03:38 darjeeling_ joined
03:38 <vaibhavsagar> ahh, my understanding of pretty printers is that they are primarily for text
03:39 Wamanuz joined
03:39 <iqubic> Oh. I guess I could write my own printing function.
03:39 <vaibhavsagar> e.g. source code or columns of text
03:39 <vaibhavsagar> have you had a look at https://hackage.haskell.org/package/brick?
03:39 <vaibhavsagar> it seems pretty cool
03:39 <c_wraith> Aleph9: hmm. That's a good question. Hey, as a related question, do you know how to use IO?
03:39 <Gurkenglas> stack doesn't suppoert ghc 7.8.3? :/ How should I build https://github.com/ekmett/hask ?
03:39 <iqubic> I want have the ability for the board to be whatever size n*m I'd like
03:40 <vaibhavsagar> are you displaying this in a terminal or do you want a GUI toolkit?
03:40 <iqubic> vaibhavsagar: What does Brick do exactly?
03:40 <Aleph9> c_wraith: roughly, I read up on the difference between impure and pure functions and side-effects, is that the problem here too?
03:41 <iqubic> Actually, Brick looks like it'll work quite well for me.
03:41 <vaibhavsagar> iqubic: it's a terminal UI library
03:41 jedws joined
03:41 <c_wraith> Aleph9: sort of. The underlying problem is that true randomness is obviously impure, so random values must be modeled somehow. That's what the RVar type is doing.
03:42 <iqubic> Oh, then I guess that's not what I want then.
03:42 <iqubic> What I want is just a way to print a grid once, then ask for input, then print the new grid.
03:42 <iqubic> It's not too fancy
03:43 <vaibhavsagar> brick should be able to do that
03:43 <Welkin> iqubic: you don't need a pretty printer
03:43 <Welkin> just print your grid one row at a time
03:43 <iqubic> Welkin: I think I'll do just that.
03:43 <iqubic> The thing is: Every other line should be nothing but ---------------------
03:43 <Welkin> it's best to start with the simplest thing that works rather than trying to pull in tons of new libraries
03:44 <iqubic> Yeah, I'll try that and see what I get.
03:44 <Welkin> iqubic: just intersperse your output with that then
03:44 <Welkin> :t intersperse
03:44 <lambdabot> a -> [a] -> [a]
03:44 <iqubic> Right.
03:44 mac10688 joined
03:45 <iqubic> Is there a way to take a list and split into sublists all with length n?
03:45 <iqubic> :t split
03:45 <lambdabot> Splitter a -> [a] -> [[a]]
03:45 <Welkin> :t chunk
03:45 <lambdabot> Int -> [e] -> [[e]]
03:45 <Welkin> from Data.List.Split
03:45 <Welkin> I think
03:46 <ChaiTRex> @hoogle chunk
03:46 <lambdabot> Data.Text.Internal.Lazy chunk :: Text -> Text -> Text
03:46 <lambdabot> Rainbow chunk :: a -> Chunk a
03:46 <lambdabot> Rainbow.Types chunk :: a -> Chunk a
03:46 <iqubic> And the sublists there will Int length long on average.
03:46 <Welkin> :t Data.List.Split.chunk
03:46 <lambdabot> Int -> [e] -> [[e]]
03:46 <Welkin> yes
03:46 <iqubic> Now, how do lines and unlines work?
03:46 red_crow joined
03:46 <Welkin> lines and unlines are very simple
03:46 <Welkin> @src lines
03:46 <lambdabot> Source not found. The more you drive -- the dumber you get.
03:46 <c_wraith> Aleph9: also, that library seems.. broken. I can't figure out how to import half the things the documentation claim are present
03:47 path[l] joined
03:47 <iqubic> :t lines
03:47 <lambdabot> String -> [String]
03:47 <iqubic> :t unlines
03:47 <lambdabot> [String] -> String
03:48 <iqubic> Wait?? lines . unlines = unlines . lines = id
03:48 <Welkin> you can use splitOn from http://hackage.haskell.org/package/split-
03:48 <iqubic> If I understand lines and unlines correctly.
03:48 <Aleph9> c_wraith: had that problem too, it's split between 'random-fu' and 'random-extras' for some reason
03:48 <Welkin> unlines it just `concat`
03:48 <Welkin> is*
03:49 <sophiag> iqubic: just a thought. you know how unix has two newlines? \n and \r? you can use \r to rewrite your tic-tac-toe lines in place to make a cool cli game
03:49 <Welkin> > Data.List.Split.splitOn '\n' "Hello\niqubic"
03:49 <lambdabot> error:
03:49 <lambdabot> • Couldn't match expected type ‘[Char]’ with actual type ‘Char’
03:49 <lambdabot> • In the first argument of ‘splitOn’, namely ‘'\n'’
03:49 <Welkin> > Data.List.Split.splitOn "\n" "Hello\niqubic"
03:49 <lambdabot> ["Hello","iqubic"]
03:49 <Welkin> > concat $ Data.List.Split.splitOn "\n" "Hello\niqubic"
03:49 <lambdabot> "Helloiqubic"
03:49 <Welkin> er
03:50 wroathe joined
03:50 fragamus joined
03:50 <iqubic> What was that supposed to do?
03:50 <Welkin> > cancat . intersperse "\n" $ Data.List.Split.splitOn "\n" "Hello\niqubic"
03:50 <lambdabot> error:
03:50 <lambdabot> • Variable not in scope: cancat :: [[Char]] -> c
03:50 <lambdabot> • Perhaps you meant one of these:
03:50 <Welkin> > concat . intersperse "\n" $ Data.List.Split.splitOn "\n" "Hello\niqubic"
03:50 <Welkin> oh lol
03:50 <lambdabot> "Hello\niqubic"
03:50 <Welkin> it's `id`
03:50 <iqubic> sophiag: What are you suggesting?
03:51 <Welkin> that is equivalent to `lines` and `unlines`
03:51 <iqubic> With Unix having two new lines.
03:51 <ChaiTRex> > lines "a\n\nb"
03:51 <lambdabot> ["a","","b"]
03:51 <c_wraith> Aleph9: still, https://hackage.haskell.org/package/random-fu- lists several methods for eliminating RVar
03:51 <Welkin> > concat . intersperse "\n\n" $ Data.List.Split.splitOn "\n\n" "Hello\n\niqubic"
03:51 <lambdabot> "Hello\n\niqubic"
03:51 <Welkin> > Data.List.Split.splitOn "\n\n" "Hello\n\niqubic"
03:51 <lambdabot> ["Hello","iqubic"]
03:52 <iqubic> Welkin: I get what you are doing there.
03:52 <iqubic> I don't understand why sophiag was mentioning the unix line breaks.
03:52 <mniip> sophiag, you'd need more advanced control sequences than \r
03:53 <mniip> like "up" or "clear line"
03:53 dfranke joined
03:53 <iqubic> I still don't get how \n and \r help me.
03:53 <sophiag> mniip: true. it was an idea tho
03:53 <iqubic> But I think I know what I need to do.
03:53 <c_wraith> Aleph9: which one you use should depend on how you want to deal with randomness. You can use an explicitly constructed PRNG with sampleState, or you can leave the construction details mysterious and use runRVar in IO - but then you need to learn to use IO
03:54 <sophiag> iqubic: \r is how those status bars in your package manager work
03:54 Johan_L joined
03:54 <sophiag> it moves the carriage back to the left side of the screen
03:54 ^bschafer1 joined
03:55 otto_s joined
03:55 <iqubic> Oh, I did not know that.
03:55 <Aleph9> c_wraith: okay, I'll look into both, thanks for the help!
03:55 orhan89 joined
03:55 <iqubic> I thought it was just another form of line break.
03:56 <mniip> sophiag, I would think they use more advanced escape seuqnces
03:56 <Welkin> line-break and carriage-return
03:56 <Welkin> as opposed to newline
03:56 <Welkin> that's only on windows though
03:56 <sophiag> mniip: i'm not certain
03:56 <iqubic> So \n only creates the new line? You need \r to actually get to the start of that new line?
03:57 <Welkin> *nix/bsd uses newline
03:57 <iqubic> I'm running Linux, so I should be fine there.
03:57 <sophiag> iqubic: i was saying you can use it to redraw the current line. but for your purposes it doesn't really make sense
03:57 <sophiag> to create a newline i'd just stick with \n
03:57 <mniip> ooh
03:58 <mniip> wget uses \r indeed
03:58 <sophiag> i was right about something!
03:58 <sophiag> lol
03:58 <sophiag> mniip: did you actually look up the source rn?
03:58 <mniip> no
03:58 <mniip> I hexdumped its output
03:58 <sophiag> ah
03:58 <iqubic> \r makes no sense for me, because my output will be a few lines long for each board
03:58 <Welkin> mniip is russian hacker
03:58 <sophiag> hehe
03:58 <Welkin> he's in your house
03:59 <iqubic> Now, time to try writting this priting function into my code.
03:59 <Welkin> he put virus on your coffee maker
03:59 felixsch_ joined
03:59 <iqubic> But first, how does one work with 2D lists in Haskell.
03:59 <Welkin> iqubic: you don't really
04:00 <Welkin> lists are not a great data structure
04:00 <iqubic> What do you mean?
04:00 <Welkin> lists are usually only used as control structures
04:00 <Welkin> like a loop
04:00 <Welkin> for data, you probably want something else
04:00 <Welkin> like a Map
04:00 <Welkin> or an Array
04:00 red_crow joined
04:00 <iqubic> If I want to store my game state as a 2D data structure, what should I do?
04:01 <Welkin> if you need a 2d data structure, use a 2d array or a map
04:01 <Welkin> you could actually also just use a flat array
04:01 <iqubic> data Piece = X | O | Blank
04:01 <Welkin> like is often done in games written in c
04:01 <iqubic> Welkin: How would a flat array work?
04:01 <Welkin> and just store the row length for processing
04:02 <Welkin> you have an indexing function that is `mod` the row length
04:02 <mniip> Welkin, why if you could use a 2D array
04:02 <iqubic> Welkin: That's a wonderful idea.
04:02 <glguy> If you're going to do something like that, then it's worth using the array package
04:02 <iqubic> How does the array package work?
04:02 <glguy> That's what it does, plus it handles using more interesting indexes, like tuples
04:02 <mniip> and I'm talking about Ix (,) here
04:03 MJ joined
04:03 <iqubic> How do you use a tuple as an index?
04:05 wroathe joined
04:06 augur_ joined
04:06 <iqubic> I've only ever seen natural numbers as indexes
04:06 <iqubic> so things in the set [0..]
04:07 <iqubic> well, I mean [0,1..]
04:08 <mniip> > range (3, 5)
04:08 <lambdabot> [3,4,5]
04:08 <iqubic> Oh.
04:08 <mniip> > range ((3, 2), (5, 4))
04:08 <lambdabot> [(3,2),(3,3),(3,4),(4,2),(4,3),(4,4),(5,2),(5,3),(5,4)]
04:08 <iqubic> :t range
04:08 <lambdabot> Ix a => (a, a) -> [a]
04:09 davr0s joined
04:09 primal joined
04:09 <iqubic> > range a z
04:09 <lambdabot> error:
04:09 <lambdabot> • Couldn't match expected type ‘Expr -> t’ with actual type ‘[a0]’
04:09 <lambdabot> • The function ‘range’ is applied to two arguments,
04:09 <iqubic> > range ('a', 'z')
04:09 <lambdabot> "abcdefghijklmnopqrstuvwxyz"
04:09 <EvanR> > ['a'..'z']
04:09 <lambdabot> "abcdefghijklmnopqrstuvwxyz"
04:10 romank joined
04:10 <iqubic> > [(3, 2).. (5, 4)]
04:10 <lambdabot> error:
04:10 <lambdabot> • Ambiguous type variable ‘t1’ arising from a use of ‘show_M829322929335...
04:10 <lambdabot> prevents the constraint ‘(Show t1)’ from being solved.
04:10 <iqubic> Darn, I thought that was a short hand for range. Darn
04:11 <EvanR> nope
04:11 <EvanR> its shorthand for fromEnumTo
04:11 filterfish joined
04:11 sleffy joined
04:11 <iqubic> oh
04:11 wei2912 joined
04:11 <EvanR> er
04:11 <iqubic> :t fromEnumTo
04:11 <lambdabot> error:
04:11 <lambdabot> • Variable not in scope: fromEnumTo
04:11 <lambdabot> • Perhaps you meant ‘fromEnum’ (imported from Prelude)
04:11 <iqubic> :t fromEnum
04:11 <lambdabot> Enum a => a -> Int
04:11 <tromp> > range ("aa","bb")
04:11 <lambdabot> error:
04:11 <lambdabot> • No instance for (Ix [Char]) arising from a use of ‘range’
04:11 <lambdabot> • In the expression: range ("aa", "bb")
04:11 <mnoonan> :t enumFromTo
04:11 <lambdabot> Enum a => a -> a -> [a]
04:12 <iqubic> tromp: Looks like there is no instance of Ix String
04:12 <mniip> such an instance wouldn't be useful
04:12 michal_kubenka joined
04:13 <EvanR> Ix is for types suitable for use an indexes, i.e. they could be mapped into a consecutive numeric order
04:13 <iqubic> Because how do you determine the next string in line?
04:13 <EvanR> similar to Enum actually
04:13 wroathe joined
04:13 <mniip> Enum is about next/pred
04:14 <mniip> Ix is more about range operations
04:14 <mniip> 'increment by n', 'distance between', etc
04:14 <EvanR> not sure i see a structural diff
04:14 <iqubic> Even just using only the letter 'a' I can create a countable infinite number of unique strings.
04:14 Bin4ry joined
04:15 <iqubic> There's now way to order all the possible strings.
04:15 <EvanR> now ... see here
04:15 <EvanR> Integer is countable and ordered
04:15 <iqubic> or now way that would let you write a suitable Ix instance for String
04:16 <EvanR> using only the letter 'a' and 'b', now you have a problem (if you allow infinite)
04:16 saussure joined
04:17 eklavya joined
04:17 bd_ joined
04:18 <mniip> but there is
04:18 <mniip> count in base 0x110000
04:18 <iqubic> Why are we talking about Ix? How does that help me represent moves on a TicTacToe board?
04:18 <EvanR> i know how
04:19 <EvanR> first represent a board position
04:19 <iqubic> Wait, if we use n symbols, we just need to count in base n to get all the possible strings that can be made from those characters
04:19 <EvanR> then two positions amounts to a move
04:19 primal_ joined
04:20 P1RATEZ joined
04:20 svgDelux joined
04:20 <iqubic> EvanR: What I mean was "How do I represent a board position?"
04:20 louispan joined
04:20 <iqubic> I typed the wrong thing
04:20 <EvanR> an array
04:20 <iqubic> 2D or no?
04:20 <iqubic> And why not a list?
04:20 <EvanR> sure
04:20 <EvanR> practically dunno
04:21 <EvanR> theoretically its an array
04:21 <iqubic> I'll use an array.
04:21 <iqubic> :t (!!)
04:21 <lambdabot> [a] -> Int -> a
04:21 <EvanR> :t (!)
04:21 <lambdabot> Ix i => Array i e -> i -> e
04:22 takle joined
04:22 <iqubic> But that let's you use things like (2, 3) as the retrieval index
04:22 <iqubic> How does that work.
04:22 <iqubic> I don't understand Haskell arrays.
04:22 <EvanR> pair of indexes has an Ix instance
04:22 <Eduard_Munteanu> Have a look at Ix.
04:23 <Eduard_Munteanu> @src Ix
04:23 <lambdabot> class (Ord a) => Ix a where
04:23 <lambdabot> range :: (a, a) -> [a]
04:23 <lambdabot> index :: (a, a) -> a -> Int
04:23 <lambdabot> inRange :: (a, a) -> a -> Bool
04:23 <lambdabot> rangeSize :: (a, a) -> Int
04:23 <iqubic> I keep trying to relate Haskell Arrays to Java Arrays, and I can't do that. They're too different
04:23 <iqubic> :t range
04:23 <lambdabot> Ix a => (a, a) -> [a]
04:23 <mniip> that is correct
04:24 <Eduard_Munteanu> > index ((0,0), (7,7)) (2, 3)
04:24 <lambdabot> error:
04:24 <lambdabot> Ambiguous occurrence ‘index’
04:24 <lambdabot> It could refer to either ‘Control.Lens.index’,
04:24 <mniip> java arrays just like C are only indexable by int
04:24 MJ_ joined
04:24 <Eduard_Munteanu> > Data.Array.Ix.index ((0,0), (7,7)) (2, 3)
04:24 <lambdabot> error:
04:24 <lambdabot> Not in scope: ‘Data.Array.Ix.index’
04:24 <lambdabot> Perhaps you meant ‘Data.Array.index’ (imported from Data.Array)
04:24 <Eduard_Munteanu> > Data.Array.Index.index ((0,0), (7,7)) (2, 3)
04:24 <lambdabot> error:
04:24 <lambdabot> Not in scope: ‘Data.Array.Index.index’
04:24 <lambdabot> Perhaps you meant ‘Data.Array.index’ (imported from Data.Array)
04:24 <Eduard_Munteanu> > Data.Array.index ((0,0), (7,7)) (2, 3)
04:24 <lambdabot> 19
04:25 <iqubic> But Haskell Arrays are indexed by anything that has an Ix instance.
04:25 <mniip> yes
04:25 <iqubic> Also Eduard_Munteanu, that example seems to have returned 0 + 0 + 7 + 7 + 2 + 3
04:25 saussure joined
04:26 <EvanR> doesnt it have to match the kind of index you made the array with
04:26 <Eduard_Munteanu> That's because Ix can translate to Int indexes.
04:26 <mniip> EvanR, yes, it's a type param
04:26 <iqubic> Ix is powerful.
04:26 <mniip> Eduard_Munteanu, no
04:26 <mniip> it can translate to Int offsets
04:27 <iqubic> Does anyone have a tutorial for Ix and Arrays, or shall I browse the Hackage documentation for a while?
04:27 <EvanR> try stuff in ghci
04:27 <EvanR> use the types
04:27 <iqubic> That's a good idea.
04:28 brynedwards joined
04:29 primal joined
04:29 wroathe joined
04:30 <Koterpillar> > Data.Array.index ((0, 0) (100, 100)) (2, 3)
04:30 <lambdabot> error:
04:30 <lambdabot> • Couldn't match expected type ‘(Integer, Integer)
04:30 <lambdabot> -> ((Integer, Integer), (Integer, Intege...
04:30 <Koterpillar> ah, ignore me
04:31 kmels joined
04:31 piyush-kurur joined
04:33 <iqubic> Data.Array.index ((0, 0), (100, 100)) (2, 3)
04:33 <iqubic> > Data.Array.index ((0, 0), (100, 100)) (2, 3)
04:33 <lambdabot> 205
04:33 <iqubic> Missed a comma Koterpillar
04:34 <Koterpillar> > Data.Array.index ((0, 0), (10, 100)) (2, 3)
04:34 <lambdabot> 205
04:35 path[l] joined
04:36 <Koterpillar> it's all an off-by-one
04:37 <Koterpillar> > Data.Array.index ((0, 0, 0) (99, 99, 99)) (1, 2, 3)
04:37 <lambdabot> error:
04:37 <lambdabot> • Couldn't match expected type ‘(Integer, Integer, Integer)
04:37 <lambdabot> -> ((Integer, Integer, Integer), (Intege...
04:37 <Koterpillar> > Data.Array.index ((0, 0, 0), (99, 99, 99)) (1, 2, 3)
04:37 <lambdabot> 10203
04:37 <Koterpillar> okay, that's it, sorry for the spam
04:37 justanotheruser joined
04:38 <iqubic> I officially have no idea what index for tuples is actually doing.
04:38 <EvanR> you could also do (1,1) (100,100)
04:38 <EvanR> and be cool like lua
04:39 primal_ joined
04:39 <iqubic> Or have a pre-proccessing flag you can set to tell the compiler whether to start indexing at 0 or 1.
04:39 <iqubic> That's what visual basic does.
04:40 <mniip> or let both min and max index be variable just like pascal
04:40 <iqubic> Literally, in the header every VBasic file you say what number, 0 or 1, that file's arrays are index in
04:40 <mniip> oh wait that's what it does
04:40 augur joined
04:43 <Koterpillar> iqubic: it's mapping them onto a continuous range that starts from 0
04:43 <Koterpillar> > map (Data.Array.index ((0, 0, 0), (99, 99, 99))) [(0, 0, 0), (0, 0, 1), (0, 0, 2), (99, 99, 99)]
04:43 <lambdabot> [0,1,2,999999]
04:43 saussure joined
04:44 govg joined
04:45 wroathe joined
04:45 martingale joined
04:47 eklavya_ joined
04:47 <et09> why is the kind of [] * -> *
04:48 <iqubic> I think [] is a bit like ()
04:48 <pacak> et09: It takes a type to make a type
04:48 <EvanR> not even close
04:48 <iqubic> Not sure that's the best comparison to draw
04:49 primal joined
04:49 <et09> oh.
04:49 <pacak> et09: What is kind of Maybe?
04:49 <et09> same right
04:49 <pacak> Same
04:49 <iqubic> :k Maybe
04:49 <lambdabot> * -> *
04:49 <et09> i need to take a break after that one lol
04:50 sssilver joined
04:50 <iqubic> Just a takes an a and makes a maybe
04:50 <pacak> :k ([])
04:50 <lambdabot> * -> *
04:50 <pacak> :k ([]) Int
04:50 <lambdabot> *
04:50 <pacak> :k Maybe
04:50 <lambdabot> * -> *
04:50 <pacak> :k Maybe In
04:50 <lambdabot> error:
04:50 <lambdabot> • Expecting one more argument to ‘'In’
04:50 <lambdabot> Expected a type, but ‘'In’ has kind ‘f0 (Mu f0) -> Mu f0’
04:50 <pacak> :k Maybe Int
04:50 <lambdabot> *
04:50 <iqubic> if a function expects Maybe a, and you give it Nothing, it's still happy
04:50 <MarcelineVQ> pacak: why the parens?
04:50 <iqubic> :k Nothing
04:50 <lambdabot> Maybe a
04:50 <pacak> :k [] Int
04:50 <lambdabot> *
04:51 <iqubic> :k []
04:51 <lambdabot> * -> *
04:51 <pacak> MarcelineVQ: I expected it to complain, I guess [] is a bit more magical than I expected.
04:52 <iqubic> et09: [a] is to Just a as [] is to Nothing
04:52 <MarcelineVQ> fair enough, list and tuple can be a little strange somtimes syntax-wise
04:52 <mniip> iqubic, completely irrelevant here
04:52 romank joined
04:52 <pacak> iqubic: There's a difference between value level and type level.
04:52 <iqubic> really?
04:52 jedws joined
04:52 <iqubic> what the HECK is a value level?
04:52 <pacak> Kinds are things from type level.
04:53 <mniip> [3] is a value
04:53 <pacak> iqubic: 3.1415, Nothing, "hello world".
04:53 <mniip> [Int] is a type
04:53 <et09> isn't it value level, type level, kind level? (just thinking out loud)
04:53 <mniip> et09, fsvo haskell, yes
04:53 <et09> like in calculus you have the derivative and integral going up and down
04:53 <mniip> recently we've got type ~ kind
04:54 <* pacak> wants dependent types
04:54 <* iqubic> has never fully understood kinds in Haskell
04:54 <mniip> iqubic, have you understood types?
04:54 <iqubic> Yeah.
04:54 <iqubic> I understand types
04:54 <iqubic> And data too.
04:54 <MarcelineVQ> pacak: you can get pretty far with singletons currently, unwieildy as they can be
04:55 <EvanR> iqubic: have you ever seen a type signature like Maybe (->) -> Char
04:55 <pacak> MarcelineVQ: Yea, but I've been playing around with idris recently...
04:55 <iqubic> no. never.
04:55 louispan joined
04:55 <EvanR> because it makes no sense
04:55 <mniip> that's because it doesn't kindcheck
04:55 <EvanR> why? because kinds
04:55 <iqubic> not sure what that type signature even means
04:55 <EvanR> it means nothing, its invalid
04:55 <iqubic> oh.
04:55 <EvanR> Maybe takes a type of kind *
04:55 <EvanR> :k (->)
04:55 <MarcelineVQ> pacak: the sun is rising on dependent haskell, long may the night be
04:55 <lambdabot> * -> * -> *
04:55 <EvanR> not that
04:56 <mniip> dependent types aren't a remedy for everything mind
04:56 <mniip> say,
04:56 <pacak> mniip: Nothing is :)
04:56 <mniip> what's the type of \f g x -> f (g x)
04:56 rdes joined
04:57 <pacak> (b -> a) -> (c -> b) -> c -> a
04:57 augur joined
04:58 <pacak> Something like this I suppose
04:58 <EvanR> bzz you didnt put a type signature so we dont know!
04:58 <mniip> pacak, I concur
04:58 <mniip> I think it's
04:58 <mniip> forall (a :: *) (b :: a -> *) (c :: forall (x :: a) -> b x -> *). pi (f :: forall (x :: a). pi (y :: b x) -> c x y) (g :: pi (x :: a) -> b x) (x :: a) -> c x (g x)
04:58 <EvanR> oh god
04:59 <mniip> you can't prove me wrong because it does typecheck
05:00 <mniip> in fact my type is more general than yours
05:00 wroathe joined
05:01 juanpaucar joined
05:01 <mniip> if you type-apply b=\_->p and c=\_ _->q
05:01 <mniip> you get (p -> q) -> (a -> p) -> a -> q
05:02 <iqubic> What the heck is a dependent type?
05:02 <MarcelineVQ> iqubic: when the type of something depends on a term/value
05:02 <mniip> iqubic, types that depend on values
05:02 <iqubic> How does that work?
05:02 <iqubic> That makes no sense
05:03 <pacak> iqubic: It does in idris.
05:03 <mniip> foo :: (x :: Bool) -> (if x then Int else Char)
05:03 <mniip> foo True = 3
05:03 <mniip> foo False = 'x'
05:04 <pacak> s/::/:/
05:04 louispan joined
05:04 <iqubic> I don't understand
05:05 <EvanR> iqubic: rather than a type "depending" on a value... think of it as a family types indexed by (the values of) some other type
05:05 Koterpillar joined
05:05 joco42 joined
05:05 <EvanR> so theres a Vect 0 Char, Vect 1 Char, Vect 2, Char, etc
05:05 romank joined
05:05 <EvanR> Vect 2 Char, etc, for fixed length lists
05:05 systadmin joined
05:06 Guest40 joined
05:06 <EvanR> these are all different types
05:06 seangrove joined
05:07 <EvanR> the "cool" part here is (++) :: Vect m a -> Vect n a -> Vect (m + n) a
05:07 <EvanR> value level computation at the type leve
05:08 takle joined
05:09 saussure joined
05:10 <pacak> and this + is regular + you can use for adding values, not some trickery you have to do in haskell.
05:10 {emptyset} joined
05:10 dec0n joined
05:10 romank joined
05:11 meandi_2 joined
05:11 <MarcelineVQ> pacak: that is haskell :>
05:11 <u-ou> so we are expressing types with values?
05:11 <u-ou> Integer is a family of types?
05:12 <EvanR> indexing types by values
05:12 <EvanR> Integer is a single type
05:12 vlatkoB joined
05:12 <u-ou> ok
05:12 <EvanR> m and n would be some kind of natural number type
05:13 <EvanR> elements of such a type*
05:13 <EvanR> Vect :: Nat -> Type -> Type
05:14 <EvanR> let your mind thusly be blown
05:14 <u-ou> what is Type
05:14 augur_ joined
05:14 <EvanR> the type of types
05:14 <EvanR> Char :: Type
05:14 <u-ou> :D
05:15 <EvanR> youve always seen it written * in haskell
05:16 wowowoow joined
05:16 <u-ou> wait, so there are types at the value level as well?
05:16 <EvanR> no
05:16 wroathe joined
05:16 <EvanR> or yes, you can manipulate types like values
05:16 <EvanR> [Char, Int, Bool] is a [Type]
05:17 <EvanR> we already have that in haskell with datakinds
05:17 <u-ou> can you return Char
05:17 <EvanR> sure
05:17 <EvanR> from a [Type] -> Type
05:18 saussure joined
05:18 <EvanR> i think this last example would be on something like 3rd higher type universe...
05:19 <EvanR> if haskell didnt smush them all into one
05:19 anodium joined
05:20 yellowj joined
05:22 <EvanR> u-ou: you can also get the effect of "returning Char" with type families... an existing technology
05:26 JoshS joined
05:26 <iqubic> Question: Is there a funtion
05:27 rdes left
05:27 <iqubic> Is there a function with type: [a] -> a -> [a], that acts like intersperse?
05:27 <iqubic> :t intersperse
05:28 <lambdabot> a -> [a] -> [a]
05:28 <EvanR> flip intersperse?
05:28 <MarcelineVQ> :t flip intersperse
05:28 <lambdabot> [a] -> a -> [a]
05:28 <iqubic> Yeah, that.
05:28 <iqubic> LOL
05:28 <iqubic> I though intersperse was only for strings.
05:28 <iqubic> Still not use to Haskell using String and [Char] interchangable.
05:29 <EvanR> @src String
05:29 <lambdabot> type String = [Char]
05:29 <thang1> My deep agony: I want to apply for real jobs and do all this cool stuffbut the only reason I'm in school in the first place is so that I can get a PhD in order to do what I really wanna do... *sigh*
05:29 sssilver joined
05:29 <iqubic> let me guess: flip f x y = f y x
05:29 <thang1> iqubic: Why isn't that sorta normal? A lot of languages treat strings as "lists"/arrays of characters
05:29 <Axman6> yep
05:29 <iqubic> Is that how that works?
05:29 <Axman6> @src flip
05:29 <lambdabot> flip f x y = f y x
05:30 <iqubic> thang1: I don't think Java treats Strings as an array of chars.
05:30 <iqubic> Not sure though
05:30 <thang1> technically they're separate, but you can willy nilly cast in between representations
05:30 <iqubic> Time to spend a few hours learning about profunctors now.
05:31 <thang1> myStr.toCharArray(); myChrArray.toString(); etc
05:31 <EvanR> what are strings really, what are arrays really
05:31 jbiesnecker joined
05:31 <iqubic> using this video: https://www.youtube.com/watch?v=OJtGECfksds
05:31 wroathe joined
05:32 texasmynsted joined
05:32 <MarcelineVQ> idk if profunctors is time well spent when just starting out, not that I speak from experience
05:33 <EvanR> to get profunctors, i think you need to get contrafunctors
05:34 <thang1> I'm lucky if I get what a functor is :p
05:34 <thang1> But yeah, idk if a 2 hour lecture is a good use of time without a lot of background knowledge...
05:34 Rakkattakka joined
05:35 mstruebing joined
05:35 <thang1> Specifically since that particular talk assumes a knowledge and understanding of Van Laarhoven lenses
05:35 <piyush-kurur> hvr: ping
05:35 <hvr> piyush-kurur: pong
05:36 saussure joined
05:36 <piyush-kurur> hvr: do you have z3 in any of your ppa so that I can use it with travis
05:36 <piyush-kurur> I am trying out liquid haskell. It looks like the ubuntu image on travis does not have any of the solvers needed
05:37 <* hackage> qr-imager - Library to generate QR codes from bytestrings and objects https://hackage.haskell.org/package/qr-imager- (vmchale)
05:37 <hvr> piyush-kurur: as it happens, I have: https://launchpad.net/~hvr/+archive/ubuntu/z3
05:37 <piyush-kurur> hvr: you are awesome. Can I use this with travis in the sudo:false mode
05:38 <piyush-kurur> They (travis) seem to have a huge bureaucracy for authenticating ppas
05:38 <hvr> piyush-kurur: not sure... you may have to try
05:38 <piyush-kurur> thanks any way
05:38 primal_ joined
05:38 ccomb joined
05:39 <Lokathor> @pl \s1 s2 -> fmap (either die return) (programFromSources s1 s2)
05:39 <lambdabot> (fmap (either die return) .) . programFromSources
05:39 takle joined
05:39 <cocreature> hvr: that package is quite old, 4.5 was released sometime last year
05:40 <EvanR> Lokathor: .: again
05:41 <MarcelineVQ> I kinda like pointful but infixed either die return <$> programFromSources s1 s2
05:41 mbuf joined
05:41 <thang1> Realtalk: Does anyone find (fmap (either die return) .) . programFromSources more readable than the other one?
05:41 <Lokathor> MarcelineVQ, that's actually what i just juggled it around to
05:41 <thang1> because that looks like incomprehensible gibberish to me
05:41 <Lokathor> EvanR, what?
05:41 <MarcelineVQ> thang1: I'm fine with (foo .) . bar but not a single thing more
05:42 <EvanR> i dont recommend the pointless here but its fmap (either die return) .: programFromSources
05:42 <MarcelineVQ> (foo blah .) . bar is too much for example
05:42 <Lokathor> let compileOrDie = \s1 s2 -> either die return <$> programFromSources s1 s2
05:42 <Lokathor> i think i'll settle on that
05:43 <MarcelineVQ> oh hmm, might prefer functions in where so they're easy to move out when needed
05:43 <thang1> what does "(foo .) . bar" do anyway? I have trouble mentally parsing the ( .) part
05:43 <EvanR> (f .) . g is something that if not stopped will become laughing stock of people looking at haskell people in 2040. alternatively everything will think thats normal in 2040
05:43 <EvanR> everyone*
05:43 <thang1> MarcelineVQ: might as well worry about that later, I guess. Refactoring in haskell is painless compared to other languages so why worry about pulling out functions until you know what you'll need?
05:44 <MarcelineVQ> put as informally and awfully as possible, give bar an argument and compose the partially applied bar with foo to expect another argument
05:44 <Lokathor> thang1, "painless"
05:45 <EvanR> it lets you rewrite \x y -> f (g x y) as (f .) . g, or with cool operators f .: g
05:45 <MarcelineVQ> EvanR: in 2040 machines will write the haskell for you
05:45 <EvanR> ... right
05:45 <EvanR> that was supposed to be happening in 1999
05:45 <Lokathor> I think the Culture decided not to contact Earth in book 4, so we're gonna be stuck here a while
05:45 <cocreature> just replace "(f .) . g" by "fmap fmap fmap f g"
05:45 <Lokathor> writing all our own code
05:45 saussure joined
05:46 <thang1> cocreature: MarcelineVQ that actually helped... somehow
05:46 <EvanR> \x y z -> f (g x y z) can be f .:: g
05:46 eklavya joined
05:46 ThomasLocke joined
05:46 <EvanR> let (.::) = (.) . (.) . (.)
05:47 <EvanR> :t (.::)
05:47 <lambdabot> error: Variable not in scope: .::
05:47 <EvanR> > let (.::) = (.) . (.) . (.)
05:47 <EvanR> :t (.::)
05:47 <lambdabot> <no location info>: error:
05:47 <lambdabot> not an expression: ‘let (.::) = (.) . (.) . (.)’
05:47 <lambdabot> error: Variable not in scope: .::
05:47 wroathe joined
05:47 <EvanR> nevermind
05:47 <thang1> lol
05:47 <thang1> :t (.:)
05:47 <lambdabot> error:
05:47 <lambdabot> • Variable not in scope: .:
05:47 <lambdabot> • Perhaps you meant one of these:
05:47 <EvanR> @let (.:) = (.) . (.)
05:47 <MarcelineVQ> it's a mad house
05:47 <lambdabot> Defined.
05:47 <EvanR> :t (.:)
05:47 <lambdabot> (b -> c) -> (a1 -> a -> b) -> a1 -> a -> c
05:48 <thang1> @let (.::) = (.) . (.) . (.)
05:48 <lambdabot> Defined.
05:48 <thang1> :t (.::)
05:48 <lambdabot> (b -> c) -> (a2 -> a1 -> a -> b) -> a2 -> a1 -> a -> c
05:48 <EvanR> all is clear now
05:48 <thang1> ಠ_ಠ a quote about the atomic bomb comes to mind
05:48 <mniip> :t fmap (fmap fmap fmap) (fmap fmap fmap)
05:48 <lambdabot> (Functor f, Functor f1, Functor f2, Functor f3) => (a -> b) -> f3 (f2 (f1 (f a))) -> f3 (f2 (f1 (f b)))
05:48 <EvanR> its functors all the way down
05:49 <thang1> yo dawg, I heard you like to fmap, so I wrote an fmap on your fmap so you can fmap fmap fmap fmap
05:49 eklavya__ joined
05:49 <EvanR> fmap seems to be unable to be wrong
05:49 <EvanR> > fmap `fmap` fmap (fmap fmap)
05:49 <lambdabot> error:
05:49 <lambdabot> • No instance for (Typeable f1)
05:49 <lambdabot> arising from a use of ‘show_M608337224326317572723778’
05:49 <EvanR> :t fmap `fmap` fmap (fmap fmap)
05:49 <lambdabot> (Functor f, Functor f2, Functor f1) => (a1 -> f2 (a -> b)) -> f1 a1 -> f1 (f2 (f a -> f b))
05:49 <thang1> lol wtf is that show instance
05:50 <thang1> show_M6083372.... how does it come up with that?
05:50 <MarcelineVQ> lambdabot doing the best it can with awful humans
05:50 <cocreature> I’m kind of annoyed that "fmap fmap fmap fmap fmap" is not "(.) . (.) . (.)"
05:50 ErinvanderVeen joined
05:50 <mniip> mueval generates some idetifiers
05:50 takle joined
05:50 <EvanR> :t (fmap fmap) fmap (fmap fmap)
05:50 <lambdabot> (Functor f, Functor f1, Functor f2, Functor f3) => f3 (f2 (f1 (a -> b))) -> f3 (f2 (f1 (f a -> f b)))
05:50 <EvanR> i dont even care anymore...
05:51 <cocreature> :t fmap `fmap` fmap `fmap` fmap
05:51 <lambdabot> (Functor f, Functor f1, Functor f2) => (a -> b) -> f2 (f1 (f a)) -> f2 (f1 (f b))
05:51 <Lokathor> oh look at that
05:52 <Lokathor> by just using fromJust <$> i can eliminate two levels of indentation
05:52 <mniip> I wonder what is the most compact expression
05:52 <EvanR> isnt that just three fmaps?
05:52 <Lokathor> C in any language folks!
05:52 <thang1> fromJust? ಠ_ಠ
05:52 <EvanR> dont ask
05:52 <MarcelineVQ> > fromJust Nothing
05:52 <thang1> I know what it is, I'm just amused why he needs it :p
05:52 <lambdabot> *Exception: Maybe.fromJust: Nothing
05:52 <EvanR> thats what i was saying
05:53 <Lokathor> thang1, because GLFW might fail to create a window when you ask it to. And if it does, the program is useless anyway, so might as well use fromJust <$> on that
05:53 <EvanR> ;_;
05:53 <MarcelineVQ> :<
05:53 <thang1> The only legit reason I've seen to use fromJust so far is I'm going through the Haskell Book and it assumes an unsafe Head function and I'm using the total functions from the protolude
05:53 <cocreature> who needs fromJust if you can just use unsafeCoerce to get a function Maybe a -> a
05:53 rdivyanshu joined
05:53 <thang1> ^
05:53 <EvanR> thang1: you used safeFromJust ?
05:54 <thang1> Lokathor: you hurt my soul. Why even have a maybe in there if you don't care about the "nothing" value?
05:54 <mniip> @let safeFromJust = maybe Just Nothing
05:54 <lambdabot> .L.hs:162:27: error:
05:54 <lambdabot> • Couldn't match expected type ‘a1 -> a -> Maybe a’
05:54 <lambdabot> with actual type ‘Maybe a0’
05:54 <mniip> @let safeFromJust = maybe Nothing Just
05:54 <lambdabot> Defined.
05:54 <thang1> oooh
05:54 tromp joined
05:54 <cocreature> thang1: sometimes you are using a library where you know that if you pass it certain inputs you’ll always get a Just back. in that case fromJust is fine
05:54 <liste> :t safeFromJust
05:54 <EvanR> Lokathor: probably better to print out GLFW's error message then throw an IO error
05:54 <lambdabot> Maybe a -> Maybe a
05:55 <Lokathor> thang1, it is the completely correct decision for the bindings authors to have the return type be Maybe Window
05:55 merijn joined
05:55 <Lokathor> EvanR, GLFW-b isn't setup like that. You have to assign an error callback and /that/ prints the error
05:55 <thang1> That's the sort of situation I was using it in. Mostly re-implementing things where the book author forces an explicit type instead of a maybe type, so Int -> Int and I used a head function which returns a Maybe Int, so then I have to unbox the maybe... that sorta thing
05:55 <Lokathor> thang1, so it looks like this http://lpaste.net/355904
05:55 <EvanR> Lokathor: ah. you should do that ;)
05:56 <EvanR> C coding without handling errors is asking for monkeys to fly out of your nose
05:56 <Lokathor> EvanR, only cause of the winky face
05:56 <cocreature> s/without handling errors//
05:57 juhp joined
05:57 <thang1> Should I stay up all night and fight the enormous pile of homework I've procrastinated on?
05:57 <Lokathor> setErrorCallback (Just $ \error msg -> print error >> putStrLn msg)
05:57 <EvanR> \o/
05:58 <EvanR> hPutStrLn stderr (show error ++ " " ++ msg); exitFailure;
05:58 <EvanR> Nothing -> hang -- waiting for error callback
05:58 <pacak> mniip: that's acme-safe
05:58 <thang1> 2 projects due tomorrow, 1 project and 2 giant homework assignments due tuesday. Yay!
05:59 <cocreature> thang1: better get some sleep and wake up early and do your homework then :)
05:59 <thang1> How did GLFW manage to make haskell look java ugly?
05:59 <EvanR> you should see the java bindings
05:59 <thang1> ಠ_ಠ do I want to?
05:59 <Lokathor> thang1, perhaps because I used a qualified import?
05:59 <EvanR> no
05:59 <thang1> I'll take your word for it :p
06:00 <Lokathor> thang1, my font doesn't support your eyes, they're big unicode error squares
06:00 <thang1> Lokathor: naah that's not it. WindowHint'OpenGLProfile is ugly in any language
06:00 beekill95 joined
06:00 <Lokathor> oh that part
06:01 <EvanR> http://i.imgur.com/TrKrVqB.png
06:01 <Lokathor> well I applaud any bindings engine that's as 1:1 as possible, honestly
06:01 <Lokathor> since you usually don't have full docs in the new version, you have to look at the C version, so 1:1 makes it easier
06:01 <thang1> Lokathor: You need an indic font I believe
06:01 danvet joined
06:02 <thang1> Well in this particular instance, it's probably a good choice that they made it 1:1, but the function names are still ugly to me.
06:02 <Lokathor> though, glfw-b accepted my pull request for more docs, so now there's more docs
06:02 <thang1> I prefer fnktn f s t a b b y. Much more clearer
06:02 <EvanR> since GLFW should be only on the very outside crunchy IO shell, shouldnt really amtter
06:02 <Lokathor> of course
06:02 <EvanR> get out of there as fast as you can and into haskell
06:02 <Lokathor> EvanR, my program is a 200 line IO block :P
06:02 wroathe joined
06:03 <thang1> /but why/
06:03 <Lokathor> well, it's about using opengl, so, there's not much to do outside of IO
06:03 <EvanR> imagine if haskell still had old I/O
06:03 saussure joined
06:03 <Lokathor> i mean there /are/ non IO portions, but not so many
06:03 <thang1> old IO?
06:04 <EvanR> lazy list I/O
06:04 <thang1> oh yeah that nightmare
06:04 juanpaucar joined
06:04 <EvanR> would be interesting to see Lokathor's 200 lines in that ;)
06:05 <Lokathor> it'd be interesting to see any opengl program in that :P
06:05 <thang1> EvanR: how did things even work with the old lazy list IO?
06:05 <thang1> inb4 "poorly"
06:05 <EvanR> you had an input stream, your program had to construct an output stream
06:06 Lemmata joined
06:06 systemfault joined
06:06 <Lokathor> https://github.com/Lokathor/learnopengl/blob/master/app/Lesson07.hs here's the last working version. It accrued a lot of cruft so I'm cleaning out some of that as I move into the next arc of lessons
06:07 jgertm joined
06:07 <thang1> That actually doesn't sound terrible. I mean, I'm sure it was, but I was expecting a bit more ugly :p
06:09 louispan joined
06:09 sherub1 joined
06:11 tomboy64 joined
06:11 Itkovian joined
06:11 <thang1> :t foldMap
06:11 <lambdabot> (Monoid m, Foldable t) => (a -> m) -> t a -> m
06:11 nshepperd joined
06:12 <et09> elof :: Int -> [a] -> Maybe a
06:12 <et09> x `elof` xs = let xslen = length xs in if ((abs x) > xslen) then Nothing else Just (xs !! (x `mod` xslen))
06:12 <thang1> hmm, so literally a fold... and a map
06:12 <et09> my array index function lol
06:12 <et09> is that bad
06:12 PotatoCommando joined
06:13 cur8or joined
06:13 xtreak joined
06:13 mfukar joined
06:13 <thang1> Well [] isn't an array, elof is a weird name, idk why you have a let in source code haskell, and the time complexity of the function is horrific
06:13 <MarcelineVQ> let is very common and totally fine :>
06:13 <EvanR> thang1: a map, then a fold...
06:14 <thang1> Really? I didn't even know you could use let inside source code haskell. I thought it was entirely for ghci. Shows how much I know :p
06:14 <MarcelineVQ> I wouldn't be surprised if most work gets done in lets :X
06:14 <et09> the time complexity is bad?
06:14 <thang1> EvanR: that's what I meant, m'bad
06:14 <EvanR> @src fix
06:14 <lambdabot> fix f = let x = f x in x
06:14 mark___ joined
06:14 <EvanR> let _ = _ in _ is one of the basic formations
06:14 <EvanR> it lets you share answers explicitly
06:15 <thang1> But other than that, I suppose it's not bad since it should do what you want. I just dunno why you even want an array index function, to be honest, et09
06:15 <thang1> EvanR: makes sense
06:15 <et09> it's a common idiom
06:15 <EvanR> where clause desugars to let
06:15 Kreest__ joined
06:15 <thang1> ahh that clears things up a bit. I use where often, just didn't realize it desugared to let
06:15 takle joined
06:16 <thang1> et09: array indexing isn't a common idiom in functional programming, however :p
06:16 <mark___> Hi, I'm learning haskell and am having issues getting something to typecheck. It's an exercise from "Haskell from first principles", which I've copied here https://pastebin.com/raw/X71nFWpW
06:16 <et09> it happens
06:16 <et09> nonetheless
06:16 <et09> what's wrong with the time complexity ?
06:17 <EvanR> mark___: i see the error, but have you tried reading the compiler error
06:17 <EvanR> message
06:17 vaibhavsagar_ joined
06:17 <mark___> I did, but I was confused because I thought rocks took as input [char] and I was giving it that.
06:18 <EvanR> what does Papu take
06:18 wroathe joined
06:18 <thang1> mark___: this sort of thing tripped me up for a bit during the chapter as well
06:18 <EvanR> you might get a better message by giving phew and top level type signature
06:19 <EvanR> a signature like phew :: Papu
06:20 <mark___> Oh, does it have to be (Rocks "chases") (Yeah True)?
06:20 <thang1> Yeah
06:20 louispan joined
06:20 <MarcelineVQ> et09: a problem is that you have to traverse the whole list due to using length, which means with an infinite list your function won't terminate.
06:20 <et09> oh, true
06:20 <MarcelineVQ> instead of asking for the length consider recursively calling eleof with a smaller x each time, if you reach the end of the list before x becomes 0 then x was larger than the length of xs
06:21 <thang1> You're constructing a Rocks and Yeah "object" (idk what to actually call them), but you can't do that without using the constructors, mark___
06:21 <et09> i was assuming the list was predefined and non-infinite
06:21 <MarcelineVQ> and if you reach zero, the head of the list is the element you want, I think
06:21 <pacak> > let foo i xs = listToMaybe $ map snd . dropWhile ((/= i) . fst) $ zip [1..] xs in foo 3 "abcde"
06:21 <thang1> in Papu "chases" True, you're just passing in a String and a Bool to Papu, but Papu takes a Rocks and Yeah, not String and Bool
06:21 <lambdabot> Just 'c'
06:21 <et09> it's surprising iterating one at a time would be faster...
06:21 <et09> in C you could just skip forward in memory
06:22 <EvanR> lists do not have their length stored anywhere
06:22 <EvanR> its just a linked list
06:22 <MarcelineVQ> to compute the length of a list you have to visit each element because it's a single-linked-list
06:22 saussure joined
06:22 <et09> ah. well that figures, since it's a bit like LISP
06:22 yoneda joined
06:22 <MarcelineVQ> so if you're going to visit every element you may as well try not to
06:22 <thang1> There's a length, a conditional, comparison, then !! (which also traverses the list), and a mod function
06:22 <Lokathor> EvanR, usingVertexArray :: MonadIO m => VertexArrayID -> m () -> m () -- such type safety!
06:22 <EvanR> and these can be infinite, so a length may not even make sense
06:22 <et09> but then i can't do a reverse index
06:22 <et09> which defeats the purpose
06:22 <EvanR> you can make an index
06:22 <pacak> et09: reverse index?
06:22 <EvanR> but then you might as well not use alist
06:22 <thang1> Can you see why combining all of that together in a function might be a bit slower than just iteration? :p
06:22 <et09> yeah like [1,2,3,4][-1] = 4
06:23 <EvanR> youre tihnking about an entirely different data structure there
06:23 <pacak> et09: You can't because there might be no right end.
06:23 <et09> well you can, it can just fail spectacularly, lol
06:23 <thang1> Just because python abuses syntactic sugar to do that sort of thing doesn't mean that you can think of python lists as real lists
06:23 <EvanR> lists in haskell are more like control structures
06:23 <EvanR> to do [1,2,3,4][-1] use a Data.Sequence
06:24 exit70 joined
06:24 <thang1> EvanR: would a vector work? Or are vectors for differnt things in haskell?
06:24 <pacak> > fix (1:)
06:24 <lambdabot> [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1...
06:24 <EvanR> vector works but you cant modify them as if it were a "queue"
06:24 <EvanR> different trade offs
06:25 <thang1> ahh right. I'm still used to vectors being a catch all data structure like they are in C++
06:25 ertes-w joined
06:25 augur joined
06:25 <et09> Data.Sequence.fromList :: [a] -> Seq a
06:25 <et09> lol
06:25 <EvanR> no catch all DS in haskell, except for acme-php
06:25 KaneTW joined
06:26 <thang1> It's weird to have all of these different structures which are actually useful for different things, yet... haskell still has linked lists embedded /deeply/ into the syntax structure of the language and it makes every other DS out there feel like a distant cousin instead of a first class citizen
06:26 <EvanR> the syntax sugar is basically the only difference
06:26 <EvanR> @src []
06:26 <lambdabot> data [] a = [] | a : [a]
06:26 <EvanR> its just a data structure
06:27 p0a joined
06:27 <thang1> There's list comprehensions too, though. And the fact that lists took : away from type signatures
06:27 <p0a> Hello suppose I want to write the function f x = g x
06:27 <EvanR> yes
06:27 <EvanR> its all superficial
06:27 <p0a> I don't know g's type but I'd like f to have the same type. How do I do this?
06:27 <EvanR> list comprehensions are sugar
06:28 <thang1> and < and { aren't available to use for convenient notation so you can't write {a} or <a>, leaving lists with the only really convenient way to write [a]
06:28 <thang1> Sure, but sugar adds up and lists have buckets of sugar compared to any other data structure in haskell
06:28 <EvanR> how many ways do you need to write [a] ;)
06:28 <Lokathor> thang1, an array backed list is just as real a list as a linked list :P
06:28 <p0a> I guess :t is convenient. I was just wondering if there's a way to let the language know I want f to have the same type as g
06:28 <p0a> but I'll just use :t really
06:29 <MarcelineVQ> :t tells you the type it doesn't tell ghc
06:29 <lambdabot> error: parse error on input ‘type’
06:29 <EvanR> thang1: idris overloads this sugar... anything with ctors Nil and (::) use [ ] sugar... and its pretty bad :)
06:29 <p0a> MarcelineVQ: yeah I can tell ghc after I learn the type from :t
06:29 <EvanR> Lokathor: a what o_O
06:29 <MarcelineVQ> what you've wrote is just f = g and f will have the same type as g with that
06:29 <p0a> MarcelineVQ: oh so it's pointfree style that I'm looking for
06:29 <MarcelineVQ> well it's also the same as f x = g x
06:30 <p0a> How would you write divides' a b = (rem b a) == 0 pointfree?
06:30 <p0a> I'm very new
06:30 <thang1> I'm not suggesting we borrow idris [] sugar :p I'm just lamenting how it feels like all data structures don't have the same ability to give easy and convenient notation the same way that lists do
06:30 <Lokathor> EvanR, python's list type is an array backed, growable structure, like an ArrayList<T> in Java, or whatever else similarity you care to name
06:30 <MarcelineVQ> I'm not sure I would, it's pretty clear the way it is, allthough you can drop the parenthesis
06:30 takle joined
06:30 <thang1> I'm not suggesting that every kinda DS out there needs access to [a,b] notation :p
06:30 <EvanR> thang1: well, Seq does have front and back views and pattern synonyms
06:30 <EvanR> er, view patterns
06:30 <p0a> It gives you an error if you don't give it the type divides' :: Integral a=> a-> a-> Bool
06:31 <p0a> Yes the parentheses may be dropped but I'd rather have them since I'm a beginner
06:31 <EvanR> Lokathor: im not sure either of those acts like or is like a haskell list
06:31 <Lokathor> EvanR, oh absolutely they're not at all. They're more like the Vector type if it had wrappers to self-resize when necessary
06:31 <EvanR> thang1: and all these other structures are a lot more complex...
06:32 <MarcelineVQ> What is the error? There shouldn't be anything amiss with that
06:32 <MarcelineVQ> @let divides' a b = (rem b a) == 0
06:32 <lambdabot> Defined.
06:32 <MarcelineVQ> @let fub = divides'
06:32 <lambdabot> Defined.
06:32 <Rotaerk> how long do these lets last in lambdabot anyway?
06:32 <p0a> No instance for (Integral a) arising from a use of 'rem'
06:32 <MarcelineVQ> not long with a few people playing about :>
06:33 <Lokathor> thang1, if you want more data structures as literals in your code, note that many structures support a fromList function, and so you can use that a lot of the time
06:33 <p0a> No instance for (Eq a) arising from a use of '==' etc
06:33 ubsan_ joined
06:33 <MarcelineVQ> Ah is this in a source file?
06:33 <p0a> yes
06:33 <thang1> True. I suppose when I get to writing more complex haskell code I won't really notice any lacking data structure magic :p
06:34 <thang1> After all, I don't really notice many advanced haskell programmers complaining about it
06:34 wroathe joined
06:34 govg joined
06:34 <EvanR> the operations an IntMap or HashMap comes with are so extensive, its like... you dont actually use the api much ;)
06:34 <EvanR> a couple calls and the job is done
06:34 <Lokathor> thang1, you'll just need to learn the art of advanced operators :P they get fancier, like pos ^+^ (speed *^ normalize moveVector)
06:35 <Lokathor> EvanR, the biggest letdown about Vector.Storable.Mutable is that it has nearly nothing for API compared to Vector.Storable
06:35 <EvanR> makes sense
06:35 <EvanR> IO gonna IO
06:36 <Lokathor> well, VS has both generate and generateM, and VSM couldn't sensibly have generate, but it doesn't even have generateM
06:36 <Lokathor> you gotta setup a goofy replicateM situation
06:36 <thang1> advanced operators feel like a bit of a working around for things, but at least you can use advanced operators instead of the verbose and terrible java situation where you have "standard names for methods"
06:37 <Lokathor> thang1, edk provides good enough documentation in the Linear package, and it's a grounded concept
06:37 quchen joined
06:37 <Lokathor> lenses... oh dear i wish i knew how to use them
06:37 <EvanR> i want + is be usable for vectors and for numbers
06:37 <Lokathor> my next "using haskell" tutorial arc will perhaps have to be a lenses
06:38 <p0a> What's wrong with filter' (x:xs) = (if (f x) then x else []) : filter' f xs
06:38 <Lokathor> EvanR, Linear puts a ^ on the side of an operator that takes a vector, so ^+^ is two vectors added, and ^* is "vector times scalar"
06:38 <EvanR> right but specifically adding
06:38 <thang1> I feel like the easiest way to get started with lenses is just writing more complex records and then going "ahhh shit I need to access this thingey" and then figuring out how to use the ^. or whatever it's called and then just going from there
06:38 <EvanR> its conventional to just add vectors
06:38 <p0a> There's two more lines; one (a -> Bool) -> [a] -> [a] and another matching filter' f [] = []
06:38 <EvanR> its not a different kind of operator
06:38 <p0a> Huh [] : [] is not [] as I thought
06:39 <Lokathor> p0a, remember that you can't do ([] : more) unless you're tying to make a list of lists
06:39 gmhafiz_ joined
06:39 <p0a> I guess "" : [] ?
06:39 <thang1> Lokathor: But, like I said, it feels kinda hackisy to say ^+^ instead of just + for vectors. I know I'm adding stuff and tne type signature can figure out that I'm adding vectors, so... why the hand waving?
06:39 <Maxdamantus> "" is a restricted form of []
06:39 <EvanR> thang1: the issue is + is tied up with * in the Num class
06:39 <p0a> Lokathor: is there some x that I can use x : list == list ?
06:39 <EvanR> vectors arent numbers, you cant multiply them
06:39 <quchen> p0a: No.
06:39 <thang1> EvanR: you can't define operators in multiple places and have them be distinguishable by types?
06:39 louispan joined
06:40 <p0a> no one liner for me then
06:40 saussure joined
06:40 <Lokathor> p0a, well you need to reconsider how much of your code is being affected by the "if" part
06:40 <Lokathor> EvanR, GLSL says otherwise ;P
06:40 <Maxdamantus> thang1: you can do that with classes, sometimes.
06:40 btk joined
06:40 <p0a> Lokathor: ?
06:40 <Maxdamantus> thang1: but each use of that identifier will be referring to the member of that class.
06:40 <EvanR> thang1: type directed name disambiguation? another thing in idris that never works right
06:40 <Lokathor> p0a, consdier like this, filter' (x:xs) = if (f x) then includeResult else excludeResult
06:41 <quchen> filter p (x:xs) = (if p x then (x:) else id) (filter f xs) -- one-liner, p0a
06:41 <EvanR> and once you have to write MyCoolModule.(+) you lost
06:41 <thang1> EvanR: I still maintain it's a great idea when someone figures out how to make it not suck :p
06:41 <p0a> What's wrong with this code? problem1 doesn't work. http://lpaste.net/355905
06:41 <Lokathor> quchen, it seems like they're a little more of a beginner than that >_>
06:41 takle joined
06:41 <p0a> quchen: okay that's pretty good. I had forgotten about currying!
06:42 <EvanR> thang1: haskell relies a lot on type inference... when it has to infer your implicit types and also what name you were trying to use... based on a type it doesnt know for sure you meant... it gets real ugly
06:42 <EvanR> if you never made mistakes, it would work out of course
06:42 <thang1> That's fair. I keep forgetting about type inference since I write my types out 99% of the time
06:42 <EvanR> no you dont ;)
06:43 <EvanR> only top level probably
06:43 <quchen> p0a: Remember that »:« prepends a single element to a list. There is no single element that, when prepended to anything, does not change the list – so there can not be an »x« such that »x : list = list«.
06:43 <thang1> hah, good point. I write top level signatures 99% of the time and every time the compiler complains about ambigious number/string literals, I fix that, but other than that...
06:44 <thang1> So yeah, I guess a lot more of my programs are implicitly typed than I think :p
06:44 <quchen> p0a: For special lists it’s possible of course, »x : repeat x = repeat x« for example.
06:44 <p0a> quchen: yeah I just realized that I needed to create a reversed list for that trick to work, i.e. (filter' p xs) : (if f x then x else [])
06:44 <EvanR> if it were like old C++, every where clause and let would be signatured
06:44 <p0a> quchen: that's a dirty lisp trick
06:44 <quchen> That will not only filter, but also reverse your input.
06:45 <quchen> Dirty tricks usually produce correct results.
06:45 <quchen> Your filter function won’t terminate on infinite inputs, for example.
06:45 <p0a> well you have a reverse and a helper lambda function doing the actual recursion
06:45 <quchen> e.g. filter isPrime [1..]
06:46 <thang1> :t isPrime
06:46 <lambdabot> error:
06:46 <lambdabot> • Variable not in scope: isPrime
06:46 <lambdabot> • Perhaps you meant ‘isPrint’ (imported from Data.Char)
06:46 <p0a> infinite inputs were not a thing in the language I was writing back when
06:46 <* thang1> is sad this does not exist
06:46 <EvanR> Integer -> Bool
06:46 <EvanR> its in arithmoi package among others
06:46 <MarcelineVQ> thang1: it exists, it's just not in scope at the moment
06:46 <quchen> p0a: You also don’t have »filter (const True) = id«.
06:46 <thang1> Well I figured it existed /somewhere/ :p
06:46 <thang1> Haskell nerds wouldn't stand to have a prime checking function undefined
06:46 <p0a> quchen: why?
06:47 <thang1> p0a: infinite inputs are part of the magic of lazy languages, so welcome to insanity :p
06:47 <quchen> p0a: Because you’re reversing the list
06:47 <p0a> by the way I do enjoy this discussion but its the lpaste link I'm wondering about
06:47 <p0a> quchen: oh yes then add a 'reverse' in front of it and recurse afterwards
06:47 <quchen> p0a: Then you’re traversing the list twice, once for filter, and once again for another reverse.
06:48 <p0a> well you'd be surprised how often that's done in lisp
06:48 <EvanR> surely not on a regular linked list?
06:48 <EvanR> some kind of whiz bang other structure
06:49 <p0a> on a whatever list sometimes it is the case that you have (reverse (func list)) just because it's cute
06:49 guiben joined
06:49 <Lokathor> Rust picked slightly less than the correct amount of type inference I think :/
06:49 <p0a> or perhaps it was a beginners thing
06:49 wroathe joined
06:49 <thang1> Well lisp is special, the entire everything is lists. LISP literally stands for LISt Processing
06:49 <quchen> ?define filterP0a _ [] = []; filterP0a p (x:xs) = filterP0a p xs ++ if p x then [x] else []
06:49 <lambdabot> Defined.
06:49 <EvanR> lisp is special alright
06:49 <quchen> There’s your filter function.
06:50 jakub_ left
06:50 <quchen> ?check \xs -> filterP0a (const True) xs == (xs :: [Int])
06:50 <lambdabot> *** Failed! Falsifiable (after 5 tests and 5 shrinks):
06:50 <lambdabot> [3,2,-1,3]
06:50 <p0a> that is nice but I liked the currying one with (x:) more :P
06:50 <thang1> Lokathor: Rust is working on that, actually. They erred on explicit typing and now they're slowly adding inference
06:50 <quchen> > filterP0a even [1..]
06:50 <lambdabot> *Exception: stack overflow
06:51 <thang1> > take 10 $ filterPOa even [1..]
06:51 <lambdabot> error:
06:51 <lambdabot> • Variable not in scope:
06:51 <lambdabot> filterPOa :: (Integer -> Bool) -> [Integer] -> [a]
06:51 <quchen> filterP0a terminates on no infinite list, because it has to traverse the entire list before producing any output.
06:51 takle joined
06:51 <thang1> I can't use someone else's lets? Interesting. Makes sense
06:51 juhp joined
06:51 <EvanR> haha
06:51 <quchen> Sure you can.
06:52 <quchen> Maybe someone has undefined it.
06:52 <EvanR> :t filterP0a
06:52 <lambdabot> (t -> Bool) -> [t] -> [t]
06:52 <quchen> Or maybe you misspelled the 0 for an O.
06:52 <MarcelineVQ> font :>
06:53 darjeeling_ joined
06:53 <p0a> So can anyone help with http://lpaste.net/355905 ?
06:53 <MarcelineVQ> p0a: best to also include your errors in pastes, if there are any, it narrows things down rapidly when you have questions
06:53 <p0a> filter' and divides' work just fine but problem1 doesn't work
06:53 <p0a> Oh okay
06:53 <quchen> ?letlpaste 355905
06:53 <lambdabot> .L.hs:175:13: error:
06:53 <lambdabot> • Couldn't match expected type ‘Int’ with actual type ‘a’
06:53 <lambdabot> ‘a’ is a rigid type variable bound by
06:54 takuan joined
06:54 <MarcelineVQ> :t take
06:54 <lambdabot> Int -> [a] -> [a]
06:55 <quchen> p0a: »take« takes an Int as first argument, not an »Integral a => a«.
06:55 <p0a> I updated it with the errors
06:55 <p0a> aha
06:55 <quchen> p0a: You can use »fromIntegral« to convert the two.
06:55 <quchen> :t fromIntegral
06:55 <lambdabot> (Num b, Integral a) => a -> b
06:55 <quchen> > fromIntegral (1 :: Integer) :: Word8
06:55 <lambdabot> 1
06:56 <p0a> If I change Integral to Int I get that "Int is being applied to too many type arguments"
06:56 <p0a> i.e. divides' :: Int a => a -> a -> Bool
06:56 ThomasLocke joined
06:56 <p0a> anyway I guess I'll use fromIntegral
06:57 dhil joined
06:57 <quchen> Integral is a constraint on a type (»Integral x means x has to implement the Integral class«), Int is a type.
06:57 <ertes-w> helo
06:57 <quchen> Int is an instance of Integral.
06:57 <quchen> Integer is an instance of Integral.
06:58 saussure joined
06:58 <quchen> Int is not an instance of Int, like in Java Serializable is not an instance of Serializable.
06:58 slomo joined
06:58 <p0a> ah I get it
06:58 connrs joined
06:58 <p0a> should've been Int -> Int -> Bool
06:58 <quchen> For example, yes.
06:58 <quchen> You can specialize »Integral x« by replacing »x« with any instance of Integral.
06:59 <p0a> Yeah I had forgotten about type constraints vs types
06:59 primal joined
06:59 <ertes-w> p0a: read "x :: C a => T" as "x is of type T, but also requires an instance (C a), as if it would take a "proof" for (C a) as an additional hidden argument
06:59 <quchen> Constraints are pretty much (properly done) interfaces.
07:00 <p0a> Well I'd read up on them a bit but I think I'll leave it for later
07:00 <p0a> because I want to solve problems and learn by doing that and use what is needed when I have to
07:00 louispan joined
07:00 <p0a> of course I'll pick up some bad habits doing that but I don't like the dry by the book way
07:00 <ertes-w> p0a: no, i think your approach is fine =)
07:01 <p0a> thanks :)
07:01 sellout- joined
07:01 <ertes-w> learning by doing and experimentation is in fact a highly underappreciated way to learn haskell
07:01 <MarcelineVQ> wet books are awful
07:02 <ertes-w> p0a: you won't necessarily pick up bad habits, but you may run into a road block from time to time… but when that happens, just ask here
07:02 jgt joined
07:02 <ertes-w> haskell will not allow you to develop bad habits as much as other languages do
07:03 stef204 joined
07:03 <EvanR> haskell cannot allow that to happen, its for your own protection
07:03 louispan joined
07:03 <MarcelineVQ> aside fromoveruse of $
07:04 <thang1> I $ don't $ know $ what $ you're $ talking $ about -- TODO fiddly with some of the $ and randomly replace with . until it compiles and passes quickCheck
07:04 <ertes-w> it's monday… don't make me respond to that =)
07:04 <MarcelineVQ> Yes it's not especially relevant sorry ignore me
07:04 juanpaucar joined
07:04 <Cale> thang1: Usually if you can write f $ g $ h $ x then you can write f . g . h $ x
07:05 wroathe joined
07:05 Gurkenglas joined
07:05 <Cale> I recommend this for a few reasons. One is that (.) is associative, so the latter expression behaves as if it has more subexpressions than the former
07:06 <ertes-w> does anyone else prefer to write (f . g . h) x? please join the $sucks movement =)
07:06 <MarcelineVQ> oh no I did the thing
07:06 <EvanR> w = f . g . h
07:06 <Cale> That is, g . h for example, is a well-typed thing on its own
07:06 <EvanR> y = w x
07:06 joco42 joined
07:06 <Cale> while g $ h is probably meaningless
07:06 <Cale> ertes-w: I don't mind *one* $
07:06 <thang1> Cale: nice, I'll keep that in mind
07:06 <thang1> ertes-w: I'm sorry, I only write lisp in lisp /s
07:07 <Cale> Another thing is that it's a good way to get used to writing function compositions, if you're not used to thinking that way already -- eventually in cases where you don't need the argument, it'll be more natural to think of the function composition straight away
07:07 <Cale> another is that $ just has the wrong damn associativity -- it should always have been left associative :P
07:07 takle joined
07:08 <ertes-w> Cale: it's a style i adopted very recently, mainly because i can immediately see which function chains are followed by an argument… i still use ($) when the argument is on the next line though
07:08 <Cale> (function application is usually left associative)
07:08 <EvanR> $ was really a side tangent here
07:08 louispan joined
07:08 <thang1> EvanR: never interrupt the bike shedding
07:08 <* thang1> 's favorite color is purple
07:09 <Cale> I just jumped in because thang1 said something indicating a bit of confusion over (.) vs. ($) :)
07:09 primal_ joined
07:09 <Gurkenglas> Is there a version of Map that only requires a partial order (a -> a -> Bool)?
07:09 <thang1> Cale: the confusion was intentional, but I appreciate the helpful enlightenment :p
07:10 <ertes-w> Gurkenglas: binary searching requires a total order, as far as i can tell
07:10 <p0a> All this conversion between Num Integral and Int is frustrating
07:10 <thang1> > mfw numeric conversion is frustrating to newbies
07:10 <EvanR> p0a: good idea to choose one and stick with it, only convert before and after the algorithms if necessary
07:10 <MarcelineVQ> hmm, what about https://hackage.haskell.org/package/unordered-containers or is the hashing a form of total ordering? idk
07:10 <ertes-w> p0a: conversion only happens between types
07:10 CurryWurst joined
07:10 <Cale> Gurkenglas: That's a *really* weak requirement. Note that (==) is a partial order.
07:10 <EvanR> Int or Integer (or something else)
07:11 <thang1> okay, EvanR, you win, I give up on my argument that numeric stuff was less confusing than string types
07:11 <Gurkenglas> Cale, then the map would be one deep, a degenerated forest.
07:11 <Cale> Gurkenglas: Ah, so you don't care about it having a terrible worst case, just making a best effort based on what the order provides. Interesting idea.
07:12 <p0a> for instance I have a take (fromIntegral n) [1,2..] to get an n-list. Then I want to sum it, but using sum doesn't work!
07:12 <ertes-w> p0a: if you feel that too much conversion is going on, paste some code, and we can help you reduce it… in most cases conversion is not necessary or very minimal
07:12 _flow_ joined
07:12 <p0a> alright
07:12 <ertes-w> :t \n -> sum (take (fromIntegral n) [1..])
07:12 <lambdabot> (Enum a, Num a, Integral a1) => a1 -> a
07:12 <ertes-w> p0a: works
07:12 <Gurkenglas> gtg but I'll read the logs later
07:12 thc202 joined
07:12 Yuras joined
07:12 <MarcelineVQ> p0a: you do a lot less of it than you'd think, it's just that beginning stuff is always about numbers for some reason :(
07:12 <p0a> So here's the code, http://lpaste.net/355907
07:13 <p0a> I'm trying to do (sum . filter') instead of just filter' but it won't work
07:13 <EvanR> youre trying to do everything with Integral
07:13 <EvanR> constraint
07:13 <ertes-w> ah, project euler
07:13 <EvanR> so use genericTake
07:13 <EvanR> :t genericTake
07:13 <lambdabot> Integral i => i -> [a] -> [a]
07:13 ragepandemic joined
07:14 <EvanR> i would probably just use Int everywhere here
07:14 Itkovian joined
07:14 <p0a> okay let me try
07:14 <ertes-w> p0a: i suggest that you don't 'take' at all there
07:14 <thang1> there's a genericLength too, which is pretty neat
07:14 <p0a> it's just that I was inspired to use Integral from looking at :t rem
07:14 <p0a> ertes-w: ?
07:14 <ertes-w> > filter (\x -> mod x 3 == 0 && mod x 5 == 0) [1..]
07:14 <lambdabot> [15,30,45,60,75,90,105,120,135,150,165,180,195,210,225,240,255,270,285,300,3...
07:14 <ertes-w> > filter (\x -> mod x 3 == 0 || mod x 5 == 0) [1..]
07:14 <lambdabot> [3,5,6,9,10,12,15,18,20,21,24,25,27,30,33,35,36,39,40,42,45,48,50,51,54,55,5...
07:14 <p0a> ah that's pretty smart
07:15 <ertes-w> p0a: 'take' only the result, just before reducing the list to the answer value
07:15 bvad joined
07:16 <thang1> p0a: integral is a very generic thing. I prefer thinking of the integral constraint as defining a family of functions
07:16 saussure joined
07:16 <ertes-w> > sum (takeWhile (< 1000) (filter (\x -> mod x 3 == 0 || mod x 5 == 0) [1..]))
07:16 <lambdabot> 233168
07:16 <EvanR> Integral is specifically for doing division and remainders
07:16 <thang1> So (Integral a) => a -> a is the identity family of functions over all types that have an Integral instance
07:16 <ertes-w> p0a: 'take' is incorrect anyway =)
07:16 vlatkoB_ joined
07:16 <ertes-w> you need the numbers below 1000, not the first 1000 results
07:17 <p0a> yeah that's a good point
07:17 <ertes-w> (the way you use it is correct, but you need to adjust for offsets, if you ever start at a different value)
07:17 <MarcelineVQ> that's one way to give away the answer :> does someone have a good explanation for why (sum . filter') is going to be an instance related type error?
07:18 <thang1> :t (sum . filter)
07:18 <lambdabot> (Num [a], Foldable ((->) [a])) => (a -> Bool) -> [a]
07:18 <thang1> :t filter
07:18 <lambdabot> (a -> Bool) -> [a] -> [a]
07:18 takle joined
07:18 <EvanR> Foldable ((->) [a])) ??
07:18 <EvanR> Num [a] ?
07:18 <thang1> ¯\_(ツ)_/¯
07:19 <EvanR> FlexibleConstraints or
07:20 <EvanR> :t sum . filter even
07:20 <lambdabot> Integral c => [c] -> c
07:20 <p0a> ertes-w: ah takeWhile is convenient
07:20 <thang1> :t (sum. filter) even
07:20 <lambdabot> (Num [a], Integral a, Foldable ((->) [a])) => [a]
07:20 <thang1> wut
07:20 <EvanR> different
07:21 <EvanR> you did sum (filter even)
07:21 <thang1> Well yeah, I just wasn't expecting Num [a] and Integral a
07:21 louispan joined
07:21 <EvanR> i kind of have no idea what those constraints are saying
07:22 <thang1> Cause to me Integral a is a stronger constraint than Num, so it should "collapse" into Integral [a]. No idea wtf the foldable ((->)) thing is for, though
07:22 <ertes-w> > (sum . takeWhile (< 1000)) (zipWith max ([0,3..] >>= (: replicate 2 0)) ([0,5..] >>= (: replicate 4 0)))
07:22 <lambdabot> 233168
07:22 <EvanR> Num [a] and Integral a are talking about two different types
07:22 <ertes-w> p0a: of course they want you to do this… it's called sieving =)
07:23 ventonegro joined
07:23 louispan joined
07:23 <EvanR> presumably you can fill in a Num String and a Integral Char
07:23 <EvanR> if you had one
07:23 <EvanR> but neither implies the other
07:24 <ertes-w> p0a: explicit divisibility testing is a valid approach, too; it's just much slower =)
07:24 <p0a> oh wow
07:25 <thang1> Don't bother understanding that, p0a, it's not exactly /super/ complicated but it's not exactly super understandable either :p
07:26 <ertes-w> p0a: PE problems are mostly about being smart at numerical/algorithmic stuff… they are interesting, but not really that helpful for actual software development in haskell, because they never touch the more dirty aspects of programming like interacting with the outside world or providing sane UX
07:26 <EvanR> all the stuff haskell does best
07:26 <ertes-w> p0a: also they are rather boring on the type level
07:27 <ertes-w> you will mostly be dealing with integers and bit fields
07:27 <p0a> no I'd rather do a 2d game or somesuch
07:27 <EvanR> checkout code.world/haskell
07:28 <ertes-w> p0a: write a small command line game first… my favourite exercise (to give to beginners) is to write an implementation of the good old hangman game
07:28 <EvanR> they have graphics
07:29 cur8or joined
07:30 meba joined
07:30 <p0a> that hangman game is a good idea since I just realized I've no idea how to read a character from input
07:30 <EvanR> :t getChar
07:30 <lambdabot> IO Char
07:31 dev-Zero_ joined
07:31 <Lokathor> what they don't tell you about getChar is that the haskell process will not normally have any chars available until the user hits enter with their terminal
07:31 <Lokathor> the shell itself buffers them jealously
07:31 <ertes-w> p0a: use getLine instead
07:32 <ertes-w> if the line is empty, abort the game
07:32 <EvanR> thats even better
07:32 <ertes-w> p0a: upfront note: do not use (==) on lists
07:32 indi_ joined
07:33 <Lokathor> ertes-w, assuming that they're known to be finite, why not?
07:33 <p0a> Hehe okay I think I need to go to bed. I really was just messing around a bit but it's getting late
07:33 <ertes-w> Lokathor: because:
07:33 <ertes-w> :t null
07:33 <lambdabot> Foldable t => t a -> Bool
07:33 <ertes-w> :t (== [])
07:33 <lambdabot> Eq t => [t] -> Bool
07:33 eminhi joined
07:33 <EvanR> if you are going to use the lists for something, == will probably end up forcing the whole thing
07:33 <p0a> Thanks for all the help every1, cu
07:33 <ertes-w> also (==) has the unnecessary Eq constraint
07:34 <EvanR> but if you just want the bool...
07:34 <ertes-w> p0a: good night, and have fun tomorrow =)
07:34 <EvanR> make sure to drop the lists so they can get gc'd
07:34 <p0a> will do!
07:34 <Lokathor> oh you mean just for == []
07:34 saussure joined
07:34 <Lokathor> sorry, missed that
07:34 takle joined
07:35 eklavya joined
07:35 ErinvanderVeen joined
07:35 <ertes-w> if foldr (\_ _ -> True) False line then …
07:35 <ertes-w> =)
07:35 <ertes-w> actually that's terrible
07:36 <ertes-w> :t getAny . foldMap (const (Any True))
07:36 <lambdabot> Foldable t => t b -> Bool
07:36 <ertes-w> much better
07:36 <EvanR> :t null
07:36 <lambdabot> Foldable t => t a -> Bool
07:36 <EvanR> golf'd
07:37 <ertes-w> is 'null' actually the same thing?
07:37 <Lokathor> the types are the same, they must be :3
07:37 <EvanR> uh
07:37 <ertes-w> @let data Snocs a = Nil | Snoc (Snocs a) a deriving (Eq, Foldable, Functor, Ord, Show, Traversable)
07:37 <lambdabot> Defined.
07:37 <MarcelineVQ> null is your foldr version, with the bools the right way around
07:38 <ertes-w> > (getAny . foldMap (const (Any True))) (Snocs Nil ())
07:38 <lambdabot> error:
07:38 <lambdabot> • Data constructor not in scope: Snocs :: Snocs a0 -> () -> [b0]
07:38 <lambdabot> • Perhaps you meant ‘Snoc’ (line 164)
07:38 <ertes-w> > (getAny . foldMap (const (Any True))) (Snoc Nil ())
07:38 <lambdabot> True
07:38 <ertes-w> d'oh
07:38 <ertes-w> > (getAll . foldMap (const (All False))) (Snoc Nil ())
07:38 <lambdabot> False
07:38 <ertes-w> > null (Snoc Nil ())
07:38 <lambdabot> False
07:38 <ertes-w> ok, seems to be the same thing
07:39 ccomb joined
07:39 primal joined
07:39 <ertes-w> > foldr (\_ _ -> True) False (Snoc Nil ())
07:39 <lambdabot> True
07:39 <ertes-w> huh?
07:39 <MarcelineVQ> _ _ means something is there :>
07:39 <ertes-w> oh, yeah, it's non-strict anyway
07:40 <ertes-w> > foldr (\_ _ -> True) False (fix (`Snoc` ()))
07:40 <lambdabot> mueval-core: Time limit exceeded
07:40 <ertes-w> > null (fix (`Snoc` ()))
07:40 takle joined
07:40 <lambdabot> mueval-core: Time limit exceeded
07:40 <ertes-w> > (getAll . foldMap (const (All False))) (fix (`Snoc` ()))
07:40 <lambdabot> *Exception: stack overflow
07:41 inad922 joined
07:41 urdh joined
07:42 thunderrd_ joined
07:42 <ertes-w> > (getAll . getDual . foldMap (\_ -> Dual (All False))) (fix (`Snoc` ()))
07:42 <lambdabot> False
07:42 ccomb1 joined
07:42 ews joined
07:45 <nilOps> Is there a total version of readFile?
07:46 <EvanR> total isnt the right word here, do you want a strict readFile
07:46 <cocreature> I think they are asking for something that doesn’t throw exceptions
07:46 <nilOps> Yes ^
07:46 <EvanR> readFile doesnt, does it
07:46 <nilOps> If the file does not exist it does
07:47 <ertes-w> nilOps: what do you want to happen instead?
07:47 <cocreature> nilOps: you can use "try" to catch exceptions and get an Either back
07:47 <nilOps> Not sure yet, just playing around
07:47 <EvanR> :t try readFile
07:47 <lambdabot> error:
07:47 <lambdabot> • Couldn't match expected type ‘IO a’
07:47 <lambdabot> with actual type ‘FilePath -> IO String’
07:47 <cocreature> if you really want to catch all exceptions you can catch SomeException but that’s almost always not what you want
07:47 <cocreature> :t try . readFile
07:47 <lambdabot> Exception e => FilePath -> IO (Either e String)
07:48 <EvanR> :t try (readFile "/etc/passwd")
07:48 <lambdabot> Exception e => IO (Either e String)
07:48 ragepandemic joined
07:48 <nilOps> Thanks EvanR
07:48 <* EvanR> takes cocreature's credit
07:48 <EvanR> cocreature++
07:49 primal_ joined
07:49 <cocreature> once you’re in IO there are a million reasons for why an exception can be thrown so it’s usually better to catch the specific kind of exception that you are interested in
07:49 acidjnk22 joined
07:49 <cocreature> e.g. if someone presses ctrl+c while you are reading a file you probably don’t want to catch that exception
07:50 ErinvanderVeen joined
07:50 <EvanR> thats an exception?
07:51 <ertes-w> EvanR: yeah
07:51 <ertes-w> interestingly SIGTERM is not an exception by default
07:51 <quchen> Sure, if you have a REPL and you don’t want it to exit hard on ^C you have to catch it
07:51 <nilOps> Seems strange coming from languages where operations return an error code
07:52 <nilOps> Is it normal to let exceptions bubble up in Haskell?
07:52 <EvanR> just to clarify, ghc is catching SIGINT and throwing an async exception to the main thread?
07:52 henriksod joined
07:52 <* hackage> sql-words - SQL keywords data constructors into OverloadedString https://hackage.haskell.org/package/sql-words- (KeiHibino)
07:52 <cocreature> quchen: sure there are cases when you want to catch it. what I’m saying is that catching all exceptions is often a bad idea and you should catch the ones that you can actually handle
07:52 saussure joined
07:52 uniclown joined
07:53 <EvanR> nilOps: in most languages with exceptions this is a good idea
07:53 <nilOps> My language experience has mainly been with Go/C/Rust
07:53 <EvanR> disabling all exceptions is a good way to have your program go unresponsive
07:53 <cocreature> Haskell is special in that we have asynchronous exceptions meaning that other threads can throw exceptions in the current thread
07:53 <cocreature> so having operations return error codes doesn’t work
07:54 <EvanR> you do get that effect if youre waiting on a thread to complete and *it* gets an async exception, you can get that result back as an error code
07:55 dni joined
07:55 tromp joined
07:55 <EvanR> but unless youre trying to do monitoring, youd probably want to rethrow, and crash yourself then too
07:56 <nilOps> That mindset is going to take a while for me to get used to
07:56 takle joined
07:56 <EvanR> file handling is a gray area, i dont know if youd call files not being there exceptional or erroneous
07:57 <EvanR> youd hope the files are there as expected, so exceptions. also returns for most of the system IO would be really messy
07:58 Bassetts joined
07:59 <EvanR> im glad its not like C where you are constantly doing and if(ret < 0){ fprintf(stder..... .
07:59 juhp joined
08:00 <nilOps> I like how Rust handles it; I guess I'm just uncomfortable around exceptions though
08:01 cschneid_ joined
08:01 <Itkovian> Any ideas on how to use cabal-rpm with a stack based installation of ghc?
08:01 <cocreature> asynchronous exceptions are important for implementing functions like "timeout"
08:02 <Lokathor> :t whenM
08:02 <lambdabot> error:
08:02 <lambdabot> • Variable not in scope: whenM
08:02 <lambdabot> • Perhaps you meant ‘when’ (imported from Control.Monad.Writer)
08:02 louispan joined
08:03 <nilOps> I'll keep that in mind cocreature
08:03 rossberg joined
08:04 <cocreature> nilOps: it might be worth pointing out that some people really hate exceptions even in Haskell and try to convert to some kind of Either/ExceptT type as early as possible
08:04 mpsag joined
08:06 dev-Zero_ joined
08:07 xtreak joined
08:07 <nilOps> I'll try to get used to exception handling in Haskell before reaching for tools that are more idiomatic in other languages
08:08 joco42 joined
08:08 c4r50nz joined
08:08 <nilOps> Though other threads throwing exceptions is interesting; I would guess the machinery is a little more complicated than just setjmp/longjmp
08:09 juanpaucar joined
08:10 saussure joined
08:12 takle joined
08:13 <ertes-w> EvanR: yeah, that's how ^C is handled (by default)
08:14 <Lokathor> so is there some function "foo :: m Bool -> m () -> m ()" under a name that's not whenM somewhere?
08:15 darjeeling_ joined
08:15 romank joined
08:16 <cocreature> EvanR: you can see the interrupt handler in runMainIO in http://hackage.haskell.org/package/base-
08:16 <halogenandtoast> This solution in Yesod seems a bit crazy: https://github.com/commercialhaskell/stack-templates/blob/master/yesod-postgres.hsfiles#L86
08:16 <halogenandtoast> Anyone know why a logger function not dependent on foundation could not be created?
08:17 <ertes-w> nilOps: example: the way you kill a thread in haskell is to throw a ThreadKilled exception at it… if the thread never handles the exception, it just dies, but it can use the usual exception handling mechanism to do cleanup
08:17 aphorisme joined
08:18 <* hackage> liblawless 0.24.0 - Prelude based on protolude for GHC 8 and beyond. https://hackage.haskell.org/package/liblawless-0.24.0 (misandrist)
08:18 dni joined
08:19 <nilOps> Lokathor: Does `flip const` work?
08:19 ali_bush joined
08:19 renzhi joined
08:19 <Lokathor> nilOps, uhmmm, no >_>
08:19 <cocreature> Lokathor: why do you want it to be not named whenM?
08:19 biglama joined
08:20 <MarcelineVQ> Lokathor: right here, whenM p a = bool (return ()) a =<< p
08:20 <MarcelineVQ> now you don't need another lib
08:20 <Lokathor> cocreature, i looked for whenM and didn't find it
08:20 <cocreature> Lokathor: http://hoogle.haskell.org/?hoogle=whenm
08:20 <MarcelineVQ> https://hackage.haskell.org/package/extra-1.5.2/docs/Control-Monad-Extra.html#v:whenM
08:21 <Lokathor> aaagh!
08:21 <Lokathor> Control.Monad and monad-loops didn't have it
08:21 <Lokathor> too many monad packages
08:21 <cocreature> oh neat protolude has it
08:23 <MarcelineVQ> speaking of protolude this liblawless sounds preaty neat
08:26 primal joined
08:26 fbergmann joined
08:27 Yuras joined
08:29 irrequietus joined
08:32 montagy joined
08:33 <Lokathor> http://lpaste.net/355909 what's the one-liner form of this because using <$> directly is an error and i'm a little lost about it
08:33 path[l] joined
08:33 merijn joined
08:33 <halogenandtoast> Lokathor: it's >>=
08:33 <halogenandtoast> programFromSources s1 s2 >>= either die return
08:34 Argue joined
08:34 ventonegro joined
08:34 <Lokathor> ugh, right
08:34 <Lokathor> i guess 230am isn't a good coding time
08:36 <halogenandtoast> Lokathor: I appreciate your 230am coding
08:36 primal_ joined
08:36 <halogenandtoast> it's not every day I answer a question correctly on here
08:37 Sindriava joined
08:39 pmuir joined
08:39 Az4bove joined
08:39 target_i joined
08:40 Az4bove left
08:41 <quchen> Lokathor: do { eth <- programFromSources s1 s2; either die return eth }
08:41 whald joined
08:42 RegEchse joined
08:42 <Lokathor> thank you quchen, for that is surely what i meant
08:42 lep-delete joined
08:42 <Lokathor> i was a fool for not having seen it earlier
08:44 indi_ joined
08:44 takle joined
08:46 baldrick1 joined
08:50 takle joined
08:50 sz0 joined
08:51 <Lokathor> hackage doesn't list all of Float's typeclasses
08:51 <Lokathor> er, all of its instances
08:51 <Lokathor> how odd
08:51 <merijn> Lokathor: Which one doesn't it list?
08:52 mmn80 joined
08:52 <Lokathor> ghc says RealFrac
08:52 <Lokathor> but hackage doesn't have it
08:53 <Lokathor> ghc also lists a Fractional instance that seems to not be documented
08:54 xificurC joined
08:54 carc joined
08:54 ventonegro joined
08:54 twanvl joined
08:55 marr joined
08:56 merijn joined
08:56 <quchen> Lokathor: You’re welcome.
08:56 systadmin joined
08:57 RazorX joined
08:59 sternmull joined
09:00 Bardusbasium joined
09:00 takle joined
09:01 AerialBo1 joined
09:01 Itkovian joined
09:06 magthe joined
09:08 bollu joined
09:09 joco42 joined
09:12 dni joined
09:12 govg joined
09:12 juanpaucar joined
09:13 irrequietus joined
09:15 wroathe joined
09:15 litchblade joined
09:15 Quickquestion joined
09:16 romank joined
09:16 indi_ joined
09:16 MrCircuitMatt joined
09:16 dihuteno joined
09:16 MrCircuitMatt left
09:16 takle joined
09:17 <Quickquestion> Hey, can somebody help me? When I try to define a simple Anonymous function it won't let me in GHCi, am I forgetting something? The function is: \x -> x + 1.
09:17 dni joined
09:18 <Quickquestion> ah nvm I have to give it a name right as in q = \x -> x + 1. ?
09:20 mpsag joined
09:20 ErinvanderVeen joined
09:20 takle_ joined
09:21 sirreal joined
09:21 <ertes-w> Quickquestion: no, you don't need to name it
09:21 <ertes-w> > (\x -> x + 1) 5
09:21 <lambdabot> 6
09:22 <ertes-w> Quickquestion: note that there is a shorter notation called section syntax: (+ 1)
09:22 <ertes-w> > (+ 1) 5
09:22 <lambdabot> 6
09:23 <Quickquestion> how does section syntax work if I wanted ^2 would I write (^2) and then the variable?
09:23 <ertes-w> Quickquestion: (^2) = \x -> x^2
09:23 <ertes-w> > (^2) 5
09:23 <lambdabot> 25
09:23 <ertes-w> > map (^2) [1..]
09:23 eklavya_ joined
09:23 <lambdabot> [1,4,9,16,25,36,49,64,81,100,121,144,169,196,225,256,289,324,361,400,441,484...
09:24 <Quickquestion> ah thanks, didn't now about that
09:24 <ertes-w> Quickquestion: section syntax also works for the other argument
09:24 <ertes-w> > map (2^) [1..]
09:24 <lambdabot> [2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262...
09:24 <Quickquestion> does it also work with to inputs like? x and y?
09:24 <Quickquestion> if I wanted to add them
09:24 <ertes-w> sure, but that's not section syntax
09:25 <ertes-w> > (+) 3 5
09:25 <lambdabot> 8
09:25 <ertes-w> it's just the way you write infix functions in prefix form
09:25 <Quickquestion> what exactly is section syntax then? Anywhere I can read about it?
09:25 <Quickquestion> if I google it I don't find it anything specific
09:25 <ertes-w> Quickquestion: it's just a short-hand notation for fixing one argument of a binary function
09:26 <ertes-w> (# y) = \x -> x # y
09:26 <ertes-w> for all functions (#) and all values y
09:26 davr0s joined
09:26 <ertes-w> similarly: (y #) = \x -> y # x
09:27 netheranthem joined
09:28 indi_ joined
09:28 maybefbi joined
09:29 indi_ joined
09:30 augur_ joined
09:30 wroathe joined
09:31 cretiq joined
09:32 Quickquestion joined
09:36 quickquestionlag joined
09:36 <quickquestionlag> did I miss something, Internet is lagging
09:37 bennofs joined
09:38 Sampuka joined
09:39 ccomb joined
09:40 indi_ joined
09:41 louispan joined
09:41 jedws joined
09:42 oisdk joined
09:43 raichoo joined
09:43 fendor joined
09:45 yqt joined
09:48 zuck05 joined
09:50 ErinvanderVeen joined
09:50 indi_ joined
09:50 zero_byte joined
09:52 oisdk joined
09:53 hurkan joined
09:55 dec0n joined
09:58 romank joined
09:59 <reactormonk[m]> Is there a way to use reserved keywords as field names?
09:59 zuck05 joined
09:59 raichoo joined
09:59 oisdk joined
09:59 gawen joined
10:00 indi_ joined
10:02 <MasseR> reactormonk[m]: prefix or suffix with something else
10:02 <MasseR> _class and _type are used on some libraries
10:03 Yuras joined
10:03 <reactormonk[m]> MasseR: kk, sad :-/
10:04 TommyC joined
10:04 phaji joined
10:04 ericsagnes joined
10:05 Oxit_ joined
10:06 yellowj joined
10:07 oisdk joined
10:07 mkoenig joined
10:10 takle joined
10:12 cyborg-one joined
10:12 arquebus joined
10:12 zariuq joined
10:13 hurkan joined
10:13 sherub1 joined
10:15 <quchen> Quick interlude for the experienced Haskeller, GHC deviates from the Report in its desugaring of sections, https://github.com/quchen/articles/blob/master/fbut.md#a-op-is-not-x---a-op-x
10:16 <quchen> In other words, (a +) is not the same as \x -> a + x.
10:17 juanpaucar joined
10:19 zuck05 joined
10:19 dejanr_ joined
10:22 Oxit_ joined
10:22 uniclown joined
10:23 fragamus joined
10:24 dec0n joined
10:25 jedws joined
10:26 eklavya joined
10:26 saussure joined
10:26 cretiq joined
10:27 SkyPatrol_ joined
10:28 ziocroc joined
10:32 nakal_ joined
10:33 xtreak joined
10:34 xtreak joined
10:35 cpup joined
10:35 Oxit_ joined
10:35 jbiesnecker joined
10:36 nighty-- joined
10:38 zuck05 joined
10:38 zariuq joined
10:39 jgt joined
10:39 ^bschafer1 joined
10:40 Xanather joined
10:41 jhrcek joined
10:44 <fendor> hey, i want to use HTF for testing, and it does not like to compare Either types... assertEquals (Right 8) (Right 8) does not work
10:45 romank joined
10:46 <fendor> similar to quickcheck, prop_wahtever x = x == x does also not compile if the signature is (Arbitrary b, Arbitrary a, Eq b, Eq a) => Either b a -> Bool
10:46 joco42 joined
10:46 jaspervdj joined
10:46 joco42_ joined
10:47 <quchen> fendor: I like this trick, prop_whatever x = let _ = x :: Int in x == x
10:47 darthdeus left
10:48 <fendor> srsly?
10:49 <fendor> however, does not fix the problem :(
10:50 primal joined
10:50 <* hackage> diagrams-lib 1.4.1 - Embedded domain-specific language for declarative graphics https://hackage.haskell.org/package/diagrams-lib-1.4.1 (BrentYorgey)
10:50 nothingnew joined
10:54 paolino joined
10:54 <fendor> quchen, the error for the first question was, that he could not infer the Either, since tehre was no left value
10:54 Yuras joined
10:55 primal joined
10:55 <fendor> same for quickcheck
10:56 <fendor> so, Either b a is just too generic
10:56 <fendor> makes sense actually
10:56 worm004 joined
10:57 tromp joined
10:58 <magthe> a possibly silly question, do I need to tell GHC 8 to use concurrency (via -threaded) or is it the default nowadays?
10:58 <merijn> magthe: You need -threaded, yes
10:58 <merijn> magthe: Note, that it's only required for executables
10:59 <magthe> you don't happen to know if stack adds it by default?
10:59 <merijn> I don't use stack, so no :)
10:59 <ertes-w> quchen: i kinda expected that to be standard behaviour
10:59 <merijn> I'm not even sure that'd be a good idea
10:59 <quchen> ertes-w: ..?
10:59 <magthe> can I see on an executable was compiled with -threaded?
10:59 <merijn> magthe: Inside the executable or externally?
11:00 <quchen> ertes-w: I think it’s the other way round with (+ a).
11:00 <ertes-w> quchen: yeah
11:00 <magthe> merijn: externally, like ldd, RTS or something
11:00 unK_ joined
11:00 <merijn> magthe: I think ldd should be able to see it
11:00 <merijn> magthe: because -threaded simply links against a different RTS
11:01 <merijn> magthe: You can still use forkIO and co in the single threaded runtime, btw
11:01 eklavya joined
11:01 <merijn> magthe: If you wanna check inside your code, there's Control.Concurrent.rtsSupportsBoundThreads :: Bool which is True when linked with the threaded RTS and False if not
11:02 primal_ joined
11:02 <magthe> merijn: ok, thanks
11:02 Snircle joined
11:03 Yuras joined
11:04 <magthe> merijn: since I'm using sockets in my app I do believe I have something to gain by using -threaded (at least if I understand the docs in Control.Concurrent correctly)
11:04 rockfordal joined
11:04 <merijn> magthe: It depends on whether your sockets are busy enough to keep the CPU busy :)
11:05 ErinvanderVeen joined
11:05 <fendor> does someone now, if i can integrate coverage reports into travis?
11:05 <merijn> magthe: If you perform blocking IO (on, say, sockets) in the single threaded runtime your thread will get suspended and another one will run until the socket actually has data
11:05 <fendor> and or show docs?
11:06 <merijn> magthe: So, if your application is just copying data around from one socket to the other, you won't gain much. If you actually have enough socket IO that it's busy with that fulltime, then using the threaded runtime can improve things (since you can then have threads computing stuff while others handle sockets)
11:07 <LiaoTao> What kind of problems does -threaded introduce?
11:07 uniclown joined
11:08 <merijn> LiaoTao: It does't introduce problems, but some operations are much slower due to the need to synchronise
11:08 erikd_ joined
11:08 <LiaoTao> Okay
11:08 Boomerang joined
11:08 <magthe> merijn: I was under the impression that the socket IO functions were blocking, and that I'd need -threaded to make foreign calls not block
11:09 <merijn> LiaoTao: I did a bunch of benchmarks to measure what synchronisation primitive to use, compare the following measurements for threaded and non-threaded runtime
11:09 <merijn> LiaoTao: http://files.inconsistent.nl/sync.txt
11:09 <merijn> LiaoTao: http://files.inconsistent.nl/sync-threaded.txt
11:09 <merijn> magthe: By default foreign calls don't block
11:10 <magthe> merijn: ah, OK
11:10 <merijn> magthe: GHC already handles running foreign calls in a different thread, even in the single-threaded runtime :)
11:10 <LiaoTao> merijn: I don't quite understand what it's supposed to measure
11:10 <LiaoTao> Pearls before swine :)
11:10 <LiaoTao> I only got the gist of it before: TMVar
11:10 <merijn> LiaoTao: 1 thread waiting for N threads to signal they're done using different primitives
11:10 <LiaoTao> sucks
11:11 slackman joined
11:11 <magthe> merijn: useful, but sligthly confusing naming then... I suppose all (standard) IO functions are non-blocking, unless otherwise specified then
11:11 nilof joined
11:11 <merijn> LiaoTao: So "100 threads/Async" spawns 100 threads, blocks all of them. Then times how long it takes to go from signallig "go!" to "all threads signalled they finished"
11:12 <LiaoTao> Right, right
11:12 <LiaoTao> You said something abound the thundering herd problem, I recall
11:12 <merijn> magthe: Where, there's 2 different notions of blocking here: 1) blocking control flow (i.e. "won't proceed to the next operation until the previous has finished) and 2) blocking a thread (i.e. nothing can run on that thread until the call finishes)
11:13 latro`a joined
11:13 <merijn> magthe: GHC runs N capabilities (== threads executing haskell code) and the unthreaded runtime basically has "N == 1" (only 1 threads runs Haskell at a time), think Python GIL
11:14 <merijn> magthe: So if you do a foreign call in a capability, that would mean you now have "N-1" capabilities until the foreign call completes. That'd be annoying. So by default GHC does a "non-blocking" foreign call "i.e. perform the call from some other thread and block the haskell thread until the call is done". This leaves the capability free to run other haskell stuff
11:14 <merijn> LiaoTao: Yeah
11:15 <ertes-w> LiaoTao: i don't think i've ever used the single-threaded run-time in the last 5 years
11:15 halogenandtoast joined
11:16 <ertes-w> it's a safe default
11:16 <ertes-w> but unfortuantely it's not GHC's actual default
11:16 <merijn> magthe: A blocking foreign call means "the capability directly calls the foreign code and is unable to run Haskell code until the foreign call completes", whereas non-blocking foreign calls mean "the thread is suspended (i.e. control flow doesn't continue and it's "blocked" until the foreign call completes), BUT other Haskell can still run on that capability
11:16 <merijn> ertes-w: Well, my benchmarks indicate there's a HUGE gap for some operations
11:16 marr joined
11:16 <LiaoTao> I seem to remember having read something about Haskell making threading easier ;)
11:16 <merijn> ertes-w: Like, MVar operations are two orders of magnitude slower :)
11:16 juanpaucar joined
11:16 <LiaoTao> Didn't quite understand where it fit in when everything was still running on a single thread
11:16 felixsch1 joined
11:17 tomphp joined
11:17 <LiaoTao> But that's another issue, isn't it? The runtime and the actual code, I ean.
11:17 <LiaoTao> mean*
11:17 <merijn> LiaoTao: It makes things easier by decoupling "logical thread/control flow" from "actual execution"
11:17 <merijn> LiaoTao: In C threads are "heavy", so you can't have, e.g. "one thread per client", so you have to write complex hacks to share N clients across M threads
11:18 CurryWurst joined
11:18 <merijn> LiaoTao: Haskell threads (i.e. forkIO) is lightweight, you can easily have 100k threads on like a regular desktop and the runtime takes care of multiplexing those 100k threads across N OS threads without you thinking about it
11:19 <merijn> LiaoTao: So you can write simple blocking control flow for each client, and let the runtimes sort out the thread scheduling mess
11:19 <ertes-w> LiaoTao: concurrency is an abstraction… it doesn't mean that things necessarily run in parallel
11:19 <LiaoTao> So, it's basically implementing some sort of reactor pattern architecture?
11:19 <merijn> LiaoTao: The runtime is just doing a regular epoll/kqueue/whatever async loop in the end, yes
11:19 <LiaoTao> Oh well, that seems pretty nice
11:20 <LiaoTao> I always end up using boost::asio for threading in C++ anyway
11:20 <ertes-w> LiaoTao: it lets you handle things that are concurrent (like network connections) as separate control flows ("threads") and gives you the tools to support communication between those threads
11:20 <merijn> LiaoTao: Right, you end up getting the nice "reactor loop" without actually having to write it yourself :)
11:20 <merijn> Because writing reactor loops is ugly messy business
11:20 <LiaoTao> Mmm
11:21 <LiaoTao> Especially with mutable data and unclear ownership
11:21 <LiaoTao> (On top of the reactor, I mean)
11:21 <merijn> LiaoTao: The other thing is very limited mutable state, makes it harder to accidentally introduce data races/etc.
11:22 <LiaoTao> I used to think it meant that the compiler would automatically generate something akin to parallel_for because of the limited mutability
11:22 <ertes-w> LiaoTao: you can't have haskell's kind of concurrency in C++… imagine that 100 clients connect, and you have 4 OS threads running (perhaps because you have 4 CPU cores)… now imagine that 20 clients that were running on thread 1 disconnect at the same time… GHC's RTS will migrate the clients so that you got 20 running on each
11:22 <ertes-w> LiaoTao: this is incredibly difficult to program with explicit OS threading
11:23 <LiaoTao> ertes-w: Oh, definitely
11:23 halogenandtoast joined
11:24 <merijn> LiaoTao: There's some work for auto parallelisation for "strategies" too, but honestly explicit is better
11:24 <LiaoTao> Probably, yes
11:25 <LiaoTao> Solving "stupidly parallel" problems automatically is still a valid improvement! *hint hint*
11:25 <merijn> I tend to just fork N workers and create a Chan where everyone reads from
11:28 <ertes-w> merijn: even for pure computations?
11:29 ccomb joined
11:29 <merijn> ertes-w: I don't often have significant pure computation in the code I write
11:30 <ertes-w> ah… but yeah, i use the worker pattern a lot, too
11:30 <ertes-w> usually with STM
11:30 dni joined
11:30 wroathe joined
11:31 <ertes-w> merijn: regarding run-times: i think -threaded should be the default, and the single-threaded run-time should be optional for the cases when the extra overhead is really a bottleneck… personally i've never needed it
11:32 <merijn> ertes-w: I'm working on a better Chan type for that kinda worker pattern
11:32 <merijn> Since Chan isn't closable
11:32 cretiq joined
11:33 <ertes-w> merijn: you need Chan? i.e. dupable?
11:35 darlan joined
11:35 CurryWurst joined
11:36 saussure joined
11:36 <merijn> ertes-w: Dupable isn't necessary for that, no. Why?
11:37 <ertes-w> merijn: because TQueue is more efficient in exchange for not being dupable
11:38 yellowj joined
11:38 <ertes-w> and TMVar . Seq would be a variant that can be closed
11:38 <merijn> TQuee is more efficient in a very specific set of conditions
11:38 <merijn> ertes-w: Actually, my benchmarks show that TMVar is utter shite :)
11:38 worm004 joined
11:39 halogenandtoast joined
11:39 oisdk joined
11:40 <piyush-kurur> is there any reason why bytestring (and list module) does not expose and exact version of unfoldrN. By exact version I mean it always generates the bytestring of the given length
11:40 ziyourenxiang joined
11:40 jedws joined
11:40 <piyush-kurur> ofcourse the unfolding fucntion should have type acc -> (Word8, acc) instead of acc -> Maybe (Word8, acc)
11:41 saussure joined
11:41 <merijn> ertes-w: TQueue performs terrible under contention (as expected, tbh)
11:41 CurryWurst joined
11:42 Yuras joined
11:43 <merijn> Although it depends a lot on threaded vs unthreaded and exact contention pattern
11:43 mmn80 joined
11:43 <merijn> ertes-w: Although I haven't had time to really dive into the benchmarks and write things up
11:44 <merijn> I need some criterion tooling first, but don't have time right now. Hoping to sucker someone else into writing it for me :p
11:44 dejanr_ joined
11:45 <merijn> So far no luck :p
11:46 davr0s joined
11:46 saussure joined
11:48 ews joined
11:50 ErinvanderVeen joined
11:50 takle joined
11:51 Netwolf joined
11:51 uniclown joined
11:51 <ertes-w> hehe
11:52 silver joined
11:54 felixsch_ joined
11:54 PotatoCommando joined
11:54 PotatoCommando joined
11:55 cdg joined
11:56 <lambdamu> How significant is the overhead of Integer vs. Int for less then 32 (or 30 if that makes a difference) bit values?
11:56 dev-Zero_ joined
11:56 <merijn> hvr: As official Hackage bounds advocate and cabal expert, I have some questions for you: What kinda bounds should I put on stm? Seems it ships with GHC, so just specifying bounds on base should do, no?
11:56 <merijn> lambdamu: Small
11:57 tiny_test joined
11:57 <* hackage> http-client - An HTTP client engine https://hackage.haskell.org/package/http-client- (MichaelSnoyman)
11:57 <merijn> lambdamu: Well, depends on how many you have...but I wouldn't worry about it until profiling says it's a problem
11:57 govg joined
11:57 tromp joined
11:58 <merijn> Is it even possible to install a newer STM?
11:58 <lambdamu> merijn: So does it makes sense to convert everything to Integer at the input boundaries and work with that internally? I'm kinda sick of using specific C*, Word* and Int* types and call fromIntegral all the time
11:58 <lambdamu> Is that something people do?
11:59 <merijn> lambdamu: It's not unreasonable, no
11:59 maybefbi joined
11:59 fendor joined
12:00 Gurkenglas joined
12:00 takle joined
12:00 tabaqui joined
12:02 cschneid_ joined
12:03 <maybefbi> can a :: i -> ComduitM i o m a be designed so that it will yield the argument i before all other i, and without using (MonadState m) => i -> ComduitM i o m a as a type constraint?
12:03 <maybefbi> *ConduitM
12:03 <maybefbi> damn typos
12:04 saussure joined
12:04 wonko7 joined
12:04 <cocreature> maybefbi: should that be "ConduitM i i m a"? I’m not sure how that’s supposed to work with different input and output types
12:04 <maybefbi> oops yeah you are right
12:05 <maybefbi> so restated it becomes can a :: i -> ConduitM i i m a be designed so that it will yield the argument i before all other i, and without using :: (MonadState m) => i -> ConduitM i i m a as a type constraint?
12:05 fotonzade joined
12:06 felixsch1 joined
12:06 <cocreature> sure, just use >> to compose yield i and some "cat"-like conduit (not sure if that already exists or if you need to build it yourself)
12:07 <maybefbi> will >> do the trick even as a transformer, and not as a producer?
12:08 <cocreature> those are the same type. Producer is just a type synonym
12:08 <cocreature> so yes
12:09 <maybefbi> my understanding was that transformers will be "called" many times by the downstream conduits, so it will keep yielding the argument i
12:09 <maybefbi> anyways let me check
12:09 <cocreature> what exactly are you referring to by "transformer"? I can’t find a type or type synonym by that name in conduit
12:10 <maybefbi> cocreature, i mean this https://www.stackage.org/haddock/lts-8.15/conduit-combinators-1.1.1/Data-Conduit-Combinators.html#g:11
12:11 joco42 joined
12:12 Sindriava joined
12:12 ccomb joined
12:13 <magthe> merijn: as I said, confusing ;)
12:14 <merijn> magthe: The problem of mixing terminology from different levels :)
12:15 saussure joined
12:15 <magthe> merijn: indeed, but that what one gets with code solving complex problems
12:16 juanpaucar joined
12:16 dni joined
12:17 <magthe> merijn: I just have to try to sort it all out in my head some time
12:20 felixsch_ joined
12:21 _sras_ joined
12:22 <_sras_> Is there any cases where enabling Arrows extension can create a parse error in existing previously error free code?
12:22 Oxit_ joined
12:23 jbiesnecker joined
12:23 <Boomerang> Maybe if you defined your own custom (-<) operator.
12:23 <ertes-w> _sras_: if you used 'proc' as an identifier
12:27 sampuka joined
12:28 <_sras_> ertes-w: I am getting parse errors where and identifeer naemd "rec" is present...
12:28 <ertes-w> _sras_: ah, i don't know if this is a bug or not, but Arrows also brings in RecursiveDo with its 'rec' keyword
12:28 <ertes-w> it has done that since like forever
12:29 osa1 joined
12:29 spacecadetbrown joined
12:29 <_sras_> ertes-w: Yes.
12:29 primal joined
12:29 plutoniix joined
12:30 felixsch1 joined
12:31 <merijn> hmmm
12:31 plutoniix joined
12:32 Velizar joined
12:32 Velizar joined
12:32 <merijn> Two dependency questions: 1) Should I put a bound on STM or does that not make sense?, 2) if benchmarks/tests/executables depend on my library, can I leave out bounds since they'll be transitively enforced by the library?
12:33 saussure joined
12:33 felixsch_ joined
12:33 <lyxia> yes and yes
12:33 jedws joined
12:34 <_sras_> ertes-w: aren't arrow notations not supported by template haskell QuasiQuoter?
12:34 <merijn> lyxia: What bounds should I enforce on STM? AFAIK it ships with GHC and I already have bounds on base?
12:35 <cocreature> merijn: if in doubt just add pvp-style bounds like you do for anything else?
12:36 <merijn> cocreature: I have no clue how to add sane PVP bounds either :p
12:37 <cocreature> merijn: given that 2.4 is the latest version >= 2.4 && < 2.5 seems pretty safe
12:39 saussure joined
12:40 Sindriava joined
12:40 takle joined
12:41 yellowj joined
12:42 mmhat joined
12:42 zuck05 joined
12:42 Sindriava joined
12:42 cretiq joined
12:43 <merijn> Time to see if I broke anything...
12:44 saussure joined
12:44 umib0zu joined
12:44 primal_ joined
12:45 yellowj joined
12:45 mnoonan joined
12:47 sherub1 joined
12:48 felixsch1 joined
12:49 saussure joined
12:49 felixsch2 joined
12:49 FreeBirdLjj joined
12:50 ErinvanderVeen joined
12:51 ^bschafer1 joined
12:51 felixsch_ joined
12:52 lambdaTom joined
12:52 sdothum joined
12:53 oisdk joined
12:53 dni joined
12:53 im0nde joined
12:53 uniclown joined
12:54 saussure joined
12:54 argent0 joined
12:55 bennofs joined
12:55 felixsch1 joined
12:56 unK_ joined
12:57 <dihuteno> what's the right way to test that my parser combinators are handling all my edge cases?
12:57 primal joined
12:57 guardianx joined
12:57 <[exa]> fuzzing!
12:57 <dihuteno> I feel like if I try to generate arbitrary strings I'd just make the same mistakes when generating that I made when trying to parse
12:57 <ventonegro> test the edge cases?
12:57 <* [exa]> hides
12:58 <dihuteno> is just manually writing out a lot of test cases frowned upon in the haskell community?
12:59 <ertes-w> dihuteno: if you can generate them, you should
12:59 <merijn> Testing parsers is hard
13:00 <dihuteno> ertes-w: even if the rules to generate them are suspiciously similar to the rules to parse them?
13:00 <lyxia> merijn: It ships with GHC but it's quite possible to still use a different version
13:00 <dihuteno> I just don't trust myself to not make the same mistakes twice
13:01 <mfukar> dihuteno coverage-based fuzzers require no such knowledge
13:01 felixsch_ joined
13:02 primal_ joined
13:02 juanpaucar joined
13:02 <lyxia> dihuteno: unit tests are still a good idea in Haskell
13:03 <ertes-w> dihuteno: think of a special case, then write a generic fuzzer that is capable of generating it
13:03 <ertes-w> then it's morally ok, if the generator looks very similar to the parser
13:03 <ertes-w> i mean it's not surprising that it does =)
13:04 felixsch1 joined
13:05 saussure joined
13:07 WarmCookie joined
13:08 oisdk joined
13:09 juanpaucar joined
13:09 Sindriava joined
13:10 <merijn> bleh
13:10 <merijn> Any advice on how to avoid defaulting warnings when using ^?
13:10 <merijn> Am I stuck annotating the right hand every time?
13:11 hpc joined
13:11 <cocreature> merijn: huh? I guess you are not referring to the lens operator "^?"?
13:11 <cocreature> oh now the question parsed
13:11 <cocreature> nvm
13:11 <merijn> No, like
13:11 <merijn> > 10^4
13:11 <lambdabot> 10000
13:12 primal joined
13:12 <merijn> I was using 1e4 with -XNumDecimals, but that breaks my benchmarks on old GHC, since those don't have NumDecimals yet
13:12 mbrock joined
13:12 joco42 joined
13:12 <merijn> I guess I could shadow Prelude.^ but that's also not ideal...
13:13 entuland joined
13:14 eminhi joined
13:15 Bardusbasium joined
13:16 <_sras_> ertes-w: Can't template haskell quotes handle arrow expression? I am getting an error that says "Expression form not (yet) handled by template haskell" ?
13:17 zero_byte joined
13:18 <cocreature> merijn: custom prelude ftw :)
13:18 <* ertes-w> has little TH/QQ experience
13:18 kmels joined
13:18 felixsch1 joined
13:19 <merijn> cocreature: Like I said, NumDecimals works, but that's giving me issues with old GHCs. Custom prelude isn't a very good solution to benchmarks in a package with a minimal dependency footprint
13:19 <merijn> Relatedly
13:19 <merijn> How do I figure out in which GHC a flag was added?
13:19 <cocreature> merijn: sry I was mostly trolling :)
13:19 jathan_ joined
13:19 <merijn> -Wno-orphans appears to exist in GHC8.0, but not in 7.10?
13:19 <cocreature> although my life has become a lot better since I’ve started using custom preludes
13:19 <* hackage> hsdev - Haskell development library https://hackage.haskell.org/package/hsdev- (AlexandrRuchkin)
13:20 eklavya joined
13:25 felixsch_ joined
13:25 <glguy> merijn: the -W flags like that are all new
13:26 <merijn> glguy: hmmm, so what do I use for older GHCs?
13:27 <glguy> merijn: it'll start with -f , I recommend using ghc --show-options | grep orphan
13:27 Big_G joined
13:27 <cocreature> merijn: -fno-warn-orphans?
13:28 Sindriava joined
13:28 svgDelux joined
13:28 <merijn> oh, right
13:29 felixsch1 joined
13:30 Neeeewbie joined
13:30 takle joined
13:31 wroathe joined
13:31 <Neeeewbie> Hello, when I try to use the isLower, toLower or simmiliar functions it won't work, do I have to load a module first?
13:31 eklavya_ joined
13:31 <Neeeewbie> for example isLower 'a' returns me that my variable is not in scope
13:32 <cocreature> Neeeewbie: you need to import the module Data.Char
13:32 <Neeeewbie> how do I import that module? :load doesn't work
13:32 <Akii> :m +Data.Char
13:33 <Akii> (in GHCI)
13:33 <quchen> Neeeewbie: :module +Data.Char adds the Data.Char module.
13:33 <quchen> Neeeewbie: »import Data.Char« does the same, this one works like in normal Haskell.
13:33 <quchen> You can also remove selected modules, :module -Data.Char, for example.
13:33 <Neeeewbie> aaah ok :m stands for module I assume and +Data.Char specifys which module.
13:33 <quchen> :m is a shorthand for :module.
13:33 <Neeeewbie> Is it possible to add several modules?
13:33 <quchen> :m Data.Char loads only Data.Char, and drops all other modules.
13:34 <quchen> :m +Data.Char +Data.Ord -- Loads Char and Ord.
13:34 <quchen> :l (:load) loads files, :m loads installed modules.
13:34 <Neeeewbie> aaaah
13:34 <Neeeewbie> that makes sense
13:35 <quchen> We usually :l our own code, and :m other modules.
13:35 juanpaucar joined
13:35 <ertes-w> Neeeewbie: also in the error message pay attention to *which* variable is not defined =)
13:36 <Neeeewbie> are modules code aswell( I know they technically are), or would they better be described as something else? Like additionional functions?
13:36 <Neeeewbie> will do! Thanks :)
13:36 red_crow joined
13:37 dsh joined
13:37 kyle1320 joined
13:37 simukis joined
13:37 <ertes-w> Neeeewbie: modules are name-spaces for top-level definitions
13:37 _flow_ joined
13:38 <ertes-w> by importing a module you can refer to things defined in that name-space
13:39 <ertes-w> the full(y qualified) name of 'toLower' is Data.Char.toLower
13:41 <Neeeewbie> ah so I can use the function without loading the module if I write it's full name
13:41 <quchen> Modules are pretty much »big ›where‹ blocks«.
13:41 sepp2k joined
13:42 <maybefbi> any chance a Data.Conduit.ConduitM can sort without using too much memory?
13:42 _flow_ joined
13:42 <c_wraith> sorting would seem to require holding an arbitrary amount of data in memory
13:43 _flow_ joined
13:43 <maybefbi> yes :(
13:43 saussure joined
13:45 <maybefbi> im thinking of having a "min heap" inside a conduit's monad, and then yielding the lowest key
13:45 <maybefbi> but i dont have theoretical guarantees on the size of the heap
13:46 <c_wraith> You can't, unless you restrict the problem further.
13:46 <c_wraith> Like, if you're dealing with streaming logs that might be slightly out of order, you can use a windowed sort
13:46 connrs joined
13:46 <* maybefbi> googles windowed sort
13:46 primal_ joined
13:46 juanpaucar joined
13:48 <ertes-w> maybefbi: you can sort without having everything in main memory by using disk-backed merge-sort
13:48 <maybefbi> ok it seems like the order is only true within the window. im trying to sort links by a score for each of them which is known by the time the sort conduit is reached in the flow
13:49 <hvr> merijn: stm is released independently from GHC; it doesn't come w/ GHC
13:49 <maybefbi> ertes-w, disk backed merge sort. not sure how to implement that. let me check
13:49 <ertes-w> maybefbi: sort blocks of a fixed length, write them somewhere, then at the end merge them all together
13:49 davr0s joined
13:50 <ertes-w> maybefbi: merging sorted sequences only requires O(k) memory, where k is the number of blocks
13:50 <maybefbi> ok
13:50 tromp joined
13:50 <ertes-w> maybefbi: but you can merge pairwise, then you only ever need O(1) memory while merging
13:51 <maybefbi> wow
13:51 <quchen> You can merge k-wise, then you only ever need O(1) while merging as well ;-)
13:51 <quchen> For fixed k, that is.
13:51 puregreen joined
13:52 <ertes-w> "17314982" -sort-> "17", "13", "49", "28" -merge-> "1137", "2489" -merge-> "11234789"
13:53 fragamus joined
13:53 jathan joined
13:53 jbiesnecker joined
13:53 <maybefbi> i guess i will have to use :: (Serialize i, MonadIO m, Monad m) => ConduitM i i m () for this.
13:53 <merijn> hvr: Yeah, I ended up putting a bound on it since the latest version just runs with every GHC I want anyway :)
13:55 uniclown joined
13:56 <maybefbi> seems like popping values out of a min heap is easier to implement although less safe, but then i will have to use MonadState m to store the heap
13:56 <maybefbi> inside the conduit
13:56 jbiesnecker_ joined
13:57 _sras_ joined
13:57 <_sras_> Is there any way to generate code that uses Arrows using template haskell?
13:58 jmcarthur joined
13:58 <_sras_> I am getting error the error that says 'Expression form not (yet) handled by Template Haskell'..for code that uses the proc() notation
13:58 cdg joined
13:59 <lyxia> just use regular Arrow functions
14:01 mjs2600 joined
14:03 mada joined
14:03 JuanDaugherty joined
14:03 <_sras_> lyxia: didn't get you.
14:04 <merijn> _sras_: proc notation is just syntactic sugar for existing arrow functions, afaik
14:04 <merijn> _sras_: So even if it doesn't support proc notation you can use the functions directly
14:07 felixsch1 joined
14:07 GreySunshine left
14:08 Welkin joined
14:08 lambdaTom joined
14:08 halogenandtoast joined
14:08 <_sras_> merijn: I have no idea how proc notation is desugared....
14:09 marr123 joined
14:10 bennofs joined
14:10 takle joined
14:11 gmhafiz_ joined
14:12 felixsch_ joined
14:12 Wuzzy joined
14:15 joco42 joined
14:15 wei2912 joined
14:16 augur joined
14:22 <tabaqui> I'm not sure, but it looks like a bug in haskell-tls
14:22 <tabaqui> *hs-tls
14:23 <tabaqui> with hostname resolution
14:23 <tabaqui> it skips a check if domain name cannot be resolved
14:23 <merijn> Well, let's see whether my 6th commit will actually fix all the old GHC issues I had >.>
14:24 Jackoe joined
14:24 <cocreature> merijn: I predict that in your 7th commit you’ll drop support for old GHCs
14:24 TheFuzzball joined
14:25 mohsen_ joined
14:26 <merijn> cocreature: Naah, it's not hard to fix, it's just that I don't have a 7.4 locally, so I get stupid shit like: Forgot to import Control.Applicative, missing ghc-prim dependency because base doesn't reexport GHC.Generics yet, etc.
14:27 mohsen_ joined
14:27 hlosempai joined
14:27 theelous3 joined
14:27 <cocreature> merijn: huh, 7.4. I already feel like I’m doing a good job supporting old GHCs when I’m supporting the last 3 versions :)
14:27 toby_ joined
14:27 <merijn> cocreature: It's actually fairly trivial to support old GHC, since I literally have only 2 dependencies for my actual code (base and transformers, and since GHC 8 it's only base). It's my benchmarks that have more dependencies :p
14:28 Adios joined
14:29 <merijn> 8th commit, because I managed to mess up < and <= :p
14:29 Oxit_ joined
14:30 <cocreature> merijn: I once managed to get a PR into protolude that changed sum and product to be strict but I managed to screw up the implementation of product and it actually calculated the sum :)
14:30 <cocreature> so messing up < and <= seems pretty harmless compared to that :)
14:31 mmhat joined
14:32 <merijn> cocreature: Well, especially since it just means it doesn't build with 7.4 rather than being actually wrong
14:34 mac10688 joined
14:35 ErinvanderVeen joined
14:35 jonas_ joined
14:35 Itkovian joined
14:36 <jonas_> @undo do x <- [3..4] ; [1..2] ; return (x, 42)
14:36 <lambdabot> [3 .. 4] >>= \ x -> [1 .. 2] >> return (x, 42)
14:36 montagy joined
14:36 felixsch1 joined
14:36 <jonas_> @undo do x [1,2,3,4]; "curry"
14:36 <lambdabot> x [1, 2, 3, 4] >> "curry"
14:36 eschnett joined
14:36 isBEKaml joined
14:37 <halogenandtoast> what is @undo?
14:37 <halogenandtoast> desugaring?
14:38 <Rotaerk> looks like
14:38 <jonas_> yea
14:39 <halogenandtoast> alright thanks, off to bed
14:40 <jonas_> @undo do [1,2,3,4]; "curry"
14:40 <lambdabot> [1, 2, 3, 4] >> "curry"
14:40 oisdk joined
14:40 <merijn> And...onto fix commit 9 >.>
14:40 <merijn> Time to hit the gym, I guess :p
14:40 tkuriyama joined
14:41 systadmin joined
14:41 <_sras_> jonas_: is there an @unproc similar to @undo?
14:42 halogenandtoast joined
14:42 saussure joined
14:43 <_sras_> @unproc proc () -> do; r <- qt a -< ();restrict -< r ^.id .== r ^. id ; returnA -< r;
14:43 <lambdabot> Unknown command, try @list
14:43 <_sras_> @undo proc () -> do; r <- qt a -< ();restrict -< r ^.id .== r ^. id ; returnA -< r;
14:43 <lambdabot> <unknown>.hs:1:10:Parse error: ->
14:44 oisdk joined
14:45 Achylles joined
14:45 <lyxia> GHC has the -ddump-ds options but it can take some effort to read
14:46 <hanna> is there a way to make an IO () “uninterruptible?” i.e. won't be interrupt even if there's an external exception (like a SIGTERM)
14:46 whald joined
14:46 <Athas> Signal mask, maybe?
14:46 eklavya joined
14:47 <hanna> The problem: I have two IO () actions that are both atomic database updates, but I need to make sure my program doesn't somehow get killed in between the two database updates
14:47 <Athas> That is impossible.
14:47 <Athas> You cannot ignore SIGKILL.
14:47 <Athas> Also, the power might go off.
14:47 <hanna> That's true, but I'm willing to ignore both of those
14:47 <Athas> Use a database transaction. Anything else is just ineffectual.
14:47 uniclown joined
14:47 <hanna> They're different databases
14:47 <hanna> That's the problem
14:48 <Athas> Use https://hackage.haskell.org/package/unix- to mask the signals you want to ignore.
14:48 <Athas> But that design is not sound and will bring misery.
14:48 <hanna> Honestly I'm just interested in SIGTERM
14:48 <hanna> So that seems like a solution
14:49 <hanna> The desired goal is to make it so ^C is a harmless action
14:49 <[exa]> hanna: anyway, afaik ^c sends SIGINT
14:50 <hanna> oh, right
14:50 ErinvanderVeen joined
14:51 <cocreature> and GHC installs a signal handler by default which converts that into an exception
14:51 <Athas> You could also wrap the entire thing in a 'catch'-block that looks for SIGINTs, and then roll back the first operation.
14:51 Johan_L joined
14:51 <[exa]> and you probably want to also catch stuff like SIGHUP, I guess closing the terminal is "just like ^c"
14:51 <cocreature> so just "mask" will do the job if you are only interested in C-c
14:51 <Athas> cocreature: out of curiosity, is there an elegant way to do synchronous signal handling in Haskell (ala signalfd())?
14:52 <Athas> I would never use asynchronous signals in a C program.
14:52 <Athas> (Although turning signals into exceptions does make them somewhat more manageable.)
14:53 shesek joined
14:53 shesek joined
14:54 <cocreature> Athas: not sure, I never cared about any other signal than SIGINT in haskell
14:54 carlomagno joined
14:54 <Athas> Also a viable solution, I suppose.
14:55 <ertes-w> hanna: alternatively you can keep a progress file, so if the power goes out, you can continue where you left off
14:56 felixsch_ joined
14:56 <hanna> I don't understand how I would keep a progress file in such a way that I could figure out after the fact whether the IO () succeeded or not
14:57 <Athas> You cannot; you'd need to make the cleanup idempotent, the way file systems or databases implement journals.
14:57 <Athas> This is definitely something you want to make someone else's problem if at all possible!
14:58 <hanna> actually I know how
14:58 carlomagno joined
14:59 Henson joined
14:59 <ertes-w> hanna: that's quite difficult… mdadm does something like that when you make certain --grow changes
14:59 tkuriyama joined
14:59 tkuriyama left
15:00 <hanna> I'll just augment my state with a Maybe Intent where data Intent = list of IDs I'm about to process. Before I process them I can commit a Just intent; and after I process them I can set it to Nothing. If I start up the program and notice my intent is Just something I need to go through the list of IDs and remove them one by one if they're present
15:00 cpennington joined
15:00 <ertes-w> hanna: but honestly i'd say if you really need to rely on such a thing, you should look for a better data/application design
15:00 <hanna> ertes-w: What would you proposE?
15:00 <hanna> I'm open to alternatives
15:00 <ertes-w> or at least try to make this operation idempotent
15:00 <ertes-w> hanna: i haven't read the whole backlog… could you summarise your application?
15:01 cschneid_ joined
15:02 <hanna> ertes-w: I process posts (given a range of IDs) and store them in a xapian database. I'm using acid-state to keep track of which IDs I've processed and which I haven't, as well as other metadata. Whenever I commit a batch of IDs, I do it like this: 1. runXapian (beginTransaction >> storeAllInXapianDatabase ids >> endTransaction); 2. Acid.update (processedIDs ids)
15:02 <hanna> The problem is that in practice, if my program dies in between step #1 and step #2, I will have stored those IDs in the xapian database but not recorded their “processed” status in the acid database
15:03 <_sras_> Can someome please desugar this code that uses arrow notation http://lpaste.net/355913 ?
15:03 <ertes-w> hanna: why xapian?
15:03 sssilver joined
15:03 <hanna> ertes-w: xapian provides effigcient tag search that scales to millions of documents; and it's also what the front-end is using
15:04 <ertes-w> hanna: does xapian have transactions?
15:04 <hanna> xapian also does lots of other useful things, like term synonyms, spelling correction, natural language search, etc.
15:04 <hanna> ertes-w: yes, that's what “beginTransaction” and “endTransaction” refers to
15:04 <ertes-w> hanna: can it store non-textual data?
15:05 <hanna> It only stores documents
15:05 <hanna> In principle I could make my own “pseudo-document” with a fixed ID (e.g. 1) to store some metadata though
15:05 <ertes-w> hanna: reason i'm asking is: why don't you just use xapian itself to store progress?
15:05 <hanna> I'm trying to avoid relying too much on xapian
15:05 <hanna> Getting data in and out of xapian is difficult, certainly much more difficult than acid-state
15:05 <ertes-w> hanna: there is no other choice… you can't synchronise acid-state with xapian
15:05 <hanna> I came up with a solution, didn't I?
15:06 <ertes-w> no… what happens if your power goes out just after xapian has committed the transaction?
15:06 marr joined
15:07 <hanna> If the power goes out after xapian commits but before I run the acid-state progress update, my `intent` would still be set to Just (list of document IDs) and I could go through and delete those IDs from xapian
15:07 <hanna> to “rollback”
15:08 bortevik joined
15:08 <ertes-w> ok, then what's the problem?
15:08 eSVG joined
15:09 <hanna> Nothing?
15:09 <hanna> You're the one telling me to change my database design :D
15:10 <* hackage> safeio - Write output to disk atomically https://hackage.haskell.org/package/safeio- (luispedro)
15:11 <ertes-w> hanna: because you were hasking about a way to make sure that an operation never interrupts, which is impossible =)
15:11 <ertes-w> hasking? hah!
15:11 <cocreature> ^ that package seems surprisingly relevant to the current discussion
15:12 <hanna> Well in my case both xapian and acid-state already take care of disk I/O, journaling, rollbacks, transactions etc.
15:12 <hanna> I'm left with the much simpler task of simply synchronizing the two
15:13 <ertes-w> yeah, well, if you can rollback to a consistent state before users ever see the inconsistent one, everything is fine
15:13 svgDelux joined
15:15 spinus joined
15:16 takle joined
15:17 <magicman> This is great. I just changed where a bit of data resides (from an MVar to Postgres), and GHC is kicking my ass. However, at the end of the day I feel pretty good that stuff still works.
15:17 <fendor> someone ever tried to use coveralls.io to show coverage information in haskell
15:17 <fendor> ?
15:18 yqt joined
15:19 Cale joined
15:19 <ertes-w> no, because it would hardly ever get past 5% for me =)
15:20 dejanr_ joined
15:20 chalkmonster joined
15:23 tkuriyama joined
15:24 Croniamental joined
15:24 uniclown joined
15:25 jao joined
15:26 eSVG joined
15:26 <fendor> :(
15:26 <Cale> What was the question? :)
15:27 <* hackage> camfort 0.902 - CamFort - Cambridge Fortran infrastructure https://hackage.haskell.org/package/camfort-0.902 (madgen)
15:27 primal joined
15:27 <jgt> if I'm using `stack runghc`, how do I enable `--pedantic`? aka: `--ghc-options="-Wall -Werror"`?
15:27 <fendor> Cale, the concrete question is, what configuration people have used to publish coverage resutls to coveralls.io
15:28 LKoen joined
15:29 jae2 joined
15:29 <ertes-w> is coveralls.io the new way TDD hipsters compare their dicks/boobs?
15:29 CheesecakeTempla joined
15:30 <Henson> hi everyone. I'm extracting data from HTML files using HXT, and reading it into Maybes in case some data can't be read. Then I want to work with those Maybes to build up other data, with the possibility of it being okay if some data is missing. If I were to use a Maybe monad to work in a natural way with the data, as soon as a Nothing is encountered the entire computation will fail. Is there..
15:31 <Henson> some natural way of working with Maybes where you can specify that some things are optional. This totally reminds me of the "optional" and "required" keywords in Applicative, but that seems to be more for parsers. Is Applicative the right direction, or is there something else I should be trying?
15:31 Lthere joined
15:31 wroathe joined
15:31 <ertes-w> Henson: the Alternative class is about alternatives
15:31 <ertes-w> > Just 3 <|> Just 4
15:31 <lambdabot> Just 3
15:31 <ertes-w> > Nothing <|> Just 4
15:31 beanbagula joined
15:31 <lambdabot> Just 4
15:34 sssilver joined
15:34 <Henson> ertes-w: ok, I came across that stuff while reading the Applicative haddock, and that seemed to be the right thing, I just didn't know if I was missing something else that would be better suited. Thanks for the information!
15:34 tkuriyama joined
15:36 cpup joined
15:37 primal_ joined
15:39 <fendor> ertes-w, well, actually i just wanted to try ut but thanks...
15:39 Bassetts joined
15:40 jbiesnecker joined
15:41 afarmer joined
15:42 umib0zu joined
15:44 {emptyset} joined
15:46 robotroll joined
15:46 <* hackage> logging-facade 0.2.0 - Simple logging abstraction that allows multiple back-ends https://hackage.haskell.org/package/logging-facade-0.2.0 (SimonHengel)
15:47 osa1 joined
15:47 osa1 joined
15:50 <_sras_> Can someone please desugar this code that uses proc notation http://lpaste.net/355913 ?
15:52 kadoban joined
15:52 CacoS joined
15:53 tzh joined
15:54 jdnavarro joined
15:55 montagy joined
15:56 jamie_ joined
15:57 felixsch1 joined
15:58 cdg joined
16:02 fbergmann joined
16:03 trism joined
16:03 urodna joined
16:04 <Welkin> is there an easy way to type unicode characters into emacs such as ∀?
16:06 eminhi joined
16:06 jgertm joined
16:07 <bytesighs> Welkin: http://haskell.github.io/haskell-mode/manual/latest/Unicode-support.html
16:07 dejanr_ joined
16:10 <Welkin> bytesighs: thanks!
16:10 <Welkin> do you know if purescript-mode supports the same?
16:10 relja joined
16:10 cdg joined
16:11 wroathe joined
16:12 <bytesighs> It seems so; https://github.com/dysinger/purescript-mode/blob/master/purescript-unicode-input-method.el
16:12 iqubic joined
16:14 BlueRavenGT joined
16:15 JagaJaga joined
16:15 joco42 joined
16:16 felixsch_ joined
16:18 kmels joined
16:18 svgDelux joined
16:18 uniclown joined
16:19 <iqubic> Anyone here, or is it too early
16:19 <iqubic> ??
16:19 felixsch1 joined
16:20 ErinvanderVeen joined
16:20 <jamie_> screen
16:21 ccomb joined
16:21 <Welkin> there si always someone here
16:21 <Welkin> we are from all around the world
16:21 wroathe joined
16:22 cretiq joined
16:22 Sose joined
16:23 nbro joined
16:23 eSVG joined
16:23 sssilver joined
16:24 <earthy> early? it's 18:24!
16:24 <Clint> no it isn't; it's may
16:25 shangxiao joined
16:25 <Welkin> Clint: it's high noon
16:25 <Welkin> and all you have is a fistful of monads
16:27 primal joined
16:30 jamie_ joined
16:31 brezel joined
16:31 teqwve joined
16:31 navilan joined
16:32 ertes joined
16:33 louispan joined
16:34 bennofs joined
16:35 jbiesnecker joined
16:35 tput joined
16:36 tromp joined
16:36 dejanr_ joined
16:41 zero_byte joined
16:42 gienah joined
16:42 halogenandtoast joined
16:42 sleffy joined
16:45 alx741 joined
16:46 bydo joined
16:46 spacecadetbrown joined
16:46 alx741 joined
16:46 SpinTensor joined
16:47 mjs2600 joined
16:50 ErinvanderVeen joined
16:52 umib0zu joined
16:54 pylbrecht joined
16:54 saussure joined
16:56 Deide joined
16:57 svgDelux joined
16:57 MarioBranco joined
16:59 tkuriyama joined
17:01 et09 joined
17:03 MarioBranco joined
17:03 cretiq joined
17:05 CaptainLex_ joined
17:06 dante joined
17:06 eSVG joined
17:11 <* hackage> LambdaHack - A game engine library for roguelike dungeon crawlers https://hackage.haskell.org/package/LambdaHack- (MikolajKonarski)
17:12 Johan_L joined
17:13 <* hackage> sum-type-boilerplate 0.1.0 - Library for reducing the boilerplate involved with sum types https://hackage.haskell.org/package/sum-type-boilerplate-0.1.0 (jdreaver)
17:13 <* hackage> Allure - Near-future Sci-Fi roguelike and tactical squad game https://hackage.haskell.org/package/Allure- (MikolajKonarski)
17:14 Bassetts joined
17:14 grizwako joined
17:15 jamie_p joined
17:16 acidjnk22 joined
17:16 <Welkin> look, haskell games
17:17 joco42 joined
17:19 fragamus joined
17:20 meba joined
17:22 <lyxia> I love playing with sum types.
17:22 <MarcelineVQ> it's always positive
17:23 <Welkin> MarcelineVQ: data Nat = Succ Nat | Z
17:23 <Welkin> :D
17:23 <Welkin> always positive
17:23 felixsch_ joined
17:24 jamie_p joined
17:26 uniclown42 joined
17:27 Ariakenom joined
17:27 TheFuzzball joined
17:27 benjic joined
17:28 yungclowns joined
17:28 Costar joined
17:29 oisdk_ joined
17:29 mjs2600 joined
17:29 uniclown joined
17:29 Yuras joined
17:29 <juanpaucar> has somebody used simple postgres and pass an argument as for a table name?
17:29 <juanpaucar> I can't figure out how it should be done
17:30 saussure joined
17:32 juanpaucar joined
17:32 jamie_p joined
17:33 kritzcreek joined
17:33 twanvl joined
17:36 jbiesnecker joined
17:38 biglama_ joined
17:39 augur joined
17:40 cdg joined
17:41 uiop joined
17:42 latro`a joined
17:42 dsub joined
17:42 cyborg-one joined
17:42 fendor joined
17:42 zachk joined
17:43 <Cale> @tell juanpaucar There is a newtype Identifier which you should wrap the table name in for postgresql-simple to splice it in with the correct quoting.
17:43 <lambdabot> Consider it noted.
17:43 tkuriyama joined
17:44 <Cale> @tell juanpaucar https://hackage.haskell.org/package/postgresql-simple-
17:44 <lambdabot> Consider it noted.
17:44 <Lokathor> thang1, you were saying "i don't think people use let in code" https://github.com/Lokathor/hexes/blob/master/src/Hexes/Internal/Types.hs#L224
17:49 dsub joined
17:49 tkuriyama left
17:52 RegEchse joined
17:54 felixsch1 joined
17:54 jimmyrcom joined
17:56 <iqubic> How was that Sci-Fi Game made?
17:56 <iqubic> How the heck did he do output, and how did take input?/
17:56 SkyPatrol joined
17:57 <tuturto> not only a game, but a game engine too
17:57 <iqubic> Did he he use the LambdaHack package? Or what?
17:58 <tuturto> yeah, he did
17:58 ianandrich joined
17:58 <tuturto> (he wrote that too)
17:58 <iqubic> I think I'll be learning that in the near future.
17:59 <iqubic> Or at least disecting it to see how it works.
17:59 <tuturto> it's fun
17:59 <tuturto> I started tinkering with that a while ago: https://github.com/tuturto/space-privateers
17:59 <tuturto> should update to new version and continue
17:59 <iqubic> Would it be possible to make a Minecraft Clone in Haskell?
17:59 mizu_no_oto joined
17:59 <iqubic> Is Haskell the right language for Game Dev?
18:00 sssilver joined
18:00 takle joined
18:00 augur joined
18:01 <iqubic> Also why are all the links to the online documentation for LambdaHack gone?
18:01 entuland joined
18:01 <iqubic> None of the module names link to anything at all.
18:02 <Welkin> the docs didn't build
18:02 <Welkin> a common problem on hackage
18:02 <iqubic> So how do I view the docs?
18:02 <Welkin> so someone would need to build the docs locally and push them up
18:02 <iqubic> And when will this issue be fixed?
18:02 <Welkin> you can download the package and buld locally with hackage
18:02 <Welkin> build*
18:02 joco42 joined
18:02 <Welkin> having local docs is better anyway
18:02 wroathe joined
18:02 <iqubic> Hackage can be installed locally?
18:02 <Welkin> yes
18:02 <iqubic> How do I do that?
18:02 fendor joined
18:02 <Welkin> you can use hoogle locally too
18:03 <iqubic> Welkin: I do use hoogle locally.
18:03 <tuturto> https://lambdahack.github.io/ is neat
18:03 <iqubic> How do I get Hackage installed locally?
18:04 n_blownapart joined
18:04 safe joined
18:05 ErinvanderVeen joined
18:05 <EvanR> iqubic: i am doing "game dev" right now in haskell
18:05 <n_blownapart> hi I have a 32bit linux machine . I don't know emacs / spacemacs *at all* and need a simple editor for haskell. suggestions please. I can use Atom and the haskell-ide fairly well but don't want that on this little machine.
18:05 <Welkin> iqubic: I didn't mean hackahe, I meant haddock
18:06 <EvanR> but im trying to make it theoretically sound, and so it may never work out, and so im either not the right person to ask or that answers your question
18:06 <Welkin> hackage*
18:06 nbro joined
18:06 ErinvanderVeen joined
18:06 <iqubic> EvanR: What kind of games are you making in Haskell right now?
18:07 <zachk> n_blownapart: vim?
18:07 <michi7x7> n_blownapart: vim? *grin*
18:07 <kadoban> n_blownapart: Editors that I wouldn't make fun of someone for using include: vim, emacs, atom, sublime, maybe gedit, kate. I think some use nano or pico even. I don't think it matters overmuch really.
18:07 juanpaucar joined
18:07 <Welkin> nano is great when it's all you have :P
18:07 <Welkin> like when isntalling arch
18:07 <kadoban> Usually as long as I have syntax highlighting and just open ghci in a separate window, it's all good.
18:07 <Welkin> installing*
18:08 <Welkin> iqubic asks a good question though
18:08 <EvanR> iqubic: arcade style
18:08 <Welkin> how *do* you force documentation to build with hadock for arbitrary packages?
18:08 <iqubic> Editors I would make fun of someone using: Libreoffice Writer, Notepad, Pencil and Paper
18:08 <Welkin> I think it's some kind of cabal command
18:08 <n_blownapart> thanks kadoban zachk michi7x7 emacs is a bear I don't understand it at all. I tried fiddling with spacemacs and just removed it
18:08 <iqubic> Google Docs is on the same list as those other editors
18:09 <Welkin> n_blownapart: emacs sucks when you first start, but if you take 30 minutes to learn the basic keybindings, it's great
18:09 <iqubic> I started with Vim, and learned that.
18:09 <iqubic> Then I heard how much better Elisp was vs VimScript and I switched to Spacemacs.
18:09 <n_blownapart> I don't understand why those environments are so unlike normal typing, in say, Atom
18:10 <iqubic> I love Spacemacs a lot
18:10 <Welkin> you can use vim keybindings in emacs
18:10 <Athas> n_blownapart: they are much older than "normal" typing.
18:10 <Welkin> I don't care for them
18:10 <lambdamu> What is the purpose of types like CFloat, is it just the Storable instance?
18:10 <Athas> Emacs and vi both predate the PC.
18:10 <Welkin> lambdamu: it is an unboxed float as represented in C
18:10 <n_blownapart> thanks I need a good tutorial to use emacs. I would like to learn it but can't even load packages. I heard intero is good in spacemacs
18:11 <Welkin> load what packages?
18:11 <Welkin> if you need a quickstart, there are several
18:11 <iqubic> Welkin: I don't think he can load any packages.
18:11 <Welkin> M-x list-packages brings up the package listing where you can isntall packages
18:11 <n_blownapart> intero I think its called Welkin
18:11 <Welkin> oh
18:11 <iqubic> What is intero?
18:11 conal joined
18:11 <Welkin> that includes adding some lines to your .emacs file
18:11 wonko7 joined
18:12 <Welkin> it can be different for each package
18:12 <Welkin> you just need to read their docs (And sometimes source comments) to find out how
18:13 <Welkin> https://hackage.haskell.org/package/intero
18:13 <iqubic> Oh, yeah I use intero.
18:13 <n_blownapart> iqubic, http://commercialhaskell.github.io/intero/
18:13 <n_blownapart> correction intero
18:13 <iqubic> Because Spacemacs includes that by defualt when you tell it you want a bunch of haskell related stuff
18:13 SkyPatrol_ joined
18:14 <Welkin> I haven't used it before
18:14 <lambdamu> Welkin: hackage says it is just a newtype of Float, isn't that true?
18:14 <Welkin> just plain emacs with haskell-mode
18:14 <Welkin> lambdamu: perhaps, I was just guessing
18:14 cchalmer_ joined
18:14 <Welkin> lambdamu: you can look at the source
18:15 <n_blownapart> Welkin, iqubic thanks kindly. I'm trying to learn math. Scheme programming started to bug me. getting advice to learn haskell.
18:15 <iqubic> Welkin: If you like your current emacs set-up, then don't switch. I don't recommend it
18:15 <iqubic> Why don't you like scheme?
18:15 <* hackage> ghc-exactprint - ExactPrint for GHC https://hackage.haskell.org/package/ghc-exactprint- (AlanZimmerman)
18:15 <Welkin> scheme is cool when you don't know any languages like haskell already
18:15 <n_blownapart> so how to load haskell-mode ?
18:15 juanpaucar joined
18:15 <Welkin> but I can't imagine writing apps with it
18:16 fotonzade joined
18:16 <Welkin> n_blownapart: just install it
18:16 <Welkin> and it should work
18:16 <et09> :t Just $ Just $ Just $ Just Nothing
18:16 <lambdabot> Maybe (Maybe (Maybe (Maybe (Maybe a))))
18:17 <Welkin> use this to bring up the package list
18:17 <Welkin> M-x list-packages
18:17 tput joined
18:17 <Welkin> then C-s haskell-mode
18:17 <Welkin> hit i to install
18:17 <Welkin> then x to execute your selections
18:17 <n_blownapart> thanks C-s is control s ?
18:17 <Welkin> yes
18:17 <Welkin> it is search
18:18 <Welkin> keep hitting C-s to go to the next search result if you need to
18:18 <iqubic> And then once you have it installed, just open up an .hs file and it will start up automatically
18:18 <n_blownapart> I see thanks will do. is spacemacs worth bothering with?
18:18 <iqubic> No.
18:18 <iqubic> Unless you already know Vim.
18:18 <Welkin> you can configure haskell-mode using the mode hooks too
18:18 <iqubic> But otherwise no.
18:18 anodium joined
18:19 <n_blownapart> there is a UC Berkeley old guard Scheme guy, a CS professor, who told me to learn emacs
18:19 <Welkin> lol
18:19 <Welkin> I have met those before
18:19 <Welkin> one professor at my uni was like that
18:19 <Welkin> haha
18:19 <iqubic> If you don't know the Vim keybindings, then stay away from Spacemacs
18:19 <n_blownapart> his name is Hilfiger
18:19 <n_blownapart> ok iqubic good advice thanks
18:19 <Welkin> I started using emacs because we used it in my c programming class
18:20 <Welkin> I hated it until I learned to love it
18:20 <n_blownapart> I'm leaving for Colombia for 2 months. at airport. gonna study emacs and mathematics with haskell.
18:20 <Welkin> bogota?
18:20 <iqubic> My Highschool CS teacher gave me extra credit for mastering Vim in just a week.
18:20 <n_blownapart> you guys will *be hearing from me* with mundane questions about everything
18:21 juanpaucar joined
18:21 <iqubic> We will be answering those mundane questions and many more.
18:21 <n_blownapart> highschool? I'm old. We read about computers in the encyclopedia
18:21 <iqubic> n_blownapart: I'm 16
18:21 <Tuplanolla> I want to ask first how you think Emacs, math and Haskell are related, n_blownapart.
18:22 <iqubic> I've had Computers around me all my life
18:22 <n_blownapart> yeah Welkin bogota. I'm going to the Amazon
18:22 <iqubic> How do you think Haskell is related to Mathematics. I too, want to know that.
18:22 TheFuzzball joined
18:23 <johnw> iqubic: it's based on the lambda calculus, which was originally invented as a foundation for mathematics
18:23 <AWizzArd> https://wiki.haskell.org/What_a_Monad_is_not#Monads_are_not_a_replacement_for_applicative_functors says „every monad is an applicative functor (as well as a functor). It is considered good practice not to use >>= if all you need is <*>, or even fmap.”
18:23 <n_blownapart> I heard Haskell is a good language to work on math. Emacs just because its a learning challenge that seems to install on this 32bit machine. otherwise I'd be using Atom
18:23 <johnw> which means there are some very close ties
18:23 <AWizzArd> Why is it considered a good practice?
18:23 <n_blownapart> Tuplanolla, ^
18:23 oisdk joined
18:24 <tsahyt> are there ghcjs builds for stackage lts-8.*?
18:24 <kadoban> AWizzArd: It can result in more general code, which thus can be used with a larger number of concrete types. Though a lot of the time it doesn't actually matter.
18:24 gauthier joined
18:24 <n_blownapart> iqubic, I've had women around me all my life
18:24 <Tuplanolla> My experience has been that Haskell is neither good for symbolic algebra (like Mathematica) nor number crunching (like Fortran), n_blownapart.
18:25 soncodi joined
18:25 uniclown joined
18:25 <iqubic> n_blownapart: And why are you telling me that?
18:25 <n_blownapart> Fortran is another one on the radar
18:25 <Tuplanolla> Even Python has us beat with SymPy and NumPy.
18:25 <iqubic> Fortran is the oldest programming language.
18:25 <iqubic> Tuplanolla: What is haskell good for in your opinion?
18:26 uniclown42 joined
18:26 <n_blownapart> iqubic, don't worry just chatter
18:26 <AWizzArd> kadoban: good, makes sense
18:26 <Tuplanolla> I can make complicated things quickly and be sure they mostly work, iqubic.
18:26 <Tuplanolla> This is not constrained to any particular domain.
18:26 saussure joined
18:27 justanotheruser joined
18:27 <n_blownapart> a math professor told me haskell is good for "conceptualizing" math, because of how its written. I dont know haskell just a bit and a bit of scheme (first chapt. sicp almost complete)
18:30 <Tuplanolla> I don't disagree, n_blownapart. It definitely helps build intuition for constructive foundational math.
18:30 xsid joined
18:30 <n_blownapart> encouraging, thanks Tuplanolla
18:30 cdg joined
18:31 joco42 joined
18:32 uniclown joined
18:32 joco42 joined
18:32 augur joined
18:32 <n_blownapart> Tuplanolla, in haskell, is recursion emphasized like in Scheme?
18:32 yungclowns joined
18:33 <sternmull> with megaparsec, what is the recommended way to skip to eof? I want to use parseMaybe and ignore the unparsed remainder.
18:33 <Tuplanolla> Yes.
18:33 joco42 joined
18:33 <n_blownapart> when I do the sicp book Tuplanolla , I hand write out the recursion so that I can visualize what the program is doing. can you do that in haskell?
18:34 <Tuplanolla> Yes to all.
18:34 joco42 joined
18:34 <sm> sternmull: anyChar `manyTill` eof, perhaps
18:34 <n_blownapart> that is helpful when I do that, your comment too
18:34 <Welkin> in my opinion, haskell is perfect for web development (Which can get very messy very quickly)
18:34 twanvl joined
18:34 <Welkin> that is 99% of my use case for haskell, bulding web servers and web apps
18:35 joco42 joined
18:35 <sternmull> sm: Thanks
18:35 <n_blownapart> Welkin, excellent. I think I'm going to switch to haskell. The bloody editor is a big impediment
18:35 joco42 joined
18:35 <EvanR> n_blownapart: but how you write out the recursion is different from scheme
18:35 <EvanR> the evaluate differently
18:36 <n_blownapart> EvanR, are there examples somewhere of how its done?
18:36 benjic joined
18:37 <Welkin> ;)
18:37 <EvanR> yes
18:37 <Welkin> > let fib a b = a : fib b (a + b) in fib 0 1
18:37 <lambdabot> [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,...
18:37 saussure joined
18:37 <EvanR> i wish i had such an example to just throw out there
18:38 <EvanR> instead of explaining it in IRC again
18:38 Scip joined
18:40 <n_blownapart> but that is just the solution, not the substitution and use of simple primatives to go through the problem
18:40 <Welkin> n_blownapart: that is all of it
18:40 <Welkin> there is nothing special used there
18:41 <n_blownapart> It's odd, the scheme irc tells me not to write out the work, i.e. in tree recursion. but I don't understand a lick of it unless I write it out.
18:41 <Welkin> I defined `fib` as a recursive function on itself
18:41 <Welkin> it constructs the list in-place
18:41 <n_blownapart> that's cool
18:42 <n_blownapart> I sort of get it. I'm in an airport squatting on the floor
18:42 <EvanR> n_blownapart: yes, you can write out the fib example step by step, which lambdabot did not do
18:43 <EvanR> the first step of evaluating that is to replace fib 0 1 with its definition, which is given in the let bindings...
18:43 <EvanR> let fib a b = a : fib b (a + b) in fib 0 1
18:43 justan0theruser joined
18:44 paolino_ joined
18:44 <EvanR> 0 : (let fib a b = a : fib b (a + b) in fib 1 1)
18:44 <n_blownapart> let is just "lambda", right?
18:44 <EvanR> no
18:44 halogenandtoast joined
18:44 <EvanR> it introduces a name for an expression
18:44 <Welkin> `let` binds some expression to a name
18:44 <EvanR> lambda constructs a function
18:44 peterbecich joined
18:45 <n_blownapart> ok, in scheme that is like defining a anonymous lambda I think
18:45 <EvanR> n_blownapart: read the first step and convince yourself the substitutions were done right
18:45 <EvanR> scheme has lets too
18:45 <Welkin> the pattern is `let <name> = <expression> in <another expression that uses <name>>`
18:45 <EvanR> but theyre not recursive or lazy
18:45 prophile joined
18:45 <EvanR> unless you use a special form for that
18:46 peterbecich joined
18:46 <Tuplanolla> I think he's asking if `let y = x in z` is the same as `(\ y -> z) x`, EvanR.
18:46 <EvanR> sure, its not
18:46 <cocreature> what is some cheap IO action that I can use to benchmark ">>" for various monad transformer stacks? ghc seems to optimize "pure () >> a" to "a" so I need something that actually does some IO
18:47 <EvanR> threadDelay 1 ?
18:47 <Welkin> cocreature: print?
18:47 <EvanR> i guess neither of these suggestions is necessarily cheap. heh, cheap IO
18:47 <cocreature> Welkin: print can be annoyingly expensive
18:47 <n_blownapart> EvanR, ok I really hope we can revisit this. I can't focus in the airport. many thanks Tuplanolla EvanR et al
18:47 <cocreature> and threadDelay is probably going to mess with benchmarks
18:48 <Welkin> cocreature: write an empty IOArray?
18:48 dejanr_ joined
18:48 <cocreature> or even just an IORef
18:48 <cocreature> thanks
18:48 <cocreature> that could work
18:50 tromp joined
18:51 <iqubic> What's the best Data structure to store the state of a Tic-Tac-Toe board.
18:51 <iqubic> If not a list, then what?
18:52 <iqubic> Because lists are primarily use as control structures in Haskell, right?
18:54 <exio4> iqubic: you can use two IntMap(s)? IntMap (IntMap Space) with data Space = X | O | Empty or so :P
18:54 <Tuplanolla> It's so small a `Map (Coord, Coord) Fill` with `|Coord| = |Fill| = 3` should do, iqubic.
18:55 <iqubic> exio4: I'm using data Piece = X | O | Blank
18:55 <Welkin> a Map or an Array would work
18:55 <Welkin> especially with Array's Ix interface
18:55 <exio4> I am guessing the best would be to inline everything, but it's much much more annoying
18:55 Johan_L joined
18:56 <iqubic> Why do you think I should inline everything?
18:56 conal joined
18:57 <exio4> iqubic: in terms of raw performance, of course, not in terms of code niceness, I'd go with Tuplanolla's solution though :P
18:57 zariuq joined
18:57 <iqubic> What does `Map (Coord, Coord) Fill` with `|Coord| = |Fill| = 3` do?
18:57 <Welkin> I don't know what that means either
18:58 <iqubic> What are you suggesting I do Tuplanolla?
18:58 <Welkin> but you can simply use `Map (Int, Int) Piece`
18:58 <Tuplanolla> The cardinality notation `|T| = N` means `T` has `N` inhabitants.
18:58 <Welkin> or, `Array Piece` and use the Ix interface to index with (Int, Int)
18:58 <iqubic> Ah, I did not know that.
18:58 <Welkin> same thing really
18:58 <EvanR> Array makes the most sense to me
18:58 <Tuplanolla> Examples include `Int` between `0` and `2` or your `Piece`, iqubic.
18:59 Henson joined
18:59 <iqubic> I think I'll use an Array.
19:00 <iqubic> How should I go about learning about the Haskell Array and Ix interface.
19:00 <Welkin> http://hackage.haskell.org/package/array-
19:00 <EvanR> read the docs and try stuff in GHCI
19:00 <Welkin> the docs are always the best place to start, unlike other languages
19:00 <Welkin> they often have tutorials in them
19:00 <iqubic> That's the same way I was told to start yesterday.
19:01 <Tuplanolla> It's a good way.
19:01 <EvanR> yes im having dejavu entirely again
19:01 <Welkin> http://hackage.haskell.org/package/array-
19:01 aarvar joined
19:01 tiny_test joined
19:01 <Welkin> that in particular shows you how to use it
19:01 <EvanR> must be a shared hallucination
19:01 matrium joined
19:01 <Tuplanolla> It's sometimes instructive to read the source too. It tends to not be pragma porridge like for some other languages.
19:03 <matrium> Hi, how can I bind over the inner monad of a transformer stack? something like "StateT s m a -> (m a -> m b) -> StateT s m b"
19:03 rkazak joined
19:03 <EvanR> :t lift
19:03 <lambdabot> (Monad m, MonadTrans t) => m a -> t m a
19:03 <Tuplanolla> :t hoist
19:03 <lambdabot> error: Variable not in scope: hoist
19:04 <hexagoxel> :t mapStateT
19:04 <lambdabot> (m (a, s) -> n (b, s)) -> StateT s m a -> StateT s n b
19:04 <Welkin> http://hackage.haskell.org/package/mmorph-1.1.0/docs/Control-Monad-Morph.html#v:hoist
19:04 <iqubic> Do I need to install any packages from Hackage to use Arrays and Ix?
19:04 <iqubic> Or is it in the base?
19:04 <Welkin> iqubic: Data.Array, but that should be in base
19:04 <Welkin> just try it out
19:04 <Welkin> the compiler will tell you if you are missing anything
19:05 Cerise_ joined
19:05 Cerise_ joined
19:07 uniclown joined
19:07 biglama joined
19:10 systemfault joined
19:10 <iqubic> That's what I love about Haskell, how simple the errors are to parse.
19:10 FreeBirdLjj joined
19:10 <cocreature> "Data.Array" is not in "base", it’s in the "array" package
19:10 <Welkin> ah yes
19:11 <Welkin> but you won't find any errors like "undefined is not a function"
19:11 Prutheus joined
19:11 <Tuplanolla> "main is usually a function".
19:11 <cocreature> isn’t there some blog by that name?
19:12 <Tuplanolla> @google "main is usually a function"
19:12 <Welkin> it's the most common error in javascript land
19:12 <lambdabot> http://jroweboy.github.io/c/asm/2015/01/26/when-is-main-not-a-function.html
19:12 <lambdabot> Title: Main is usually a function. So then when is it not?
19:12 takle joined
19:12 <Tuplanolla> That's certainly a blog.
19:13 merijn joined
19:14 <EvanR> what in the wworld
19:15 Gurkenglas joined
19:16 tiny_test joined
19:18 Lemmata joined
19:18 spacecadetbrown joined
19:18 <maerwald> omg xD
19:20 meba joined
19:21 wonko7 joined
19:21 <Gurkenglas> Can we get ircbrowse out of the topic yet?
19:23 <Welkin> lol
19:23 <Welkin> that is an actual error from gcc "main is usually a function"
19:23 <Welkin> never seen that one
19:23 juanpaucar joined
19:23 caumeslasal joined
19:23 tiny_test joined
19:24 <pikajude> i wish GHC-built binaries didn't take 15 minutes to start up on WSL
19:24 yqt joined
19:24 <Welkin> WSL?
19:24 stvc joined
19:24 <iqubic> Is there a way to take a list and turn it into an enum?
19:25 <geekosaur> how would that work?
19:25 <Welkin> you mean create a type from a value?
19:25 <EvanR> what is the type of that operation
19:25 patbecich joined
19:25 <iqubic> I don't know
19:25 <EvanR> ah
19:25 <iqubic> How do you create an enum in Haskell?
19:25 <EvanR> you can use template haskell to generate enum types
19:25 <Welkin> it's not an enum, but a sum type
19:25 <geekosaur> types are a compile time thing, "making an enum from a list" is a runtime thing
19:26 mizu_no_oto joined
19:26 <Welkin> data SumType = A | B | C
19:26 <geekosaur> unless you are thinking TH which kinda mixes the levels with a "runtime" at compile time
19:26 <pikajude> WSL is linux on windows
19:26 <pikajude> new in w10
19:26 <Welkin> pikajude: oh god, that thing?
19:26 <geekosaur> ^ "windows services for linux"
19:26 <pikajude> the RTS allocates like 2TB of virtual memory
19:26 <Welkin> it' s trojan horse
19:26 Itkovian joined
19:26 <pikajude> and WSL can't gracefully deal with that
19:26 <pikajude> :(
19:26 <Welkin> I'd never trust it
19:26 <merijn> pikajude: Ah
19:26 <iqubic> I don't use that.
19:26 <EvanR> for a minute i thought, due to the name, it was a windows subsystem that runs on linux
19:26 <geekosaur> pikajude, there's some talk about providing an RTS option to fall back to the old memory allocator
19:27 <merijn> pikajude: The 2TB is by design, but the windows degradation probably isn't
19:27 <geekosaur> don't know if it will be in 8.2
19:27 <merijn> I recall windows has a stupid way of dealing with mmap, which is the issue
19:27 <pikajude> i hope they just fix it instead, to be honest
19:27 takle joined
19:27 <iqubic> I did use WSL, but I removed it when I found out that it was a terrible thing.
19:27 <pikajude> what's wrong with it?
19:27 <merijn> pikajude: I'm not sure GHC *can* fix the issue
19:27 <geekosaur> but WSL doesn't support the speculative page table allocation that produces the fake 2TB "allocation"
19:27 <pikajude> merijn: I mean MS, not GHC
19:27 <Welkin> what is the reason to use WSL at all?
19:28 <merijn> pikajude: Oh, right, agreed :)
19:28 <Welkin> just run linux
19:28 <pikajude> Welkin: games
19:28 <merijn> Welkin: You can run stuff on windows using the familiar posix layout?
19:28 <EvanR> business
19:28 <Welkin> dual boot
19:28 <merijn> Welkin: billions use windows, people might wanna sell software/tools to those people...
19:28 <pikajude> not really interested in having 10 minutes of downtime every time i want to play a game
19:28 <pikajude> sometimes I want to play a game and also be in IRC simultaneously
19:29 <Welkin> use two computers
19:29 <Welkin> I do that o.o
19:29 <pikajude> how about no
19:29 <EvanR> is this argument really appropriate
19:29 <EvanR> haskell tends to suck on windows, we need to fix that
19:29 <pikajude> haskell is fine on linux, it's their memory manager that's the problem
19:29 <merijn> pikajude: Anyway, I think people are working on a workaround/solution for windows until MS fixes it, but I'm not sure what the time frame is, tbh
19:29 Cerise_ joined
19:29 Cerise_ joined
19:29 <Welkin> no one wants to fix it though because few of us use windows
19:30 <EvanR> which is a problem
19:30 <pikajude> merijn: well, ok
19:30 <pikajude> I'll deal with it
19:30 <pikajude> I wonder if this ghcjs build will be finished by tomorrow
19:30 <Welkin> many games already run on linux
19:30 <Welkin> there are only a few of the ones I play that don't
19:30 crundar joined
19:30 <pikajude> 95% of the ones I play don't
19:30 <Tuplanolla> The trivial solution is to stop playing games entirely, like I did.
19:30 <Welkin> windows becomes less and less useful every day
19:31 <koala_man> speaking of which, how can I build a Windows .exe on Linux? cabal builds it just fine on Windows
19:31 <pikajude> don't you have to have a cross compiler for that
19:31 <Tuplanolla> Bigger lifestyle changes have happened.
19:31 conal joined
19:31 dni joined
19:31 <sm> you can use wine
19:31 <merijn> Welkin: I don't see how this is at all helpful or constructive?
19:31 <pikajude> wine can't emulate dx3d
19:32 <sm> for some projects
19:32 <merijn> Hell, SPJ develops GHC on windows, so saying "no one cares about windows" seems disingenous
19:32 <merijn> koala_man: Do you want simple or painful?
19:32 <pikajude> that seems like a silly question
19:33 <crundar> What are the laws of run for a monad? How does one "check the laws" that run is implemented properly, the way one would with >>= and return?
19:33 <merijn> koala_man: The simple solution is: Don't. Download VirtualBox (or the VM of your choice), install GHC+cabal on it and compile on Windows directly
19:33 shubunkin joined
19:33 jellie joined
19:33 <Welkin> crundar: you have to manually check the laws
19:33 <EvanR> run isnt a part of the monad laws
19:33 <Welkin> ghc will not check them for you
19:33 <merijn> koala_man: You probably *can* cross-compile, but I wouldn't wish that upon my enemies...
19:33 jellie joined
19:34 <merijn> pikajude: Well, the simple solution isn't really a solution. But sometimes the easiest way is to not solve a problem >.>
19:34 <koala_man> merijn: I want to do it automatically on Travis, so I'm not sure if vbox is suitable
19:34 <sm> koala_man, merijn: or you can use wine, in many cases
19:34 <merijn> koala_man: Not sure if travis can do that kinda thing
19:34 <crundar> Welkin: what are those aspects of the laws, then? I didn't see anything corresponding in unit/fmap/join or >>=/return formulations?
19:34 <koala_man> maybe I can use wine in a docker image or something
19:34 <pikajude> yeah, I kinda doubt travis can do that, you might need your own build machine
19:35 <Welkin> crundar: check the typeclassopedoa
19:35 <sm> why is docker needed ?
19:35 <Welkin> @where typeclassopedia
19:35 <lambdabot> http://www.haskell.org/haskellwiki/Typeclassopedia
19:35 <Welkin> the laws are listed there
19:35 <EvanR> compile windows binaries on windows in a vm
19:35 <merijn> sm: I dunno, everything needs docker nowadays
19:35 <cocreature> if you use docker it’s webscale
19:35 <sm> pretty sure you'll be able to download and run wine as part of a travis script, like we do with eg stack
19:36 <merijn> Unrelatedly, 9th commit was the charm to actually work :p
19:36 <pikajude> I've not ever actually found a use for docker
19:36 <sm> but you can also use appveyor, which is windows
19:37 Scip joined
19:37 <crundar> EvanR: Or, I guess, why not? What does govern the "correctness" of an implementation of a run?
19:37 chaosmasttter joined
19:37 eHammarstrom joined
19:37 <koala_man> sm: I'm not entirely sure how Travis works, but it seems like the kind of environment where docker would be available but wine wouldn't
19:37 <EvanR> nothing
19:38 <EvanR> run is not even part of the Monad interface
19:38 <pikajude> would wine really work in docker?
19:38 Cerise_ joined
19:38 Cerise_ joined
19:38 <EvanR> not all monads have something that begins with the word run
19:38 jbiesnecker joined
19:39 <Welkin> what is `run` anyway?
19:39 <Welkin> do you mean things like `runReader` and `runST`?
19:39 <Welkin> those are just record accessors that unwrap the values
19:39 <EvanR> they are functions specific to each monad, and only some of them
19:40 takle joined
19:40 ziocroc joined
19:41 <EvanR> e.g. [], Maybe, Stream dont have any run thing
19:41 tromp joined
19:41 CheesecakeTempla joined
19:41 <Gurkenglas> How do I find the most specialized common generalization of two types?
19:42 <Welkin> lol Gurkenglas
19:42 mstruebing joined
19:42 epsilonhalbe joined
19:42 anuxivm joined
19:43 oish joined
19:43 <Gurkenglas> The most general common specialization, if it exists, would be :t [undefined :: <a>, undefined :: <b>]
19:45 dejanr_ joined
19:47 spinus joined
19:48 primal_ joined
19:48 daniel___ joined
19:48 dni joined
19:51 conal joined
19:54 simukis joined
19:56 osa1 joined
19:56 saussure joined
19:58 wonko7 joined
19:59 MarioBranco joined
19:59 conal joined
20:00 <wz1000> Gurkenglas: What would be the "most specialized common generalization" for Read a => a, Show a => a?
20:00 <Gurkenglas> a
20:01 <Welkin> (Read a, Show a) => a
20:01 <Welkin> :D
20:01 <Gurkenglas> No, that's the most general common specialization
20:01 <Welkin> o.o
20:02 <Tuplanolla> Is the answer always `a`, Gurkenglas?
20:02 <Welkin> forall a. a
20:02 <Gurkenglas> Tuplanolla, for Int -> b and String -> c, it's a -> b
20:03 <wz1000> why not a?
20:03 <Tuplanolla> Oh, I see now.
20:03 <Gurkenglas> Because a -> b is more special than a and more general than Int -> b and String -> c, so a cannot be the most specialized type that is more general than Int -> b and String -> c.
20:03 <* hackage> here 1.2.11 - Here docs & interpolated strings via quasiquotation https://hackage.haskell.org/package/here-1.2.11 (TaylorHedberg)
20:04 <Tuplanolla> Would it work to assume all variables are free and perform unification, Gurkenglas?
20:05 {emptyset} joined
20:05 <Gurkenglas> That's still the most general common specialization
20:05 <Gurkenglas> Read a and Show a do not unify to a
20:05 <Gurkenglas> *"=> a" ._.
20:05 quobo joined
20:06 <Tuplanolla> You'd get `c => a`, no?
20:07 MarioBranco joined
20:07 <Gurkenglas> That's the same as a
20:07 jellie joined
20:07 jellie joined
20:08 dni joined
20:08 <Gurkenglas> Something that gives "c => a" for any c and a can give it for c = the empty constraint, so it can be specialized to "a", and "a" can be specialized to "c => a" because "a" can be specialized to anything.
20:09 Guest40 joined
20:10 <Gurkenglas> What GUI framework should I use in order to let the user explore a DAG?
20:10 perrier-jouet joined
20:10 fragamus joined
20:11 <wz1000> I like gloss. And it has a neat self balancing graph example.
20:12 thebardian joined
20:16 taktoa joined
20:17 HallaSurvivor joined
20:17 <\u> data Bad a = Bad (Bad a -> a) . does it have a name?
20:18 primal joined
20:19 ocramius joined
20:19 romank joined
20:21 jellie joined
20:22 Prutheus joined
20:23 Kreest_ joined
20:23 <Gurkenglas> For a = {Cooperate, Defect}, it looks like the type of prisoner's dillemas bots that are given a blackbox of their counterpart
20:23 romank joined
20:23 dni joined
20:25 shangxiao joined
20:27 toby1851 joined
20:27 saussure joined
20:28 primal_ joined
20:30 Boomerang joined
20:30 Rakkattakka joined
20:31 conal joined
20:32 exit70 left
20:32 daimonos joined
20:33 samvher joined
20:33 daimonos joined
20:33 daimonos joined
20:35 <EvanR> question
20:35 <thang1> Answer
20:35 <EvanR> how do i use a case but only for its guards
20:36 <EvanR> do i nec have to do _ | asdf -> ...
20:36 <johnw> case () of () | blah -> ...
20:36 <Tuplanolla> You probably have to `case () of () | ... -> ...`, EvanR.
20:36 <thang1> Can you not just use guards directly? o.O
20:37 <hpc> guards are syntactically a part of pattern matching
20:37 <geekosaur> sounds like EvanR is reaching for the MultiWayIf extension to me
20:37 primal joined
20:38 <EvanR> ok but multiway if requires you save the expr to a let first...
20:38 <geekosaur> huh?
20:38 <* hackage> hsdev - Haskell development library https://hackage.haskell.org/package/hsdev- (AlexandrRuchkin)
20:38 <EvanR> trying to split on a numeric result being < 0, == 0, > 0
20:39 <EvanR> which i see is not exactly what i was getting at
20:39 <Gurkenglas> case compare x 0 of
20:39 <geekosaur> I'd actually write that as : case compare x 0 of
20:39 daimonos joined
20:39 <Tuplanolla> Today you get two answer for the price of one!
20:40 <EvanR> hmm.
20:40 <geekosaur> and what you were looking for wasn't just "only for its guards" so much as "partially applied guards" which isn't really a thing
20:40 katesmith left
20:40 takle joined
20:41 asd joined
20:41 descender joined
20:42 Welkin joined
20:43 Prutheus joined
20:44 nbro joined
20:44 primal_ joined
20:44 thebardian joined
20:46 halogenandtoast joined
20:46 <iqubic> What's a DAG?
20:47 <iqubic> Draggable Art Gidget?
20:47 <descender> directed acyclic graph?
20:47 <EvanR> ^
20:50 <geekosaur> aka a tree with no loops, more or less
20:50 <EvanR> ok so case compare (foo bar baz) 0 of
20:50 <EvanR> but then i dont have the value to use
20:50 <EvanR> ...
20:50 <geekosaur> @src Ordering
20:50 <lambdabot> data Ordering = LT | EQ | GT
20:50 <EvanR> the result of foo bar baz
20:51 <geekosaur> you did the comparison, you have an Ordering now.
20:51 <EvanR> but not the numeric value
20:51 <EvanR> i dont know why i thought this would have a shorter way
20:51 <pikajude> LT = foo, EQ = bar, GT = baz
20:51 <geekosaur> what are you doing now that you want the numeric value?
20:52 <EvanR> using it, but how i use it depends on if its positive negative or zero so
20:52 <EvanR> i guess ill do let then multiway if
20:52 <geekosaur> yes
20:52 RegEchse joined
20:52 <geekosaur> positive is GT, zero is EQ, negative is LE
20:52 <geekosaur> er LT
20:52 <geekosaur> > compare 5 0
20:52 <lambdabot> GT
20:52 <Lokathor> dag, i have a (StateT ProgState IO a), and GLFW lets you set an IO callback, and I want to set it up so that you can run a callback in the StateT layer
20:53 <Lokathor> and these types i tell you
20:54 jao joined
20:54 <EvanR> http://lpaste.net/355922
20:55 <EvanR> Lokathor: with GLFW callbacks... it pays to set up either global or partial closured TVars or MVars to share state
20:55 <EvanR> then run your state actions from there
20:56 cozachk joined
20:56 <Lokathor> so instead of (StateT HexesState IO a) i use (StateT (TVar HexesState) IO a) ?
20:56 takle joined
20:57 darjeeling_ joined
20:57 <EvanR> you use which ever you want, but you "run" it from the callback
20:57 <EvanR> which is IO ()
20:58 <EvanR> get the state out of the var, run it, put the modified state back
20:58 <Lokathor> hmm
20:58 <dmj`> TVar’s can be modified anywhere in monad with a base of IO, at that point a StateT isn’t useful (i.e. StateT (TVar HexesState) IO a)
20:58 <EvanR> which i see now means use the first one
20:58 <cozachk> couldn't you use a readerT if you are using TVars or MVars because they are refernences and you never actually mutate them
20:58 <EvanR> yes StateT (TVar ...) is kind of suspicious
20:59 <Lokathor> well the point is that the HexesState is locked away from bothering with for normal users, and they actually use various Hexes actions to affect it
20:59 <EvanR> cozachk: the callback is an *IO ()*, not a MonadBaseControled lifted stacked whatever you want
20:59 drewbert joined
20:59 <Lokathor> yeah that's the problem
20:59 <Lokathor> GLFW has IO () for callbacks, but I want to be able to do the StateT version of things as the accepted callback
20:59 <EvanR> Lokathor: this would not be involved with users... unless i still misunderstand who your users are
21:00 mnoonan joined
21:00 <Lokathor> "users of the library", i should say
21:00 <Lokathor> people outside the module
21:00 takle joined
21:00 <EvanR> what im saying completely lets users provide StateT Whatever actions the same as before
21:00 <EvanR> im explaining how you do what you said to do
21:01 <EvanR> whoever has access to whatever they had before, this just how you get the callbacks to run the proper monads
21:01 Fendor joined
21:01 <Lokathor> hmm
21:02 chewzerita joined
21:02 <chewzerita> @pl (\x y -> x ^^ (round y))
21:02 <lambdabot> (. round) . (^^)
21:02 <jle`> \x -> (x ^^) . round
21:03 wonko7 joined
21:04 uiop joined
21:05 <Lokathor> http://lpaste.net/355923 so EvanR, with things setup like this so far, you're suggesting that an MVar layer be put in basically?
21:06 tromp joined
21:06 <Lokathor> and then you get the state, execute an inner State action, get the resulting state back from that inner action, and then put it back into the mvar?
21:07 tristanp joined
21:07 sleffy joined
21:09 epsilonhalbe left
21:11 <* hackage> bindings-levmar - Low level bindings to the C levmar (Levenberg-Marquardt) library https://hackage.haskell.org/package/bindings-levmar- (BasVanDijk)
21:12 MP2E joined
21:14 takle joined
21:14 <* hackage> levmar - An implementation of the Levenberg-Marquardt algorithm https://hackage.haskell.org/package/levmar- (BasVanDijk)
21:14 <EvanR> Lokathor: using modifyMVar_ or equivalent TVar machinery
21:14 bigos joined
21:15 <Lokathor> I'm not sure if I want MVar or TVar, but this feels more like MVar
21:15 chewzerita left
21:16 coltfred joined
21:16 <pikajude> i'm pretty sure developing in a linux VM with ghcjs will be faster than trying to use it on WSL
21:17 ckubrak joined
21:18 juanpaucar joined
21:19 stevenxl joined
21:19 markus1189 joined
21:20 takle joined
21:20 markus1199 joined
21:20 ^bschafer1 joined
21:21 meba joined
21:23 svgDelux joined
21:23 saussure joined
21:23 primal joined
21:24 juanpaucar joined
21:25 OnkelTem joined
21:26 <AWizzArd> https://wiki.haskell.org/Monad#Monad_class says „Any Monad can be made a Functor” — possible that this article was written when Monads didn’t have the Functor constraint?
21:26 <Lokathor> old articles on the wiki? never
21:26 <Lokathor> :3
21:30 <EvanR> "However, the Functor class is not a superclass of the Monad class." <- real old
21:31 <pikajude> I feel like that's ripe territory for one of those "just got out of a coma" memes
21:31 <EvanR> the very definition of Monad is of a certain kind of functor
21:32 armyriad joined
21:32 <monochrom> https://ro-che.info/ccc/21
21:33 <Lokathor> http://lpaste.net/355923 EvanR does this look right? I mean it compiles and all
21:35 araujo joined
21:35 araujo joined
21:36 <* hackage> soap - SOAP client tools https://hackage.haskell.org/package/soap- (AlexanderBondarenko)
21:36 <EvanR> if it compiles its good
21:36 takle joined
21:36 <Lokathor> right, of course :P
21:37 <Lokathor> let's try testing this out
21:37 <EvanR> erm
21:38 <Lokathor> seems to work
21:38 <EvanR> the var is inside the state that youre trying to implement/
21:38 <Lokathor> well, the MVar is the state at the moment, yet, but really now that it's wrapped in an MVar it should be more like ReaderT
21:38 <EvanR> is this api like a duplicate of the GLFW api
21:39 <EvanR> i dont think this will work
21:39 <Lokathor> the part that lets you set a callback is essentially the GLFW callback minus the window being passed to you
21:39 <EvanR> the set callback is an action of the monad that uses the state that the action would already be using
21:39 jbiesnecker joined
21:39 <EvanR> so it should deadlock
21:39 <Lokathor> well it prints when i press letters in my demo
21:40 <EvanR> welp sounds like it makes sense to you : )
21:40 pgiarrusso joined
21:41 <Lokathor> i could try to explain to you why i think it should work, if you still think it shouldn't :?
21:41 <Lokathor> basically the MVar is safe to be shared at any time since it's not mutated, it's more like a pointer
21:41 <Lokathor> so everyone sees all the updates
21:42 <EvanR> if you run an action, you need the state, which is in the var. if you run another action from within the action, theres no state in the var
21:42 <EvanR> and youre stuck
21:42 <EvanR> keeping the var inside the state thats inside the var, etc just seems weird to me
21:42 <Lokathor> well again, it should be more like ReaderT at this point
21:43 <Lokathor> the MVar doesn't hold itself, if that's what you're asking
21:44 takuan joined
21:44 dejanr_ joined
21:44 <Lokathor> http://lpaste.net/355925
21:45 ccomb joined
21:46 <Lokathor> I'll rename it to HexesData to reduce possible confusion
21:47 Bassetts joined
21:50 carlomagno joined
21:51 <EvanR> i do not understand the need for StateT (MVar StateData) ...
21:51 bollu joined
21:51 <Lokathor> what if it was "newtype Hexes a = Hexes (ReaderT (MVar HexesData) IO a)" ?
21:52 <EvanR> is Hexes the monad you want users to use?
21:52 <Lokathor> yes
21:52 <EvanR> why do actions need the MVar
21:52 <Lokathor> that's where all of its own configuration data lives
21:53 tomboy64 joined
21:53 <EvanR> what
21:53 hiratara joined
21:53 <EvanR> doesnt it live in HexesData
21:53 <Lokathor> the MVar is holding the data, yes
21:53 <EvanR> or youre deciding not to use a State monad at all
21:54 <Lokathor> it *was* state, until i realized a bit ago that you can't at all easily mix that with the GLFW callbacks
21:54 <EvanR> its an extra step for the action to get the data out of the mvar every time...
21:54 <Lokathor> then you suggested mvar, and so i went that route
21:54 <EvanR> you can, which is what i was saying
21:54 tomboy64 joined
21:54 <Lokathor> so, then, what would you do diffently with the mvar compared to what i'm doing?
21:55 <iqubic> Does this exist: type Bad a = Bad (Bad a -> a)
21:55 <EvanR> no
21:55 <iqubic> Why not?
21:55 <EvanR> newtype Bad a = Bad (Bad a -> a) does
21:56 <iqubic> What is that type called, Bad?
21:56 <pikajude> it's called Bad
21:56 <EvanR> you named it that didnt you
21:57 <iqubic> Why is it called Bad? How do you use it?
21:57 <EvanR> where did that come from
21:57 <iqubic> I saw it in chat earlier today.
21:57 <EvanR> im not sure how you could construct a bad
21:58 <EvanR> Bad <what>
21:58 <EvanR> newtype Bad a = Bad { unBad :: a }
21:58 <EvanR> hmm.
21:58 <EvanR> newtype Bad a = Bad { unBad :: Bad a -> a }
21:59 <EvanR> unBad :: Bad a -> Bad a -> a
21:59 <pikajude> "construct a bad"
21:59 <iqubic> What about: newtype Good a = Good (a -> Good a)
21:59 <iqubic> Is that a thing.
21:59 <geppettodivacin> The one iqubic mentioned was definitely mentioned about two hours ago. No one really discussed it, though.
21:59 <EvanR> that makes more sense
22:00 <iqubic> Wait, not only is that a thing, but several dozen types use that Good format
22:00 <geppettodivacin> I'm not really sure how I would construct Good, myself.
22:00 <Tuplanolla> Now we only lack `newtype Ugly a = Ugly {unUgly :: Ugly a -> Ugly a}`.
22:00 <pikajude> couldn't it just be Good Good
22:00 <EvanR> ugly makes the most sense
22:01 <EvanR> Ugly id :: Ugly (Ugly a)
22:01 <EvanR> erm
22:01 Achylles joined
22:01 <EvanR> everyone put all this in the compiler now
22:01 juanpaucar joined
22:01 <Rotaerk> Ugly UrMom
22:02 <Lokathor> EvanR, how did you expect the MVar to be used if not to wrap around the StateT's state value?
22:02 top4o joined
22:03 albel727 joined
22:03 <EvanR> :t runState
22:03 <lambdabot> State s a -> s -> (a, s)
22:03 <EvanR> :t modifyMVar
22:03 <lambdabot> error: Variable not in scope: modifyMVar
22:03 <EvanR> MVar a -> (a -> IO (a, b)) -> IO b
22:04 <EvanR> modifyMVar_ mv (let (x, s') = runState action s in return (s', x))
22:04 <EvanR> er
22:04 <EvanR> modifyMVar mv (let (x, s') = runState action s in return (s', x))
22:04 LeNsTR joined
22:04 darjeeling_ joined
22:05 conal joined
22:05 <EvanR> and i forgot the IO
22:05 zacts joined
22:05 <Lokathor> so, get the state at the StateT level, use it in the modifyMVar, and then get that state back from there into the StateT level, and set it again in StateT?
22:06 carlomagno1 joined
22:06 <Lokathor> but your state within the callback would be stale, because you generally only set the callback once at the start of the program.
22:06 <EvanR> this is "IO level"
22:07 <EvanR> the state is in the MVar
22:07 <EvanR> it always has the latest state
22:07 juanpaucar joined
22:07 <Lokathor> so, instead of, "newtype Hexes a = Hexes (ReaderT (MVar HexesData) IO a)", what would you write as the newtype definition? When does the state go into the MVar?
22:08 andrei joined
22:08 halogenandtoast joined
22:08 <EvanR> modifyMVar puts it back, so you mean, originally?
22:09 <Lokathor> yeah, when does it get into the mvar for you to use with modifyMVar
22:09 marr123 joined
22:09 <EvanR> when you set up
22:09 <Lokathor> so you would use ReaderT then?
22:10 <EvanR> if the monad is supposed to modify the HexesData, StateT is a possibliity
22:10 skeuomorf joined
22:10 uvelichitel joined
22:10 martingale joined
22:10 <Lokathor> well, StateT (MVar a) and ReaderT (MVar a) are nearly identical either way
22:11 wonko7 joined
22:12 juanpaucar joined
22:12 conal joined
22:13 <andrei> Is there a way to convert a value (something that's say Typeable or Generic) to an haskell-src-exts AST from?
22:14 <EvanR> well if you want to put the MVar in there, great
22:14 <thang1> oh my god
22:15 <Lokathor> EvanR, how else do you pass the mvar along the computation?
22:15 <EvanR> you wouldnt!
22:15 <EvanR> the question was, why do you want to
22:15 <EvanR> "to get the data in it" is not the answer
22:15 <Lokathor> the user can call setKeyCallback at any time, so if you need the mvar to assign a key callback, you at least need the mvar during that operation
22:15 Welkin joined
22:16 <thang1> Check this out: https://www.reddit.com/r/rust/comments/5penft/parallelizing_enjarify_in_go_and_rust/dcsgk7n/
22:16 <EvanR> ok
22:17 <Welkin> lol, rust
22:17 <thang1> The beauty is the comment chain about Go generics
22:17 Gurkenglas joined
22:17 <Lokathor> "If you look closely, those aren't angle brackets, they're characters from the Canadian Aboriginal Syllabics block"
22:18 <thang1> Completely slayed me
22:18 jao joined
22:18 mheinzel joined
22:20 <thang1> So have you heard about microsoft's P language?
22:21 silver_ joined
22:21 <thang1> I can't wait for someone to release a Nis framework for the language so I can learn it and put P/Nis on my resume
22:21 <EvanR> rimshot
22:22 tromp joined
22:22 <hpc> http://www.pnas.org/
22:22 yamadapc joined
22:22 <thang1> glorious
22:23 <thang1> Nobody has ever made a joke at the academy, I'm sure
22:23 <monochrom> thang1: I don't get the P/Nis joke...
22:24 <monochrom> Oh, now I get it. Have to pronounce it.
22:24 <monochrom> Do you happen to know why they named it P?
22:25 <monochrom> (And another childish joke: Whereas C compilers are called "cc", are they going to call P compilers "pp"?)
22:25 michi7x7 joined
22:25 <thang1> I, honestly, have no idea
22:25 <thang1> Well they can't call it pc because no republican would ever program in that language /s
22:26 <thang1> I'm /guessing/ that since it's for async event-driven systems that P comes from shortening 'ping'
22:26 <Tuplanolla> Free Pascal already has `pc`.
22:29 sanitypassing joined
22:30 <Lokathor> so if i have a flat, linear sequence of items, and i want to be able to update those items from time to time in an efficient manner and also have them accessable via a Ptr value
22:31 <Lokathor> I'm kinda stuck with Vector.Storable.Mutable and its anemic interface, aren't i?
22:31 <Lokathor> or is the overhead on Vector.Storable not so bad?
22:31 hiratara joined
22:33 wroathe joined
22:34 TheFuzzball joined
22:34 <Gurkenglas> Why does intero-type-at say that filtered is not in scope? https://i.gyazo.com/eaad01e2ff74a0822cf9f2ea3e055a99.mp4
22:36 prkc joined
22:42 <lpaste> saylu pasted “hoauth2 issue” at http://lpaste.net/2999345030537150464
22:42 <saylu> hey folks! getting a super odd issue with hoauth2
22:42 jbiesnecker joined
22:42 mac10688 joined
22:42 <* hackage> hnormalise - Log message normalisation tool producing structured JSON messages https://hackage.haskell.org/package/hnormalise- (AndyGeorges)
22:43 <saylu> I'm able to fetch an access token for a Google API just fine -- but when I then try to fetch a refresh token, hoauth2 thinks it's got to parse a URL when its getting a JSON response
22:43 <saylu> typechecks just fine, and I've referred to this example and don't see where I'm going off the rails:
22:43 <saylu> https://github.com/freizl/hoauth2/blob/master/example/Google/test.hs
22:43 <saylu> Any ideas?
22:46 carlomagno joined
22:48 shutdown_-h_now joined
22:49 saussure joined
22:51 darjeeling_ joined
22:53 mizu_no_oto joined
22:54 ubsan_ joined
22:55 <thang1> Line 38 looks ugly (but that's just aesthetics)
22:56 <thang1> Where's the actual error happening?
23:00 im0nde joined
23:02 <lambdamu> is it possible to get a list of names along with there types that are in scope with template haskell, maybe even with their source module if their were imported? With reifyModule it is possible to get a list of imported modules, but can we get an import list from those names?
23:05 hamishmack joined
23:05 Jesin joined
23:06 <saylu> thang1: in the 'fetchrefresh' function
23:06 <saylu> Line 18
23:06 MarioBranco joined
23:08 <lpaste> saylu revised “hoauth2 issue”: “hoauth2 issue” at http://lpaste.net/2999345030537150464
23:08 mheinzel joined
23:08 <saylu> thang1: I added a different function that works very similarly -- it's to fetch the initial token, not to refresh the token. But the format is quite similar. Maybe that will provide some extra contex.t
23:09 {emptyset} joined
23:09 <saylu> The main thing is in the `fetchRefreshToken` function, which gives an exception ----> *** Exception: hoauth2.HttpClient.parseResponseString/Could not decode URL: { "access_token" : "ya29.G ...........
23:10 primal_ joined
23:10 dan_f joined
23:10 Bardusbasium joined
23:11 thegoodfather joined
23:11 nisstyre joined
23:11 YongJoon joined
23:17 <et09> clojure or scala, who wins in a cage match
23:17 <EvanR> haskell drops in from the rafters
23:17 <glguy> et09: No, that's not on topic for #haskell
23:17 <EvanR> with cheap fireworks going on
23:17 <cozachk> et09, try asking in #haskell-blah
23:18 <et09> right i forgot the ontopic/offtopic thing
23:18 Bardusbasium joined
23:19 primal joined
23:20 <cozachk> et09, well blah is offtopic so you can ask in there
23:21 theDon_ joined
23:22 meba joined
23:22 louispan joined
23:22 Koterpillar joined
23:24 markus1209 joined
23:24 <saylu> From this:
23:24 <saylu> hoauth2 has two ways to parse responses:
23:24 <saylu> parseResponseString and parseResponseJSON
23:24 markus1219 joined
23:24 <saylu> currently I"m getting an exception because `fetchRefreshToken' is trying to use parseResponseString for JSON
23:24 katesmith joined
23:25 <saylu> Is there any way I could force it to use parseResponseJSON instead?
23:26 <saylu> Oh, hmm -- it's using `doFlexiblePostRequest` under the hood to return either JSON or a string, but it's choosing the wrong one
23:26 <saylu> oof
23:27 Salt1 joined
23:28 sternmull joined
23:33 wroathe joined
23:35 bigbang joined
23:36 mjs2600 joined
23:38 tromp joined
23:41 Achylles joined
23:42 wroathe joined
23:43 <Squarism> saylu, dont really know what you problems is - but i can say i was able to use hoauth2 (with minor modifications to protocol version/endpoints)
23:43 <Squarism> ...for google and facebook
23:43 jbiesnecker joined
23:43 albel727 joined
23:44 ericsagnes joined
23:47 <saylu> Squarism: Any shot at example code I could check?
23:47 <Squarism> saylu, lemme check
23:47 <saylu> That's good to know.
23:47 <saylu> Had some trouble earlier because the Stackage LTS version is only 0.5.7, instead of the Hackage one at 1.2.0
23:47 <saylu> so I switched over to 1.2.0, but my last working version was 0.5.7.
23:47 <saylu> bit of a mess
23:48 <MarcelineVQ> that's quite a difference
23:49 <MarcelineVQ> ah nightly resolver does have 1.2.0 at least
23:49 <saylu> Yea it's quite different haha
23:49 <MarcelineVQ> pretty big jump to 0.5.7 in lts 8.15 though :X
23:49 juanpaucar joined
23:49 <saylu> But the old version is the one that works OK for me! Rough times.
23:49 <saylu> Probably a mistake on my end -- might need to give it a night and come back fresh
23:53 <Squarism> saylu, http://lpaste.net/5758756248568725504 is my current version of the google auth
23:53 juanpaucar joined
23:53 <Squarism> saylu, afaik the example program worked pretty much out of the the box - but i have vague memories of needing to do some small changes.
23:53 cozachk joined
23:53 <saylu> Squarism: Have you been able to implement token refreshing?
23:54 <Squarism> saylu, nope
23:54 <saylu> I'm able to access OK so long as I never have to refresh -- that's the step that breaks
23:54 YongJoon joined
23:54 <Squarism> ah ok
23:54 <saylu> Thanks though!
23:57 alveric3 joined