never executed always true always false
1 {-# LANGUAGE QuasiQuotes #-}
2
3 module Conjure.Representations.Primitive
4 ( primitive
5 ) where
6
7 -- conjure
8 import Conjure.Prelude
9 import Conjure.Language
10 import Conjure.Representations.Internal
11
12
13 primitive :: forall m . MonadFailDoc m => Representation m
14 primitive = Representation
15 { rCheck = \ _ domain -> return $
16 case domain of
17 DomainBool -> [DomainBool]
18 DomainIntE x -> [DomainIntE x]
19 DomainInt t rs -> [DomainInt t rs]
20 _ -> []
21 , rDownD = const $ return Nothing
22 , rStructural = \ _ _ _ -> return (\ _ -> return [] )
23 , rDownC = const $ return Nothing
24 , rUp = \ ctxt (name, _) ->
25 case lookup name ctxt of
26 Nothing -> failDoc $ vcat
27 $ ("No value for:" <+> pretty name)
28 : "Bindings in context:"
29 : prettyContext ctxt
30 Just c -> return (name, c)
31 , rSymmetryOrdering = \ _innerSO _downX1 inp domain -> return $
32 case domain of
33 DomainBool -> [essence| -toInt(&inp) |]
34 _ -> [essence| &inp |]
35 }
36