Github API libraries - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Sridhar Ratnakumar

... all suck in one way or the other.

Sridhar Ratnakumar

Going back to good ol' req.

demo :: Text -> IO Text
demo authToken = runReq defaultHttpConfig $ do
  let auth = oAuth2Token $ encodeUtf8 authToken
      userAgent = header "User-Agent" ""
  r <-
      (https "" /: "repos" /: "srid" /: "somerepo" /: "git" /: "ref" /: "heads" /: "master")
      (auth <> userAgent)
  liftIO $ print (responseBody r :: Value)
  pure $ toText $ shower (responseBody r :: Value)
Magnus Therning

I'd be interested in what ways they suck :slight_smile:

I did a quick hack in Python this morning, but plan to rewrite it in Haskell if it proves to be useful so knowing of limitations of the various libs available on Hackage would be very useful.

Sridhar Ratnakumar

github library is good, if you can get it to work (its got its strange problems when using in obelisk as a override; so I use the stable hackage version only for its types).

Joel McCracken

Sometimes Its just easier to do it manually. Like, I was looking at the available haskell stripe API and it was very confusing; I ended up just using req and it was a lot simpler