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@
9 -- at parsing time as done with 'Term';
10 -- it is mainly here for the sake of curiosity.
11 module Language.Symantic.Interpreting.Dup where
13 -- | Interpreter's data.
14 data Dup term1 term2 a
22 => (forall term. cl term => term a)
28 => (forall term. cl term => term a -> term b)
31 dup1 f (a1 `Dup` a2) =
36 => (forall term. cl term => term a -> term b -> term c)
40 dup2 f (a1 `Dup` a2) (b1 `Dup` b2) =
45 => (forall term. cl term => term a -> term b -> term c -> term d)
50 dup3 f (a1 `Dup` a2) (b1 `Dup` b2) (c1 `Dup` c2) =
51 f a1 b1 c1 `Dup` f a2 b2 c2