Search Haskell Channel Logs

Sunday, February 19, 2017

#haskell channel featuring angerman, Koterpillar, geekosaur, Axman6, piyush-kurur, MarcelineVQ, and 5 others.

Koterpillar 2017-02-19 17:45:31
pretty sure it's some experimental code anyway...
Axman6 2017-02-19 17:46:02
liftIO is the answer though
halogenandtoast 2017-02-19 17:46:07
Hmm for some reason I thought the whole OverloadedRecordFields thing was solved in ghc 8, but that doesn't seem to be the case. It's mostly become DuplicateRecordFields and it's still ambiguous when accessing internal data
lpaste_ 2017-02-19 17:46:50
halogenandtoast pasted "DuplicateRecordFields.hs" at http://lpaste.net/352745
threshold 2017-02-19 17:47:03
Koterpillar: Hi, thanks for responding. If the last line of postUser is "liftIO (return (u ++ " on server " ++ (head args)))", the error then changes, but is similar: Expected type: Server Routes Actual type: [Char] -> IO b0
halogenandtoast 2017-02-19 17:47:05
So that paste for instance errors with name being ambiguous
Koterpillar 2017-02-19 17:47:25
threshold: liftIO getArgs
threshold 2017-02-19 17:48:06
Koterpillar: This? args <- liftIO getArgs
geekosaur 2017-02-19 17:48:33
halogenandtoast, it's only started, not completed
geekosaur 2017-02-19 17:48:44
another chunk, but still not the whole thing iirc, is slated for 8.2.1
Koterpillar 2017-02-19 17:49:17
threshold: correct
halogenandtoast 2017-02-19 17:49:53
geekosaur: yeah I'm just surprised. I guess it's far more difficult than I could imagine.
halogenandtoast 2017-02-19 17:50:18
Or perhaps it's not difficult, but it's difficult to make safe, fast, and easy.
geekosaur 2017-02-19 17:50:44
my impression is that it looks easy but has edge cases all over the place
threshold 2017-02-19 17:50:45
Koterpillar: That did cause it do something different: Expected type: Server Routes Actual type: [Char] -> Control.Monad.Trans.Except.ExceptT ServantErr IO [Char]
geekosaur 2017-02-19 17:50:56
but that's just my impression, I do not know details
halogenandtoast 2017-02-19 17:51:03
geekosaur: thanks
Koterpillar 2017-02-19 17:51:05
threshold: repaste?
lpaste_ 2017-02-19 17:52:45
threshold pasted "Repaste" at http://lpaste.net/352746
Koterpillar 2017-02-19 17:53:46
ok, well, now the problem is you're adding User and String
Axman6 2017-02-19 17:54:01
probably need show u
threshold 2017-02-19 17:54:12
Koterpillar: Thanks. I'll try T.pack
Koterpillar 2017-02-19 17:54:14
no, the return type is still User
Koterpillar 2017-02-19 17:54:29
so you need to somehow add User and String and get back a User
Koterpillar 2017-02-19 17:54:57
what are you actually trying to do? This sounds like an abomination in using Servant
Axman6 2017-02-19 17:54:58
oh right, yes you need to return a User
threshold 2017-02-19 17:55:45
Koterpillar: How did you know that I need to return a User? That would help me quite a bit. My primary confusion is in what exactly is the expected return type.
Koterpillar 2017-02-19 17:55:58
Post '[JSON] User
Axman6 2017-02-19 17:56:03
because of the type Routes
Koterpillar 2017-02-19 17:56:19
this part says you return a User, encoded in JSON
Axman6 2017-02-19 17:56:30
`Server Routes` translates into User -> Handler User
Koterpillar 2017-02-19 17:56:34
this is your input: ReqBody '[JSON] User
threshold 2017-02-19 17:59:32
Koterpillar and Axman6, that helps. It's strange that the return type is a Post
Axman6 2017-02-19 17:59:54
threshold: if you run :kind! Server oputes in GHCi, you'll see what type you need
Koterpillar 2017-02-19 17:59:57
I agree, that bit is actually part of the input
angerman 2017-02-19 18:00:34
how do I selectively enable an Executable in the cabal file based on a flag?
angerman 2017-02-19 18:00:49
e.g. do not build this executable unless -xyz is specificed.
MarcelineVQ 2017-02-19 18:04:42
good question, if's aren't allowed between stanza's appearantly, hmm...
threshold 2017-02-19 18:05:07
:kind! Server results in Server :: k -> * = Server while :kind! Routes.Routes results in Routes.Routes :: * = Routes
Koterpillar 2017-02-19 18:06:03
did you mean :kind (or :type?) Server Routes?
MarcelineVQ 2017-02-19 18:06:06
angerman: and moving to Custom build feels like a step too far
threshold 2017-02-19 18:07:09
Koterpillar: Thanks again. That results in Server Routes :: *
Koterpillar 2017-02-19 18:07:52
no luck
threshold 2017-02-19 18:08:03
I need to understand how to transform * -> * to * probably.
Koterpillar 2017-02-19 18:08:18
well, Server has an associated data type
Koterpillar 2017-02-19 18:08:21
*is
Koterpillar 2017-02-19 18:08:35
every Route has one, and when they are combined, the type changes
threshold 2017-02-19 18:11:31
Koterpillar: This is confusing. Maybe I should start out with something simpler such as a simple WAI app
threshold 2017-02-19 18:11:39
I do like the idea of not having to serialize JSON
threshold 2017-02-19 18:12:19
Koterpillar: Do you have experience with this. Is it that difficult to handle JSON?
lpaste_ 2017-02-19 18:12:48
MarcelineVQ pasted "angerman" at http://lpaste.net/9168932458794582016
Koterpillar 2017-02-19 18:13:22
threshold: you'll get combinators to serve it in every framework
MarcelineVQ 2017-02-19 18:14:00
angerman: relevant http://cabal.readthedocs.io/en/latest/developing-packages.html#conditional-blocks
angerman 2017-02-19 18:14:35
MarcelineVQ: thanks. And now I'm handicaped by ghc-cabal. AHH!!
Koterpillar 2017-02-19 18:15:24
threshold: but I do think you need to try some other framework before servant, just to get a feel
MarcelineVQ 2017-02-19 18:24:06
angerman: is it much different?
angerman 2017-02-19 18:24:30
MarcelineVQ: supports only a single stanza it seems :-/
angerman 2017-02-19 18:24:57
MarcelineVQ: so maybe it would work, maybe not... but I don't want to go down that rabbit hole now.
piyush-kurur 2017-02-19 18:30:57
is there a reason why unboxed vector from the vector library does not have a foldable instance ?
piyush-kurur 2017-02-19 18:31:18
or is it that the author missed it?
erlandsona 2017-02-19 18:34:23
What's a function with the signature [(a,b)] -> [(a,c)] ? It's definitely a map over a list of pairs... is there a nice way to do this?
Koterpillar 2017-02-19 18:34:46
:t second -- erlandsona
lambdabot 2017-02-19 18:34:49
Arrow a => a b c -> a (d, b) (d, c)
Koterpillar 2017-02-19 18:35:07
map (second negate) [(1, 2), (3, 4)]
Koterpillar 2017-02-19 18:35:15
> map (second negate) [(1, 2), (3, 4)]
lambdabot 2017-02-19 18:35:20
[(1,-2),(3,-4)]
threshold 2017-02-19 18:35:31
Koterpillar: What is the most straightforward framework?
erlandsona 2017-02-19 18:35:40
second! Yes! I love irc! and you too Koterpillar thanks so much!
Koterpillar 2017-02-19 18:36:10
threshold: scotty?
threshold 2017-02-19 18:40:09
Koterpillar: I'll try it out. Thanks again