1 {-# LANGUAGE AllowAmbiguousTypes #-}
2 {-# LANGUAGE ConstraintKinds #-}
3 -- | Interpreter to duplicate the representation of an expression
4 -- in order to evaluate it with different interpreters.
6 -- NOTE: this is a more verbose, less clear,
7 -- and maybe less efficient alternative
8 -- to maintaining the universal polymorphism of @term@ at parsing time
9 -- as done with 'TermO';
10 -- it is mainly here for the sake of curiosity.
11 module Language.Symantic.Interpreting.Dup where
13 -- | Interpreter's data.
14 data DupI term1 term2 a
22 => (forall term. cl term => term a)
28 => (forall term. cl term => term a -> term b)
31 dupI1 f (a1 `DupI` a2) =
36 => (forall term. cl term => term a -> term b -> term c)
40 dupI2 f (a1 `DupI` a2) (b1 `DupI` b2) =
41 f a1 b1 `DupI` f a2 b2
45 => (forall term. cl term => term a -> term b -> term c -> term d)
50 dupI3 f (a1 `DupI` a2) (b1 `DupI` b2) (c1 `DupI` c2) =
51 f a1 b1 c1 `DupI` f a2 b2 c2