1 {-# OPTIONS_GHC -fno-warn-orphans #-}
2 -- | This module provides the 'Identity' semantic
3 -- which interprets the combinators as a Haskell value.
4 module Symantic.Semantics.Identity
8 import Control.Applicative qualified as App
9 import Data.Either qualified as Either
10 import Data.Eq qualified as Eq
11 import Data.Function qualified as Fun
12 import Data.Functor.Identity (Identity(..))
13 import Data.Maybe qualified as Maybe
15 import Symantic.Syntaxes.Classes
19 instance Abstractable Identity where
20 lam f = Identity (runIdentity Fun.. f Fun.. Identity)
21 instance Abstractable1 Identity where
22 lam1 f = Identity (runIdentity Fun.. f Fun.. Identity)
23 instance Anythingable Identity
24 instance Constantable c Identity where
26 instance Eitherable Identity where
27 either = Identity Either.either
28 left = Identity Either.Left
29 right = Identity Either.Right
30 instance Equalable Identity where
31 equal = Identity (Eq.==)
32 instance IfThenElseable Identity where
33 ifThenElse test ok ko = Identity
37 instance Instantiable Identity where
38 Identity f .@ Identity x = Identity (f x)
39 instance Listable Identity where
42 instance Maybeable Identity where
43 nothing = Identity Maybe.Nothing
44 just = Identity Maybe.Just
45 instance Unabstractable Identity where
46 ap = Identity (App.<*>)
47 const = Identity Fun.const
49 (.) = Identity (Fun..)
50 flip = Identity Fun.flip
51 ($) = Identity (Fun.$)
52 instance Varable Identity where