Is escaping partial functions easier in Haskell than in other languages?

We urge you to avoid partial functions with seemingly more attention in Haskell than other languages.

Is it because partial functions are a more frequent risk in Haskell than other languages ​​(cf this question ), or is it that avoiding them in other languages ​​is not practical point of little attention?

+4
source share
2 answers

Is it because partial functions are a more frequent risk in Haskell than other languages ​​(cf this question), or is it that avoiding them in other languages ​​is impractical from the point of view of a little consideration?

, . null , , haskell Maybe a.

, haskell : , .

uhoh :: String
uhoh = error "oops"

. haskell , . , . .

, , haskell, , , , , , , . Prelude , tail /, , , , , , lib, , .

EDIT , .

+8

, Haskell , - . , . head , Prelude.head: empty list. , , head ! , , , .

, , : . https://hackage.haskell.org/package/base-4.9.1.0/docs/GHC-Stack.html https://wiki.haskell.org/Debugging. GHC ( ).

+8

Source: https://habr.com/ru/post/1681411/


All Articles