zm 0.2 → 0.2.2
raw patch · 3 files changed
+4/−41 lines, 3 files
Files
- README.md +2/−40
- src/ZM/Pretty/Value.hs +1/−0
- zm.cabal +1/−1
README.md view
@@ -31,10 +31,10 @@ import ZM ``` -We use `absTypeModel` to get the canonical type of `Maybe Bool` and `pPrint` to print is nicely:+We use `absTypeModel` to get the canonical type of `Maybe Bool` and `pPrint` to print it nicely: ```haskell-prt = pPrint+prt = pPrint -- . CompactPretty ``` ```haskell@@ -321,44 +321,6 @@ For an example of using canonical data types as a data exchange mechanism see [top](https://github.com/tittoassini/top), the Type Oriented Protocol. -<!---### Long Term Data Preservation--For an example of using canonical data types as a long term data preservation mechanism see [timeless](https://github.com/tittoassini/timeless).--Inspect the data to figure out its type dynamically--So far so good but what if we lose the definitions of our data types?--Two ways:--- save the full canonical definition of the data with the data itself or--- save the def in the cloud so that it can be shared--Better save them for posterity:--sv = saveTypeIn theCloud (Couple One Tre)--The type has been saved, with all its dependencies.-TypeApp (TypeApp (TypeCon (CRC16 91 93)) (TypeCon (CRC16 79 130))) (TypeCon (CRC16 65 167))--Now that they are safe in the Cloud we can happily burn our code-in the knowledge that when we are presented with a binary of unknown type-we can always recover the full definition of our data.--PUT BACK dt = e2 >>= recoverTypeFrom theCloud-What if we have no idea of what is the type--instance (Flat a , Flat b) => Flat (CoupleB a b)--t = ed False >> ed Tre >> ed (Couple (CoupleB True Uno One) Three)-ed = pp . unflatDynamically . flat . typedValue--We can now use it to define a hard-wired decoder--Or use a dynamic decder to directly show the value.--The final system will also keep track of the documentation that comes with the types to give you a fully human understandable description of the data.---> ### Haskell Compatibility
src/ZM/Pretty/Value.hs view
@@ -81,6 +81,7 @@ tuple (Value _ _ _ vs) = (False,tup vs) + -- BUG: why is this occasionally failing? prettyPrinter t = listToMaybe . map snd . filter fst . map (\(t2,p) -> (match t t2,p)) $ [ (absType (Proxy::Proxy ()),\_ -> (False,text "()")) ,(absType (Proxy::Proxy Word8),\v -> (False,wrd v))
zm.cabal view
@@ -1,5 +1,5 @@ name: zm-version: 0.2+version: 0.2.2 synopsis: Language independent, reproducible, absolute types description: See the <http://github.com/tittoassini/zm online tutorial>.