summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraminb <>2017-12-17 21:35:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2017-12-17 21:35:00 (GMT)
commit392f426c90b0c2f6a37e398df2bed21bf644bed0 (patch)
tree3ec5cfc9bc0b1c57da52c512dccf7832a5cd2768
parent466706de4545927f2a4332d2e7604d0a3c5dc192 (diff)
version 0.2.5HEAD0.2.5master
-rw-r--r--README.md7
-rw-r--r--bookkeeper.cabal58
-rw-r--r--doctest/Doctest.hs (renamed from test/Doctest.hs)0
-rw-r--r--package.yaml23
-rw-r--r--src/Bookkeeper/Internal.hs9
-rw-r--r--src/Bookkeeper/Lens.hs9
6 files changed, 63 insertions, 43 deletions
diff --git a/README.md b/README.md
index 5321512..89c90c0 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-# Bookkeeper
+# Bookkeeper [![Build Status][ci-img]][ci]
-Bookkeeper is a new Haskell library that uses the new OverlodaedLabels feature
+Bookkeeper is a new Haskell library that uses the new OverloadedLabels feature
of GHC 8 to provide a new take on datatypes and records:
~~~ {.haskell}
@@ -52,3 +52,6 @@ You can set, modify, or get fields. See the haddocks for more information.
main :: IO ()
main = return ()
~~~
+
+[ci-img]: https://travis-ci.org/turingjump/bookkeeper.svg?branch=master
+[ci]: https://travis-ci.org/turingjump/bookkeeper
diff --git a/bookkeeper.cabal b/bookkeeper.cabal
index 91052df..f34c2d4 100644
--- a/bookkeeper.cabal
+++ b/bookkeeper.cabal
@@ -1,11 +1,13 @@
--- This file has been generated from package.yaml by hpack version 0.14.1.
+-- This file has been generated from package.yaml by hpack version 0.20.0.
--
-- see: https://github.com/sol/hpack
+--
+-- hash: 919c9bd63ad7efe1c1c555270f3970af8bead66e26cb198aca395daf0d1abc13
name: bookkeeper
-version: 0.2.4
+version: 0.2.5
synopsis: Anonymous records and overloaded labels
-description: Please see README.md
+description: Please see README.md for more information and examples.
category: Data Structures, Records
homepage: http://github.com/turingjump/bookkeeper#readme
bug-reports: https://github.com/turingjump/bookkeeper/issues
@@ -14,7 +16,7 @@ maintainer: jkarni@gmail.com
copyright: (c) Julian K. Arni
license: BSD3
license-file: LICENSE
-tested-with: GHC == 8.0.1
+tested-with: GHC == 8.0.1, GHC == 8.2.1
build-type: Simple
cabal-version: >= 1.10
@@ -33,9 +35,9 @@ library
default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFunctor DeriveGeneric DeriveFoldable DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs MultiParamTypeClasses KindSignatures TypeInType OverloadedStrings RankNTypes ScopedTypeVariables TypeApplications TypeFamilies TypeOperators OverloadedLabels MagicHash
ghc-options: -Wall
build-depends:
- base >= 4.9 && < 4.10
- , type-level-sets
+ base >=4.9 && <4.11
, data-default-class
+ , type-level-sets
exposed-modules:
Bookkeeper
Bookkeeper.Internal
@@ -49,29 +51,29 @@ executable readme
exec
ghc-options: -Wall -pgmL markdown-unlit -fno-warn-unused-top-binds
build-depends:
- base >= 4.9 && < 4.10
- , type-level-sets
+ base >=4.9 && <4.11
+ , bookkeeper
, data-default-class
- , base >=4.9 && < 4.10 , bookkeeper , markdown-unlit
+ , markdown-unlit
+ , type-level-sets
default-language: Haskell2010
test-suite doctest
type: exitcode-stdio-1.0
main-is: Doctest.hs
hs-source-dirs:
- test
+ doctest
default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFunctor DeriveGeneric DeriveFoldable DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs MultiParamTypeClasses KindSignatures TypeInType OverloadedStrings RankNTypes ScopedTypeVariables TypeApplications TypeFamilies TypeOperators OverloadedLabels MagicHash
ghc-options: -Wall
build-depends:
- base >= 4.9 && < 4.10
- , type-level-sets
+ Glob >=0.7 && <0.9
+ , base >=4.9 && <4.11
, data-default-class
- , doctest >= 0.9 && < 0.12
- , Glob >= 0.7 && < 0.8
- , yaml == 0.8.*
+ , doctest >=0.9 && <0.12
+ , type-level-sets
+ , yaml ==0.8.*
other-modules:
- BookkeeperSpec
- Spec
+ Paths_bookkeeper
default-language: Haskell2010
test-suite spec
@@ -82,15 +84,15 @@ test-suite spec
default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFunctor DeriveGeneric DeriveFoldable DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs MultiParamTypeClasses KindSignatures TypeInType OverloadedStrings RankNTypes ScopedTypeVariables TypeApplications TypeFamilies TypeOperators OverloadedLabels MagicHash
ghc-options: -Wall
build-depends:
- base >= 4.9 && < 4.10
- , type-level-sets
- , data-default-class
+ QuickCheck >=2.8 && <2.11
+ , base >=4.9 && <4.11
, bookkeeper
- , hspec > 2 && < 3
- , QuickCheck >= 2.8 && < 2.9
+ , data-default-class
+ , hspec >2 && <3
+ , type-level-sets
other-modules:
BookkeeperSpec
- Doctest
+ Paths_bookkeeper
default-language: Haskell2010
benchmark bench
@@ -99,11 +101,13 @@ benchmark bench
hs-source-dirs:
bench
default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFunctor DeriveGeneric DeriveFoldable DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs MultiParamTypeClasses KindSignatures TypeInType OverloadedStrings RankNTypes ScopedTypeVariables TypeApplications TypeFamilies TypeOperators OverloadedLabels MagicHash
- ghc-options: -Wall -O2
+ ghc-options: -Wall -Wall
build-depends:
- base >= 4.9 && < 4.10
- , type-level-sets
- , data-default-class
+ base >=4.9 && <4.11
, bookkeeper
, criterion
+ , data-default-class
+ , type-level-sets
+ other-modules:
+ Paths_bookkeeper
default-language: Haskell2010
diff --git a/test/Doctest.hs b/doctest/Doctest.hs
index 6bf4575..6bf4575 100644
--- a/test/Doctest.hs
+++ b/doctest/Doctest.hs
diff --git a/package.yaml b/package.yaml
index 2587669..6ff413c 100644
--- a/package.yaml
+++ b/package.yaml
@@ -1,7 +1,7 @@
name: bookkeeper
-version: 0.2.4
+version: 0.2.5
synopsis: Anonymous records and overloaded labels
-description: Please see README.md
+description: Please see README.md for more information and examples.
homepage: http://github.com/turingjump/bookkeeper#readme
license: BSD3
license-file: LICENSE
@@ -9,7 +9,7 @@ author: Julian K. Arni
maintainer: jkarni@gmail.com
copyright: (c) Julian K. Arni
github: turingjump/bookkeeper
-tested-with: GHC == 8.0.1
+tested-with: GHC == 8.0.1, GHC == 8.2.1
category: Data Structures, Records
extra-source-files:
- CHANGELOG.md
@@ -19,7 +19,7 @@ extra-source-files:
ghc-options: -Wall
dependencies:
- - base >= 4.9 && < 4.10
+ - base >= 4.9 && < 4.11
- type-level-sets
- data-default-class
@@ -60,14 +60,14 @@ tests:
dependencies:
- bookkeeper
- hspec > 2 && < 3
- - QuickCheck >= 2.8 && < 2.9
+ - QuickCheck >= 2.8 && < 2.11
doctest:
main: Doctest.hs
- source-dirs: test
+ source-dirs: doctest
default-extensions: *allExts
dependencies:
- doctest >= 0.9 && < 0.12
- - Glob >= 0.7 && < 0.8
+ - Glob >= 0.7 && < 0.9
- yaml == 0.8.*
benchmarks:
@@ -78,7 +78,7 @@ benchmarks:
dependencies:
- bookkeeper
- criterion
- ghc-options: -O2
+ ghc-options: -Wall
executables:
@@ -88,6 +88,7 @@ executables:
source-dirs: exec
default-extensions: []
other-modules: []
- dependencies: base >=4.9 && < 4.10
- , bookkeeper
- , markdown-unlit
+ dependencies:
+ - base >=4.9 && < 4.11
+ - bookkeeper
+ - markdown-unlit
diff --git a/src/Bookkeeper/Internal.hs b/src/Bookkeeper/Internal.hs
index b4ddb36..f5ef8cb 100644
--- a/src/Bookkeeper/Internal.hs
+++ b/src/Bookkeeper/Internal.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE UndecidableInstances #-}
+{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
module Bookkeeper.Internal where
@@ -75,7 +76,11 @@ type a :=> b = a ':-> b
instance (s ~ s') => IsLabel s (Key s') where
+#if MIN_VERSION_base(4,10,0)
+ fromLabel = Key
+#else
fromLabel _ = Key
+#endif
-- | 'Key' is simply a proxy. You will usually not need to generate it
-- directly, as it is generated by the OverlodadedLabels magic.
@@ -238,7 +243,9 @@ type family Expected a where
instance (book ~ Expected (l :+: r)) => FromGeneric (l :+: r) book where
fromGeneric = error "impossible"
-instance (book ~ Expected U1) => FromGeneric U1 book where
+instance {-# OVERLAPPABLE #-}
+ (book ~ Expected lhs, lhs ~ U1
+ ) => FromGeneric lhs book where
fromGeneric = error "impossible"
diff --git a/src/Bookkeeper/Lens.hs b/src/Bookkeeper/Lens.hs
index 8648dd8..4f0fccb 100644
--- a/src/Bookkeeper/Lens.hs
+++ b/src/Bookkeeper/Lens.hs
@@ -1,10 +1,11 @@
{-# LANGUAGE UndecidableInstances #-}
+{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Bookkeeper.Lens where
import GHC.OverloadedLabels
import Bookkeeper.Internal
-import GHC.TypeLits (Symbol, KnownSymbol, TypeError, ErrorMessage(..))
+import GHC.TypeLits (Symbol)
-- * Lenses
@@ -36,5 +37,9 @@ instance (Settable field valnew old new,
s2ft ~ (Book' old -> f (Book' new)))
=> IsLabel (field :: Symbol)
((val -> f valnew) -> s2ft) where
- fromLabel _ = rlens (Key @field)
+#if MIN_VERSION_base(4,10,0)
+ fromLabel = rlens (Key @field)
+#else
+ fromLabel _ = rlens (Key @field)
+#endif