Cooler 2017-02-21 18:57:26
and recurse?
Cooler 2017-02-21 18:58:04
jle`, i need the de sugared version
lpaste_ 2017-02-21 18:58:25
threshold pasted "Simple Scotty App take 6" at http://lpaste.net/352856
threshold 2017-02-21 18:59:05
Koterpillar: I don't know what I want, but I do know I want it work
Koterpillar 2017-02-21 18:59:56
OK, so now we're down to lazy/strict text
Koterpillar 2017-02-21 19:00:22
remove .Lazy from your import?
Cooler 2017-02-21 19:00:23
:t (>>)
lambdabot 2017-02-21 19:00:25
Monad m => m a -> m b -> m b
Cooler 2017-02-21 19:01:11
i am confused about what this is doing meh :: Monad m => [a] -> (a -> m b) -> m [b]
Cooler 2017-02-21 19:01:36
its applying f to the first element of the list
jle` 2017-02-21 19:01:37
centril: what's the error
jle` 2017-02-21 19:02:03
Cooler: it's applying it to every element in the list
Cooler 2017-02-21 19:02:58
then its using some version of >>= :: m x -> (a -> m b) -> m b
Cooler 2017-02-21 19:03:13
to sequence it with the next application
jle` 2017-02-21 19:03:13
Cooler: the type signatures are similar yes
centril 2017-02-21 19:03:16
jle`: http://lpaste.net/352858
centril 2017-02-21 19:03:43
u = undefined
Cooler 2017-02-21 19:03:46
is that right?
jle` 2017-02-21 19:03:46
Cooler: what part are you confused about?
Cooler 2017-02-21 19:04:11
is it using weirdBind :: m x -> (a -> m b) -> m b to sequence?
lpaste_ 2017-02-21 19:04:23
threshold pasted "Simple Scotty App Error Lazy/Strict Text" at http://lpaste.net/352859
Cooler 2017-02-21 19:04:28
actually
jle` 2017-02-21 19:04:41
centril: why are you typing zero
jle` 2017-02-21 19:04:43
instead of 0
threshold 2017-02-21 19:04:44
Koterpillar: Sorry for just seeing your message. I actually had tried that and was staring at the error pasted above
jle` 2017-02-21 19:04:48
> 1 + zero
Cooler 2017-02-21 19:04:49
weirdBind :: m x -> (a -> m b) -> a -> m b
lambdabot 2017-02-21 19:04:51
error:
lambdabot 2017-02-21 19:04:51
• Variable not in scope: zero
lambdabot 2017-02-21 19:04:51
• Perhaps you meant 'mzero' (imported from Control.Monad.Writer)
jle` 2017-02-21 19:05:03
in general, haskell doesn't recognize zero as 0
centril 2017-02-21 19:05:25
jle`: well, i tried 0, but it complained then as well
jle` 2017-02-21 19:05:31
what's the error?
centril 2017-02-21 19:05:37
sec
Cooler 2017-02-21 19:06:02
it seems like you need
Cooler 2017-02-21 19:06:03
weirdBind :: m x -> (a -> m b) -> a -> m b
jle` 2017-02-21 19:06:18
what do you need it for?
centril 2017-02-21 19:06:26
jle`: http://lpaste.net/352860
Cooler 2017-02-21 19:06:40
where your looking at the structure of m x and then using a instead of x
Cooler 2017-02-21 19:06:48
applying f to a
centril 2017-02-21 19:06:57
jle`: i need to construct a Sized from a list which is at minimum of length 1
jle` 2017-02-21 19:07:03
centril: %:< takes two Sing's
jle` 2017-02-21 19:07:05
but you gave it 0
jle` 2017-02-21 19:07:08
give it a Sing
jle` 2017-02-21 19:07:13
like `SNat @0`
threshold 2017-02-21 19:07:14
Koterpillar: I didn't see your feedback about how to write out the functions with their expected domains/codomains. That feedback helps. A type of Maybe User might be something I can work toward
Cooler 2017-02-21 19:07:24
here m x would be the result of the previous application of f to a
jle` 2017-02-21 19:07:37
Cooler: what are you trying to do?
Cooler 2017-02-21 19:07:47
meh :: Monad m => [a] -> (a -> m b) -> m [b]
jle` 2017-02-21 19:07:56
a good way to start wuld be by pattern matching
jle` 2017-02-21 19:08:00
meh [] _ = ???
jle` 2017-02-21 19:08:05
meh (x:xs) _ = ???
jle` 2017-02-21 19:08:10
er, meh (x:xs) f = ??
centril 2017-02-21 19:08:22
jle`: parse error on input `@'
jle` 2017-02-21 19:08:30
centril: turn on TypeApplications
centril 2017-02-21 19:09:23
jle`: where does the constructor SNat even come from ?
Cooler 2017-02-21 19:09:35
meh [1, 2, 3] f = weirdBind (weirdBind (f 1) f 2) f 3 ?
Cooler 2017-02-21 19:09:42
weirdBind :: m x -> (a -> m b) -> a -> m b
Koterpillar 2017-02-21 19:09:44
threshold: more types is good, you can always unify them later
threshold 2017-02-21 19:09:48
Koterpillar: It did return strict Text, but scotty's html function is expecting lazy Text
jle` 2017-02-21 19:09:58
Cooler: start from the skeleton i gave
johnw 2017-02-21 19:10:08
weirdBind, by its type, must be useless
johnw 2017-02-21 19:10:13
weirdBind _ = id
pikajude 2017-02-21 19:10:15
meh (x:xs) f = f x >>= \ x' -> (x':) <$> meh xs f
jle` 2017-02-21 19:10:20
centril: it's from Data.Singletons.TypeLits
Cooler 2017-02-21 19:10:29
johnw, why would it be useless?
Koterpillar 2017-02-21 19:10:33
threshold: there are toStrict and fromStrict if you are really confused
jle` 2017-02-21 19:10:45
Cooler: if you're trying to write your function, start from the skeleton i gave
threshold 2017-02-21 19:10:45
fromSTrict
Cooler 2017-02-21 19:11:03
jle`, no i am trying to figure out the semantics first
threshold 2017-02-21 19:11:04
Koterpillar: Sorry, I didn't see your message. Maybe this will fix it
buttons840 2017-02-21 19:11:13
is there any shorthand for something like: (\a -> a {b = c}) <$> x ?
Cooler 2017-02-21 19:11:18
i am not sure i understand what it does
jle` 2017-02-21 19:11:20
Cooler: start with the implementation, then you can look at the semantics from there
Koterpillar 2017-02-21 19:11:29
buttons840: lens
pikajude 2017-02-21 19:11:32
did they update the hackage CSS?
Koterpillar 2017-02-21 19:11:36
buttons840: but it's a large library
Cooler 2017-02-21 19:11:40
jle`, i can't write it if i don't know what its supposed to do
pikajude 2017-02-21 19:11:43
doesn't look like type signatures are on a gray background anymore
johnw 2017-02-21 19:11:57
buttons840: that's pretty squarely in lens territory
centril 2017-02-21 19:18:46
I tried SNat (..), but i forgot that it is just a synonym
centril 2017-02-21 19:18:55
jle`: very confusing
jle` 2017-02-21 19:19:03
yeah, it's a bit confusing that they had the same name
centril 2017-02-21 19:19:13
jle`: i hope haskell gets proper dependent types soon, so we can get rid of all this hackery
jle` 2017-02-21 19:19:19
SNat(..) wouldn't help you either because SNat the type synonym is not related to SNat the constructor
centril 2017-02-21 19:19:29
yea =)
threshold 2017-02-21 19:19:37
Koterpillar: The paste above is directed at you, probably, since you have been helping me
centril 2017-02-21 19:19:38
type synonyms dont have constructors anyways
jle` 2017-02-21 19:19:46
mhm
johnw 2017-02-21 19:19:58
I'm not entirely sure you want full dependent types in Haskell; they do make code harder to writer (which is the point), but sometimes it's more difficulty than it's worth
jle` 2017-02-21 19:20:11
SNat is a constructor for the 'Sing n' type, for (n :: Nat)
johnw 2017-02-21 19:20:34
the approach I'm taking is to make it easier to integrate Coq into Haskell development
centril 2017-02-21 19:20:40
jle`: yeah =)
threshold 2017-02-21 19:21:36
johnw: How do you go about that?
Cooler 2017-02-21 19:21:47
is meh something like this? http://lpaste.net/352863
johnw 2017-02-21 19:22:25
threshold: if we had a few hours at a café, I'd love to tell you all about it :)
jle` 2017-02-21 19:22:30
centril: kinda close, but (f x :) is the wrong type
jle` 2017-02-21 19:22:34
* Cooler
jle` 2017-02-21 19:22:38
try using do notation
Cooler 2017-02-21 19:22:39
actually no that doesn't work
jle` 2017-02-21 19:22:52
meh (x:xs) = do
jle` 2017-02-21 19:23:00
* (x:xs) f = do
threshold 2017-02-21 19:30:34
Koterpillar: I realize what it was
Cooler 2017-02-21 19:30:34
then you go through the array doing b <- m b
threshold 2017-02-21 19:30:34
Koterpillar: I was getting insteading of posting
Cooler 2017-02-21 19:30:53
and combine all the bs and return bs
threshold 2017-02-21 19:30:56
Koterpillar: That did it!
Koterpillar 2017-02-21 19:31:12
yay!
threshold 2017-02-21 19:31:45
Koterpillar: Thank you for helping me. I will study why this works and ask questions again later. It feels as though my karma is too low to continue asking and not aiding others.
Cooler 2017-02-21 19:31:47
how does b <- m b work?
threshold 2017-02-21 19:32:09
Cooler: I believe <- is >>=
Cooler 2017-02-21 19:32:40
need the desugared version
Koterpillar 2017-02-21 19:33:00
Cooler: threshold: do { x1 <- y1; x2 <- y2; y3 } is the same as: y1 >>= \x1 -> y2 >>= \x2 -> y3
threshold 2017-02-21 19:33:59
f x >>= (\x -> ... I think is equivalent to x <- m x -- but others here have my experience and are probably smarter
threshold 2017-02-21 19:34:20
I mean that others here have more experience
Cooler 2017-02-21 19:36:06
f x >>= (\b -> (meh xs f >>= (\bs -> return (b:bs))))
johnw 2017-02-21 19:36:17
f x >>= (\x -> ...) is equivalent to x <- fx; ...
johnw 2017-02-21 19:36:22
s/fx/f x
mrkgnao1 2017-02-21 19:37:22
I never tried writing out the instances for Free until today
mrkgnao1 2017-02-21 19:37:34
very educative
mrkgnao1 2017-02-21 19:37:36
oh, no
threshold 2017-02-21 19:38:06
mrkgnao: What is it?
threshold 2017-02-21 19:38:19
mrkgnao: The suspense is killing me ;)
Cooler 2017-02-21 19:38:39
are the parens correct?
jle` 2017-02-21 19:40:14
Cooler: does it compile?
threshold 2017-02-21 19:40:43
Cooler: I believe so, but I don't know why you want (\bs -> return (b:bs) when meh already has return $ b:bs