<    April 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
00:00 bydo joined
00:14 <Durbley> using just the IO monad, can someone suggest some exercises
00:14 <Durbley> illuminating ones
00:16 <Durbley> lol a good smart ass answer would be: main = do {putStrLn "Exercise : ... "}
00:25 <benzrf> Durbley: hey sorry my internet farted
00:25 <benzrf> Durbley: fyi, someone observed "io monad" is bad terminology - just "IO type" is better
00:25 <Durbley> y
00:26 <benzrf> calling it a monad even when you're just talking about the type in general would be like "how should i have a function that might not have a result without throwing an exception?" "use the Either monad"
00:26 <benzrf> which would be weird - the point isn't the monadness, it's the Either type
00:26 <benzrf> perhaps you will use the monad instance when making use of the function, but that's beside the point
00:27 <Durbley> when would you not use the monad part
00:27 <Durbley> derp = putStrLn "derp"
00:27 <Durbley> ?
00:27 <benzrf> well... ok :)
00:27 <benzrf> and yeah that would be one example
00:31 MotherFlojo joined
00:37 takle joined
00:47 takle joined
00:49 conal joined
00:55 takle joined
01:01 vaibhavsagar joined
01:05 peterbecich joined
01:06 takle joined
01:06 Durbley_ joined
01:14 ali_bush joined
01:14 ali_bush joined
01:15 monochrom joined
01:16 peterbecich joined
01:21 takle joined
01:27 ali_bush joined
01:27 ali_bush joined
01:34 metalbot joined
01:35 animated joined
01:38 takle joined
01:41 Guest88185 joined
01:43 louispan joined
01:47 vaibhavsagar joined
01:47 Rodya_ joined
01:51 takle joined
01:54 geekosaur joined
01:57 baldfat_ joined
02:00 conal joined
02:04 takle joined
02:12 louispan joined
02:12 ljc joined
02:14 takle joined
02:16 exferenceBot joined
02:18 takle_ joined
02:21 hexagoxel joined
02:28 takle joined
02:31 MotherFlojo joined
02:32 sotojuan joined
02:37 conal joined
02:41 kadoban joined
02:42 louispan joined
02:45 takle joined
02:45 MotherFlojo joined
02:57 chatter29 joined
02:57 <chatter29> hey guys
02:57 chatter29 joined
02:58 developernotes joined
02:59 <chatter29> allah is doing
02:59 <chatter29> sun is not doing allah is doing
02:59 <chatter29> to accept Islam say that i bear witness that there is no deity worthy of worship except Allah and Muhammad peace be upon him is his slave and messenger
03:00 developernotes left
03:01 takle joined
03:09 takle joined
03:17 takle joined
03:27 Durbley joined
03:29 conal joined
03:33 takle joined
03:38 malaclyps joined
03:40 sherub1 joined
03:41 louispan joined
03:49 takle joined
03:54 <benzrf> wot
03:56 kritzcreek_ joined
03:58 takle joined
04:02 DataComputist joined
04:02 yellowj joined
04:05 Guest5679 joined
04:07 takle joined
04:10 <Durbley> https://pastebin.com/gsY50ye8
04:10 <Durbley> reimplementing State functor exercise
04:11 <Durbley> is this right, overcomplicated?
04:15 peterbecich joined
04:22 conal joined
04:26 <Durbley> nvm. above is wrong
04:26 <Durbley> https://pastebin.com/GyDWaHcH
04:26 <Durbley> same questions for this
04:26 ploop joined
04:26 <monochrom> Have you tested it?
04:27 aarvar joined
04:27 <Durbley> runMoi ((+1) <$> (Moi $ \s -> (0, s))) 0
04:27 <Durbley> (1,0)
04:27 <Durbley> only test case he gives
04:27 <Durbley> it works
04:27 <Durbley> but my first one did too but it was wrong
04:28 Cale joined
04:29 <Durbley> the functor for tuple maps over the second element right? is there a standard version that maps over first
04:32 takle joined
04:40 takle joined
04:40 conal joined
04:41 <Durbley> did applicative, https://pastebin.com/P0n52Zrd
04:41 <vaibhavsagar> @import Control.Arrow
04:41 <lambdabot> Unknown command, try @list
04:41 <vaibhavsagar> :t Control.Arrow.first
04:41 <lambdabot> Arrow a => a b c -> a (b, d) (c, d)
04:41 <vaibhavsagar> > Control.Arrow.first (+1) (2,3)
04:41 <lambdabot> (3,3)
04:42 <vaibhavsagar> Durbley: is that what you're looking for?
04:42 <Durbley> fmap f (Moi g) = Moi (\s -> first f (g s))
04:42 <Durbley> i think so
04:43 <kadoban> If so, using Data.Bifunctor.first is usually what I want instead. It generalizes over the thing I *far* more often want to generalize over.
04:47 <Durbley> can someone tell me if these are proper implementations of functor and applicative for State
04:47 <Durbley> https://pastebin.com/P0n52Zrd
04:47 <monochrom> Yes.
04:47 <Durbley> rly
04:48 pbrant joined
04:48 <monochrom> Yes.
04:48 <Durbley> nice. thanks
04:48 takle joined
04:48 <Durbley> monad next
04:48 <Durbley> gulp
04:48 <monochrom> But you should devise tests.
04:48 <Durbley> haha nope
04:50 <MarcelineVQ> the book will eventually ask you to create tests for your instances, if it hasn't already
04:52 <Durbley> it probably did but i probably refused
04:52 <MarcelineVQ> you should unrefuse, quickcheck or something like it will save your life some day best to figure it out early :O
04:53 <Durbley> says everyone who didn't do that
04:54 <MarcelineVQ> I did that :(
04:54 <MarcelineVQ> depending on the that you mean :>
04:59 malaclyps joined
04:59 Levex joined
05:01 takle joined
05:02 MotherFlojo joined
05:07 takle joined
05:13 <Durbley> newtype Moi s a = Moi { runMoi :: s -> (a, s) }
05:13 <Durbley> when I have a data of type Moi s a
05:13 <Durbley> how do I actually call runMoi
05:16 <Durbley> ahhh i got it
05:16 takle joined
05:18 conal joined
05:24 MotherFlojo joined
05:34 takle joined
05:45 IRCFrEAK joined
05:47 alexelcu joined
05:47 IRCFrEAK left
05:51 systemfault joined
05:53 takle joined
05:54 srhb joined
05:56 sherub1 joined
05:56 ThomasLocke joined
05:58 meandi_2 joined
06:06 galderz joined
06:07 takle joined
06:11 dni- joined
06:14 takle joined
06:27 takle joined
06:30 raduom joined
06:34 ali_bush joined
06:34 ali_bush joined
06:37 vaibhavsagar joined
06:38 Levex joined
06:40 salva joined
06:45 andyhoang joined
06:48 nick_h joined
06:52 thc202 joined
06:53 taksuyu joined
06:53 louispan joined
06:59 mattyw joined
07:12 patbecich joined
07:13 malaclyps joined
07:15 nick_h joined
07:15 nick_h joined
07:28 takle joined
07:36 peterbecich joined
07:41 takle joined
07:42 Durz0 joined
07:43 chin-tastic joined
07:50 alexelcu joined
07:51 takle joined
07:53 Pupnik joined
07:53 teho_ joined
07:53 <teho_> hi
07:54 <teho_> `f [] = 0;f (' ':xs) = f xs` is syntactic sugar for case..of?
07:54 alexelcu1 joined
07:54 <teho_> `case...of`
07:56 <jle`> i think so, yes
07:57 alexelcu joined
07:58 <teho_> do haskell programmers use frequently syntactic sugar like 'do' or 'if'?
07:58 alexelcu joined
07:58 <jle`> do is pretty common
07:59 <jle`> if is less common
07:59 <jle`> but not exactly rare
08:00 <teho_> thanks
08:00 takle joined
08:02 takle_ joined
08:09 takle joined
08:10 Uniaika joined
08:13 merijn joined
08:19 <jle`> no problem!
08:25 grdryn joined
08:28 nacon joined
08:29 suls joined
08:30 zero_byte joined
08:32 t0by joined
08:34 Uniaika joined
08:35 MotherFlojo joined
08:35 Gurkenglas joined
08:37 takle joined
08:42 gpampara joined
08:46 prophile joined
08:52 Gurkenglas_ joined
09:13 patbecich joined
09:30 <dmj`> bool is the new if
09:32 Iceland_jack joined
09:32 <Iceland_jack> Hey all!
09:33 <* dmj`> waves to Iceland_jack
09:33 <* Iceland_jack> waves back
09:44 dni- joined
09:45 qu1j0t3 joined
09:47 Uniaika joined
10:00 louispan joined
10:02 Gurkenglas_ joined
10:09 <* vaibhavsagar> waves
10:12 azahi joined
10:15 nil_ joined
10:17 <Iceland_jack> It's starting to get hot in London
10:17 <* Iceland_jack> dies
10:21 takle joined
10:33 carlomagno joined
10:54 dni- joined
10:56 Levex joined
11:11 Gloomy joined
11:14 patbecich joined
11:19 nil_ joined
11:21 ederign joined
11:31 jrm joined
11:33 timdiels joined
11:35 <timdiels> How do you pick one of 2 functions based on a condition? Instead I get http://lpaste.net/354237
11:36 <nil_> timdiels: head and tail don't have the same type.
11:38 <nil_> Both branches of an if-then-else expression must have the same type.
11:38 <timdiels> nil_: thanks, seems I was looking for `last`
11:39 <nil_> timdiels, exactly.
11:39 <merijn> Word of warning: 'last' has terrible performance
11:39 <timdiels> Yep, luckily it's only 2 long ;)
11:39 vaibhavsagar left
11:40 vaibhavsagar joined
11:41 sherub1 joined
11:41 <nil_> Can we have a look at your actual code?
11:43 <__rgn> is there a way to make ghci not fail in case where expression evaluates to a function, for example. (No instance for Show)
11:44 <merijn> __rgn: ghci prints the result of expressions and you can't sensibly print functions
11:44 <merijn> __rgn: So, store the result in a variable?
11:45 <__rgn> why isn't showing something like [(a -> a), (a -> a)] etc. sensible
11:47 <__rgn> in javascript, repl would show you rather opaque [Function] as result
11:47 <__rgn> > map(add, [1,2,3])
11:47 <lambdabot> error:
11:47 <lambdabot> • Couldn't match expected type ‘a -> b’
11:47 <lambdabot> with actual type ‘(t0, [Integer])’
11:47 <__rgn> [ [Function: f1], [Function: f1], [Function: f1] ]
11:47 <__rgn> oops
11:47 <merijn> __rgn: Well, you'd need to write a Show instance for function types. Which instance would be appropriate according to you?
11:48 <__rgn> not sure what that means
11:49 <merijn> __rgn: Well, if you wrote "instance Show (a -> b) where ..." then there's no way to print what types 'a' and 'b' are
11:49 <merijn> And else you end up writing an instance for every possible set of types
11:50 lithie joined
11:50 <merijn> And if you did that (which would be kinda impossible, there being an unlimited number of types) wouldn't be able to deal with polymorphic functions
11:51 <__rgn> just find it somewhat silly that i have to keep prepending lines with :t when the result is a proper value
11:52 <merijn> __rgn: I don't usually write that much in ghci, tbh
11:54 <Iceland_jack> __rgn: That instance is in Text.Show.Functions
11:55 <Iceland_jack> > import Text.Show.Functions
11:55 <lambdabot> <hint>:1:1: error: parse error on input ‘import’
11:55 <Iceland_jack> > [head, last]
11:55 <lambdabot> error:
11:55 <lambdabot> • No instance for (Typeable a0)
11:55 <lambdabot> arising from a use of ‘show_M531996708941956081611903’
11:56 <Iceland_jack> yeah didn't mean to bug you lambdabot :)
11:56 <merijn> Iceland_jack: That only works for functions whose types are Typeable
11:56 <Iceland_jack> Why do you say that
11:56 <merijn> See the above error
11:57 <merijn> > elem :: Int -> [Int] -> Bool
11:57 <Iceland_jack> As I said, I didn't mean to invoke lambdabot
11:57 <lambdabot> <Int -> [Int] -> Bool>
11:57 <merijn> Iceland_jack: Lambdabot already has that instance
11:57 <Iceland_jack> It works fine for Text.Show.Functions: [<function>, <function>]
11:57 <__rgn> Prelude Text.Show.Functions> [head, last]
11:57 <__rgn> [<function>,<function>]
11:57 <Iceland_jack> with no Typeable constraint
11:57 <__rgn> cool
11:57 <merijn> I don't really see how that's more helpful, though?
11:58 <Iceland_jack> Works with polymorphic functions, exists in base, either way is fine though
11:59 <merijn> Iceland_jack: I meant "I don't see how <function>" being printed is more helpful than things not being printed
12:01 <Iceland_jack> There are many cases where I find it useful, it's a matter of taste
12:01 <__rgn> it's helpful to know what you wrote returned a valid result instead of spewing five lines of noise starting with "error"
12:02 <Iceland_jack> What __rgn said, I rarely want those noisy errors. You still get the structure of your code: With [<function>, <function>, <function>] you know your list has 3 elements
12:03 <Iceland_jack> Also deriving Show for your data type while developing, a valid alternative is using Test.QuickCheck.Modifiers.Blind
12:03 <merijn> Iceland_jack: I tend to simply write in an editor and use typed-holes to figure out the types of things, generally
12:04 <Iceland_jack> How does that let you intuit the shape of your data, as with [<function>,..]
12:05 <Iceland_jack> or help you derive show for types containing functions, but again matter of taste
12:05 <merijn> Iceland_jack: Honestly, I don't think I've ever really wondered about things like the number of elements for a list/container?
12:05 <Iceland_jack> It comes up on occasion
12:07 <__rgn> is the only way to get a reference to last expression to use :set +t which adds `it` but also automatically prints type of last expression
12:08 andyhoang joined
12:08 <Iceland_jack> __rgn: you can write "ghci> let x = ..."?
12:10 <Iceland_jack> In the most recent version of GHC you can omit "let"
12:14 <timdiels> nil_: sure, here's the actual code http://lpaste.net/354239#line79 (WIP, but it runs)
12:15 <Iceland_jack> poo, lpaste is blocked at work
12:17 <timdiels> nil_: I'm going to combine down/up into netMonitorNew' instead of making 2 separate calls like this.
12:18 yellowj joined
12:19 <zaquest> __rgn, you don't need +t for `it`
12:21 Levex joined
12:25 <__rgn> you are right, somehow it seemed like it didn't work before
12:25 <__rgn> so i can do :t it, good
12:45 netheranthem joined
12:55 gpampara joined
13:01 <nil_> I seem to recall that GHC can "sometimes" figure out that it can optimize a list into a plain array and will do that. Is that real or was it in a dream I had?
13:02 dni- joined
13:12 developernotes joined
13:15 patbecich joined
13:17 developernotes joined
13:17 andyhoang joined
13:18 takle joined
13:18 aarvar joined
13:32 pbrant joined
13:32 jathan joined
13:39 mizu_no_oto_work joined
14:02 geekosaur joined
14:03 earldouglas joined
14:06 snowcrshd joined
14:06 geekosaur joined
14:09 gregman_ joined
14:17 albertus1 joined
14:18 aarvar left
14:21 yellowj joined
14:21 lithie joined
14:23 Levex joined
14:33 thallada joined
14:34 <Akii> is there a lens for a `NonEmpty (k,v)` to get a `Maybe v`?
14:36 <rizary> Hi, i have error when try to install ghcjs with cabal install
14:37 thallada joined
14:37 <rizary> the error is this:
14:37 <rizary> https://www.irccloud.com/pastebin/0hVCwrNa/
14:41 <Akii> alternatively I'd like to only write a getter, not a setter. How can I do that?
14:42 simendsjo joined
14:42 <Gurkenglas_> Akii, you mean given a k, find a v that's tupled up with it?
14:42 <Iceland_jack> Akii: Have you looked at https://hackage.haskell.org/package/lens-4.15.1/docs/Control-Lens-At.html
14:42 <Iceland_jack> You can use that to model your solution
14:42 <Akii> Gurkenglas_: yes
14:43 <Akii> Iceland_jack: `at` would access at a certain index, not `k`
14:43 <geekosaur> rizary, as far as I know no ghc (including ghcjs) can be installed via cabal
14:43 <Akii> as far as I understood it
14:43 mattyw joined
14:43 <geekosaur> that's what the ":compiler-only" in the error message is trying to hint at
14:43 <Iceland_jack> You can write your own: Eq k => k -> Lens' (NonEmpty (k, v)) v
14:44 <Iceland_jack> *(Maybe v)
14:45 chlong joined
14:45 kadoban joined
14:45 <rizary> geekosaur: yes, i just fixed it :D
14:46 <Akii> Iceland_jack: ok, will do. Thanks!
14:47 <Gurkenglas_> :t lookupOf traverse -- Akii
14:47 <lambdabot> (Traversable t, Eq k) => k -> t (k, v) -> Maybe v
14:48 <Gurkenglas_> (Or do you actually want to edit the value there?)
14:48 <timdiels> Are the _ <- ... necessary: https://hackage.haskell.org/package/taffybar-0.4.6/docs/src/System-Taffybar-Widgets-PollingLabel.html#pollingLabelNew
14:48 <Akii> I would need it to be a `Getting (Maybe a)` ideally
14:49 <Akii> `Getting (Maybe a) s (Maybe a)`
14:49 <timdiels> E.g. isn't _ <- a equiv to `a`?
14:49 <timdiels> *a
14:50 <geekosaur> timdiels, no
14:51 <geekosaur> if it were `let` then it would be equivalent. but the <- syntax turns into (>>=) which adds actions to a chain (I suggest you learn how IO works; in the meantime, you can sort of think of this as "running an action")
14:52 <geekosaur> so for example the `_ <- forkIO ...` mean to "run" the forkIO action (spawning a new thread) and ignore the result (the thread ID, which is provided in case you want to do something to the thread later instead of letting it run by itself)
14:53 <nil_> geekosaur: how does do { _ <- a ; b } differ from a >> b ?
14:53 <geekosaur> it doesn't
14:53 <nil_> Oh.
14:53 NeverDie joined
14:53 <geekosaur> mostly that's there because forkIO used to produce IO () and they made the minimal change to support later versions that poroduce a ThreadID
14:53 <nil_> Right, that's not the same as what timdiels asked.
14:54 <geekosaur> @undo do { _ <- a; b } -- compare definition of (>>)
14:54 <lambdabot> a >>= \ _ -> b
14:55 <Gurkenglas_> Akii, "to (lookupOf traverse)" technically does that but I guess you want a getter there because then our answers are more likely to generalize to other things you need?
14:55 <Gurkenglas_> > ["hello","the","world","!!!"]^?traversed.index 2 -- http://hackage.haskell.org/package/lens-4.15.1/docs/Control-Lens-Indexed.html#v:index gives an example but it doesnt seem to work
14:55 <lambdabot> error:
14:55 <lambdabot> • Couldn't match type ‘Int’
14:55 <lambdabot> with ‘p0 [Char] (Const (First a) [Char])’
14:59 <Akii> Gurkenglas_: ye, I think "Getting" is just the wrong type
14:59 <Gurkenglas_> Ah, works locally, lambdabot must have a name clash for index
14:59 <Akii> I'd need Get a (Maybe b)
14:59 <Gurkenglas_> Akii, is it fine if the getter isn't Maybe but sometimes fails?
15:01 <Akii> ok, my use case is that I need to check if something in my data structure already exists
15:01 <geekosaur> :t Getting
15:01 <lambdabot> error:
15:01 <lambdabot> • Data constructor not in scope: Getting
15:01 <lambdabot> • Perhaps you meant one of these:
15:01 <Akii> :i Getting
15:01 <timdiels> geekosaur: but isn't do { a ; b } equiv to do { a >> b } equiv to do { _ <- a ; b } ?
15:01 <geekosaur> oh, right, it's a constraint
15:01 <geekosaur> timdiels, yes
15:01 <Gurkenglas_> Akii, why not just use lookupOf traverse?
15:01 <timdiels> geekosaur: ok, that's what I meant to ask
15:01 <geekosaur> Akii, no :i in lambdabot (nor @info; that gets edit "corrected" to @undo)
15:02 <Akii> geekosaur: ok :(
15:02 <geekosaur> this is mostly historial, the original didn;t have the _ <- but ghc was changed to always warn when you don't bind the result of something producing m ()
15:02 <Gurkenglas_> :t lookupOf traverse -- look at the type signature, this one's actually comprehensible
15:02 <lambdabot> (Traversable t, Eq k) => k -> t (k, v) -> Maybe v
15:02 <geekosaur> so they just hacked _ <- into it
15:02 <Akii> Gurkenglas_: sure but my stuff is bit more deeply nested
15:02 <Akii> and the NonEmpty is actually a lens itself
15:03 <geekosaur> because forkIO at least produces m ThreadID; I don't know about the other offhand
15:03 <Gurkenglas_> :t to (lookupOf traverse) -- this one then? Also you can show your code so I can refactor it :P
15:03 dni- joined
15:03 <lambdabot> (Functor f, Traversable t, Eq k, Contravariant f, Profunctor p) => Optic' p f k (t (k, v) -> Maybe v)
15:03 <Gurkenglas_> Oops not so comprehensible. But it just turns (s -> a) into Getter' s a
15:04 <Gurkenglas_> *Getter
15:04 <Akii> ok, that I can use to construct a Map and then do normal lookup xD
15:04 <Gurkenglas_> wat why
15:04 <Akii> why not
15:04 uglyfigurine joined
15:04 <Akii> for science
15:04 <Gurkenglas_> couldnt you just do toList and then fromList if you were gonna do that
15:05 <Akii> I could use a NonEmptyMap
15:05 <Akii> :D
15:05 <Akii> if that exists
15:06 <Gurkenglas_> Why is it irrelevant whether its empty, if all you do is lookup keys for which you get no containment gurantees anyway
15:06 <Gurkenglas_> *Why is it relevant
15:09 <Akii> it's not relevant if it's only a getter
15:09 <Akii> I wrote a Lens so it has to be NonEmpty
15:09 <Gurkenglas_> NotEmpty (k, v) doesn't gurantee that there's going to be a v for the k the user inputs
15:10 <Akii> I know
15:10 <Akii> has nothing to do with that
15:10 <Gurkenglas_> Why does it have to be NonEmpty then?
15:10 <Akii> I just can't handle setting a value with an empty map or list
15:10 <glguy> Akii: What's the actual question? There seem to be a few things being discussed in the backlog
15:10 <Akii> I think my problem is solved with `to`
15:11 <Akii> didn't know how to create a Getter
15:11 <glguy> Oh, OK.
15:13 <Akii> nice :D
15:13 <Akii> the goal is also not to write the most perfect code. Right now I just want to do something with lenses.
15:17 patbecich joined
15:22 hoffmeyer joined
15:24 mthek joined
15:25 Uniaika joined
15:25 Uniaika joined
15:26 alexelcu joined
15:28 binaryplease joined
15:33 <Akii> I should maybe also look into Validation
15:33 <Akii> yes, that'd make it even better
15:33 <Akii> first thing tomorrow :D
15:35 GreySunshine joined
15:37 conal joined
15:38 <GreySunshine> Howdy!
15:38 <lambdabot> Hello.
15:40 Levex joined
15:42 <qu1j0t3> GreySunshine: hi
15:43 <Iceland_jack> Hey GreySunshine
15:44 <GreySunshine> Its been a long time since I've been here thanks for the welcome!
15:47 govg joined
15:48 <nil_> That's a delightfully paradoxical name.
15:56 pbrant joined
16:03 pbrant joined
16:05 Gloomy joined
16:06 ederign joined
16:11 argent0 joined
16:14 <__rgn> why isn't getLine called getStrLn
16:14 pbrant joined
16:17 pbrant joined
16:22 azahi joined
16:33 <nil_> __rgn: other, older languages tend to use similar naming conventions.
16:34 <nil_> The "Ln" in "putStrLn" stands for "add a newline at the end".
16:34 <nil_> > putStr "Hello!" >> putStrLn "Hello!"
16:34 <lambdabot> <IO ()>
16:34 <__rgn> makes sense
16:35 <nil_> ...Okay, the output should have been "Hello!Hello!\n" :>
16:41 initiumdoeslinux joined
16:52 dni- joined
16:53 <monochrom> getLine is a good name. putStrLn is the one that should be renamed to putLine.
16:53 <Iceland_jack> agreed
16:53 <monochrom> The "Str" part is redundant because the type already says it.
16:53 <Iceland_jack> I hate typing putStrLn, so awkward
16:54 <monochrom> See for example C's symmetrically named puts and gets.
16:54 <monochrom> Even though gets is highly error-prone.
16:58 Gloomy joined
17:02 <__rgn> i know the example is simple but is one of them more idiomatic than others, https://gist.github.com/anonymous/d8d1a00446b565aae282649fe05edc9b
17:02 Durz0 joined
17:03 <__rgn> guess applicative style vs do comes down to readability in the end?
17:05 <monochrom> You have not considered getLine >>= putStrLn . reverse :)
17:06 <monochrom> I think I'll use do-notation.
17:06 <__rgn> how does that evaluate
17:08 <__rgn> was there a tool to add "points" to expression
17:08 malaclyps joined
17:08 <__rgn> reverse of making something point-free
17:18 patbecich joined
17:21 chlong joined
17:21 ederign_ joined
17:22 <Cale> do x <- getLine; putStrLn (reverse x)
17:22 <Cale> would be equivalent
17:23 <Cale> If I was going to use an operator like that, I would tend to pick =<<
17:23 <Cale> So it would be putStrLn . reverse =<< getLine
17:33 AsymmetricalFace joined
17:33 <AsymmetricalFace> hi
17:34 <AsymmetricalFace> i downloaded `https://downloads.haskell.org/~ghc/latest/docs/html/libraries/index.html` but i cant search for a word like i can on https://hackage.haskell.org/. what should i do?
17:35 <AsymmetricalFace> i need a web interface
17:35 <AsymmetricalFace> while offline
17:35 <AsymmetricalFace> on hackage site is a box where i can enter a word in order to being the search
17:36 <AsymmetricalFace> *begin
17:36 <geekosaur> you want to use a mirroring tool
17:36 <geekosaur> it's not enough to download the index
17:36 <AsymmetricalFace> geekosaur, do you use a mirroring tool?
17:37 <geekosaur> and even then it's entirely possible that the searhc is javascri[pt and needs to be rewritten to search locally
17:37 <* geekosaur> just uses the online one, no real need to work offline
17:38 <AsymmetricalFace> geekosaur, do you know anyone who successfully implemented smth similar offline?
17:38 <geekosaur> I think most people build docs locally and use a local hoogle installation
17:39 <AsymmetricalFace> all inside terminal?
17:39 sigmundv joined
17:39 <geekosaur> yes
17:40 <geekosaur> if you install hoogle locally you can use it from a terminal
17:40 <AsymmetricalFace> i can browse docs in html format in my browser, but search is smth different
17:40 <geekosaur> you probably want http://hackage.haskell.org/package/hoogle-4.2.43 specifically becuse hoogle 5.x is still incomplete
17:40 <AsymmetricalFace> i use hoogle already but i feel more comfortable in the browser
17:41 Rodya_ joined
17:41 <AsymmetricalFace> geekosaur, what editor/ide do you use for haskell coding?
17:41 <geekosaur> emacs, generally
17:42 <AsymmetricalFace> do you use stack?
17:42 <geekosaur> nope
17:43 <AsymmetricalFace> autocompletion works in emacs?
17:44 <AsymmetricalFace> hlint works, but i cant make autocompletion work yet in my editor
17:45 hoffmeyer joined
17:47 <DataComputist> I use Emacs and occasionally IntelliJ IDEA with the Haskell plug-in.
17:47 <DataComputist> I also use Haskell stack.
17:47 pdgwien joined
17:48 snowcrshd joined
17:54 pdgwien joined
17:55 eacameron joined
18:03 yellowj joined
18:07 pdgwien joined
18:09 uglyfigurine joined
18:20 Levex joined
18:25 pdgwien joined
18:30 sherub1 joined
18:34 gpampara joined
18:41 dni- joined
18:42 AsymmetricalFace joined
18:43 Rodya_ joined
18:43 pdgwien joined
18:48 azahi joined
18:50 Levex joined
18:55 expo873 joined
19:09 Rodya_ joined
19:13 Rodya_ joined
19:16 herr_jth joined
19:22 moei joined
19:23 grayjoc joined
19:41 mizu_no_oto_work joined
19:42 govg joined
19:44 malaclyps joined
19:52 chlong joined
19:56 gpampara joined
20:02 mengu joined
20:04 mizu_no_oto_work joined
20:07 yellowj joined
20:08 Rodya_ joined
20:09 Ferdirand joined
20:16 mattyw joined
20:17 sherub1 joined
20:28 Rodya_ joined
20:30 dni- joined
20:36 takle joined
20:37 Rodya_ joined
20:39 Gloomy joined
20:39 eacameron joined
20:41 uglyfigurine joined
20:45 dni- joined
20:51 Rodya_ joined
20:52 takle joined
21:08 peterbecich joined
21:13 azahi joined
21:17 Rodya_ joined
21:22 Rodya_ joined
21:26 Rodya_ joined
21:28 azahi joined
21:30 AndreasK joined
21:35 kadobanana joined
21:36 azahi joined
21:39 Rodya_ joined
21:52 hiratara joined
21:59 azahi joined
22:04 contiver joined
22:05 meandi joined
22:10 zipper joined
22:14 texasmynsted joined
22:21 HallaSurvivor joined
22:31 hiratara joined
22:38 malaclyps joined
22:44 Durbley joined
22:59 alasi joined
23:05 suls joined
23:22 <Durbley> whats the difference between the applicative instance for functions and the monad instance for functions
23:24 <jle`> Durbley: well, applicative instances and monad instances have different things
23:24 <jle`> Durbley: an Applicative instance has pure and (<*>)
23:24 <jle`> a Monad instnace has return and (>>=)
23:24 <jle`> but, there are laws that say that, for a given Monad instance, the corresponding Applicative instance is uniquely defined.
23:25 <jle`> that is, pure *has* to be the same as return
23:25 <jle`> and (<*>) *has* to be the same as \f x -> do { g <- f; y <- x; return (g y) }
23:31 <Durbley> that last line I don't get
23:33 <jle`> Durbley: 'mf <*> mx' is "do mf to get a function f as a result, do mx to get a value x as a result, and the final result is (f x)"
23:33 <jle`> Durbley: so if i had 'mf :: IO (String -> Bool)', and 'mx :: IO String', then 'mf <*> mx' will execute mf, then mx, and the final result will be whatever function mf returned applied to whatever value mx returned
23:35 peterbecich joined
23:35 <jle`> not all Applicatives can be "sequenced" like this
23:35 <jle`> but if they can, then <*> has to match this behavior
23:39 <__rgn> IO example makes sense, something like (+) <*> (*2) doesn't as much
23:40 <jle`> in eahc instance you just have to look at the definitions
23:40 <__rgn> i understand what it does, but the "get function out of this thing and apply it to value in this other thing" analogy doesn't seem applicable
23:40 <Durbley> applicable
23:40 <Durbley> hehheh
23:40 <jle`> (f <*> x) = \r -> (f r) (x r)
23:40 <monochrom> "(->) e" being a Monad etc is a bit harder because too many ->'s.
23:41 <jle`> yeah, it's hard to say anything about things monads and applicatives *in general*
23:41 louispan joined
23:41 <jle`> there isn't any real intuition that works for all of them
23:41 <monochrom> But if you survive the types, then the coding is pretty anti-climatic.
23:42 eacamero_ joined
23:42 <__rgn> > jle` | (f <*> x) = \r -> (f r) (x r)
23:42 <lambdabot> <hint>:1:6: error: parse error on input ‘|’
23:42 <__rgn> that's a nice way to put it
23:42 <jle`> that's...the definition, isn't it?
23:42 <jle`> http://hackage.haskell.org/package/base-4.9.1.0/docs/src/GHC.Base.html#line-641
23:43 vaibhavsagar joined
23:43 <jle`> they write it (<*>) f g x = (f x) (g x), i guess, so maybe it's a little less clear
23:43 <Durbley> jle`, f is a function of two arguments?
23:43 <Durbley> in this (f <*> x) = \r -> (f r) (x r)
23:43 <jle`> check the types :)
23:43 <__rgn> before, i tried to understand it through <*> :: (r -> a -> b) -> (a -> b) -> (r -> b)
23:44 <jle`> (<*>) :: (r -> a -> b) -> (r -> a) -> (r -> b)
23:44 <Durbley> he answered :^)
23:44 <__rgn> right
23:44 <* ski> would write it as `(f <*> g) r = (f r) (g r)'
23:44 <jle`> so for f <*> x, f :: r -> a -> b, x :: r -> a, and the result is an r -> b
23:45 <jle`> but yes, one good way to understand something is to look at its definition :)
23:45 <jle`> alternatively, because haskell is great, looking at the types is a good way too
23:46 louispan joined
23:47 eacameron joined
23:54 eacameron joined