LIB: move maybeD to MyPrelude

This commit is contained in:
Julian Ospald 2016-03-30 19:16:33 +02:00
parent f301e2e519
commit 5b1c595703
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
2 changed files with 7 additions and 3 deletions

View File

@ -95,6 +95,7 @@ import HPath
, pattern Path
)
import qualified HPath as P
import MyPrelude
import Safe
(
atDef
@ -763,9 +764,6 @@ fromFreeVar :: (Default d) => (a -> d) -> File a -> d
fromFreeVar f df = maybeD f $ getFreeVar df
-- |A `maybe` flavor using the `Default` class.
maybeD :: (Default b) => (a -> b) -> Maybe a -> b
maybeD = maybe def
-- |Pack the modification time into a string.

View File

@ -19,9 +19,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module MyPrelude where
import Data.Default
import Data.List
listIndices :: [a] -> [Int]
listIndices = findIndices (const True)
-- |A `maybe` flavor using the `Default` class.
maybeD :: (Default b) => (a -> b) -> Maybe a -> b
maybeD = maybe def