4 ms·
Why require Pure to be an annotation - why not make that the default without annotation - no effects? (Same as in Haskell)
by xixixao 5y ago
Why require Pure to be an annotation - why not make that the default without annotation - no effects? (Same as in Haskell)
- endgame 5y agoAll functions in Haskell are pure: the function `putStrLn :: String -> IO ()` returns the same IO action for the given input.
- kreetx 5y agoBut you don't need to annotate that, i.e `putStrLn :: Pure (String -> IO ())` (or as in the OP lisp: `Pure (-> String (IO ()))`)
- nonsince 5y agoBecause it’s an effect system, it’s not returning monads. It’s a different kind of type system with different restrictions and benefits. You could make every function implicitly pure, but that would be syntactic sugar, as opposed to Haskell where pure-as-default is a consequence of how the type system is structured.