lynnard 2017-01-25 21:46:09
biglama: try 'some (some (noneOf " ") <* some space)'
zipper 2017-01-25 21:46:24
Cale: I see how the f is (-> e) but past that I don't see much
julienchurch 2017-01-25 21:46:25
Maybe I'm misunderstanding something more fundamental. Are functions instances of Functor/Applicative?
lynnard 2017-01-25 21:46:33
again no expert - so someone who knows the syntax better could give a prettier version
zipper 2017-01-25 21:46:35
julienchurch: They are
biglama 2017-01-25 21:47:45
lynnard: ok, thanks
zipper 2017-01-25 21:48:35
julienchurch: In our case the f is (-> e) which is the `Just` which should be applied to the 1 to give us an a of type Maybe a
zipper 2017-01-25 21:48:59
but it seems const already at the same time took the e which is 1
zipper 2017-01-25 21:49:06
and will ignore the Just 1
zipper 2017-01-25 21:51:50
Oh wait I get it Cale in my head I was picturing const <*> (Just 1) while it really is of (const <*> Just) 1
julienchurch 2017-01-25 21:55:25
zipper: I was gonna say, ($) is lowest precedence.
julienchurch 2017-01-25 21:55:56
zipper: I think I'm getting how it type checks now, though. Still having a rough time visualizing it
julienchurch 2017-01-25 21:56:17
Does the head just get thrown away from the first function?
zipper 2017-01-25 21:56:18
julienchurch: Do you get what is going on? I can make the types align on paper. But I can't do a step by step evaluation on paper. :)
zipper 2017-01-25 21:56:37
julienchurch: What do you mean by the head?
julienchurch 2017-01-25 21:58:08
zipper: Like in this example:
julienchurch 2017-01-25 21:58:16
(\x -> (\y -> x + y)) <*> (\x -> 29) $ 1
julienchurch 2017-01-25 21:58:51
Wait, nevermind.
quchen 2017-01-25 21:58:53
(f <*> g) x = f x (g x), that's it.
zipper 2017-01-25 21:59:05
julienchurch: Is this what you are calling the head ? `(\x -> (\y -> x + y)) <*> (\x -> 29)`
zipper 2017-01-25 21:59:16
((-> a) b -> a) <*> ((-> a) b) the Applicative f here is (-> a)
zipper 2017-01-25 21:59:46
the result of this `(\x -> 29)` gets thrown away
zipper 2017-01-25 21:59:54
idk if that's what you consider the head
julienchurch 2017-01-25 22:00:41
I meant the basically outer "x" of the first expression (in the first operand)
julienchurch 2017-01-25 22:00:57
Not sure if that's the right terminology
zipper 2017-01-25 22:02:00
julienchurch: Naaah that's not really what is happening. 1 is passed to both functions simultaneously as x
zipper 2017-01-25 22:02:42
but the function `(\x -> 29)` ignores the 1 and just returns 29
zipper 2017-01-25 22:03:15
and then we have (\y -> 1 + y) being applied to the result of (\x -> 29) which is 29
zipper 2017-01-25 22:03:19
So we get 30
zipper 2017-01-25 22:03:45
What boggles my mind is how the 1 gets applied to both seemingly simulataneously
zipper 2017-01-25 22:03:48
:D
julienchurch 2017-01-25 22:03:52
zipper: Yeah, I just threw a constant in there to see what was going on with the second function. Your/quchen's explanations are helping me understand how it's happening
julienchurch 2017-01-25 22:04:02
I'm just not terribly sure why
quchen 2017-01-25 22:04:17
julienchurch: Use my definition to evaluate your expression by hand!
zipper 2017-01-25 22:05:15
quchen: I fail to see why <*> of functions f and g means apply the x to both at the same time
zipper 2017-01-25 22:05:21
but I can see it is happening
zipper 2017-01-25 22:05:29
based on (f <*> g) x = f x (g x)
julienchurch 2017-01-25 22:05:40
quchen: I did :] I guess the rule itself is what's getting me. Or maybe I'm tired enough that I don't see the logic
julienchurch 2017-01-25 22:05:49
I mean, what you wrote is clear to me
zipper 2017-01-25 22:05:54
julienchurch: Which rule?
julienchurch 2017-01-25 22:08:45
zipper: Gimme a minute, I'm about to try to explain myself :P
julienchurch 2017-01-25 22:09:18
gotta fire up ghci quick
julienchurch 2017-01-25 22:09:47
(because I'm not even sure what I'm talking about anymore)
zipper 2017-01-25 22:09:54
julienchurch: Ok take all the time you want
zipper 2017-01-25 22:10:07
It's 1209 hrs in my timezone
julienchurch 2017-01-25 22:13:43
It's 04:13 here now
julienchurch 2017-01-25 22:13:49
<- is a ding dong
MarcelineVQ 2017-01-25 22:15:26
:t is
lambdabot 2017-01-25 22:15:28
error:
lambdabot 2017-01-25 22:15:29
• Variable not in scope: is
lambdabot 2017-01-25 22:15:29
• Perhaps you meant one of these:
dramforever 2017-01-25 22:16:07
:t (<*>) @ (->) -- Please
lambdabot 2017-01-25 22:16:09
error: parse error on input '->'
dramforever 2017-01-25 22:16:19
:t (<*>) @(->) -- This?
lambdabot 2017-01-25 22:16:21
error: parse error on input '->'
dramforever 2017-01-25 22:16:22
Sorry...
julienchurch 2017-01-25 22:16:25
zipper: Ok, I think I'm starting to get it.
MarcelineVQ 2017-01-25 22:16:45
lambdabot doesn't TypeApplications
roxxik 2017-01-25 22:16:55
:t id @Int
lambdabot 2017-01-25 22:16:58
error:
lambdabot 2017-01-25 22:16:58
Pattern syntax in expression context: id@Int
lambdabot 2017-01-25 22:16:58
Did you mean to enable TypeApplications?
dramforever 2017-01-25 22:17:58
YES!
dramforever 2017-01-25 22:18:02
It doesn't help...
MarcelineVQ 2017-01-25 22:18:05
dramforever: if you wanted to apply that though it'd be :t (<*>) @ ((->)_)
dramforever 2017-01-25 22:18:25
MarcelineVQ: Hmm you're right
zipper 2017-01-25 22:21:06
wz1000: How does your IRC client connect from aws? A bnc?
julienchurch 2017-01-25 22:21:54
This is true, more or less: `[(\x -> x)] <*> [1] == [(\x -> x) 1]`. So it follows that `(\a -> (\b -> a + b) <*> (\x -> x) == ((\a -> (\b -> a + b)) (\x -> x)) == (\b -> (\x -> x) + b)`, right?
julienchurch 2017-01-25 22:22:07
Sorry for the lambdavomit.
wz1000 2017-01-25 22:23:15
zipper: I just leave weechat running in a tmux session
julienchurch 2017-01-25 22:24:18
zipper: ?
zipper 2017-01-25 22:24:24
wz1000: Making secOps and devOps people cringe must be your hobby :P
zipper 2017-01-25 22:24:34
julienchurch: Sorry I hadn't seen that let me look
julienchurch 2017-01-25 22:24:51
zipper: Of course!
wz1000 2017-01-25 22:26:08
zipper: Why? What's so terrible about this compared to stuff like IRCCloud
julienchurch 2017-01-25 22:28:24
zipper: I didn't try that out in GHCi, now I'm not so sure about it. Sorry. -_-
merijn 2017-01-25 22:28:57
zipper: Why would that make secops people cringe?
zipper 2017-01-25 22:29:28
julienchurch: Ok I read it over and over and it only works because + is commutative
zipper 2017-01-25 22:29:42
Because you keep switching the order of args to +
zipper 2017-01-25 22:30:10
but the first and the follows one are of different types
zipper 2017-01-25 22:30:27
in one we have a `[(a->b)]`
zipper 2017-01-25 22:30:48
in the second we have `(a -> b -> c)`
zipper 2017-01-25 22:31:03
wz1000: Sorry idk what IRCCloud is
zipper 2017-01-25 22:32:13
merijn: Well idk depends on the purpose of the server itself. It's not really an issue. I just would expect one to run a bouncer instead
zipper 2017-01-25 22:32:23
Which would have better UX
zipper 2017-01-25 22:32:30
but that is offtopic
wz1000 2017-01-25 22:32:51
zipper: https://www.irccloud.com/
AndChat8064 2017-01-25 22:33:08
the reader monad seems really useless
zipper 2017-01-25 22:33:20
Basically a web UI for IRC?
merijn 2017-01-25 22:33:24
zipper: tbh, I doubt a bouncer is more secure than just a VPS running tmux
peteretep 2017-01-25 22:33:34
I am using IRC Cloud and I like it
cocreature 2017-01-25 22:33:37
AndChat8064: it saves you from having to pass around the same argument to a lot of functions
peteretep 2017-01-25 22:33:39
I used to run irssi on a shell account
merijn 2017-01-25 22:33:40
AndChat8064: Why's that?
dramforever 2017-01-25 22:33:49
AndChat8064: Depending on what you expect out of it
peteretep 2017-01-25 22:33:49
But like the switch from mutt to gmail
AndChat8064 2017-01-25 22:33:50
hmm
peteretep 2017-01-25 22:33:54
Life got easier when I used irccloud
dramforever 2017-01-25 22:33:57
ReaderT is much more useful actually
zipper 2017-01-25 22:34:16
A lot of stuff we do in haskell seems useless "AndChat8064 | the reader monad seems really useless"
dramforever 2017-01-25 22:34:17
well, sorry I meant I use ReaderT more often
zipper 2017-01-25 22:34:26
It's all about focusing on correctness
zipper 2017-01-25 22:34:34
and ease of almost proving it
zipper 2017-01-25 22:34:36
I think
peteretep 2017-01-25 22:34:41
A lot of stuff seems useless, but read about it, and one day you'll have a problem and be like "I know what solves that!!!!"
AndChat8064 2017-01-25 22:34:43
it is described as allowing you to read from an environment
AndChat8064 2017-01-25 22:34:43
or something
AndChat8064 2017-01-25 22:34:43
but why not explicitly pass
peteretep 2017-01-25 22:34:49
Like applicative :'D
zipper 2017-01-25 22:34:55
merijn: but weechat is in the tmux session
AndChat8064 2017-01-25 22:35:02
the entire env as a record object
merijn 2017-01-25 22:35:06
AndChat8064: Well, it's nice if you use the reader applicative, for example
zipper 2017-01-25 22:35:15
AndChat8064: You might want type safety
cocreature 2017-01-25 22:35:21
AndChat8064: if you have a single expression it doesn't buy you anything. the power of Reader comes when you have a lot of expressions that all need to access the same environment
merijn 2017-01-25 22:35:28
AndChat8064: Imagine I have three functions, foo, bar, and baz that all want the same input
dramforever 2017-01-25 22:35:28
AndChat8064: because passing it around is tedious
cocreature 2017-01-25 22:35:28
at that point passing it manually becomes tedious
MarcelineVQ 2017-01-25 22:35:36
:X
zipper 2017-01-25 22:35:41
AndChat8064: You want the typechecker to prove that you are passing stuff correctly
dramforever 2017-01-25 22:35:47
AndChat8064: 'the entire env as a record object'
dramforever 2017-01-25 22:35:54
^ What do you mean by this?
zipper 2017-01-25 22:36:00
merijn: Ah composability :)
merijn 2017-01-25 22:36:18
AndChat8064: Now I can have quux which needs the results of foo, bar, and baz, and do "quux <$> foo <*> bar <*> baz" and have a single function that takes the input and passes it on to all the subfunctions without me needing to write the boilerplate
AndChat8064 2017-01-25 22:36:27
the env is a collection of values, no?
AndChat8064 2017-01-25 22:36:29
the record object also is
dramforever 2017-01-25 22:36:34
No it's just one value
dramforever 2017-01-25 22:36:39
The env *can* be a record
AndChat8064 2017-01-25 22:36:42
ok fine
dramforever 2017-01-25 22:36:45
They focus on different things
AndChat8064 2017-01-25 22:36:48
maybe one day ill understand
dramforever 2017-01-25 22:36:55
And *that's* why you ask before you answer
AndChat8064 2017-01-25 22:37:17
.
dramforever 2017-01-25 22:37:57
AndChat8064: What about this: If you want you pass this env thingy around normally
zipper 2017-01-25 22:37:59
AndChat8064: Have faith that you'll need it someday. It's what I do when learning CT lol
dramforever 2017-01-25 22:38:48
Reader just kinda avoids the noise of the env, *while* keeping it done pretty explicitly
dramforever 2017-01-25 22:38:55
that was compared to, say, global variables
dramforever 2017-01-25 22:39:58
I suppose you misunderstood what the enviroment is :) Those things are not really related, like, 'I think a car is useless, why don't you just drink water from a bottle?'-type not really related
merijn 2017-01-25 22:40:18
zipper: Wasting your time ;)
merijn 2017-01-25 22:40:54
zipper: Ok, not entirely, but my recommendation is that if the end goal is "become better at haskell" CT should be at the bottom of your list :)
cocreature 2017-01-25 22:41:01
learning CT is fun but it's not all that helpful when you're programming haskell
lpaste 2017-01-25 22:41:20
bwe revised "Conduit readCSVFile": "Conduit readCSVFile" at http://lpaste.net/9045721241620578304
merijn 2017-01-25 22:41:34
zipper: Not to say that you shouldn't learn CT (I keep trying), but do it because you think it's fun or interesting, not for Haskell. I can recommend you far more useful things to learn to become better at haskell :p
zipper 2017-01-25 22:41:47
merijn: tbh CT has helped me understand how functions are Functors
merijn 2017-01-25 22:42:07
Including, but not limited too: Algebra, type theory, formal methods
zipper 2017-01-25 22:42:24
merijn: Algebra is a huge topic
merijn 2017-01-25 22:42:35
Incidentally, the books for the those topics are also a factor 100 more accessible than CT ;)
zipper 2017-01-25 22:42:40
maybe type theory I have not heard of formal methods
merijn 2017-01-25 22:42:45
zipper: Sure, I'm not saying you should learn all of it ;)
merijn 2017-01-25 22:43:07
zipper: formal methods in the sense of proving code correct
zipper 2017-01-25 22:43:36
merijn: Oh I've heard about coq on podcasts, that's as far as I know about proving correctness.
merijn 2017-01-25 22:44:07
zipper: For type theory the de facto standard book is "Types and Programming Languages" which is book written for undergrad/grad students and starts from untyped lambda calculus and builds up to way more than you need to implement standard haskell
zipper 2017-01-25 22:44:36
merijn: And I can use this to improve my haskell?
bwe 2017-01-25 22:44:37
In which way do you recommend me to transform the list type of [["56.56145325"],["99.42876163"], ...] into [56.56145325, 99.42876163] step-by-step? Changing the code in the do block of the readCSV.hs file and sending off `:r` in the ghci does not turn out to be wise.
zipper 2017-01-25 22:44:40
Will def read it
merijn 2017-01-25 22:44:43
It covers the type system, proofs of correctness of the type system and actual implementations of the type checkers (in ocaml, but if you know haskell it should be easy enough to read)
zipper 2017-01-25 22:44:45
or look at it