Safe Haskell | Safe |
---|
Data.Algorithm.SatSolver.Utils
List
safeHead :: [a] -> Maybe a Source #
safeHead
xs
return the first element of list xs
if it is
not empty and Nothing
otherwise.
>>>
safeHead []
Nothing>>>
safeHead [1]
Just 1>>>
safeHead [1..5]
Just 1
safeLast :: [a] -> Maybe a Source #
safeHead
xs
return the last element of list xs
if it is
not empty and Nothing
otherwise.
>>>
safeLast []
Nothing>>>
safeLast [1]
Just 1>>>
safeLast [1..5]
Just 5