references 0.3.0.1 → 0.3.1.0
raw patch · 5 files changed
+22/−31 lines, 5 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Control.Reference.Types: instance GHC.Base.Alternative Control.Reference.Representation.MU
- Control.Reference.Types: instance GHC.Base.MonadPlus Control.Reference.Representation.MU
+ Control.Reference.Combinators: infixl 5 &|&
+ Control.Reference.Combinators: infixl 6 &
+ Control.Reference.Operators: infixl 4 !|
+ Control.Reference.Predefined.Containers: type family SetElem e :: *;
+ Control.Reference.Predefined.Containers: }
+ Control.Reference.Types: data family MSt m1 m2 a :: *;
+ Control.Reference.Types: }
- Control.Reference.Predefined: state :: Monad m => Simple (StateLens s m) a s
+ Control.Reference.Predefined: state :: forall s m a. Monad m => Simple (StateLens s m) a s
- Control.Reference.Predefined.Containers: class Association e where type family AssocIndex e :: * type family AssocElem e :: *
+ Control.Reference.Predefined.Containers: class Association e where type AssocIndex e :: * type AssocElem e :: * where {
- Control.Reference.Predefined.Containers: class SetLike e where type family SetElem e :: *
+ Control.Reference.Predefined.Containers: class SetLike e where type SetElem e :: * where {
- Control.Reference.TupleInstances: _1 :: Lens_1 s_apLS t_apLT a_apLU b1_apLV => Lens s_apLS t_apLT a_apLU b1_apLV
+ Control.Reference.TupleInstances: _1 :: Lens_1 s_aswp t_aswq a_aswr b1_asws => Lens s_aswp t_aswq a_aswr b1_asws
- Control.Reference.TupleInstances: _10 :: Lens_10 s_apMs t_apMt a_apMu b1_apMv => Lens s_apMs t_apMt a_apMu b1_apMv
+ Control.Reference.TupleInstances: _10 :: Lens_10 s_aswZ t_asx0 a_asx1 b1_asx2 => Lens s_aswZ t_asx0 a_asx1 b1_asx2
- Control.Reference.TupleInstances: _11 :: Lens_11 s_apMw t_apMx a_apMy b1_apMz => Lens s_apMw t_apMx a_apMy b1_apMz
+ Control.Reference.TupleInstances: _11 :: Lens_11 s_asx3 t_asx4 a_asx5 b1_asx6 => Lens s_asx3 t_asx4 a_asx5 b1_asx6
- Control.Reference.TupleInstances: _12 :: Lens_12 s_apMA t_apMB a_apMC b1_apMD => Lens s_apMA t_apMB a_apMC b1_apMD
+ Control.Reference.TupleInstances: _12 :: Lens_12 s_asx7 t_asx8 a_asx9 b1_asxa => Lens s_asx7 t_asx8 a_asx9 b1_asxa
- Control.Reference.TupleInstances: _13 :: Lens_13 s_apME t_apMF a_apMG b1_apMH => Lens s_apME t_apMF a_apMG b1_apMH
+ Control.Reference.TupleInstances: _13 :: Lens_13 s_asxb t_asxc a_asxd b1_asxe => Lens s_asxb t_asxc a_asxd b1_asxe
- Control.Reference.TupleInstances: _14 :: Lens_14 s_apMI t_apMJ a_apMK b1_apML => Lens s_apMI t_apMJ a_apMK b1_apML
+ Control.Reference.TupleInstances: _14 :: Lens_14 s_asxf t_asxg a_asxh b1_asxi => Lens s_asxf t_asxg a_asxh b1_asxi
- Control.Reference.TupleInstances: _15 :: Lens_15 s_apMM t_apMN a_apMO b1_apMP => Lens s_apMM t_apMN a_apMO b1_apMP
+ Control.Reference.TupleInstances: _15 :: Lens_15 s_asxj t_asxk a_asxl b1_asxm => Lens s_asxj t_asxk a_asxl b1_asxm
- Control.Reference.TupleInstances: _16 :: Lens_16 s_apMQ t_apMR a_apMS b1_apMT => Lens s_apMQ t_apMR a_apMS b1_apMT
+ Control.Reference.TupleInstances: _16 :: Lens_16 s_asxn t_asxo a_asxp b1_asxq => Lens s_asxn t_asxo a_asxp b1_asxq
- Control.Reference.TupleInstances: _2 :: Lens_2 s_apLW t_apLX a_apLY b1_apLZ => Lens s_apLW t_apLX a_apLY b1_apLZ
+ Control.Reference.TupleInstances: _2 :: Lens_2 s_aswt t_aswu a_aswv b1_asww => Lens s_aswt t_aswu a_aswv b1_asww
- Control.Reference.TupleInstances: _3 :: Lens_3 s_apM0 t_apM1 a_apM2 b1_apM3 => Lens s_apM0 t_apM1 a_apM2 b1_apM3
+ Control.Reference.TupleInstances: _3 :: Lens_3 s_aswx t_aswy a_aswz b1_aswA => Lens s_aswx t_aswy a_aswz b1_aswA
- Control.Reference.TupleInstances: _4 :: Lens_4 s_apM4 t_apM5 a_apM6 b1_apM7 => Lens s_apM4 t_apM5 a_apM6 b1_apM7
+ Control.Reference.TupleInstances: _4 :: Lens_4 s_aswB t_aswC a_aswD b1_aswE => Lens s_aswB t_aswC a_aswD b1_aswE
- Control.Reference.TupleInstances: _5 :: Lens_5 s_apM8 t_apM9 a_apMa b1_apMb => Lens s_apM8 t_apM9 a_apMa b1_apMb
+ Control.Reference.TupleInstances: _5 :: Lens_5 s_aswF t_aswG a_aswH b1_aswI => Lens s_aswF t_aswG a_aswH b1_aswI
- Control.Reference.TupleInstances: _6 :: Lens_6 s_apMc t_apMd a_apMe b1_apMf => Lens s_apMc t_apMd a_apMe b1_apMf
+ Control.Reference.TupleInstances: _6 :: Lens_6 s_aswJ t_aswK a_aswL b1_aswM => Lens s_aswJ t_aswK a_aswL b1_aswM
- Control.Reference.TupleInstances: _7 :: Lens_7 s_apMg t_apMh a_apMi b1_apMj => Lens s_apMg t_apMh a_apMi b1_apMj
+ Control.Reference.TupleInstances: _7 :: Lens_7 s_aswN t_aswO a_aswP b1_aswQ => Lens s_aswN t_aswO a_aswP b1_aswQ
- Control.Reference.TupleInstances: _8 :: Lens_8 s_apMk t_apMl a_apMm b1_apMn => Lens s_apMk t_apMl a_apMm b1_apMn
+ Control.Reference.TupleInstances: _8 :: Lens_8 s_aswR t_aswS a_aswT b1_aswU => Lens s_aswR t_aswS a_aswT b1_aswU
- Control.Reference.TupleInstances: _9 :: Lens_9 s_apMo t_apMp a_apMq b1_apMr => Lens s_apMo t_apMp a_apMq b1_apMr
+ Control.Reference.TupleInstances: _9 :: Lens_9 s_aswV t_aswW a_aswX b1_aswY => Lens s_aswV t_aswW a_aswX b1_aswY
- Control.Reference.TupleInstances: class Lens_1 s_apLS t_apLT a_apLU b1_apLV | s_apLS -> a_apLU, t_apLT -> b1_apLV, a_apLU t_apLT -> s_apLS, b1_apLV s_apLS -> t_apLT
+ Control.Reference.TupleInstances: class Lens_1 s_aswp t_aswq a_aswr b1_asws | s_aswp -> a_aswr, t_aswq -> b1_asws, a_aswr t_aswq -> s_aswp, b1_asws s_aswp -> t_aswq
- Control.Reference.TupleInstances: class Lens_10 s_apMs t_apMt a_apMu b1_apMv | s_apMs -> a_apMu, t_apMt -> b1_apMv, a_apMu t_apMt -> s_apMs, b1_apMv s_apMs -> t_apMt
+ Control.Reference.TupleInstances: class Lens_10 s_aswZ t_asx0 a_asx1 b1_asx2 | s_aswZ -> a_asx1, t_asx0 -> b1_asx2, a_asx1 t_asx0 -> s_aswZ, b1_asx2 s_aswZ -> t_asx0
- Control.Reference.TupleInstances: class Lens_11 s_apMw t_apMx a_apMy b1_apMz | s_apMw -> a_apMy, t_apMx -> b1_apMz, a_apMy t_apMx -> s_apMw, b1_apMz s_apMw -> t_apMx
+ Control.Reference.TupleInstances: class Lens_11 s_asx3 t_asx4 a_asx5 b1_asx6 | s_asx3 -> a_asx5, t_asx4 -> b1_asx6, a_asx5 t_asx4 -> s_asx3, b1_asx6 s_asx3 -> t_asx4
- Control.Reference.TupleInstances: class Lens_12 s_apMA t_apMB a_apMC b1_apMD | s_apMA -> a_apMC, t_apMB -> b1_apMD, a_apMC t_apMB -> s_apMA, b1_apMD s_apMA -> t_apMB
+ Control.Reference.TupleInstances: class Lens_12 s_asx7 t_asx8 a_asx9 b1_asxa | s_asx7 -> a_asx9, t_asx8 -> b1_asxa, a_asx9 t_asx8 -> s_asx7, b1_asxa s_asx7 -> t_asx8
- Control.Reference.TupleInstances: class Lens_13 s_apME t_apMF a_apMG b1_apMH | s_apME -> a_apMG, t_apMF -> b1_apMH, a_apMG t_apMF -> s_apME, b1_apMH s_apME -> t_apMF
+ Control.Reference.TupleInstances: class Lens_13 s_asxb t_asxc a_asxd b1_asxe | s_asxb -> a_asxd, t_asxc -> b1_asxe, a_asxd t_asxc -> s_asxb, b1_asxe s_asxb -> t_asxc
- Control.Reference.TupleInstances: class Lens_14 s_apMI t_apMJ a_apMK b1_apML | s_apMI -> a_apMK, t_apMJ -> b1_apML, a_apMK t_apMJ -> s_apMI, b1_apML s_apMI -> t_apMJ
+ Control.Reference.TupleInstances: class Lens_14 s_asxf t_asxg a_asxh b1_asxi | s_asxf -> a_asxh, t_asxg -> b1_asxi, a_asxh t_asxg -> s_asxf, b1_asxi s_asxf -> t_asxg
- Control.Reference.TupleInstances: class Lens_15 s_apMM t_apMN a_apMO b1_apMP | s_apMM -> a_apMO, t_apMN -> b1_apMP, a_apMO t_apMN -> s_apMM, b1_apMP s_apMM -> t_apMN
+ Control.Reference.TupleInstances: class Lens_15 s_asxj t_asxk a_asxl b1_asxm | s_asxj -> a_asxl, t_asxk -> b1_asxm, a_asxl t_asxk -> s_asxj, b1_asxm s_asxj -> t_asxk
- Control.Reference.TupleInstances: class Lens_16 s_apMQ t_apMR a_apMS b1_apMT | s_apMQ -> a_apMS, t_apMR -> b1_apMT, a_apMS t_apMR -> s_apMQ, b1_apMT s_apMQ -> t_apMR
+ Control.Reference.TupleInstances: class Lens_16 s_asxn t_asxo a_asxp b1_asxq | s_asxn -> a_asxp, t_asxo -> b1_asxq, a_asxp t_asxo -> s_asxn, b1_asxq s_asxn -> t_asxo
- Control.Reference.TupleInstances: class Lens_2 s_apLW t_apLX a_apLY b1_apLZ | s_apLW -> a_apLY, t_apLX -> b1_apLZ, a_apLY t_apLX -> s_apLW, b1_apLZ s_apLW -> t_apLX
+ Control.Reference.TupleInstances: class Lens_2 s_aswt t_aswu a_aswv b1_asww | s_aswt -> a_aswv, t_aswu -> b1_asww, a_aswv t_aswu -> s_aswt, b1_asww s_aswt -> t_aswu
- Control.Reference.TupleInstances: class Lens_3 s_apM0 t_apM1 a_apM2 b1_apM3 | s_apM0 -> a_apM2, t_apM1 -> b1_apM3, a_apM2 t_apM1 -> s_apM0, b1_apM3 s_apM0 -> t_apM1
+ Control.Reference.TupleInstances: class Lens_3 s_aswx t_aswy a_aswz b1_aswA | s_aswx -> a_aswz, t_aswy -> b1_aswA, a_aswz t_aswy -> s_aswx, b1_aswA s_aswx -> t_aswy
- Control.Reference.TupleInstances: class Lens_4 s_apM4 t_apM5 a_apM6 b1_apM7 | s_apM4 -> a_apM6, t_apM5 -> b1_apM7, a_apM6 t_apM5 -> s_apM4, b1_apM7 s_apM4 -> t_apM5
+ Control.Reference.TupleInstances: class Lens_4 s_aswB t_aswC a_aswD b1_aswE | s_aswB -> a_aswD, t_aswC -> b1_aswE, a_aswD t_aswC -> s_aswB, b1_aswE s_aswB -> t_aswC
- Control.Reference.TupleInstances: class Lens_5 s_apM8 t_apM9 a_apMa b1_apMb | s_apM8 -> a_apMa, t_apM9 -> b1_apMb, a_apMa t_apM9 -> s_apM8, b1_apMb s_apM8 -> t_apM9
+ Control.Reference.TupleInstances: class Lens_5 s_aswF t_aswG a_aswH b1_aswI | s_aswF -> a_aswH, t_aswG -> b1_aswI, a_aswH t_aswG -> s_aswF, b1_aswI s_aswF -> t_aswG
- Control.Reference.TupleInstances: class Lens_6 s_apMc t_apMd a_apMe b1_apMf | s_apMc -> a_apMe, t_apMd -> b1_apMf, a_apMe t_apMd -> s_apMc, b1_apMf s_apMc -> t_apMd
+ Control.Reference.TupleInstances: class Lens_6 s_aswJ t_aswK a_aswL b1_aswM | s_aswJ -> a_aswL, t_aswK -> b1_aswM, a_aswL t_aswK -> s_aswJ, b1_aswM s_aswJ -> t_aswK
- Control.Reference.TupleInstances: class Lens_7 s_apMg t_apMh a_apMi b1_apMj | s_apMg -> a_apMi, t_apMh -> b1_apMj, a_apMi t_apMh -> s_apMg, b1_apMj s_apMg -> t_apMh
+ Control.Reference.TupleInstances: class Lens_7 s_aswN t_aswO a_aswP b1_aswQ | s_aswN -> a_aswP, t_aswO -> b1_aswQ, a_aswP t_aswO -> s_aswN, b1_aswQ s_aswN -> t_aswO
- Control.Reference.TupleInstances: class Lens_8 s_apMk t_apMl a_apMm b1_apMn | s_apMk -> a_apMm, t_apMl -> b1_apMn, a_apMm t_apMl -> s_apMk, b1_apMn s_apMk -> t_apMl
+ Control.Reference.TupleInstances: class Lens_8 s_aswR t_aswS a_aswT b1_aswU | s_aswR -> a_aswT, t_aswS -> b1_aswU, a_aswT t_aswS -> s_aswR, b1_aswU s_aswR -> t_aswS
- Control.Reference.TupleInstances: class Lens_9 s_apMo t_apMp a_apMq b1_apMr | s_apMo -> a_apMq, t_apMp -> b1_apMr, a_apMq t_apMp -> s_apMo, b1_apMr s_apMo -> t_apMp
+ Control.Reference.TupleInstances: class Lens_9 s_aswV t_aswW a_aswX b1_aswY | s_aswV -> a_aswX, t_aswW -> b1_aswY, a_aswX t_aswW -> s_aswV, b1_aswY s_aswV -> t_aswW
- Control.Reference.Types: class MorphControl (m1 :: * -> *) (m2 :: * -> *) where data family MSt m1 m2 a :: *
+ Control.Reference.Types: class MorphControl (m1 :: * -> *) (m2 :: * -> *) where data MSt m1 m2 a :: * where {
Files
- Control/Reference/Examples/TH.hs +8/−10
- Control/Reference/TH/Records.hs +3/−3
- Control/Reference/TH/Tuple.hs +9/−8
- Control/Reference/Types.hs +0/−8
- references.cabal +2/−2
Control/Reference/Examples/TH.hs view
@@ -98,29 +98,27 @@ definedName = partial (\case FunD n c -> Right (n, \n' -> FunD n' c) ValD (VarP n) b w -> Right (n, \n' -> ValD (VarP n') b w) - DataD c n tv con d -> Right (n, \n' -> DataD c n' tv con d) - NewtypeD c n tv con d -> Right (n, \n' -> NewtypeD c n' tv con d) + DataD c n tv k con d -> Right (n, \n' -> DataD c n' tv k con d) + NewtypeD c n tv k con d -> Right (n, \n' -> NewtypeD c n' tv k con d) TySynD n tv t -> Right (n, \n' -> TySynD n' tv t) ClassD c n tv fd f -> Right (n, \n' -> ClassD c n' tv fd f) - FamilyD fl n tv k -> Right (n, \n' -> FamilyD fl n' tv k) other -> Left other) -- | Accesses the constructors of a data or newtype definition. -- After changing the definition becames a newtype if there is only one constructor. definedConstructors :: Simple Partial Dec [Con] definedConstructors - = partial (\case DataD c n tv con d -> Right (con, \con' -> createConOrNewtype c n tv con' d) - NewtypeD c n tv con d -> Right ([con], \con' -> createConOrNewtype c n tv con' d) + = partial (\case DataD c n tv k con d -> Right (con, \con' -> createConOrNewtype c n tv k con' d) + NewtypeD c n tv k con d -> Right ([con], \con' -> createConOrNewtype c n tv k con' d) other -> Left other) - where createConOrNewtype c n tv [con] d = NewtypeD c n tv con d - createConOrNewtype c n tv cons d = DataD c n tv cons d + where createConOrNewtype c n tv k [con] d = NewtypeD c n tv k con d + createConOrNewtype c n tv k cons d = DataD c n tv k cons d -- | Accesses the type variables of a definition definedTypeArgs :: Simple Partial Dec [TyVarBndr] definedTypeArgs - = partial (\case DataD c n tv con d -> Right (tv, \tv' -> DataD c n tv' con d) - NewtypeD c n tv con d -> Right (tv, \tv' -> NewtypeD c n tv' con d) + = partial (\case DataD c n tv k con d -> Right (tv, \tv' -> DataD c n tv' k con d) + NewtypeD c n tv k con d -> Right (tv, \tv' -> NewtypeD c n tv' k con d) TySynD n tv t -> Right (tv, \tv' -> TySynD n tv' t) ClassD c n tv fd f -> Right (tv, \tv' -> ClassD c n tv' fd f) - FamilyD fl n tv k -> Right (tv, \tv' -> FamilyD fl n tv' k) other -> Left other)
Control/Reference/TH/Records.hs view
@@ -66,7 +66,7 @@ = do inf <- reify n case inf of TyConI decl -> case newtypeToData decl of - DataD _ tyConName args cons _ -> + DataD _ tyConName args _ cons _ -> createReferences tyConName (args ^? traversal&typeVarName) cons _ -> fail "makeReferences: Unsupported data type" _ -> fail "makeReferences: Expected the name of a data type or newtype" @@ -186,8 +186,8 @@ addTypeArgs n = foldl AppT (ConT n) . map VarT newtypeToData :: Dec -> Dec -newtypeToData (NewtypeD ctx name tvars con derives) - = DataD ctx name tvars [con] derives +newtypeToData (NewtypeD ctx name tvars kind con derives) + = DataD ctx name tvars kind [con] derives newtypeToData d = d bindAndRebuild :: Con -> Q (Pat, Exp, [Name])
Control/Reference/TH/Tuple.hs view
@@ -59,14 +59,15 @@ = do names <- replicateM m (newName "a") name <- newName "b2" genBody <- generateBody - return $ InstanceD [] (ConT (lensClass n) - `AppT` typGen names - `AppT` typGen (replace n name names) - `AppT` VarT (names !! n) - `AppT` VarT name - ) - [ ValD (VarP (lensFun n) ) - (NormalB genBody) [] ] + return $ InstanceD Nothing [] + (ConT (lensClass n) + `AppT` typGen names + `AppT` typGen (replace n name names) + `AppT` VarT (names !! n) + `AppT` VarT name + ) + [ ValD (VarP (lensFun n) ) + (NormalB genBody) [] ] where generateBody :: Q Exp generateBody
Control/Reference/Types.hs view
@@ -20,14 +20,6 @@ import Control.Monad.Trans.Maybe (MaybeT(..)) import Control.Monad.ST (ST) import Data.Proxy - -instance Alternative MU where - empty = Proxy - _ <|> _ = Proxy - -instance MonadPlus MU where - mzero = Proxy - mplus _ _ = Proxy -- | A monomorph 'Lens', 'Traversal', 'Partial', etc... -- Setting or updating does not change the type of the base.
references.cabal view
@@ -1,5 +1,5 @@ name: references -version: 0.3.0.1 +version: 0.3.1.0 synopsis: Selectors for reading and updating data. description: References are data accessors that can read, write or update the accessed infromation through their context. They are first-class values, can be passed in functions, transformed, combined. References generalize lenses, folds and traversals for haskell (see: < https://hackage.haskell.org/package/lens>). @@ -93,7 +93,7 @@ , Control.Reference.TH.Records , Control.Reference.TH.Tuple , Control.Reference.Examples.TH - build-depends: base >= 4.6 && < 5 + build-depends: base >= 4.9 && < 5 , uniplate >= 1.6 && < 2 , text >= 1.1 && < 2 , array >= 0.5 && < 1