<    March 2017    >
Su Mo Tu We Th Fr Sa  
          1  2  3  4  
 5  6  7  8  9 10 11  
12 13 14 15 16 17 18  
19 20 21 22 23 24 25  
26 27 28 29 30 31
00:00 Xlaech joined
00:03 uglyfigurine joined
00:08 Rizy joined
00:10 Denthir left
00:15 eacameron joined
00:18 contiver joined
00:23 geekosaur joined
00:28 Rizy joined
00:31 malaclyps joined
00:41 fhoffmeyer joined
00:45 Rizy joined
00:59 NoCreativity joined
01:06 eacameron joined
01:13 louispan joined
01:18 xmonader joined
01:23 lithie joined
01:28 sullyj3 joined
01:29 <sullyj3> hey guys, which arcane infix incantation do I have to use to make this one line inside a do block? `inputTmp <- getContents; let input = lines inputTmp`
01:29 notsohuman joined
01:30 <notsohuman> Hi
01:30 louispan joined
01:30 <benzrf> sullyj3: you just need fmap
01:30 carlomagno joined
01:30 <sullyj3> benzrf: Oh, of course.
01:30 <sullyj3> cheers.
01:30 <benzrf> lol
01:32 <sullyj3> like `input <- line <$> getContents`?
01:32 <notsohuman> How can I assign multiple argument using where??
01:34 <lpaste_> notsohuman revised “No title”: “multiple arguments in where” at http://lpaste.net/353367
01:34 <notsohuman> I edited it now
01:34 <notsohuman> is that correct ??
01:36 expo873 joined
01:42 louispan joined
01:43 fhoffmeyer joined
01:50 wei2912 joined
01:53 harfangk joined
01:55 stevenxl joined
01:56 eacameron joined
01:57 <stevenxl> Hi folks. I have two source files - PutJSON.hs and SimpleJSON.hs.
01:57 <stevenxl> I import SimpleJSON in PutJSON, but when I try to load PutJSON in ghci, I get an error that "Failed to load interface for "SimpleJSON""...
01:57 <stevenxl> any hints?
02:06 faberbrain joined
02:16 conal joined
02:19 exferenceBot joined
02:20 sullyj3 joined
02:20 <sullyj3> There's gotta be a better way to write this:? http://lpaste.net/353370
02:21 roboguy` joined
02:28 <stevenxl> @sullyj3
02:28 <lambdabot> Unknown command, try @list
02:29 <stevenxl> doesn't look to bad to me to be quit honest
02:29 <stevenxl> http://lpaste.net/353371
02:29 <stevenxl> The only thing I could think of was jsut adding the modulo then and there, instead of the recursive call.
02:30 <stevenxl> If it's already a multiple of five, the modulo would be 0, so the addition would be a no-op in terms of what is returned.
02:30 <stevenxl> The modulo basically tells us how much we have to add to get to the next five, if it's not already a multiple of five.
02:39 skeet70 joined
02:42 hexagoxel joined
02:44 fhoffmeyer joined
02:51 peterbecich joined
02:52 hphuoc25 joined
02:52 <faberbrain> how come this doesn't type check? http://lpaste.net/5337535972487725056
02:53 <geekosaur> because the default scope of a type variable is the thing it is used in
02:53 <geekosaur> so the scope of the one on line 4 is exactly line 4
02:54 <geekosaur> and the scope of the one on line 5 is the parentheses around the type-ascripted expression
02:54 NeverDie joined
02:54 Rodya_ joined
02:54 <geekosaur> you probably want to look at the ScopedTypeVariables extension; note that you also need to use an explicit "forall" on line 4 to "declare" the extended scope of the type variable "a"
02:55 <geekosaur> you can also avoid the extension by rewriting line 5:
02:55 ebsen joined
02:56 <geekosaur> hm, maybe not, I just confused myself. (this is not difficulr when type level stuff is in play, sadly)
02:56 <faberbrain> heh, yea i've discovered that
02:56 <faberbrain> i thought that without an explicit forall, it was implicitly added in front of everything?
02:56 <geekosaur> I think you can use asTypeOf somewhere in there but I got lost trying to use it with Proxy; it's usually used with the old style where we do undefined `asTypeOf` whatever instead of using Proxy
02:57 <geekosaur> otoh making those undefined-s go away is a Good Thing
02:57 <geekosaur> normally yes
02:57 <geekosaur> this abuse of forall is a hack
02:57 <geekosaur> tha lets you specify exactly which type variables get their scope extended into the definition
02:57 <faberbrain> so its an interaction between ScopedTypeVariables and forall that makes it work?
02:58 <geekosaur> (it even makes a certain twisted sense: forall normally limits the scope of a type variable, but here it's extending it)
02:58 <geekosaur> so forall can be used as a general marker for "beware, the scope of this type variable is different from normal"
02:59 <faberbrain> is that only true when using the ScopedTypeVariables extension?
02:59 <geekosaur> and yes, it's an interaction defined by the ScopedTypeVariables extension
02:59 <geekosaur> explicit forall would normally do nothing
02:59 <geekosaur> ScopedTypeVariables borrows it to mean something extra (extend the scope of only the specified type variables)
03:00 <faberbrain> interesting
03:00 <faberbrain> woudl there be any way to re-write that without the useless argument?
03:00 <geekosaur> that was what I was trying to figure out with asTypeOf
03:01 <geekosaur> I don't know how to make it work with Proxy :(
03:01 <faberbrain> hmm, its possible that i'm just approachign this whole problem wrong
03:01 <geekosaur> if you were using it in any other way, you could use it to extract the type of the parameter and apply it to the expression
03:02 <faberbrain> seems like being forced to inject a useless argument may be an indication of a larger design problem
03:02 <geekosaur> this doesn;t mean you;re doing it wrong, it does mean that you are playing with something Haskell wasn;t originally intended to do
03:02 <geekosaur> but ghc has been extended to do it. not always in the most "obvious" way because it would conflict with more normal use of Haskell
03:02 <faberbrain> yea makes sense
03:04 <faberbrain> the larger context (that led me to start messing w/ type level stuff and proxys) is tryign to do somethign like this: http://lpaste.net/5129458430632787968
03:04 <faberbrain> where the queueName is basically a constant for any given j
03:04 <faberbrain> but that doesn't work
03:04 Kuros joined
03:05 <faberbrain> unless i make it queueName :: Proxy j -> ByteString
03:05 <* geekosaur> will likely have to pass you on to someone else to decipher type level stuff... and you;d be better off asing in #haskell; type level shenanigans are not exactly beginner fodder
03:05 <faberbrain> hah, ok, i'll throw it out in #haskell.. thanks!
03:12 <notsohuman> How can I assign multiple argument using where?? http://lpaste.net/353367
03:12 <notsohuman> is the above code correct??
03:17 begriffs joined
03:22 seagreen joined
03:27 mattyw joined
03:30 mattyw joined
03:34 mattyw joined
03:40 begriffs joined
03:40 uglyfigurine joined
03:40 begriffs joined
03:41 mac10688 joined
03:43 aniketd joined
03:45 fhoffmeyer joined
03:49 systemfault joined
03:49 eacameron joined
03:52 sullyj3 joined
03:54 <xmonader> why this comment --: WRONG eval (Div x y) = pure safediv <*> eval x <*> eval y gives me an error? when i removed the colon from it was parsed correctly?
03:55 exferenceBot joined
03:55 <monochrom> A very special thing about how Haskell knows you intend a comment or you intend a user-defined operator.
03:56 <monochrom> "--:" is considered a user-defined operator.
03:57 <monochrom> Generally if you have dashes followed immediately by more puntuation, the whole thing is considered one token and a user-defined operator.
03:58 <monochrom> You need dashes followed by nothing or non-punctuations to indicate a comment.
03:59 hexagoxel joined
04:02 litwol joined
04:04 MickyOwly joined
04:08 shayan_ joined
04:09 louispan joined
04:13 nomotif joined
04:16 hphuoc25 joined
04:16 coderpath joined
04:24 faberbrain joined
04:24 seagreen joined
04:28 \Mike joined
04:30 uglyfigurine joined
04:44 peterbecich joined
04:47 fhoffmeyer joined
04:50 notsohuman joined
05:14 cschneid_ joined
05:16 begriffs joined
05:26 <mac10688> http://hackage.haskell.org/package/reactive-banana-1.1.0.1/docs/Control-Event-Handler.html
05:26 <mac10688> can someone help explain somethings to me about this page?
05:27 <mac10688> the register method takes a Handler a and produces an IO(IO ())
05:27 begriffs joined
05:28 <mac10688> but in the example under newAddHandler the register method takes the addHandler instead of the Handler
05:29 <mac10688> unless, (addHandler putStrLn) is the same as a Handler a
05:29 <mac10688> which is type Handler a = a -> IO ()
05:48 fhoffmeyer joined
05:50 permegreen joined
05:56 peterbecich joined
05:56 permagreen joined
06:00 permegreen joined
06:06 hphuoc25 joined
06:09 louispan joined
06:13 begriffs joined
06:14 eacameron joined
06:16 Rizy joined
06:48 shayan_ joined
06:49 uglyfigurine joined
06:49 fhoffmeyer joined
06:49 kritzcreek_ joined
06:51 Rizy joined
07:13 Pupnik_ joined
07:15 uglyfigurine joined
07:26 hdeshev joined
07:29 uglyfigurine joined
07:33 thc202 joined
07:40 owiecc joined
07:41 eacameron joined
07:48 Pupnik_ joined
07:51 fhoffmeyer joined
07:53 <Akii> hmm
07:53 pie_ joined
07:53 <Akii> I've two IO actions and I write "a <|> b"
07:53 <Akii> what would be a failing condition for a? throwing an exception?
07:54 <Akii> this is not helping xD https://hackage.haskell.org/package/base-4.9.1.0/docs/src/GHC.Base.html#line-1100
07:54 <Akii> what is mplusIO
07:55 <jle`> i think it's an exception, yes
07:55 uglyfigurine joined
07:55 <Akii> I'll just try it
07:55 <Akii> would be awesome
07:55 <Akii> and that's also what I'd expect to happen.. kinda
07:55 <dmj`> Akii: I’d check out io-choice
07:56 <dmj`> @package io-choice
07:56 <lambdabot> http://hackage.haskell.org/package/io-choice
07:56 <Akii> I've to be very productive today
07:56 <Akii> so I'll check that out later :D
07:56 <* Akii> is in full-speed full-pragmatism mode today
07:56 <dmj`> it might be more product to use that than write Alternative IO
07:56 <dmj`> productive*
07:58 <dmj`> plus kazu wrote it, so it’s quality
08:01 <jle`> Alternative IO is in base though, isn't it?
08:04 raduom joined
08:05 permagreen joined
08:08 uglyfigurine joined
08:11 <dmj`> I don’t think so
08:12 <dmj`> it is !
08:12 <dmj`> instance Alternative IO -- Defined in `GHC.Base'
08:13 <dmj`> new as of 4.9
08:14 dmj` joined
08:22 <jle`> ah so it's recent :o
08:32 zero_byte joined
08:34 peterbecich joined
08:34 uglyfigurine joined
08:35 owiecc joined
08:38 Rizy joined
08:40 eacameron joined
08:52 fhoffmeyer joined
08:52 louispan joined
09:03 Rizy joined
09:08 ali_bush joined
09:08 ali_bush joined
09:14 uglyfigurine joined
09:14 owiecc joined
09:16 MickyOwly joined
09:17 ali_bush joined
09:17 ali_bush joined
09:17 faberbrain joined
09:21 merijn joined
09:27 Rizy joined
09:29 grdryn joined
09:30 <Akii> can't connect to localhost with simpleHTTP O.o
09:30 <Akii> anyone else had the same problem maybe?
09:30 <Akii> *** Exception: connect: does not exist (Connection refused)
09:30 <Akii> great now it works
09:31 <Akii> changed nothing; maybe timeout
09:31 cschneid_ joined
09:32 <Akii> nope, no idea; seemed random
09:53 fhoffmeyer joined
09:53 uglyfigurine joined
09:54 pie_ joined
09:56 mengu joined
10:09 uglyfigurine joined
10:15 andrei_chifa joined
10:17 Gurkenglas_ joined
10:20 galderz joined
10:21 hphuoc25 joined
10:26 fab_ joined
10:26 kadoban joined
10:33 uglyfigurine joined
10:42 tsmish joined
10:46 lithie joined
10:48 uglyfigurine joined
10:54 keutoi joined
10:55 fhoffmeyer joined
11:05 galderz joined
11:12 Guest56598 joined
11:13 <Guest56598> hello
11:15 <Akii> hi!
11:18 <Guest56598> i'm new to irc
11:19 <Guest56598> i just wanted to know where all the haskell people hang out
11:20 faberbrain joined
11:20 <Akii> you found 'em
11:21 <Akii> here and in #haskell
11:21 <Akii> you can chose a nick with `/nick yournick`
11:21 <Akii> choose*
11:21 <Guest56598> i was learning the language for some time now, but it's nice to know that you are not alone
11:21 <mengu> Guest56598: you will never walk alone :-)
11:21 hphuoc25 joined
11:22 <yellow_janitor> it's nice to know, thank you)
11:22 <yellow_janitor> i have one questino that bothers me
11:23 <yellow_janitor> does anyone know anything about keera studios?
11:23 <mengu> if anyone has safaribooksonline membership, here's a nice series https://www.safaribooksonline.com/library/view/learning-haskell-programming/9781786465542/
11:24 <mengu> yellow_janitor: i've just heard it from you
11:24 <yellow_janitor> they supposed to be doing game engine in haskell
11:25 <yellow_janitor> but i couldn't find no info on it
11:25 <mengu> their blog looks old
11:25 <mengu> last entry is on 2015
11:25 <yellow_janitor> yeah
11:25 <yellow_janitor> i thought so myself
11:26 <mengu> but
11:26 <mengu> https://github.com/keera-studios
11:26 <yellow_janitor> one of them currently maintains yampa
11:26 <mengu> this is their github account
11:27 <yellow_janitor> i saw that too, but there are bunch of fpr libraries
11:27 <mengu> yellow_janitor: so you want to make games?
11:28 nacon joined
11:28 nacon joined
11:28 <yellow_janitor> i started programming with that in mind
11:28 <mengu> yellow_janitor: if you are on mac, https://github.com/mchakravarty/HaskellSpriteKit
11:28 <yellow_janitor> back in 2012
11:28 <mengu> i really want to do something with this
11:28 <yellow_janitor> no, linux
11:28 djfo joined
11:28 <mengu> i think, i'm dumb, can't think of any game
11:30 <mengu> yellow_janitor: there are some opengl bindings, https://wiki.haskell.org/OpenGL
11:30 <yellow_janitor> yeah, there are, but i'm not too great with low level 3d graphics and such
11:32 <mengu> yellow_janitor: and not related with haskell but with gaming, https://www.youtube.com/playlist?list=PLmV5I2fxaiCI9IAdFmGChKbIbenqRMi6Z
11:34 <Akii> hm I bet there is a function for that: `ioA >>= \a -> doSmthWith a; return a`
11:34 <Akii> a do is missing `do smthWith a; return a`
11:34 <yellow_janitor> i'm currently struggling with url copying
11:35 netheranthem joined
11:35 <mengu> yellow_janitor: you can download xchat for linux
11:35 <yellow_janitor> never new how to use tmux copy mode properly
11:36 <yellow_janitor> a would prefer a cui client
11:38 <yellow_janitor> i have an issue with memory leaks, so just trying to minimize ram usage
11:38 <yellow_janitor> akii, why not ioA >>= return . doSmthWith ?
11:39 <yellow_janitor> or map doSmthWith ioA?
11:39 <yellow_janitor> fmap *
11:39 <Akii> yellow_janitor: doSmthWith has unit return type
11:39 <yellow_janitor> oh, i see
11:40 <Akii> it's just an additional thing I want to do before returning the previous result unmodified
11:41 snowcrshd joined
11:50 reverse_light joined
11:53 <yellow_janitor> what does "---------------------------" in this chat means?
11:54 xmonader joined
11:54 <Geekingfrog> This is probably something your irc client printed just for you. Possibly when you switched to another window and then came back, to show you where you left.
11:55 <yellow_janitor> oh, maybe
11:56 <yellow_janitor> i just switched few times back and forth and it disappeared
11:56 fhoffmeyer joined
12:04 ederign joined
12:08 owiecc joined
12:09 yellow_janitor joined
12:19 janitor1 joined
12:22 hphuoc25 joined
12:29 <janitor1> i won the fight over urls, but in the meantime i lost the url i wanted to open
12:30 jarshwah joined
12:30 <djfo> janitor1: https://wiki.haskell.org/OpenGL ?
12:31 <janitor1> it was a video on youtube
12:31 <djfo> https://www.youtube.com/playlist?list=PLmV5I2fxaiCI9IAdFmGChKbIbenqRMi6Z
12:33 <janitor1> thank you
12:35 zero_byte joined
12:37 galderz joined
12:39 andrei_chifa joined
12:39 <janitor1> interesting kind of let's play videos
12:57 fhoffmeyer joined
12:59 takle joined
13:03 dni-_ joined
13:07 djfo left
13:08 kzz322 joined
13:11 andrei_chifa joined
13:15 mixandgo joined
13:15 xmonader joined
13:21 faberbrain joined
13:30 kzz322 left
13:59 fhoffmeyer joined
13:59 <yellow_janitor> Akii, about function io >>= \a -> doStuff a >> return a
14:00 <yellow_janitor> i think (*>) is what you need there
14:00 <Akii> :t (*>)
14:00 <lambdabot> Applicative f => f a -> f b -> f b
14:00 <yellow_janitor> yeah
14:00 <Akii> almost
14:01 <Akii> :t (<*)
14:01 <lambdabot> Applicative f => f a -> f b -> f a
14:01 <Akii> more like it
14:01 <Akii> thanks!
14:01 <Akii> totally forgot about applicatives again
14:01 <Akii> @karma+ yellow_janitor
14:01 <lambdabot> yellow_janitor's karma raised to 1.
14:01 <yellow_janitor> yeah thats more like it
14:01 <yellow_janitor> oh
14:01 <yellow_janitor> what's karma?
14:01 <Akii> good question
14:01 <Akii> internet points
14:01 <Akii> the more you have the better
14:02 <yellow_janitor> i never quite knew why anyone would need such a useless thing as (*>)
14:02 <yellow_janitor> but i got it now
14:04 <yellow_janitor> i thought of it as a useless thing before i understood what applicatives exectly are, though
14:04 <Akii> nope, sorry
14:04 <Akii> that's not working
14:04 <Akii> as I do need bind here
14:04 <Akii> anyway not so important
14:04 <yellow_janitor> i think you use it like (ai >>= doStuff *>)
14:05 <Akii> that would make sense yes
14:05 <Akii> I find that harder to read though
14:05 <yellow_janitor> not exactly a single function, but a little bit more concise
14:05 <Akii> ye ok
14:07 <Akii> nope not working xD
14:07 <yellow_janitor> i know
14:07 <Akii> need to play around with it more later
14:07 <yellow_janitor> just tried
14:08 <yellow_janitor> but
14:08 <yellow_janitor> it works if put something after *>
14:08 <yellow_janitor> it breaks because of precendence i think
14:09 <Akii> well it's partial application otherwise
14:10 <yellow_janitor> yeah
14:10 <yellow_janitor> it was the idea
14:10 <yellow_janitor> not very good one though
14:10 <Akii> it's almost working :D
14:12 <yellow_janitor> in something like purescript it would be possible to partially apply it though
14:12 mizu_no_oto_work joined
14:12 <Akii> well you can too
14:12 <Akii> (*>) a1
14:13 <yellow_janitor> yes, obviously
14:13 <yellow_janitor> but i somehow forgot about that
14:17 <yellow_janitor> no good, partial application messes everything up
14:25 hphuoc25 joined
14:27 hphuoc25 joined
14:29 n00b joined
14:30 <Guest674> Hey
14:34 pbrant joined
14:36 mattyw joined
14:37 Rizy joined
14:39 mattyw_ joined
14:45 PeterStuart joined
14:48 cris_ joined
14:50 <cris_> hello, i publish a package , free to comment: https://hackage.haskell.org/package/carbonara
14:51 janitor1 joined
14:52 <cris_> hi janitor
14:52 <Durbley_> http://lpaste.net/1401021544590737408 why is this correct?
14:53 <Durbley_> I don't understand why it's asymmetric
14:53 <Durbley_> unless I'm totally misunderstanding what Either is for
14:53 snowcrshd joined
14:54 <Durbley_> also, I don't understand this line "instance Functor (PhhhbbtttEither b) where"
14:55 <Durbley_> why isn't it just PhhhbbtttEither or (PhhhhbbtttEither b a)
14:56 <ski> Durbley_ : do you know about kinds ?
14:56 <Durbley_> I was just skimming back over that chapter. Honestly, barely
14:56 <janitor1> hello cris_
14:57 <ski> "kinds" are, basically, "types of types"
14:57 <ski> consider `Maybe'
14:57 <ski> saying `x :: Maybe' doesn't make sense. a value can't have type `Maybe'
14:58 <Durbley_> yeah it has to be Just x or Nothing
14:58 <Akii> hmpf anyone got an idea how to write y? http://lpaste.net/353392
14:58 <ski> `Maybe' is not a "concrete type", it's a "template", you have to specify an "element" type (thinking of `Maybe' as describing "collections" having zero or one element in it)
14:58 <ski> so, if `X' is a concrete type, then `Maybe X' is also a concrete type
14:58 <Durbley_> it's of kind *->* right?
14:58 <ski> or, if `X' has kind `*', then `Maybe X' has kind `*'
14:58 <ski> and so `Maybe' itself has kind `* -> *', yes
14:59 <ski> `Maybe' is a type function, a function on the type level, mapping concrete types into concrete types
14:59 <ski> now, if you consider type classes, like e.g. `Eq', this is a predicate (property) of *concrete* types
14:59 <ski> so in `Eq X', `X' should have kind `*'
14:59 <ski> however, for `Functor F', `F' should have kind `* -> *'
15:00 <Durbley_> why
15:00 fhoffmeyer joined
15:00 <ski> the member function `fmap', for `Functor f', has type `forall a b. (a -> b) -> f a -> f b'
15:00 <ski> `f' is being applied to concrete types, `a' resp. `b', in the type signature of `fmap'
15:01 <ski> e.g., for the instance `Functor Maybe', `fmap' has type `forall a b. (a -> b) -> Maybe a -> Maybe b'
15:01 <ski> allowing one to "map over" the contents, by applying a function transforming an `a' to a `b'
15:01 <ski> (and in case the "collection" is empty, we get back an empty "collection")
15:01 <Durbley_> okay sec
15:01 <ski> @src Maybe fmap
15:01 <lambdabot> fmap _ Nothing = Nothing
15:01 <lambdabot> fmap f (Just a) = Just (f a)
15:02 <Durbley_> I think I might know why I'm confused
15:02 <ski> now, if we take again
15:02 <ski> fmap :: forall a b. (a -> b) -> f a -> f b
15:02 <ski> actually, let's rename the `a' and `b' here to `a0' and `a1', so
15:02 <ski> fmap :: forall a0 a1. (a0 -> a1) -> f a0 -> f a1
15:02 <ski> now, in your case, we have `Functor (PhhhbbtttEither b)'
15:03 <ski> so `f' here is `PhhhbbtttEither b', so in this case the signature for `fmap' will be
15:03 <ski> fmap :: forall a0 a1. (a0 -> a1) -> PhhhbbtttEither b a0 -> PhhhbbtttEither b a1
15:03 <ski> note that `PhhhbbtttEither' itself has kind `* -> * -> *', so can't be an instance of `Functor'
15:03 <ski> but, given any `b', `PhhhbbtttEither b' *has* kind `* -> *'
15:03 <Durbley_> yeah I think I get it
15:04 <Durbley_> my confusion still though is
15:04 <ski> so, `b' is kept "fixed", only the "last type argument" is what may be changed by `fmap
15:04 <ski> '
15:04 <Durbley_> what's the point of Either
15:04 <ski> so if `f :: Int -> Bool', and we have `x :: PhhhbbtttEither String Int', then `fmap f x :: PhhhbbtttEither String Bool', changing the `Left' part, if it's that alternative
15:05 <ski> `Either' is for expressing one of two possible alternatives
15:05 <ski> a common use is "either we get some kind of error indication, or we get the expected result"
15:05 <Durbley_> so the reason we only map over the Left side is because the Right side represents "we don't care"?
15:05 <Durbley_> in this case
15:05 <ski> the reason we only map over the `Left' side is because `PhhhbbtttEither' was defined as
15:05 <ski> data PhhhbbtttEither b a = Left a | Right b
15:06 <ski> where the *last* type parameter (`a') is the one that's specifying the argument type of the data constructor `Left'
15:06 <ski> if we had instead defined
15:06 <ski> data PhhhbbtttEither a b = Left a | Right b
15:06 <ski> then `fmap' would have to change the `Right' case instead
15:06 <Durbley_> I think that was my confusion
15:06 <Durbley_> isn't it usually defined as the latter
15:07 <Durbley_> (part of my confusion)
15:07 <ski> yes, the usual `Either' is in this latter way
15:07 <ski> instance Functor PhhhbbtttEither
15:07 <ski> doesn't work
15:07 <ski> instance Functor (PhhhbbtttEither b)
15:07 <ski> works, by partially applying to all type parameters, *except* the last (which is what `fmap' will "change"), because then the resulting partially applied type will have the right kind `* -> *'
15:08 <ski> *if* we could use lambda expressions in types, then one could imagine something like
15:08 <ski> instance Functor (\b -> PhhhbbtttEither b a)
15:08 <ski> which then would change the `Right' alternative instead
15:08 <Durbley_> can you give an example of using this Functor in a useful way
15:08 <ski> (note that `\a -> PhhhbbtttEither b a' is conceptually the same thing as `PhhhbbtttEither b')
15:09 <ski> i suspect they defined this `PhhhbbtttEither' "the other way around", just to spite you a bit, making you realize why the ordinary `Either' has to have `fmap' changing the `Right' case, and not the `Left' one
15:10 <janitor1> would it work?
15:10 <ski> would what work ?
15:10 <janitor1> the \b -> puoeuoeu b a thing
15:10 <janitor1> \oeu -> anithing is a lambda
15:10 <janitor1> Poeuoe a a atype
15:10 <janitor1> type contructor
15:10 <janitor1> sorry
15:10 <ski> well, we can't use actually lambda expressions in types, so we can't try it
15:11 <ski> .. there's also a conceptual problem
15:11 <ski> when you use `fmap f x', and say `x :: PhhhbbtttEither String Int'
15:11 <janitor1> if mean that as a type constructor than it would
15:12 <ski> now, we want to match the actual parameter type `PhhhbbtttEither String Int, with the formal parameter (of `fmap') type `f a' of
15:12 <ski> the obvious way, which is what Haskell does, is set `f' to the `PhhhbbtttEither String' part, and `a' to the `Int' part
15:12 <ski> (recall that `PhhhbbtttEither String Int' means `(PhhhbbtttEither String) Int')
15:13 <Durbley_> ski do I need the same kinds for Applicative and Monad
15:13 <ski> so, that means we're looking at
15:13 <ski> fmap :: (Int -> b) -> PhhhbbtttEither String Int -> PhhhbbtttEither String b'
15:13 <ski> and then by matching the type of `f' with `Int -> b', and/or by matching the expected return type with the type `PhhhbbtttEither String b', we should also be able to determine `b' in this specific call of `fmap'
15:14 <ski> however, another way to match `PhhhbbtttEither String Int', with `f a', conceptually speaking
15:14 <janitor1> yes, you do need the same kinds
15:14 <ski> is to first note that `PhhhbbtttEither String Int' is (conceptually) equal to `(\b -> PhhhbbtttEither b Int) String'
15:15 <ski> so it would seem that `f' could also be `\b -> PhhhbbtttEither b Int', and `a' be `String'
15:15 <ski> (this would then use the other instance we imagined above)
15:15 chlong_ joined
15:16 <ski> but the main problem here is that a type system wouldn't know which of these two different instances you actually wanted to use
15:16 owiecc joined
15:16 <ski> (in some cases, it could rule out all but one alternative, by looking at return type, and the type of `f'. but that won't work in all cases)
15:16 <ski> Durbley_ : yes
15:17 <ski> Durbley_,janitor1 : does this make sense ?
15:17 <janitor1> for me yes
15:18 <janitor1> but i think that using lambdas in the explanation may cause some frustration
15:18 Rodya_ joined
15:19 <Durbley_> why do you need that kind for Functor, Applicative, and Monad?
15:19 <ski> because
15:19 <ski> @src Functor
15:19 <lambdabot> class Functor f where
15:19 <lambdabot> fmap :: (a -> b) -> f a -> f b
15:19 <Sornaensis> `f a`
15:19 <ski> the type parameter, `f', of `Functor' is applied to `a' (and to `b'), in the type signature of `fmap'
15:20 <ski> since e.g. `f b', the return type, must be a concrete type, that means that `f' itself must have kind `... -> *'
15:20 <Sornaensis> :kind Maybe
15:20 <janitor1> sorry, but can somebody tell how to use lambdabot?
15:20 <ski> and, looking at `a -> b', we see that `a' and `b' must also be concrete types, so `f' indeed must have kind `* -> *'
15:20 <ski> @kind Maybe
15:20 <ski> :k Maybe
15:20 <lambdabot> * -> *
15:20 <lambdabot> * -> *
15:20 <Sornaensis> thx
15:20 <ski> @kind Functor
15:20 <lambdabot> (* -> *) -> Constraint
15:21 <ski> @kind Eq
15:21 <lambdabot> * -> Constraint
15:21 <Sornaensis> can you get source for instances?
15:21 <janitor1> does he know about anithing not from prelude?
15:21 <Sornaensis> @src Eq Maybe
15:21 <lambdabot> Source not found. And you call yourself a Rocket Surgeon!
15:21 <Sornaensis> @src render
15:21 <lambdabot> Source not found. I don't think I can be your friend on Facebook anymore.
15:21 <ski> only for a few cases, which someone has hard-coded into lambdabot (or rather a small resource file that it uses)
15:22 <ski> @src [] (==)
15:22 <lambdabot> [] == [] = True
15:22 <lambdabot> (x:xs) == (y:ys) = x == y && xs == ys
15:22 <lambdabot> _ == _ = False
15:22 <ski> @src Maybe fmap
15:22 <lambdabot> fmap _ Nothing = Nothing
15:22 <lambdabot> fmap f (Just a) = Just (f a)
15:23 <ski> @where src
15:23 <lambdabot> The fixed database for the `src' lambdabot command is at <https://github.com/lambdabot/lambdabot/blob/master/lambdabot/State/source>
15:25 <* ski> isn't sure that's the up-to-date location, but should give you an idea
15:25 <ski> @where L.hs
15:25 <lambdabot> what lambdabot has in scope is at http://silicon.int-e.eu/lambdabot/State/Pristine.hs
15:26 <ski> (might be a more up-to-date location. int-e is the one currently hosting lambdabot, at least the last i heard)
15:27 <ski> (it's also possible to install lambdabot locally, e.g. querying it locally (from the interactor, iirc))
15:27 <* ski> hasn't tried that, though
15:27 eacameron joined
15:33 thc202 joined
15:33 eacameron joined
15:48 nail82 joined
15:49 nail82 joined
15:51 xmonader joined
15:54 mixandgo joined
15:59 hoffmeyer joined
16:01 fhoffmeyer joined
16:02 aniketd joined
16:03 cschneid_ joined
16:03 owiecc joined
16:03 contiver joined
16:06 uglyfigurine joined
16:07 hoffmeyer joined
16:08 owiecc joined
16:12 dgonzo joined
16:12 zero_byte joined
16:13 emmanuel_erc joined
16:22 djfo joined
16:24 jathan joined
16:25 nail82 left
16:25 hphuoc25 joined
16:26 dgonzo joined
16:31 dgonzo joined
16:38 pfurla joined
16:43 djfo joined
16:56 owiecc joined
16:56 conal joined
16:58 <janitor1> Akii: i can't think of anything reasonable without pattern matching
16:58 <janitor1> so i came up with this
16:58 <janitor1> http://lpaste.net/353397
17:00 gpolitis joined
17:02 gpolitis joined
17:02 fhoffmeyer joined
17:09 aminb joined
17:10 <ski> janitor1 : looks like you could possibly use `ExceptT'
17:27 hphuoc25 joined
17:30 janitor1 joined
17:32 lithie joined
17:43 robertss joined
17:44 robertss left
17:45 uglyfigurine joined
17:45 AndreasK joined
17:49 aarvar joined
17:59 <MarcelineVQ> ski: for which problem?
18:01 <ski> i don't know. i was only commenting on the paste
18:03 <ski> `somefun' looks similar to `(>>=)' on `ExceptT a IO'
18:04 skeet70 joined
18:04 fhoffmeyer joined
18:05 Majiir joined
18:05 <ski> hm .. or i suppose `mapM' on `Either a . []' ?
18:05 michbad joined
18:06 takle joined
18:06 <MarcelineVQ> ah neat observation, I was playing with it and ended up with mapM (mapM f) r for the second case but didn't consider the entire pattern was more general as well
18:09 malaclyps joined
18:09 ncyellow joined
18:13 <janitor1> ski: i missed your comment
18:14 takle joined
18:14 <ski> ah
18:14 <ski> <ski> janitor1 : looks like you could possibly use `ExceptT'
18:14 <janitor1> i thought so myself at first
18:15 <janitor1> actually i thought of EitherT
18:15 cgdub joined
18:16 <janitor1> but i'm not quite used to transformers yet
18:17 <janitor1> and original problem was about Either, IO and list
18:31 ncyellow joined
18:32 pfurla joined
18:35 <janitor1> :t (>>=)
18:35 <lambdabot> Monad m => m a -> (a -> m b) -> m b
18:37 <ski> certain common patterns of using `m (Maybe a)' or `m (Either e a)', e.g. `m' being `IO', can be more nicely expressed using `MaybeT m a' and `ExceptT e m a'
18:38 <ski> (cuts down on the boiler-plate, lets one focus more on the part of the code actually contributing directly to the functionality)
18:39 <janitor1> ski: what do you mean by Either a . []?
18:39 bjoernfan left
18:43 <ski> janitor1 : something like `newtype EitherList e a = EL (Either e [a])'
18:43 <ski> for which your `somefun' is the `mapM' (see `Traversable') for
18:43 <janitor1> aha
18:43 <janitor1> now i see
18:43 <ski> @type mapM
18:43 <lambdabot> (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
18:43 <ski> in your case, `m = IO'
18:47 <janitor1> but then i have to make a bunch of instances for EL
18:49 <janitor1> foldable, traversable and a functor
18:54 xmonader joined
18:59 <ski> you should be able to derive `Functor'. iirc, also the two others
19:00 <x1n4u> how can i wrap a IO a in a IO (Maybe a) ?
19:01 <monochrom> Does that mean IO (Maybe (IO a))?
19:01 <ski> `fmap Just', iiuc ..
19:01 <x1n4u> monochrom: nope IO (Maybe IO)
19:01 <monochrom> There is no such thing.
19:02 <* ski> suggests x1n4u give more context
19:03 <x1n4u> i created a little gist https://gist.github.com/x1n4u/4c32853cc55a839e7cecb2755c051182
19:04 <x1n4u> ski: i'm trying to check if some condition is true and return a just value from an io action or return nothing
19:05 Gurkenglas joined
19:05 fhoffmeyer joined
19:06 <x1n4u> monochrom: sry meant IO (Maybe a), ah my brain isn't work properly
19:06 <monochrom> Then what ski said. fmap Just.
19:07 owiecc joined
19:07 <ski> perhaps `MaybeT IO' could be useful here -- but it's hard to say for sure, without seeing more of the surrounding code
19:07 earldouglas joined
19:08 <x1n4u> ski: i have updated the gist with some more code, hope this is more helpful
19:13 <x1n4u> found a solution, damn me
19:14 <ski> doesn't show call sites of `checkForDeps'
19:14 <x1n4u> thanks for your nice help
19:15 <ski> (found a solution for what ?)
19:17 <x1n4u> ski: my problem
19:18 <ski> which of them ? :)
19:18 <ski> <x1n4u> ski: i'm trying to check if some condition is true and return a just value from an io action or return nothing
19:18 <x1n4u> fmap and changing the positio of my return
19:18 <ski> or some other problem (which you haven't mentioned, and perhaps not noticed, yet)
19:19 <ski> (oh, i just noticed you had `return $ ...' there)
19:20 <* ski> is still interested in seeing how `checkForDeps' is called
19:20 <x1n4u> i wish i could show you the callSite but its not implemented yet
19:20 <ski> ah, i see :)
19:20 <x1n4u> :D
19:21 <x1n4u> thanks, you guys rock
19:22 <ski> yw
19:26 faberbrain joined
19:28 hphuoc25 joined
19:31 <* mniip> . o O ( IOT Maybe )
19:32 uglyfigurine joined
19:33 uglyfigurine joined
19:34 <ski> hehe
19:36 albertus1 joined
19:43 chlong_ joined
19:46 nomotif joined
19:48 fhoffmeyer joined
19:58 t0by joined
20:00 conal joined
20:12 ultalbot joined
20:25 mengu_ joined
20:29 hphuoc25 joined
20:34 initiumdoeslinux joined
20:47 uglyfigurine joined
20:52 jarshwah_ joined
20:58 uglyfigurine joined
21:00 mengu joined
21:06 thc202 joined
21:08 louispan joined
21:24 mizu_no_oto_work joined
21:26 pie__ joined
21:28 faberbrain joined
21:30 hphuoc25 joined
21:30 merijn joined
21:41 averell joined
21:41 MotherFlojo joined
21:44 <MotherFlojo> Hi, I'm a little lost on the phone exercise in chapter 11. Can anybody give me a hint on how to set up the datastructure
21:47 tnks joined
21:49 eacameron joined
21:52 hiratara joined
21:53 <eacameron> Does anyone derive their Arbitrary instances with Generics? I have a simple record type which really just needs to stick "arbitrary" into every field.
21:54 <eacameron> I'm not sure if that's a beginner question or not...but I'm certainly a QuickCheck beginner... ;)
21:56 <jle`> i think there are some libraries
22:00 <eacameron> jle`: I saw one on GitHub but nothing on Hackage that I could find. Is it not commonly done for some reason?
22:00 dni- joined
22:01 <jle`> i'm seeing https://hackage.haskell.org/package/quickcheck-arbitrary-adt ?
22:01 dpren joined
22:01 <eacameron> jle`: Oh, I missed that one!
22:03 NoCreativity joined
22:04 carlomagno joined
22:04 louispan joined
22:06 madjestic joined
22:12 meck joined
22:21 Gurkenglas joined
22:30 faberbrain joined
22:30 hphuoc25 joined
22:31 hiratara joined
22:32 jarshwah joined
22:35 albertus1 joined
22:37 shayan_ joined
22:42 pilne joined
22:46 NoCreativity_ joined
22:48 albertus1 joined
22:49 ncyellow left
22:49 mizu_no_oto_work joined
22:59 zero_byte joined
23:02 nadirs joined
23:28 geekosaur joined
23:36 louispan joined
23:37 nomotif joined
23:40 curious_corn joined
23:44 aarvar joined
23:55 peterbecich joined
23:57 cschneid_ joined