gdp-0.0.0.2: Reason about invariants and preconditions with ghosts of departed proofs.

Copyright(c) Matt Noonan 2018
LicenseBSD-style
Maintainermatt.noonan@gmail.com
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.The

Description

 
Synopsis
  • class The d a | d -> a where
    • pattern The :: The d a => a -> d

    Documentation

    class The d a | d -> a where #

    A class for extracing "the" underlying value. the should ideally be a coercion from some newtype wrap of a back to a.

    For this common use case, in the module where newtype New a = New a is defined, an instance of The can be created with an empty definition:

    newtype New a = New a
    instance The (New a) a
    

    Methods

    the :: d -> a #

    the :: Coercible d a => d -> a #

    Instances
    The (Named name a) a # 
    Instance details

    Defined in Theory.Named

    Methods

    the :: Named name a -> a #

    The (Satisfies p a) a # 
    Instance details

    Defined in Data.Refined

    Methods

    the :: Satisfies p a -> a #

    The a' a => The (a' ::: p) a # 
    Instance details

    Defined in Data.Refined

    Methods

    the :: (a' ::: p) -> a #

    pattern The :: The d a => a -> d #

    A view pattern for discarding the wrapper around a value.

    f (The x) = expression x
    

    is equivalent to

    f x = let x' = the x in expression x'