fcf-base (empty) → 0.1.0.0
raw patch · 5 files changed
+140/−0 lines, 5 filesdep +basedep +fcf-basedep +fcf-family
Dependencies added: base, fcf-base, fcf-family
Files
- CHANGELOG.md +5/−0
- LICENSE +20/−0
- fcf-base.cabal +37/−0
- src/Fcf/Base.hs +58/−0
- test/Main.hs +20/−0
+ CHANGELOG.md view
@@ -0,0 +1,5 @@+# Revision history for fcf-base++## 0.1.0.0 -- 2023-01-23++* First version. Released on an unsuspecting world.
+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (c) 2022 Li-yao Xia++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be included+in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ fcf-base.cabal view
@@ -0,0 +1,37 @@+cabal-version: 3.0+name: fcf-base+version: 0.1.0.0+synopsis: Family-of-families instances for base+description: See the package <https://hackage.haskell.org/package/fcf-family fcf-family> for more information.+homepage: https://gitlab.com/lysxia/fcf-family+license: MIT+license-file: LICENSE+author: Li-yao Xia+maintainer: lysxia@gmail.com+category: Other+build-type: Simple+extra-doc-files: CHANGELOG.md++common warnings+ ghc-options: -Wall++library+ import: warnings+ exposed-modules:+ Fcf.Base+ build-depends:+ fcf-family,+ base >= 4.15 && < 4.19+ hs-source-dirs: src+ default-language: Haskell2010++test-suite fcf-base-test+ import: warnings+ default-language: Haskell2010+ type: exitcode-stdio-1.0+ hs-source-dirs: test+ main-is: Main.hs+ build-depends:+ base,+ fcf-family,+ fcf-base
+ src/Fcf/Base.hs view
@@ -0,0 +1,58 @@+{-# LANGUAGE CPP, DataKinds, NoStarIsType, PolyKinds, TemplateHaskell, TypeFamilies #-}++-- | First-class promotion of type families in /base/.+module Fcf.Base () where++import Data.Type.Bool+import Data.Type.Equality+import GHC.Generics (Rep)+import GHC.TypeLits+#if MIN_VERSION_base(4,16,0)+import Data.Type.Ord+#endif+#if MIN_VERSION_base(4,17,0)+import GHC.TypeError+#endif++import Fcf.Family.TH (fcfify)++-- Bool+fcfify ''(||)+fcfify ''(&&)+fcfify ''If+fcfify ''Not++-- Equality+fcfify ''(==)++-- Generics+fcfify ''Rep++-- TypeError+fcfify ''TypeError++-- TypeLits+fcfify ''AppendSymbol+fcfify ''CmpSymbol++-- TypeNats+fcfify ''(+)+fcfify ''(-)+fcfify ''(*)+fcfify ''Div+fcfify ''Mod+fcfify ''Log2+fcfify ''CmpNat++#if MIN_VERSION_base(4,16,0)+fcfify ''Compare+fcfify ''OrdCond+fcfify ''ConsSymbol+fcfify ''UnconsSymbol+fcfify ''CharToNat+fcfify ''NatToChar+fcfify ''CmpChar+#endif+#if MIN_VERSION_base(4,17,0)+fcfify ''Assert+#endif
+ test/Main.hs view
@@ -0,0 +1,20 @@+{-# LANGUAGE AllowAmbiguousTypes, DataKinds, PolyKinds, ScopedTypeVariables, TemplateHaskell, TypeApplications, TypeFamilies, TypeOperators #-}++module Main where++import Data.Type.Bool (If)+import Data.Type.Equality (type (==))+import GHC.TypeNats (type (+))++import Fcf.Family (Eval)+import Fcf.Family.TH (applyFamily)+import Fcf.Base ()++equals :: forall a b. (a ~ b) => IO ()+equals = pure ()++main :: IO ()+main = do+ equals @(Eval $(applyFamily ''(+) [ [t|3|] , [t|4|] ])) @7+ equals @(Eval $(applyFamily ''If [ [t|'True|] , [t|Int|] , [t|()|] ])) @Int+ equals @(Eval $(applyFamily ''(==) [ [t|()|] , [t|Int|] ])) @'False