on master help sign in
Add missing module headers
commitfa94a03e89ed6b6b6d11b34335a9f88e76b27fef authorCsongor Kiss <kiss.csongor.kiss@gmail.com> dateTue 1 Aug 2017, 21:33 (9 years ago) parentf7fd419
7 files changed+55−25
README.md+1−1 generic-lens.cabal+3−3 src/Data/Generics/Internal/Families.hs+10 src/Data/Generics/Internal/Families/Count.hs+10 src/Data/Generics/Internal/Families/Has.hs+16−6 src/Data/Generics/Internal/HList.hs+12−12 src/Data/Generics/Sum/Constructors.hs+3−3
README.md+1−1
@@ -200,7 +200,7 @@ error:
200200 • The type Animal does not contain a constructor named "Giraffe"
201201```
202202
203−## Typed constructors
203+### Typed constructors
204204
205205Constructor components can be accessed using the component's type, assuming
206206that this type is unique:
generic-lens.cabal+3−3
@@ -41,7 +41,7 @@ library
4141
4242 hs-source-dirs: src
4343 default-language: Haskell2010
44− ghc-options: -Wall -Werror
44+ ghc-options: -Wall
4545
4646source-repository head
4747 type: git
@@ -58,7 +58,7 @@ test-suite generic-lens-test
5858 , generic-lens
5959
6060 default-language: Haskell2010
61− ghc-options: -Wall -Werror
61+ ghc-options: -Wall
6262
6363benchmark generic-lens-bench
6464 type: exitcode-stdio-1.0
@@ -74,4 +74,4 @@ benchmark generic-lens-bench
7474 , lens
7575
7676 default-language: Haskell2010
77− ghc-options: -Wall -Werror
77+ ghc-options: -Wall
src/Data/Generics/Internal/Families.hs+10
@@ -1,3 +1,13 @@
1+-----------------------------------------------------------------------------
2+-- |
3+-- Module : Data.Generics.Internal.Families
4+-- Copyright : (C) 2017 Csongor Kiss
5+-- License : BSD3
6+-- Maintainer : Csongor Kiss <kiss.csongor.kiss@gmail.com>
7+-- Stability : experimental
8+-- Portability : non-portable
9+--
10+-----------------------------------------------------------------------------
111module Data.Generics.Internal.Families
212 ( module Families
313 ) where
src/Data/Generics/Internal/Families/Count.hs+10
@@ -4,6 +4,16 @@
44{-# LANGUAGE TypeOperators #-}
55{-# LANGUAGE UndecidableInstances #-}
66
7+-----------------------------------------------------------------------------
8+-- |
9+-- Module : Data.Generics.Internal.Families.Count
10+-- Copyright : (C) 2017 Csongor Kiss
11+-- License : BSD3
12+-- Maintainer : Csongor Kiss <kiss.csongor.kiss@gmail.com>
13+-- Stability : experimental
14+-- Portability : non-portable
15+--
16+-----------------------------------------------------------------------------
717module Data.Generics.Internal.Families.Count
818 ( CountTotalType
919 , CountPartialType
src/Data/Generics/Internal/Families/Has.hs+16−6
@@ -1,9 +1,19 @@
1−{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE PolyKinds #-}
3−{-# LANGUAGE TypeFamilies #-}
4−{-# LANGUAGE TypeOperators #-}
5−{-# LANGUAGE UndecidableInstances #-}
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE PolyKinds #-}
3+{-# LANGUAGE TypeFamilies #-}
4+{-# LANGUAGE TypeOperators #-}
5+{-# LANGUAGE UndecidableInstances #-}
66
7+-----------------------------------------------------------------------------
8+-- |
9+-- Module : Data.Generics.Internal.Families.Has
10+-- Copyright : (C) 2017 Csongor Kiss
11+-- License : BSD3
12+-- Maintainer : Csongor Kiss <kiss.csongor.kiss@gmail.com>
13+-- Stability : experimental
14+-- Portability : non-portable
15+--
16+-----------------------------------------------------------------------------
717module Data.Generics.Internal.Families.Has
818 ( HasTotalFieldP
919 , HasTotalTypeP
@@ -16,7 +26,7 @@ import GHC.Generics
1626import GHC.TypeLits
1727
1828type family HasTotalFieldP (field :: Symbol) f :: Bool where
19− HasTotalFieldP field (S1 ('MetaSel ('Just field) _ _ _) (Rec0 t))
29+ HasTotalFieldP field (S1 ('MetaSel ('Just field) _ _ _) _)
2030 = 'True
2131 HasTotalFieldP field (l :*: r)
2232 = HasTotalFieldP field l || HasTotalFieldP field r
src/Data/Generics/Internal/HList.hs+12−12
@@ -11,16 +11,18 @@
1111{-# LANGUAGE TypeOperators #-}
1212{-# LANGUAGE UndecidableInstances #-}
1313
14+-----------------------------------------------------------------------------
15+-- |
16+-- Module : Data.Generics.Internal.HList
17+-- Copyright : (C) 2017 Csongor Kiss
18+-- License : BSD3
19+-- Maintainer : Csongor Kiss <kiss.csongor.kiss@gmail.com>
20+-- Stability : experimental
21+-- Portability : non-portable
22+--
23+-----------------------------------------------------------------------------
1424module Data.Generics.Internal.HList
15− ( HList (..)
16−
17− , head'
18− , tail'
19−
20− , append
21− , (++)
22−
23− , Splittable (..)
25+ ( (++)
2426
2527 , ListTuple (..)
2628
@@ -47,9 +49,6 @@ append (x :> xs) ys = x :> append xs ys
4749head' :: HList (a ': as) -> a
4850head' (x :> _) = x
4951
50−tail' :: HList (a ': as) -> HList as
51−tail' (_ :> xs) = xs
52−
5352--------------------------------------------------------------------------------
5453-- * Split HList
5554
@@ -142,6 +141,7 @@ instance ListTuple (a, b, c, d, e, f, g, h, j, k, l) '[a, b, c, d, e, f, g, h, j
142141 = (a, b, c, d, e, f, g, h, j, k, l)
143142
144143--------------------------------------------------------------------------------
144+
145145class GCollectible (f :: Type -> Type) (as :: [Type]) | f -> as where
146146 gtoCollection :: f x -> HList as
147147 gfromCollection :: HList as -> f x
src/Data/Generics/Sum/Constructors.hs+3−3
@@ -28,9 +28,6 @@ module Data.Generics.Sum.Constructors
2828
2929 -- $example
3030 AsConstructor (..)
31−
32− -- *Internals
33− , GAsConstructor (..)
3431 ) where
3532
3633import Data.Generics.Internal.Families
@@ -77,10 +74,13 @@ class AsConstructor (ctor :: Symbol) a s | s ctor -> a where
7774 --
7875 -- >>> dog ^? _Ctor @"Dog"
7976 -- Just (MkDog {name = "Shep", age = 3})
77+ --
8078 -- >>> dog ^? _Ctor @"Cat"
8179 -- Nothing
80+ --
8281 -- >>> cat ^? _Ctor @"Cat"
8382 -- Just ("Mog", 5)
83+ --
8484 -- >>> _Ctor @"Cat" # ("Garfield", 6) :: Animal
8585 -- Cat ("Garfield", 6)
8686 _Ctor :: Prism' s a