How does the presence of the “error” function bear on the purity of Haskell?
问题 I've always wondered how the Haskell exception system fits in with the whole "Pure functional language" thing. For example see the below GHCi session. GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help Prelude> head [] *** Exception: Prelude.head: empty list Prelude> :t head head :: [a] -> a Prelude> :t error error :: [Char] -> a Prelude> error "ranch" *** Exception: ranch CallStack (from HasCallStack): error, called at <interactive>:4:1 in interactive:Ghci1 Prelude> The type of