Better HN
topnewbestaskshowjobs
Log inSign up

nogenerics123

2 karma · joined Feb 20, 2018 (8y ago) · 2 submissions

Submissions

comment 8y ago · link · parent

Many times do blocks are passed into functions so the monad type can be looked up from the function definition.

    flip runStateT s $ do ...
To find the type of this do block I don't have to scan it I just have to look up the definition of runStateT.

If I have to add an explicit annotation to a do block it's simple enough to separate it into another function.

    justSix :: Maybe Int
    justSix = do
        x <- pure 1
        y <- pure 5
        pure (x + y)
I read the article and couldn't find the part where they said that type inference is a problem with do notation.

comment 8y ago · link · parent

If anyone is interested in looking at the benchmarks or implementation: https://github.com/cw75/tiered-storage is from the main developer and it looks similar to Anna.