singleton-bool (empty) → 0.1.0.0
raw patch · 5 files changed
+122/−0 lines, 5 filesdep +basesetup-changed
Dependencies added: base
Files
- LICENSE +30/−0
- README.md +7/−0
- Setup.hs +2/−0
- singleton-bool.cabal +38/−0
- src/Data/Singletons/Bool.hs +45/−0
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2016, Oleg Grenrus++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * 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.++ * Neither the name of Oleg Grenrus nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"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 COPYRIGHT+OWNER 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.
+ README.md view
@@ -0,0 +1,7 @@+# singleton-bool++[](https://travis-ci.org/phadej/singleton-bool)+[](http://hackage.haskell.org/package/singleton-bool)+[](http://stackage.org/nightly/package/singleton-bool)++Type level booleans
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ singleton-bool.cabal view
@@ -0,0 +1,38 @@+-- This file has been generated from package.yaml by hpack version 0.14.0.+--+-- see: https://github.com/sol/hpack++name: singleton-bool+version: 0.1.0.0+synopsis: Type level booleans+description: Type level booleans.+ .+ @singletons@ package provides similar functionality,+ but it has tight dependency constraints.+category: Web+homepage: https://github.com/phadej/singleton-bool#readme+bug-reports: https://github.com/phadej/singleton-bool/issues+author: Oleg Grenrus <oleg.grenrus@iki.fi>+maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>+license: BSD3+license-file: LICENSE+tested-with: GHC==7.4.2, GHC==7.6.3, GHC==7.8.4, GHC==7.10.3, GHC==8.0.1+build-type: Simple+cabal-version: >= 1.10++extra-source-files:+ README.md++source-repository head+ type: git+ location: https://github.com/phadej/singleton-bool++library+ hs-source-dirs:+ src+ ghc-options: -Wall+ build-depends:+ base >=4.5 && <4.10+ exposed-modules:+ Data.Singletons.Bool+ default-language: Haskell2010
+ src/Data/Singletons/Bool.hs view
@@ -0,0 +1,45 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE KindSignatures #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeOperators #-}+module Data.Singletons.Bool (+ SBool(..),+ SBoolI(..),+ -- * Data.Type.Bool+ -- | These are only defined with @base >= 4.7@+#if MIN_VERSION_base(4,7,0)+ sboolAnd, sboolOr, sboolNot,+#endif+ ) where++#if MIN_VERSION_base(4,7,0)+import Data.Type.Bool+#endif++data SBool (b :: Bool) where+ STrue :: SBool 'True+ SFalse :: SBool 'False++class SBoolI (b :: Bool) where sbool :: SBool b+instance SBoolI 'True where sbool = STrue+instance SBoolI 'False where sbool = SFalse++-------------------------------------------------------------------------------+-- Witnesses+-------------------------------------------------------------------------------++#if MIN_VERSION_base(4,7,0)+sboolAnd :: SBool a -> SBool b -> SBool (a && b)+sboolAnd SFalse _ = SFalse+sboolAnd STrue b = b++sboolOr :: SBool a -> SBool b -> SBool (a || b)+sboolOr STrue _ = STrue+sboolOr SFalse b = b++sboolNot :: SBool a -> SBool (Not a)+sboolNot STrue = SFalse+sboolNot SFalse = STrue+#endif