diff options
author | Kosyrev Serge <serge.kosyrev@iohk.io> | 2018-01-14 04:21:47 +0300 |
---|---|---|
committer | Kosyrev Serge <serge.kosyrev@iohk.io> | 2018-01-14 04:21:47 +0300 |
commit | 9e20219a97353fbb6ca615851c8cdbea4b00f29d (patch) | |
tree | 4978b8c3d0df4d388e44fa12460474f0f0c148b7 /lambdacube-ir.haskell/src/LambdaCube | |
parent | 8f66aef1bee137b3cb8f84ed01118935c8c9f33e (diff) |
PipelineSchemaUtil: Semigroup instance for PipelineSchema (GHC 8.4 compat)
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 | ||