packages feed

void 0.5.8 → 0.5.10

raw patch · 2 files changed

+10/−18 lines, 2 files

Files

Data/Void.hs view
@@ -12,19 +12,14 @@ ---------------------------------------------------------------------------- module Data.Void (Void, absurd, vacuous, vacuousM) where -import Data.Semigroup (Semigroup(..)) import Data.Ix+import Control.Monad (liftM)+import Data.Semigroup (Semigroup(..))  #ifdef LANGUAGE_DeriveDataTypeable import Data.Data #endif -#ifdef __GLASGOW_HASKELL__-import Unsafe.Coerce-#else-import Control.Monad (liftM)-#endif- -- | A logically uninhabited data type. #if __GLASGOW_HASKELL__ < 700 data Void = Void !Void@@ -32,12 +27,18 @@ newtype Void = Void Void #endif   deriving-  ( Eq, Ord, Show, Read+  ( Show, Read #ifdef LANGUAGE_DeriveDataTypeable   , Data, Typeable #endif   ) +instance Eq Void where+  _ == _ = True++instance Ord Void where+  compare _ _ = EQ+ -- | Since 'Void' values logically don't exist, this witnesses the logical -- reasoning tool of \"ex falso quodlibet\". absurd :: Void -> a@@ -47,21 +48,12 @@ -- | If 'Void' is uninhabited then any 'Functor' that holds only values of type 'Void' -- is holding no values. vacuous :: Functor f => f Void -> f a-#ifdef __GLASGOW_HASKELL__-vacuous = unsafeCoerce-#else--- other haskell compilers are free to use less homogeneous representations (NHC does, for instance) vacuous = fmap absurd-#endif  -- | If 'Void' is uninhabited then any 'Monad' that holds values of type 'Void' -- is holding no values. vacuousM :: Monad m => m Void -> m a-#ifdef __GLASGOW_HASKELL__-vacuousM = unsafeCoerce-#else vacuousM = liftM absurd-#endif  instance Semigroup Void where   a <> _ = a
void.cabal view
@@ -1,6 +1,6 @@ name:          void category:      Data Structures-version:       0.5.8+version:       0.5.10 license:       BSD3 cabal-version: >= 1.6 license-file:  LICENSE