void-0.7.2/0000755000000000000000000000000013065370240010647 5ustar0000000000000000void-0.7.2/.ghci0000644000000000000000000000012513065370240011560 0ustar0000000000000000:set -isrc -idist/build/autogen -optP-include -optPdist/build/autogen/cabal_macros.h void-0.7.2/.gitignore0000644000000000000000000000012013065370240012630 0ustar0000000000000000*# *.hi *.o *~ .*.swo .*.swp .swp .DS_Store TAGS _darcs dist docs tags wiki wip void-0.7.2/.travis.yml0000644000000000000000000001020413065370240012755 0ustar0000000000000000# This file has been generated -- see https://github.com/hvr/multi-ghc-travis language: c sudo: false notifications: irc: channels: - "irc.freenode.org#haskell-lens" skip_join: true template: - "\x0313void\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}" cache: directories: - $HOME/.cabsnap - $HOME/.cabal/packages before_cache: - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar matrix: include: - env: CABALVER=1.18 GHCVER=7.0.4 compiler: ": #GHC 7.0.4" addons: {apt: {packages: [cabal-install-1.18,ghc-7.0.4], sources: [hvr-ghc]}} - env: CABALVER=1.18 GHCVER=7.2.2 compiler: ": #GHC 7.2.2" addons: {apt: {packages: [cabal-install-1.18,ghc-7.2.2], sources: [hvr-ghc]}} - env: CABALVER=1.18 GHCVER=7.4.2 compiler: ": #GHC 7.4.2" addons: {apt: {packages: [cabal-install-1.18,ghc-7.4.2], sources: [hvr-ghc]}} - env: CABALVER=1.18 GHCVER=7.6.3 compiler: ": #GHC 7.6.3" addons: {apt: {packages: [cabal-install-1.18,ghc-7.6.3], sources: [hvr-ghc]}} - env: CABALVER=1.18 GHCVER=7.8.4 compiler: ": #GHC 7.8.4" addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} - env: CABALVER=1.22 GHCVER=7.10.3 compiler: ": #GHC 7.10.3" addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}} - env: CABALVER=1.24 GHCVER=8.0.2 compiler: ": #GHC 8.0.2" addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2], sources: [hvr-ghc]}} - env: CABALVER=head GHCVER=head compiler: ": #GHC head" addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} allow_failures: - env: CABALVER=head GHCVER=head before_install: - unset CC - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH install: - cabal --version - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ]; then zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz > $HOME/.cabal/packages/hackage.haskell.org/00-index.tar; fi - travis_retry cabal update -v - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt # check whether current requested install-plan matches cached package-db snapshot - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt; then echo "cabal build-cache HIT"; rm -rfv .ghc; cp -a $HOME/.cabsnap/ghc $HOME/.ghc; cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/; else echo "cabal build-cache MISS"; rm -rf $HOME/.cabsnap; mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin; cabal install -j --only-dependencies --enable-tests --enable-benchmarks; fi # snapshot package-db on cache miss - if [ ! -d $HOME/.cabsnap ]; then echo "snapshotting package-db to build-cache"; mkdir $HOME/.cabsnap; cp -a $HOME/.ghc $HOME/.cabsnap/ghc; cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/; fi # Here starts the actual work to be performed for the package under test; # any command which exits with a non-zero exit code causes the build to fail. script: - if [ -f configure.ac ]; then autoreconf -i; fi - cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging - cabal build # this builds all libraries and executables (including tests/benchmarks) - cabal test - cabal check - cabal sdist # tests that a source-distribution can be generated # Check that the resulting source distribution can be built & installed. # If there are no other `.tar.gz` files in `dist`, this can be even simpler: # `cabal install --force-reinstalls dist/*-*.tar.gz` - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && (cd dist && cabal install --force-reinstalls "$SRC_TGZ") # EOF void-0.7.2/.vim.custom0000644000000000000000000000137713065370240012764 0ustar0000000000000000" Add the following to your .vimrc to automatically load this on startup " if filereadable(".vim.custom") " so .vim.custom " endif function StripTrailingWhitespace() let myline=line(".") let mycolumn = col(".") silent %s/ *$// call cursor(myline, mycolumn) endfunction " enable syntax highlighting syntax on " search for the tags file anywhere between here and / set tags=TAGS;/ " highlight tabs and trailing spaces set listchars=tab:‗‗,trail:‗ set list " f2 runs hasktags map :exec ":!hasktags -x -c --ignore src" " strip trailing whitespace before saving " au BufWritePre *.hs,*.markdown silent! cal StripTrailingWhitespace() " rebuild hasktags after saving au BufWritePost *.hs silent! :exec ":!hasktags -x -c --ignore src" void-0.7.2/CHANGELOG.markdown0000644000000000000000000000105213065370240013700 0ustar00000000000000000.7.2 ----- * Only depend on `deepseq`, `hashable`, and `semigroups` if using GHC 7.8 or earlier. * Cleaned up spurious "redundant constraint" warnings on GHC 8+ 0.7.1 ----- * Support `semigroups` 0.17 on older GHCs * Backported `NFData`'s `semigroup` instance to older GHCs. 0.7 --- * adapt to `Data.Void` being moved into `base-4.8` * `vacuousM` removed 0.6 --- * `instance Exception Void` * `instance Generic Void` * `instance Hashable Void` 0.5.12 ------ * Fixed compatibility with GHC 7.2 (#6) * Added `CHANGELOG.markdown` and `README.markdown` void-0.7.2/LICENSE0000644000000000000000000000265313065370240011662 0ustar0000000000000000Copyright 2015 Edward Kmett All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the author nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. void-0.7.2/README.markdown0000644000000000000000000000106013065370240013345 0ustar0000000000000000void ==== [![Hackage](https://img.shields.io/hackage/v/void.svg)](https://hackage.haskell.org/package/void) [![Build Status](https://secure.travis-ci.org/ekmett/void.png?branch=master)](http://travis-ci.org/ekmett/void) This package provides a canonical 'uninhabited' data type for Haskell. This arises in a surprisingly wide array of situations in practice. Contact Information ------------------- Contributions and bug reports are welcome! Please feel free to contact me through github or on the #haskell IRC channel on irc.freenode.net. -Edward Kmett void-0.7.2/Setup.lhs0000644000000000000000000000016513065370240012461 0ustar0000000000000000#!/usr/bin/runhaskell > module Main (main) where > import Distribution.Simple > main :: IO () > main = defaultMain void-0.7.2/void.cabal0000644000000000000000000000276713065370240012610 0ustar0000000000000000name: void category: Data Structures version: 0.7.2 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE author: Edward A. Kmett maintainer: Edward A. Kmett stability: portable homepage: http://github.com/ekmett/void bug-reports: http://github.com/ekmett/void/issues copyright: Copyright (C) 2008-2015 Edward A. Kmett synopsis: A Haskell 98 logically uninhabited data type description: A Haskell 98 logically uninhabited data type, used to indicate that a given term should not exist. build-type: Simple extra-source-files: .ghci .gitignore .travis.yml .vim.custom CHANGELOG.markdown README.markdown source-repository head type: git location: git://github.com/ekmett/void.git flag safe manual: True default: False library default-language: Haskell98 hs-source-dirs: src exposed-modules: Data.Void.Unsafe build-depends: base >= 3 && < 10 ghc-options: -Wall if flag(safe) cpp-options: -DSAFE if !impl(ghc>=7.9) hs-source-dirs: src-old exposed-modules: Data.Void build-depends: deepseq >= 1.1 && < 1.5, hashable >= 1.1, semigroups >= 0.8.2 if impl(ghc) other-extensions: DeriveDataTypeable cpp-options: -DLANGUAGE_DeriveDataTypeable if impl(ghc >= 7.2) other-extensions: StandaloneDeriving -- other-extensions: DeriveGeneric isn't known to cabal yet cpp-options: -DLANGUAGE_DeriveGeneric build-depends: ghc-prim void-0.7.2/src/0000755000000000000000000000000013065370240011436 5ustar0000000000000000void-0.7.2/src/Data/0000755000000000000000000000000013065370240012307 5ustar0000000000000000void-0.7.2/src/Data/Void/0000755000000000000000000000000013065370240013210 5ustar0000000000000000void-0.7.2/src/Data/Void/Unsafe.hs0000644000000000000000000000265013065370240014770 0ustar0000000000000000{-# LANGUAGE CPP #-} #if !defined(SAFE) && defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 704 #define UNSAFE {-# LANGUAGE Unsafe #-} #endif #if __GLASGOW_HASKELL__ >= 800 {-# OPTIONS_GHC -Wno-redundant-constraints #-} -- they aren't redundant! #endif ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2008-2015 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett -- 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-0.7.2/src-old/0000755000000000000000000000000013065370240012212 5ustar0000000000000000void-0.7.2/src-old/Data/0000755000000000000000000000000013065370240013063 5ustar0000000000000000void-0.7.2/src-old/Data/Void.hs0000644000000000000000000000525313065370240014325 0ustar0000000000000000{-# LANGUAGE CPP #-} #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} #endif #ifdef LANGUAGE_DeriveDataTypeable {-# LANGUAGE DeriveDataTypeable #-} #endif #ifdef LANGUAGE_DeriveGeneric {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE StandaloneDeriving #-} #endif #ifndef MIN_VERSION_base #define MIN_VERSION_base(x,y,z) 1 #endif #ifndef MIN_VERSION_semigroups #define MIN_VERSION_semigroups(x,y,z) 1 #endif ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2008-2015 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett -- Stability : provisional -- Portability : portable -- ---------------------------------------------------------------------------- module Data.Void ( Void , absurd , vacuous , vacuousM ) where import Control.DeepSeq (NFData(..)) import Control.Monad (liftM) import Data.Ix import Data.Hashable import Data.Semigroup (Semigroup(..)) #ifdef LANGUAGE_DeriveDataTypeable import Data.Data #endif #ifdef LANGUAGE_DeriveGeneric import GHC.Generics #endif #if MIN_VERSION_base(4,0,0) import Control.Exception #endif -- | A logically uninhabited data type. #if __GLASGOW_HASKELL__ < 700 data Void = Void !Void #else newtype Void = Void Void #endif #ifdef LANGUAGE_DeriveDataTypeable deriving (Data, Typeable) #endif #ifdef LANGUAGE_DeriveGeneric deriving instance Generic Void #endif instance Eq Void where _ == _ = True instance Hashable Void where hashWithSalt _ = absurd instance Ord Void where compare _ _ = EQ instance Show Void where showsPrec _ = absurd -- | Reading a 'Void' value is always a parse error, considering 'Void' as -- a data type with no constructors. instance Read Void where readsPrec _ _ = [] -- | Since 'Void' values logically don't exist, this witnesses the logical -- reasoning tool of \"ex falso quodlibet\". absurd :: Void -> a absurd a = a `seq` spin a where spin (Void b) = spin b -- | 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 vacuous = fmap absurd -- | If 'Void' is uninhabited then any 'Monad' that holds values of type 'Void' -- is holding no values. vacuousM :: Monad m => m Void -> m a vacuousM = liftM absurd instance Semigroup Void where a <> _ = a #if MIN_VERSION_semigroups(0,17,0) stimes _ a = a #else times1p _ a = a #endif instance Ix Void where range _ = [] index _ = absurd inRange _ = absurd rangeSize _ = 0 #if MIN_VERSION_base(4,0,0) instance Exception Void #endif -- | Defined as @'rnf' = 'absurd'@. instance NFData Void where rnf = absurd