>>13The best case use for Haskell is the use of functions to perform functions. We can take the function f :: Int -> Int as the argument of its argument f :
f xs :: int = f xs
Notice the type signature for the function f : the type of the function is int . That type signature can be modified and written in a variety of ways. For example, the above example could be done using type polymorphism in the GHC compiler. Let's take a look.
Let's suppose we have written f :: Int -> int . This can be read as follows: This function f must be used in any function f that takes an argument of type int . However the Haskell type signature can be modified to be either an Int or a Maybe Int .
So in the example above, we have given the result type from Haskell like this: data Just a = Just (a) data Maybe a = Nothing A Haskell might look like this:
In fact Haskell allows you to do things such that the type signature of a function f will change in a manner similar to that for reading the type in a language.