Last active
August 29, 2015 14:25
-
-
Save bergmark/e4b714f55b25a60f2f53 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| example/Example.hs:1:1: Splicing declarations | |
| mkId ''Id | |
| ======> | |
| example/Example.hs:25:1-9 | |
| unsafeId :: UUID -> Id | |
| unsafeId = Id | |
| unsafeId' :: UUID -> Maybe Id | |
| unsafeId' = (.) Just Id | |
| instance FromField Id where | |
| fromField = fromFieldAux unsafeId' | |
| instance ShowConstant Id where | |
| type PGRep Id = PGRep UUID | |
| constant = (unsafeCoerce . (constant . unId)) | |
| instance PGRep Id ~ a => QueryRunnerColumnDefault Id Id where | |
| queryRunnerColumnDefault = fieldQueryRunnerColumn | |
| example/Example.hs:1:1: Splicing declarations | |
| makeColumnInstances | |
| ''Gender ''String 'genderToString 'stringToGender | |
| ======> | |
| example/Example.hs:41:1-69 | |
| instance FromField Gender where | |
| fromField = fromFieldAux stringToGender | |
| instance ShowConstant Gender where | |
| type PGRep Gender = PGRep String | |
| constant = (unsafeCoerce . (constant . genderToString)) | |
| instance PGRep Gender ~ a => | |
| QueryRunnerColumnDefault Gender Gender where | |
| queryRunnerColumnDefault = fieldQueryRunnerColumn | |
| example/Example.hs:1:1: Splicing declarations | |
| makeTypes | |
| [d| data Person | |
| = Person {id_ :: Id, | |
| name :: String, | |
| age :: Int, | |
| gender :: Nullable Gender} | |
| deriving (Show) |] | |
| ======> | |
| example/Example.hs:(43,1)-(50,4) | |
| data PersonP a b c d | |
| = Person {id_ :: a, name :: b, age :: c, gender :: d} | |
| deriving (Show) | |
| type Person = PersonP Id String Int (Nullable Gender) | |
| type PersonH = PersonP Id String Int (Maybe Gender) | |
| type instance To typ (PersonP a b c d) = PersonP (typ a) (typ b) (typ c) (typ d) | |
| example/Example.hs:1:1: Splicing declarations | |
| makeAdaptorAndInstance "pPerson" ''PersonP | |
| ======> | |
| example/Example.hs:52:1-42 | |
| pPerson :: | |
| forall p | |
| a1_0 | |
| a2_0 | |
| a3_0 | |
| a4_0 | |
| a1_1 | |
| a2_1 | |
| a3_1 | |
| a4_1. ProductProfunctor p => | |
| PersonP (p a1_0 a1_1) (p a2_0 a2_1) (p a3_0 a3_1) (p a4_0 a4_1) | |
| -> p (PersonP a1_0 a2_0 a3_0 a4_0) (PersonP a1_1 a2_1 a3_1 a4_1) | |
| pPerson | |
| = (((dimap toTuple fromTuple) . p4) . toTuple) | |
| where | |
| toTuple (Person a1_ a2_ a3_ a4_) = (a1_, a2_, a3_, a4_) | |
| fromTuple (a1_, a2_, a3_, a4_) = Person a1_ a2_ a3_ a4_ | |
| instance (ProductProfunctor p, | |
| Default p a1_0 a1_1, | |
| Default p a2_0 a2_1, | |
| Default p a3_0 a3_1, | |
| Default p a4_0 a4_1) => | |
| Default p (PersonP a1_0 a2_0 a3_0 a4_0) (PersonP a1_1 a2_1 a3_1 a4_1) where | |
| def = pPerson (Person def def def def) | |
| example/Example.hs:1:1: Splicing declarations | |
| makeTable_ "people" 'pPerson ''PersonP | |
| ======> | |
| example/Example.hs:56:1-38 | |
| table :: Table (To Maybe (To Column Person)) (To Column Person) | |
| table | |
| = Table | |
| "people" | |
| (pPerson | |
| (Person | |
| {id_ = optionalColumn "id_", name = optionalColumn "name", | |
| age = optionalColumn "age", gender = optionalColumn "gender"})) | |
| emptyUpdate :: To Maybe (To Column Person) | |
| emptyUpdate = Person Nothing Nothing Nothing Nothing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment