diff options
Diffstat (limited to 'lambdacube-ir.haskell/src/LambdaCube')
-rw-r--r-- | lambdacube-ir.haskell/src/LambdaCube/PipelineSchemaUtil.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lambdacube-ir.haskell/src/LambdaCube/PipelineSchemaUtil.hs b/lambdacube-ir.haskell/src/LambdaCube/PipelineSchemaUtil.hs index a5eac55..dc2c456 100644 --- a/lambdacube-ir.haskell/src/LambdaCube/PipelineSchemaUtil.hs +++ b/lambdacube-ir.haskell/src/LambdaCube/PipelineSchemaUtil.hs | |||
@@ -1,4 +1,4 @@ | |||
1 | {-# LANGUAGE FlexibleContexts, TypeSynonymInstances, FlexibleInstances #-} | 1 | {-# LANGUAGE CPP, FlexibleContexts, TypeSynonymInstances, FlexibleInstances #-} |
2 | module LambdaCube.PipelineSchemaUtil where | 2 | module LambdaCube.PipelineSchemaUtil where |
3 | 3 | ||
4 | import Control.Monad.Writer | 4 | import Control.Monad.Writer |
@@ -16,5 +16,11 @@ unionObjectArraySchema (ObjectArraySchema a1 b1) (ObjectArraySchema a2 b2) = | |||
16 | 16 | ||
17 | instance Monoid PipelineSchema where | 17 | instance Monoid PipelineSchema where |
18 | mempty = PipelineSchema mempty mempty | 18 | mempty = PipelineSchema mempty mempty |
19 | #if !MIN_VERSION_base(4,11,0) | ||
19 | mappend (PipelineSchema a1 b1) (PipelineSchema a2 b2) = | 20 | mappend (PipelineSchema a1 b1) (PipelineSchema a2 b2) = |
20 | PipelineSchema (Map.unionWith unionObjectArraySchema a1 a2) (Map.unionWith (\a b -> if a == b then a else error $ "schema type mismatch " ++ show (a,b)) b1 b2) | 21 | PipelineSchema (Map.unionWith unionObjectArraySchema a1 a2) (Map.unionWith (\a b -> if a == b then a else error $ "schema type mismatch " ++ show (a,b)) b1 b2) |
22 | #else | ||
23 | instance Semigroup PipelineSchema where | ||
24 | (<>) (PipelineSchema a1 b1) (PipelineSchema a2 b2) = | ||
25 | PipelineSchema (Map.unionWith unionObjectArraySchema a1 a2) (Map.unionWith (\a b -> if a == b then a else error $ "schema type mismatch " ++ show (a,b)) b1 b2) | ||
26 | #endif | ||