From 9e20219a97353fbb6ca615851c8cdbea4b00f29d Mon Sep 17 00:00:00 2001 From: Kosyrev Serge Date: Sun, 14 Jan 2018 04:21:47 +0300 Subject: PipelineSchemaUtil: Semigroup instance for PipelineSchema (GHC 8.4 compat) --- lambdacube-ir.haskell/src/LambdaCube/PipelineSchemaUtil.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lambdacube-ir.haskell/src/LambdaCube') 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 @@ -{-# LANGUAGE FlexibleContexts, TypeSynonymInstances, FlexibleInstances #-} +{-# LANGUAGE CPP, FlexibleContexts, TypeSynonymInstances, FlexibleInstances #-} module LambdaCube.PipelineSchemaUtil where import Control.Monad.Writer @@ -16,5 +16,11 @@ unionObjectArraySchema (ObjectArraySchema a1 b1) (ObjectArraySchema a2 b2) = instance Monoid PipelineSchema where mempty = PipelineSchema mempty mempty +#if !MIN_VERSION_base(4,11,0) mappend (PipelineSchema a1 b1) (PipelineSchema a2 b2) = 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) +#else +instance Semigroup PipelineSchema where + (<>) (PipelineSchema a1 b1) (PipelineSchema a2 b2) = + 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) +#endif -- cgit v1.2.3