never executed always true always false
    1 {-# LANGUAGE DeriveGeneric, DeriveDataTypeable, DeriveFunctor, DeriveTraversable, DeriveFoldable #-}
    2 
    3 module Conjure.Language.Expression.Op.Participants 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 OpParticipants x = OpParticipants x
   15     deriving (Eq, Ord, Show, Data, Functor, Traversable, Foldable, Typeable, Generic)
   16 
   17 instance Serialize x => Serialize (OpParticipants x)
   18 instance Hashable  x => Hashable  (OpParticipants x)
   19 instance ToJSON    x => ToJSON    (OpParticipants x) where toJSON = genericToJSON jsonOptions
   20 instance FromJSON  x => FromJSON  (OpParticipants x) where parseJSON = genericParseJSON jsonOptions
   21 
   22 instance (TypeOf x, Pretty x) => TypeOf (OpParticipants x) where
   23     typeOf inp@(OpParticipants p) = do
   24         pTy <- typeOf p
   25         case pTy of
   26             TypePartition pTyInner -> return (TypeSet pTyInner)
   27             _ -> raiseTypeError inp
   28 
   29 instance SimplifyOp OpParticipants x where
   30     simplifyOp _ = na "simplifyOp{OpParticipants}"
   31 
   32 instance Pretty x => Pretty (OpParticipants x) where
   33     prettyPrec _ (OpParticipants a) = "participants" <> prParens (pretty a)
   34 
   35 instance VarSymBreakingDescription x => VarSymBreakingDescription (OpParticipants x) where
   36     varSymBreakingDescription (OpParticipants a) = JSON.Object $ KM.fromList
   37         [ ("type", JSON.String "OpParticipants")
   38         , ("children", JSON.Array $ V.fromList
   39             [ varSymBreakingDescription a
   40             ])
   41         ]