packages feed

void 0.5.6 → 0.5.7

raw patch · 2 files changed

+11/−3 lines, 2 files

Files

Data/Void.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- Module      :  Data.Void@@ -11,7 +12,6 @@ ---------------------------------------------------------------------------- module Data.Void (Void, absurd, vacuous, vacuousM) where -import Control.Monad (liftM) import Data.Semigroup (Semigroup(..)) import Data.Ix @@ -21,8 +21,11 @@  #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 #else@@ -38,8 +41,11 @@ -- | Since Void values are logically uninhabited, this witnesses the logical -- reasoning tool of 'ex falso quodlibet'. absurd :: Void -> a-absurd (Void a) = absurd a+absurd a = a `seq` spin a where+   spin (Void b) = spin b +-- | If 'Void' is uninhabited then any 'Functor' that holds values of type 'Void'+-- is holding no values. vacuous :: Functor f => f Void -> f a #ifdef __GLASGOW_HASKELL__ vacuous = unsafeCoerce@@ -48,6 +54,8 @@ 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
void.cabal view
@@ -1,6 +1,6 @@ name:          void category:      Data Structures-version:       0.5.6+version:       0.5.7 license:       BSD3 cabal-version: >= 1.6 license-file:  LICENSE