Hacker News new | ask | show | jobs
by moomin 4185 days ago
Consider an HTTP request. A get can't have a body, a post can.

So you could define

    data Request b where
      GET :: Headers -> Request ()
      POST :: Headers -> body -> Request body
As the article says, building up your intuition is the hard bit.

You could go further by typing the headers to recognize the type of body you're dealing with.