haskus-utils-1.5: Haskus utility modules

Safe HaskellSafe
LanguageHaskell2010

Haskus.Utils.Dynamic

Contents

Synopsis

Dynamic

Dynamic with equality

data DynEq where Source #

Dynamic type with Eq and Ord instance

Can be used as Map keys for instance

Constructors

DynEq :: forall a. (Eq a, Ord a) => TypeRep a -> a -> DynEq 
Instances
Eq DynEq Source # 
Instance details

Defined in Haskus.Utils.Dynamic

Methods

(==) :: DynEq -> DynEq -> Bool #

(/=) :: DynEq -> DynEq -> Bool #

Ord DynEq Source # 
Instance details

Defined in Haskus.Utils.Dynamic

Methods

compare :: DynEq -> DynEq -> Ordering #

(<) :: DynEq -> DynEq -> Bool #

(<=) :: DynEq -> DynEq -> Bool #

(>) :: DynEq -> DynEq -> Bool #

(>=) :: DynEq -> DynEq -> Bool #

max :: DynEq -> DynEq -> DynEq #

min :: DynEq -> DynEq -> DynEq #

toDynEq :: (Typeable a, Eq a, Ord a) => a -> DynEq Source #

Create a DynEq value

>>> toDynEq (10 :: Int) == toDynEq (12 :: Int)
False
>>> toDynEq (10 :: Int) <= toDynEq (12 :: Int)
True
>>> toDynEq (10 :: Int) /= toDynEq "Test"
True

fromDynEq :: Typeable a => DynEq -> a -> a Source #

Get a value from a DynEq or the default one if the type doesn't match

fromDynEqMaybe :: forall a. Typeable a => DynEq -> Maybe a Source #

Get a value from a DynEq if the type matches