module Control.OOP.Base
where
class a :> b where
cast :: a -> b
instance a :> a where
cast = id
member :: cls :> inst
=> (inst -> inst -> a)
-> cls
-> a
member p obj =
imember p (cast obj)
imember :: (inst -> inst -> a)
-> inst
-> a
imember p vt =
p vt vt
pureMember :: (cls :> inst, Applicative m)
=> (inst -> inst -> a)
-> cls
-> m a
pureMember p = pure . member p
mapMember :: (cls :> inst, Functor m)
=> (inst -> inst -> a)
-> m cls
-> m a
mapMember p = fmap (member p)
(-->) :: cls :> inst
=> cls
-> (inst -> inst -> a)
-> a
(-->) = flip member
infixl 8 -->
(==>) :: inst
-> (inst -> inst -> a)
-> a
(==>) = flip imember
infixl 8 ==>
(-->>) :: (cls :> inst, Applicative m)
=> cls
-> (inst -> inst -> a)
-> m a
(-->>) = flip pureMember
infixl 8 -->>
(>-->) :: (cls :> inst, Functor m)
=> m cls
-> (inst -> inst -> a)
-> m a
(>-->) = flip mapMember
infixl 8 >-->