never executed always true always false
    1 {-# LANGUAGE DeriveGeneric, DeriveDataTypeable, DeriveFunctor, DeriveTraversable, DeriveFoldable #-}
    2 
    3 module Conjure.Language.Expression.Op.LexLt 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 OpLexLt x = OpLexLt x x
   15     deriving (Eq, Ord, Show, Data, Functor, Traversable, Foldable, Typeable, Generic)
   16 
   17 instance Serialize x => Serialize (OpLexLt x)
   18 instance Hashable  x => Hashable  (OpLexLt x)
   19 instance ToJSON    x => ToJSON    (OpLexLt x) where toJSON = genericToJSON jsonOptions
   20 instance FromJSON  x => FromJSON  (OpLexLt x) where parseJSON = genericParseJSON jsonOptions
   21 
   22 instance BinaryOperator (OpLexLt x) where
   23     opLexeme _ = L_LexLt
   24 
   25 instance (TypeOf x, Pretty x) => TypeOf (OpLexLt x) where
   26     typeOf p@(OpLexLt a b) = do
   27         tyA <- typeOf a
   28         tyB <- typeOf b
   29         if typesUnify [tyA, tyB]
   30             then return TypeBool
   31             else raiseTypeError $ vcat [ pretty p
   32                                        , "LHS has type:" <+> pretty tyA
   33                                        , "RHS has type:" <+> pretty tyB
   34                                        ]
   35 
   36 instance SimplifyOp OpLexLt x where
   37     simplifyOp _ = na "simplifyOp{OpLexLt}"
   38 
   39 instance Pretty x => Pretty (OpLexLt x) where
   40     prettyPrec prec op@(OpLexLt a b) = prettyPrecBinOp prec [op] a b
   41 
   42 instance VarSymBreakingDescription x => VarSymBreakingDescription (OpLexLt x) where
   43     varSymBreakingDescription (OpLexLt a b) = JSON.Object $ KM.fromList
   44         [ ("type", JSON.String "OpLexLt")
   45         , ("children", JSON.Array $ V.fromList
   46             [ varSymBreakingDescription a
   47             , varSymBreakingDescription b
   48             ])
   49         ]