packages feed

msh 0.1.0.0 → 0.1.0.1

raw patch · 4 files changed

+68/−26 lines, 4 files

Files

+ Language/MSH.hs view
@@ -0,0 +1,63 @@+{-# LANGUAGE RankNTypes, MultiParamTypeClasses, FunctionalDependencies, FlexibleContexts #-}+{-# LANGUAGE TypeFamilies, DataKinds, KindSignatures, FlexibleInstances, DefaultSignatures #-}+module Language.MSH (+    module Control.Lens,+    module Control.Monad.Identity,+    module Control.Monad.State,+    module Language.MSH.QuasiQuoters,+    module Language.MSH.Selectors,+    module Language.MSH.RuntimeError,+    +    SetterContext(..),+    ValueContext(..),+    HasData(..),+    Cast(..),+    New(..),+    Void,+    switch,+    (<:)+) where++import Control.Lens+import Control.Monad.Identity+import Control.Monad.State hiding (state)+import Language.MSH.QuasiQuoters+import Language.MSH.Selectors+import Language.MSH.RuntimeError++class HasData obj d | obj -> d where+    extractData :: obj -> d ++class Cast sub sup | sub -> sup where+    downcast :: sub -> sup++class New obj where+    type Args obj :: *+    new :: Args obj -> obj++type Void = ()++infixl 7 <:+class SetterContext r o s m where+    (>:) :: Selector Field o s m val -> val -> r++class ValueContext r val where+    type VCSt  r :: *+    type VCM   r :: * -> *+    --value :: Selector o (VCSt r) (VCM r) arg val -> r++{-instance SetterContext (StateT s m ()) o s m where+    (MkField g g' s s') <: v = s' v-}++instance ValueContext (StateT s m val) val where+    type VCSt (StateT s m val) = s+    type VCM (StateT s m val) = m+    --value (MkField g g' s s') = g'+++(<:) :: Monad m => Selector Field o s m val -> val -> StateT s m ()+(MkField g g' s s') <: v = s' v++switch :: Monad m => Selector ty o s m val -> (val -> StateT s m b) -> StateT s m b+switch (MkMethod im em)      m = im >>= m+switch (MkField eg ig es is) m = ig >>= m
− Main.hs
@@ -1,21 +0,0 @@-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE QuasiQuotes #-}-{-# LANGUAGE ExistentialQuantification #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE FunctionalDependencies #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE TypeFamilies #-}-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE LambdaCase #-}--module Main where--import Language.MSH---{-instance New (SList a) where-    type Args (SList a) = ()-    new = const _mkSList-}-- 
msh.cabal view
@@ -10,13 +10,13 @@ -- PVP summary:      +-+------- breaking API changes --                   | | +----- non-breaking API additions --                   | | | +--- code changes with no API change-version:             0.1.0.0+version:             0.1.0.1  -- A short (one-line) description of the package.-synopsis:            Template Haskell implementation of Programming with Monadic State Hierarchies +synopsis:            Object-Oriented Programming in Haskell   -- A longer description of the package.-description: Library for object-oriented programming in Haskell       +description: Library for object-oriented programming in Haskell.       -- URL for the project homepage or repository. homepage:            http://www.cl.cam.ac.uk/~mbg28/@@ -43,7 +43,7 @@  -- Extra files to be distributed with the package, such as examples or a  -- README.-extra-source-files:  readme.txt+--extra-source-files:  readme.txt  -- Constraint on the version of Cabal needed to build this package. cabal-version:       >=1.10@@ -54,7 +54,7 @@  library   -- Modules exported by the library.-  exposed-modules:     Main+  exposed-modules:     Language.MSH      -- Modules included in this library but not exported.   -- other-modules:       
− readme.txt