lens-sop 0.1.0.2 → 0.2.0.0
raw patch · 4 files changed
+11/−14 lines, 4 filesdep ~generics-sopPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: generics-sop
API changes (from Hackage documentation)
- Generics.SOP.Lens: instance (Category r, ArrowApply w) => Category (GLens r w)
- Generics.SOP.Lens.Computed: lensOptionsMatch :: LensOptions -> DatatypeName -> FieldName -> String -> Bool
- Generics.SOP.Lens.Named: instance Show (NamedLens a ctxt)
- Generics.SOP.Lens.Named: unNamedLens :: NamedLens a ctxt -> GLens (->) (->) a b
+ Generics.SOP.Lens: instance (Control.Category.Category r, Control.Arrow.ArrowApply w) => Control.Category.Category (Generics.SOP.Lens.GLens r w)
+ Generics.SOP.Lens.Computed: [lensOptionsMatch] :: LensOptions -> DatatypeName -> FieldName -> String -> Bool
+ Generics.SOP.Lens.Named: [unNamedLens] :: NamedLens a ctxt -> GLens (->) (->) a b
+ Generics.SOP.Lens.Named: instance GHC.Show.Show (Generics.SOP.Lens.Named.NamedLens a ctxt)
- Generics.SOP.Lens: np :: (Arrow r, ArrowApply w, SingI xs) => NP (GLens r w (NP I xs)) xs
+ Generics.SOP.Lens: np :: (Arrow r, ArrowApply w, SListI xs) => NP (GLens r w (NP I xs)) xs
Files
- lens-sop.cabal +4/−9
- src/Generics/SOP/Lens.hs +5/−3
- src/Generics/SOP/Lens/Computed.hs +0/−1
- src/Generics/SOP/Lens/Named.hs +2/−1
lens-sop.cabal view
@@ -1,5 +1,5 @@ name: lens-sop-version: 0.1.0.2+version: 0.2.0.0 synopsis: Computing lenses generically using generics-sop description: This library contains a definition of generalized lenses that are built@@ -16,11 +16,11 @@ license: BSD3 license-file: LICENSE author: Edsko de Vries <edsko@well-typed.com>, Andres Löh <andres@well-typed.com>-maintainer: edsko@well-typed.com+maintainer: andres@well-typed.com category: Generics build-type: Simple cabal-version: >=1.10-tested-with: GHC == 7.6.3, GHC == 7.8.2+tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.2 source-repository head type: git@@ -31,7 +31,7 @@ Generics.SOP.Lens.Named Generics.SOP.Lens.Computed build-depends: base >= 4.6 && < 5,- generics-sop >= 0.1 && < 2,+ generics-sop >= 0.2 && < 0.3, fclabels >= 2.0 && < 2.1, transformers >= 0.3 && < 0.5 hs-source-dirs: src@@ -56,8 +56,3 @@ FunctionalDependencies if impl (ghc >= 7.8) default-extensions: AutoDeriveTypeable- other-extensions: OverloadedStrings- OverlappingInstances- PolyKinds- UndecidableInstances- CPP
src/Generics/SOP/Lens.hs view
@@ -3,6 +3,7 @@ -- Intended to be imported qualified -- -- > import Generics.SOP.Lens as GLens+-- module Generics.SOP.Lens ( -- * Generalized lenses GLens@@ -78,15 +79,16 @@ -------------------------------------------------------------------------------} glenses :: forall r w a xs. (Generic a, Code a ~ '[xs], Arrow r, ArrowApply w) => NP (GLens r w a) xs-glenses = case sing :: Sing (Code a) of+glenses = case sList :: SList (Code a) of SCons -> hliftA (\l -> l . sop . rep) np+ _ -> error "inaccessible" {------------------------------------------------------------------------------- Generalized lenses for representation types -------------------------------------------------------------------------------} -np :: forall r w xs. (Arrow r, ArrowApply w, SingI xs) => NP (GLens r w (NP I xs)) xs-np = case sing :: Sing xs of+np :: forall r w xs. (Arrow r, ArrowApply w, SListI xs) => NP (GLens r w (NP I xs)) xs+np = case sList :: SList xs of SNil -> Nil SCons -> i . head :* hliftA (. tail) np
src/Generics/SOP/Lens/Computed.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE UndecidableInstances, OverlappingInstances #-} module Generics.SOP.Lens.Computed ( -- * Abstract lenses AbstractLens(..)
src/Generics/SOP/Lens/Named.hs view
@@ -46,9 +46,10 @@ gnamedLenses :: forall a ctxt xs. (Generic a, HasDatatypeInfo a, Code a ~ '[xs], All ctxt xs) => (DatatypeName -> ConstructorName -> LensName) -> [(String, NamedLens a ctxt)]-gnamedLenses mkName = case sing :: Sing (Code a) of+gnamedLenses mkName = case sList :: SList (Code a) of SCons -> zip (fieldNames mkName (datatypeInfo pa)) (hcollapse $ hcliftA pc (K . NamedLens) totalLenses)+ _ -> error "inaccessible" where totalLenses :: NP (GLens (->) (->) a) xs totalLenses = GLens.glenses