----------------------------------------------------------------------------- -- -- Module : Data.Maybe.Util -- Copyright : (c) 2014-16 Brian W Bush -- License : MIT -- -- Maintainer : Brian W Bush -- Stability : Stable -- Portability : Portable -- -- | Utility functions for 'Data.Maybe'. -- ----------------------------------------------------------------------------- {-# LANGUAGE Safe #-} module Data.Maybe.Util ( -- * Utilities maybeRead ) where import Data.Maybe (listToMaybe) -- | Maybe read a value. maybeRead :: Read a => String -- ^ The string. -> Maybe a -- ^ The value, if it could be parsed. maybeRead = fmap fst . listToMaybe . reads