type-ord-spine-cereal (empty) → 0.1
raw patch · 4 files changed
+80/−0 lines, 4 filesdep +basedep +template-haskelldep +type-cerealsetup-changed
Dependencies added: base, template-haskell, type-cereal, type-ord, type-spine
Files
- LICENSE +1/−0
- Setup.hs +2/−0
- Type/Ord/SpineSerialize.hs +53/−0
- type-ord-spine-cereal.cabal +24/−0
+ LICENSE view
@@ -0,0 +1,1 @@+BSD3
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ Type/Ord/SpineSerialize.hs view
@@ -0,0 +1,53 @@+{-# LANGUAGE TypeFamilies, QuasiQuotes, TypeOperators, UndecidableInstances #-}++{- |++Module : Type.Ord.SpineSerialize+Copyright : (c) The University of Kansas 2011+License : BSD3++Maintainer : nicolas.frisby@gmail.com+Stability : experimental+Portability : see LANGUAGE pragmas (... GHC)++Generic type-level comparison of @type-spine@- and @type-cereal@-enabled types.++-}+module Type.Ord.SpineSerialize+ (SpineCompare, Compare, spineSerializeType, spineSerializeTypeAsHash,+ module Type.Spine, module Type.Serialize, module Type.Ord) where++import Type.Spine+import Type.Serialize+import Type.Ord hiding (Compare)+import qualified Type.Ord as Ord++import Language.Haskell.TH (Name, Q, Dec)+++type SpineCompare l r = Ord.Compare (Spine l) (Spine r)+type Compare l r = SpineCompare ([qK|*|] l) ([qK|*|] r)++type instance Ord.Compare (TypeName l) (TypeName r) =+ Ord.Compare (Serialize l) (Serialize r)+type instance Ord.Compare (lx :@ ly) (rx :@ ry) =+ OrdCase (Ord.Compare (Spine lx) (Spine rx))+ LT+ (Ord.Compare (Spine ly) (Spine ry))+ GT+type instance Ord.Compare (TypeName l) (rx :@ ry) = LT+type instance Ord.Compare (lx :@ ly) (TypeName r) = GT++++spineSerializeType :: Name -> Q [Dec]+spineSerializeType n = do+ x <- serializeType n+ y <- spineType n+ return $ x ++ y++spineSerializeTypeAsHash :: Name -> Q [Dec]+spineSerializeTypeAsHash n = do+ x <- serializeTypeAsHash n+ y <- spineType n+ return $ x ++ y
+ type-ord-spine-cereal.cabal view
@@ -0,0 +1,24 @@+Name: type-ord-spine-cereal+Version: 0.1+License: BSD3+License-File: LICENSE+Author: Nicolas Frisby <nicolas.frisby@gmail.com>+Maintainer: Nicolas Frisby <nicolas.frisby@gmail.com>++Category: Type System++Synopsis: Generic type-level comparison of types++Description: Generic type-level comparison of @type-spine@- and+ @type-cereal@-enabled types.++Cabal-Version: >= 1.6.0.1++Build-Type: Simple+++Library+ Build-Depends: base >= 4 && < 5, template-haskell+ Build-Depends: type-spine < 0.2, type-cereal < 0.2, type-ord < 0.2++ Exposed-Modules: Type.Ord.SpineSerialize