src/Tools/Haskell/Library.hs
changeset 69234 2dec32c7313f
parent 69227 71b48b749836
child 69240 16ca270090b6
     1.1 --- a/src/Tools/Haskell/Library.hs	Sun Nov 04 15:28:51 2018 +0100
     1.2 +++ b/src/Tools/Haskell/Library.hs	Sun Nov 04 17:19:56 2018 +0100
     1.3 @@ -8,9 +8,12 @@
     1.4  -}
     1.5  
     1.6  module Isabelle.Library
     1.7 -  ((|>), (|->), (#>), (#->), fold, fold_rev, single, quote, trim_line)
     1.8 +  ((|>), (|->), (#>), (#->), the_default, fold, fold_rev, single, quote, trim_line)
     1.9  where
    1.10  
    1.11 +import Data.Maybe
    1.12 +
    1.13 +
    1.14  {- functions -}
    1.15  
    1.16  (|>) :: a -> (a -> b) -> b
    1.17 @@ -26,6 +29,13 @@
    1.18  (f #-> g) x  = x |> f |-> g
    1.19  
    1.20  
    1.21 +{- options -}
    1.22 +
    1.23 +the_default :: a -> Maybe a -> a
    1.24 +the_default x Nothing = x
    1.25 +the_default _ (Just y) = y
    1.26 +
    1.27 +
    1.28  {- lists -}
    1.29  
    1.30  fold :: (a -> b -> b) -> [a] -> b -> b