never executed always true always false
    1 {-# LANGUAGE DeriveGeneric, DeriveDataTypeable, DeriveFunctor, DeriveTraversable, DeriveFoldable #-}
    2 
    3 module Conjure.Language.Expression.Op.Apart where
    4 
    5 import Conjure.Prelude
    6 import Conjure.Language.Expression.Op.Internal.Common
    7 
    8 import qualified Data.Aeson as JSON             -- aeson
    9 import qualified Data.Aeson.KeyMap as KM
   10 
   11 import qualified Data.Vector as V               -- vector
   12 
   13 
   14 data OpApart x = OpApart x x
   15     deriving (Eq, Ord, Show, Data, Functor, Traversable, Foldable, Typeable, Generic)
   16 
   17 instance Serialize x => Serialize (OpApart x)
   18 instance Hashable  x => Hashable  (OpApart x)
   19 instance ToJSON    x => ToJSON    (OpApart x) where toJSON = genericToJSON jsonOptions
   20 instance FromJSON  x => FromJSON  (OpApart x) where parseJSON = genericParseJSON jsonOptions
   21 
   22 instance (TypeOf x, Pretty x) => TypeOf (OpApart x) where
   23     typeOf inp@(OpApart x p) = do
   24         xTy <- typeOf x
   25         pTy <- typeOf p
   26         case (xTy, pTy) of
   27             (TypeSet xTyInner, TypePartition pTyInner) | typesUnify [xTyInner, pTyInner] -> return TypeBool
   28             _ -> raiseTypeError inp
   29 
   30 instance SimplifyOp OpApart x where
   31     simplifyOp _ = na "simplifyOp{OpApart}"
   32 
   33 instance Pretty x => Pretty (OpApart x) where
   34     prettyPrec _ (OpApart a b) = "apart" <> prettyList prParens "," [a,b]
   35 
   36 instance VarSymBreakingDescription x => VarSymBreakingDescription (OpApart x) where
   37     varSymBreakingDescription (OpApart a b) = JSON.Object $ KM.fromList
   38         [ ("type", JSON.String "OpApart")
   39         , ("children", JSON.Array $ V.fromList
   40             [ varSymBreakingDescription a
   41             , varSymBreakingDescription b
   42             ])
   43         ]