hsqml-datamodel 0.2.0.1 → 0.2.0.2
raw patch · 5 files changed
+21/−18 lines, 5 files
Files
- CHANGELOG +5/−0
- hsqml-datamodel.cabal +2/−2
- src/Graphics/QML/DataModel/Internal/Generic/Count.hs +5/−6
- src/Graphics/QML/DataModel/Internal/Generic/Get.hs +2/−3
- src/Graphics/QML/DataModel/Internal/Generic/Set.hs +7/−7
+ CHANGELOG view
@@ -0,0 +1,5 @@+HsQML Data Model - Release history++release 0.2.0.0++ * Removed the 'Mock' type class, using Proxy instead.
hsqml-datamodel.cabal view
@@ -1,5 +1,5 @@ name: hsqml-datamodel-version: 0.2.0.1+version: 0.2.0.2 synopsis: HsQML (Qt5) data model. description: HsQML (Qt5) data model. Use any collection (actually, any (Int -> IO a) action) of single constructor data types as a model for use with QML views. license: BSD3@@ -10,7 +10,7 @@ category: Graphics build-type: Custom Extra-source-files:- cbits/*.cpp cbits/*.h + cbits/*.cpp cbits/*.h CHANGELOG cabal-version: >=1.10 homepage: https://github.com/marcinmrotek/hsqml-datamodel source-repository head
src/Graphics/QML/DataModel/Internal/Generic/Count.hs view
@@ -4,7 +4,6 @@ DefaultSignatures , DeriveDataTypeable , FlexibleContexts- , PartialTypeSignatures , PolyKinds , ScopedTypeVariables , TypeFamilies@@ -39,13 +38,13 @@ class CountFields t where countFields :: proxy t -> Int - default countFields :: (Generic t, GCountFields f, (Rep t ~ f a)) => proxy t -> Int+ default countFields :: ( Generic t, GCountFields (Rep t) ) => proxy t -> Int countFields _ = gCountFields p where p :: Proxy (Rep t) = Proxy -- |Generic implementation of the 'CountFields' class. class GCountFields f where- gCountFields :: proxy (f a) -> Int+ gCountFields :: proxy f -> Int -- |A container type has a proxyle column. instance GCountFields (K1 i c) where@@ -54,11 +53,11 @@ -- |Meta information is skipped, and the recursion proceeds further down. instance GCountFields f => GCountFields (M1 i t f) where gCountFields _ = gCountFields p- where p :: Proxy (f _) = Proxy+ where p :: Proxy f = Proxy -- |A product type's number of columns is a sum of the terms' column numbers. instance (GCountFields a, GCountFields b) => GCountFields (a :*: b) where gCountFields _ = gCountFields a + gCountFields b- where a :: Proxy (a _) = Proxy- b :: Proxy (b _) = Proxy+ where a :: Proxy a = Proxy+ b :: Proxy b = Proxy
src/Graphics/QML/DataModel/Internal/Generic/Get.hs view
@@ -4,7 +4,6 @@ DefaultSignatures , FlexibleContexts , FlexibleInstances- , PartialTypeSignatures , PolyKinds , ScopedTypeVariables , TypeOperators@@ -62,8 +61,8 @@ else gGetColumn (ix - na) b where na = gCountFields pa nb = gCountFields pb- pa :: Proxy (a _) = Proxy- pb :: Proxy (b _) = Proxy+ pa :: Proxy a = Proxy+ pb :: Proxy b = Proxy -- |A class of types with columns that can be cast to a 'QtVariant'. class QtField t where
src/Graphics/QML/DataModel/Internal/Generic/Set.hs view
@@ -34,7 +34,7 @@ setupColumns :: HmDelegateHandle -> proxy t -> IO () default setupColumns - :: ( Generic t, GSetupColumns f, (Rep t ~ f a) ) + :: ( Generic t, GSetupColumns (Rep t) ) => HmDelegateHandle -> proxy t -> IO ()@@ -43,21 +43,21 @@ -- |A generic implementation for 'SetupColumns'. class GSetupColumns f where- gSetupColumns :: HmDelegateHandle -> proxy (f a) -> IO ()+ gSetupColumns :: HmDelegateHandle -> proxy f -> IO () -- |A helper class for the generic implementation for 'SetupColumns', starts its work at a particular index. class GSetupColumnIx f where- gSetupColumnIx :: HmDelegateHandle -> Int -> proxy (f a) -> IO ()+ gSetupColumnIx :: HmDelegateHandle -> Int -> proxy f -> IO () -- |Meta information for a whole datatype is skipped, and the recursion proceeds further down. instance GSetupColumns f => GSetupColumns (M1 D t f) where gSetupColumns h _ = gSetupColumns h p- where p :: Proxy (f _) = Proxy+ where p :: Proxy f = Proxy -- |Meta information for a constructor is skipped, and 'SetupColumnIx' is used starting at index 0. instance GSetupColumnIx f => GSetupColumns (M1 C t f) where gSetupColumns h _ = gSetupColumnIx h 0 p- where p :: Proxy (f _) = Proxy+ where p :: Proxy f = Proxy -- |Setups both terms of the product. instance ( GCountFields a@@ -68,8 +68,8 @@ gSetupColumnIx h ix _ = do gSetupColumnIx h ix a gSetupColumnIx h (ix + gCountFields a) b- where a :: Proxy (a _) = Proxy- b :: Proxy (b _) = Proxy+ where a :: Proxy a = Proxy+ b :: Proxy b = Proxy -- |A model role name is added accoring to the record selector's name. instance Selector t => GSetupColumnIx (M1 S t f) where