base-generics (empty) → 0.1.0.1
raw patch · 6 files changed
+233/−0 lines, 6 filesdep +basesetup-changed
Dependencies added: base
Files
- LICENSE +20/−0
- README.md +2/−0
- Setup.hs +2/−0
- base-generics.cabal +73/−0
- src/GHC/Int/Generics.hs +61/−0
- src/GHC/Word/Generics.hs +75/−0
+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (c) 2015 songzh + +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.
+ README.md view
@@ -0,0 +1,2 @@+# base-generics+This library provides some instances for extra GHC.Generic typeclass such as Int8, Word16 and so on.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple +main = defaultMain
+ base-generics.cabal view
@@ -0,0 +1,73 @@+-- Initial base-generics.cabal generated by cabal init. For further +-- documentation, see http://haskell.org/cabal/users-guide/ + +-- The name of the package. +name: base-generics + +-- The package version. See the Haskell package versioning policy (PVP) +-- for standards guiding when and how versions should be incremented. +-- http://www.haskell.org/haskellwiki/Package_versioning_policy +-- PVP summary: +-+------- breaking API changes +-- | | +----- non-breaking API additions +-- | | | +--- code changes with no API change +version: 0.1.0.1 + +-- A short (one-line) description of the package. +synopsis: This library provides some instances for extra GHC.Generic typeclass such as Int8, Word16 and some unboxed types as well. + +-- A longer description of the package. +description: This package provides Generic instance for Int8 and WOrd primitive types. + +-- URL for the project homepage or repository. +homepage: https://github.com/HaskellZhangSong/base-generics + +-- The license under which the package is released. +license: MIT + +-- The file containing the license text. +license-file: LICENSE + +-- The package author(s). +author: songzh + +-- An email address to which users can send suggestions, bug reports, and +-- patches. +maintainer: Haskell.Zhang.Song@hotmail.com + +-- A copyright notice. +-- copyright: + +category: Generic + +build-type: Simple + +-- Extra files to be distributed with the package, such as examples or a +-- README. +extra-source-files: README.md + +-- Constraint on the version of Cabal needed to build this package. +cabal-version: >=1.10 + + +library + -- Modules exported by the library. + exposed-modules: + GHC.Int.Generics + GHC.Word.Generics + + -- Modules included in this library but not exported. + -- other-modules: + + -- LANGUAGE extensions used by modules in this package. + other-extensions: + TypeFamilies + + -- Other library packages from which modules are imported. + build-depends: base >=4.7 && <4.8 + + -- Directories containing source files. + hs-source-dirs: src + + -- Base language which the package is written in. + default-language: Haskell2010 +
+ src/GHC/Int/Generics.hs view
@@ -0,0 +1,61 @@+{-# LANGUAGE TypeFamilies, MagicHash #-} +module GHC.Int.Generics where + +import GHC.Generics +import GHC.Int + +data C_Int8 +data D_Int8 + +instance Datatype D_Int8 where + datatypeName _ = "Int8" + moduleName _ = "GHC.Int" +instance Constructor C_Int8 where + conName _ = "" + +instance Generic Int8 where + type Rep Int8 = D1 D_Int8 (C1 C_Int8 (S1 NoSelector (Rec0 Int8))) + from x = M1 (M1 (M1 (K1 x))) + to (M1 (M1 (M1 (K1 x)))) = x + +data C_Int16 +data D_Int16 + +instance Datatype D_Int16 where + datatypeName _ = "Int16" + moduleName _ = "GHC.Int" +instance Constructor C_Int16 where + conName _ = "" + +instance Generic Int16 where + type Rep Int16 = D1 D_Int16 (C1 C_Int16 (S1 NoSelector (Rec0 Int16))) + from x = M1 (M1 (M1 (K1 x))) + to (M1 (M1 (M1 (K1 x)))) = x + +data C_Int32 +data D_Int32 + +instance Datatype D_Int32 where + datatypeName _ = "Int32" + moduleName _ = "GHC.Int" +instance Constructor C_Int32 where + conName _ = "" + +instance Generic Int32 where + type Rep Int32 = D1 D_Int32 (C1 C_Int32 (S1 NoSelector (Rec0 Int32))) + from x = M1 (M1 (M1 (K1 x))) + to (M1 (M1 (M1 (K1 x)))) = x + +data C_Int64 +data D_Int64 + +instance Datatype D_Int64 where + datatypeName _ = "Int64" + moduleName _ = "GHC.Int" +instance Constructor C_Int64 where + conName _ = "" + +instance Generic Int64 where + type Rep Int64 = D1 D_Int64 (C1 C_Int64 (S1 NoSelector (Rec0 Int64))) + from x = M1 (M1 (M1 (K1 x))) + to (M1 (M1 (M1 (K1 x)))) = x
+ src/GHC/Word/Generics.hs view
@@ -0,0 +1,75 @@+{-# LANGUAGE TypeFamilies #-} +module GHC.Word.Generics where + +import GHC.Generics +import GHC.Word + +data C_Word +data D_Word + +instance Datatype D_Word where + datatypeName _ = "Word" + moduleName _ = "GHC.Word" +instance Constructor C_Word where + conName _ = "" + +instance Generic Word where + type Rep Word = D1 D_Word (C1 C_Word (S1 NoSelector (Rec0 Word))) + from x = M1 (M1 (M1 (K1 x))) + to (M1 (M1 (M1 (K1 x)))) = x + +data C_Word8 +data D_Word8 + +instance Datatype D_Word8 where + datatypeName _ = "Word8" + moduleName _ = "GHC.Word" +instance Constructor C_Word8 where + conName _ = "" + +instance Generic Word8 where + type Rep Word8 = D1 D_Word8 (C1 C_Word8 (S1 NoSelector (Rec0 Word8))) + from x = M1 (M1 (M1 (K1 x))) + to (M1 (M1 (M1 (K1 x)))) = x + +data C_Word16 +data D_Word16 + +instance Datatype D_Word16 where + datatypeName _ = "Word16" + moduleName _ = "GHC.Word" +instance Constructor C_Word16 where + conName _ = "" + +instance Generic Word16 where + type Rep Word16 = D1 D_Word16 (C1 C_Word16 (S1 NoSelector (Rec0 Word16))) + from x = M1 (M1 (M1 (K1 x))) + to (M1 (M1 (M1 (K1 x)))) = x + +data C_Word32 +data D_Word32 + +instance Datatype D_Word32 where + datatypeName _ = "Word32" + moduleName _ = "GHC.Word" +instance Constructor C_Word32 where + conName _ = "" + +instance Generic Word32 where + type Rep Word32 = D1 D_Word32 (C1 C_Word32 (S1 NoSelector (Rec0 Word32))) + from x = M1 (M1 (M1 (K1 x))) + to (M1 (M1 (M1 (K1 x)))) = x + +data C_Word64 +data D_Word64 + +instance Datatype D_Word64 where + datatypeName _ = "Word64" + moduleName _ = "GHC.Word" +instance Constructor C_Word64 where + conName _ = "" + +instance Generic Word64 where + type Rep Word64 = D1 D_Word64 (C1 C_Word64 (S1 NoSelector (Rec0 Word64))) + from x = M1 (M1 (M1 (K1 x))) + to (M1 (M1 (M1 (K1 x)))) = x