msh-0.1.0.2: Object-Oriented Programming in Haskell

Safe HaskellNone
LanguageHaskell2010

Language.MSH

Contents

Synopsis

Documentation

data CallType Source

Enumerates call types.

Constructors

ExtCall

The call is to a method, externally.

data RunnableQuery ty obj st ctx r where Source

Represents a query which can be run by combinators such as result, object, etc.

Constructors

MkExtCall :: ctx (r, obj) -> RunnableQuery ExtCall obj st ctx r 

class Functor ctx => CallCtx ty ctx where Source

Represents a context in which combinators may be used.

Associated Types

type CtxResult ty ctx r :: * Source

Methods

result :: RunnableQuery ty obj st ctx r -> CtxResult ty ctx r Source

object :: RunnableQuery ty obj st ctx r -> CtxResult ty ctx obj Source

Instances

(~) (* -> *) ctx Identity => CallCtx ExtCall ctx Source 

data MemberType Source

Constructors

Mutable 
Immutable 

data FieldType Source

Constructors

Method 
Field 

data Selector ty o s m a where Source

Constructors

MkMethod :: StateT s m a -> (o -> m (a, o)) -> Selector Method o s m a 
MkField :: (o -> m (a, o)) -> StateT s m a -> (o -> a -> m ((), o)) -> (a -> StateT s m ()) -> Selector Field o s m a 

Instances

(Object obj st ctx, Object r st' Identity, (~) (* -> *) m Identity) => Object (Selector Method obj st ctx r) st' m Source 
(Object obj st ctx, Object r st' Identity, (~) (* -> *) m Identity) => Object (Selector Field obj st ctx r) st' m Source 
type QueryObject (Selector Method obj st ctx r) = r Source 
type QueryObject (Selector Field obj st ctx r) = r Source 
type QueryMonad (Selector Method obj st ctx r) ctx' = ctx' Source 
type QueryMonad (Selector Field obj st ctx r) ctx' = ctx' Source 
type QueryResult (Selector Method obj st ctx r) ty st' m x = Selector Method obj st ctx x Source 
type QueryResult (Selector Field obj st ctx r) Field st' m x = Selector Field obj st ctx x Source 
type QueryResult (Selector Field obj st ctx r) Method st' m x = Selector Method obj st ctx x Source 

data This o s m a where Source

Constructors

MkThis :: This o s m a 

Instances

(Object obj st ctx, Object r st' ctx', (~) (* -> *) ctx ctx', (~) * st st') => Object (This obj st ctx r) st' ctx' Source 
type QueryObject (This obj st ctx r) = obj Source 
type QueryMonad (This obj st ctx r) ctx' = ctx' Source 
type QueryResult (This obj st ctx r) ty st' m x = StateT st' ctx x Source 

type family QueryObject obj :: * Source

Instances

type QueryObject (This obj st ctx r) = obj Source 
type QueryObject (Selector Method obj st ctx r) = r Source 
type QueryObject (Selector Field obj st ctx r) = r Source 

type family QueryMonad obj m :: * -> * Source

Instances

type QueryMonad (This obj st ctx r) ctx' = ctx' Source 
type QueryMonad (Selector Method obj st ctx r) ctx' = ctx' Source 
type QueryMonad (Selector Field obj st ctx r) ctx' = ctx' Source 

type family QueryResult obj ty st m r :: * Source

Instances

type QueryResult (This obj st ctx r) ty st' m x = StateT st' ctx x Source 
type QueryResult (Selector Method obj st ctx r) ty st' m x = Selector Method obj st ctx x Source 
type QueryResult (Selector Field obj st ctx r) Field st' m x = Selector Field obj st ctx x Source 
type QueryResult (Selector Field obj st ctx r) Method st' m x = Selector Method obj st ctx x Source 

class Monad m => Object obj st m where Source

Minimal complete definition

(.!)

Methods

this :: This obj st m obj Source

(.!) :: forall r ty. obj -> Selector ty (QueryObject obj) st (QueryMonad obj m) r -> QueryResult obj ty st m r infixr 8 Source

Instances

(Object obj st ctx, Object r st' ctx', (~) (* -> *) ctx ctx', (~) * st st') => Object (This obj st ctx r) st' ctx' Source 
(Object obj st ctx, Object r st' Identity, (~) (* -> *) m Identity) => Object (Selector Method obj st ctx r) st' m Source 
(Object obj st ctx, Object r st' Identity, (~) (* -> *) m Identity) => Object (Selector Field obj st ctx r) st' m Source 

(.$) :: (Monad ctx, Functor f) => Selector lty obj st ctx (f a) -> Selector rty a st' Identity b -> Selector (FieldComposeResult lty rty) obj st ctx (f b) Source

If s returns a value whose type is a Functor, then `s.$m' calls m on the inner value of s via fmap.

run the internal call (if the selector on the RHS is a method)

run the internal getter (if the selector on the RHS is a field)

run the internal call (if the selector on the RHS is a method)

run the internal getter (if the selector on the RHS is a field)

run the internal call (if the selector on the RHS is a method)

run the internal getter (if the selector on the RHS is a field)

class SetterContext r o s m where Source

Methods

(>:) :: Selector Field o s m val -> val -> r Source

class ValueContext r val Source

Associated Types

type VCSt r :: * Source

type VCM r :: * -> * Source

Instances

ValueContext (StateT s m val) val Source 

class HasData obj d | obj -> d where Source

Methods

extractData :: obj -> d Source

class Cast sub sup | sub -> sup where Source

Methods

downcast :: sub -> sup Source

class New obj where Source

Associated Types

type Args obj :: * Source

Methods

new :: Args obj -> obj Source

type Void = () Source

switch :: Monad m => Selector ty o s m val -> (val -> StateT s m b) -> StateT s m b Source

(<:) :: Monad m => Selector Field o s m val -> val -> StateT s m () infixl 7 Source