packages feed

void 0.5.10 → 0.5.11

raw patch · 3 files changed

+66/−6 lines, 3 filesdep ~basedep ~semigroups

Dependency ranges changed: base, semigroups

Files

Data/Void.hs view
@@ -10,7 +10,12 @@ -- Portability :  portable -- -----------------------------------------------------------------------------module Data.Void (Void, absurd, vacuous, vacuousM) where+module Data.Void+  ( Void+  , absurd+  , vacuous+  , vacuousM+  ) where  import Data.Ix import Control.Monad (liftM)
+ Data/Void/Unsafe.hs view
@@ -0,0 +1,48 @@+{-# LANGUAGE CPP #-}+#if !defined(SAFE) && defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+#define UNSAFE+{-# LANGUAGE Unsafe #-}+#endif+-----------------------------------------------------------------------------+-- |+-- Module      :  Data.Void.Unsafe+-- Copyright   :  (C) 2008-2012 Edward Kmett+-- License     :  BSD-style (see the file LICENSE)+--+-- Maintainer  :  Edward Kmett <ekmett@gmail.com>+-- Stability   :  provisional+-- Portability :  portable+--+----------------------------------------------------------------------------+module Data.Void.Unsafe+  ( unsafeVacuous+  , unsafeVacuousM+  ) where++import Data.Void++#ifdef UNSAFE+import Unsafe.Coerce+#endif++-- | If 'Void' is uninhabited than any 'Functor' that holds only values of the type 'Void'+-- is holding no values.+--+-- This is only safe for valid functors that do not perform GADT-like analysis on the argument.+unsafeVacuous :: Functor f => f Void -> f a+#ifdef UNSAFE+unsafeVacuous = unsafeCoerce+#else+unsafeVacuous = fmap absurd+#endif++-- | If 'Void' is uninhabited then any 'Monad' that holds values of type 'Void'+-- is holding no values.+--+-- This is only safe for valid monads that do not perform GADT-like analysis on the argument.+unsafeVacuousM :: Monad m => m Void -> m a+#ifdef UNSAFE+unsafeVacuousM = unsafeCoerce+#else+unsafeVacuousM m = m >>= return . absurd+#endif
void.cabal view
@@ -1,6 +1,6 @@ name:          void category:      Data Structures-version:       0.5.10+version:       0.5.11 license:       BSD3 cabal-version: >= 1.6 license-file:  LICENSE@@ -20,16 +20,23 @@   type: git   location: git://github.com/ekmett/void.git +flag safe+  manual: True+  default: False+ library-  extensions:-    CPP   exposed-modules:     Data.Void+    Data.Void.Unsafe+   build-depends:-    base >= 3 && < 10,-    semigroups >= 0.8.2 && < 0.9+    base       >= 3 && < 10,+    semigroups >= 0.8.2    ghc-options: -Wall++  if flag(safe)+    cpp-options: -DSAFE    if impl(ghc)     extensions: DeriveDataTypeable