packages feed

defun-bool (empty) → 0.1

raw patch · 4 files changed

+141/−0 lines, 4 filesdep +basedep +defun-coredep +singleton-bool

Dependencies added: base, defun-core, singleton-bool

Files

+ CHANGELOG.md view
@@ -0,0 +1,3 @@+## 0.1++* First version. Released on an unsuspecting world.
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2023, 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.
+ defun-bool.cabal view
@@ -0,0 +1,50 @@+cabal-version:   2.4+name:            defun-bool+version:         0.1+license:         BSD-3-Clause+license-file:    LICENSE+author:          Oleg Grenrus <oleg.grenrus@iki.fi>+maintainer:      Oleg Grenrus <oleg.grenrus@iki.fi>+category:        Data+build-type:      Simple+extra-doc-files: CHANGELOG.md+tested-with:     GHC ==9.2.8 || ==9.4.8 || ==9.6.3 || ==9.8.1+synopsis:        Defunctionalization helpers: booleans+description:+  This package provides type and term definitions for boolean type families+  in "Data.Type.Bool" (in @base@) using @SBool@ type from @singleton-bool@ package.++source-repository head+  type:     git+  location: https://github.com/phadej/defun.git+  subdir:   defun-bool++common language+  default-language:   Haskell2010+  default-extensions:+    DataKinds+    EmptyCase+    GADTs+    KindSignatures+    NoImplicitPrelude+    PatternSynonyms+    PolyKinds+    RankNTypes+    ScopedTypeVariables+    StandaloneKindSignatures+    TypeApplications+    TypeFamilies+    TypeOperators+    UndecidableInstances+    ViewPatterns++library+  import:            language+  hs-source-dirs:    src+  exposed-modules:   SBool.DeFun+  build-depends:+    , base            ^>=4.16.3.0 || ^>=4.17.2.0 || ^>=4.18.0.0 || ^>=4.19.0.0+    , defun-core      ^>=0.1+    , singleton-bool  ^>=0.1.7++  x-docspec-options: -XDataKinds -XGADTs -XStandaloneDeriving
+ src/SBool/DeFun.hs view
@@ -0,0 +1,58 @@+{-# LANGUAGE Trustworthy #-}+-- | Boolean functions.+--+-- Type families are defined in "Data.Type.Bool" module in @base@ package.+-- Term implementation use 'SBool' from @singleton-bool@ package.+--+module SBool.DeFun (+    -- * Logical and+    LAnd, LAndSym, LAndSym1,+    land, landSym, landSym1,+    -- * Logical or+    LOr, LOrSym, LOrSym1,+    lor, lorSym, lorSym1,+    -- * Logical not+    Not, NotSym,+    not, notSym,+) where++import Data.Singletons.Bool (SBool (..), sboolAnd, sboolNot, sboolOr)++import DeFun.Bool+import DeFun.Core++-------------------------------------------------------------------------------+-- LAnd+-------------------------------------------------------------------------------++land :: SBool x -> SBool y -> SBool (LAnd x y)+land = sboolAnd++landSym1 :: SBool x -> Lam SBool SBool (LAndSym1 x)+landSym1 x = Lam (land x)++landSym :: Lam2 SBool SBool SBool LAndSym+landSym = Lam landSym1++-------------------------------------------------------------------------------+-- LOr+-------------------------------------------------------------------------------++lor :: SBool x -> SBool y -> SBool (LOr x y)+lor = sboolOr++lorSym1 :: SBool x -> Lam SBool SBool (LOrSym1 x)+lorSym1 x = Lam (lor x)++lorSym :: Lam2 SBool SBool SBool LOrSym+lorSym = Lam lorSym1++-------------------------------------------------------------------------------+-- Not+-------------------------------------------------------------------------------++not :: SBool x -> SBool (Not x)+not = sboolNot++notSym :: Lam SBool SBool NotSym+notSym = Lam not