git.iko.soy/typeable/schematic
on master help sign in
more readable types
commitad9327440928a384ba58aa127df250cc115fbfb1 authorDenis Redozubov <denis.redozubov@gmail.com> dateTue 13 Jun 2017, 15:01 (9 years ago) parent2033814
2 files changed+6−6
src/Data/Schematic.hs+5−5 src/Data/Schematic/Migration.hs+1−1
src/Data/Schematic.hs+5−5
@@ -87,11 +87,11 @@ instance {-# OVERLAPPABLE #-}
8787 Right x -> Valid x
8888
8989parseAndValidateVersionedJson
90− :: forall proxy v. (SingI (Reverse (AllVersions v)), Migratable (Reverse (AllVersions v)))
90+ :: forall proxy v. (SingI (AllVersions v), Migratable (AllVersions v))
9191 => proxy v
9292 -> J.Value
93− -> ParseResult (JsonRepr (Snd (Head (Reverse (AllVersions v)))))
94−parseAndValidateVersionedJson _ v = mparse (sing :: Sing (Reverse (AllVersions v))) v
93+ -> ParseResult (JsonRepr (Snd (Head (AllVersions v))))
94+parseAndValidateVersionedJson _ v = mparse (sing :: Sing (AllVersions v)) v
9595
9696decodeAndValidateJson
9797 :: forall schema
@@ -103,10 +103,10 @@ decodeAndValidateJson bs = case decode bs of
103103 Just x -> parseAndValidateJson x
104104
105105decodeAndValidateVersionedJson
106− :: (Migratable (Reverse (AllVersions versioned)), SingI (Reverse (AllVersions versioned)))
106+ :: (Migratable (AllVersions versioned), SingI (AllVersions versioned))
107107 => proxy versioned
108108 -> BL.ByteString
109− -> ParseResult (JsonRepr (Snd (Head (Reverse (AllVersions versioned)))))
109+ -> ParseResult (JsonRepr (Snd (Head (AllVersions versioned))))
110110decodeAndValidateVersionedJson vp bs = case decode bs of
111111 Nothing -> DecodingError "malformed json"
112112 Just x -> parseAndValidateVersionedJson vp x
src/Data/Schematic/Migration.hs+1−1
@@ -87,7 +87,7 @@ type family ElemOf (e :: k) (l :: [(a,k)]) :: Constraint where
8787
8888-- | Extracts revision/schema pairs from @Versioned@ in reverse order.
8989type family AllVersions (vd :: Versioned) :: [(Revision, Schema)] where
90− AllVersions ('Versioned s ms) = AllVersions' '[ '("initial", s) ] ms
90+ AllVersions ('Versioned s ms) = Reverse (AllVersions' '[ '("initial", s) ] ms)
9191
9292type family AllVersions' (acc :: [(Revision, Schema)]) (ms :: [Migration]) = (r :: [(Revision, Schema)]) where
9393 AllVersions' acc '[] = acc