packages feed

Deadpan-DDP 0.3.0.1 → 0.3.0.2

raw patch · 2 files changed

+27/−26 lines, 2 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Data.EJson.Prism: prop_ejopristest_null :: Bool
- Data.EJson.Prism: prop_ejopristest_object :: Bool
- Data.EJson.Prism: prop_ejspristest_string :: Bool
- Web.DDP.Deadpan.DSL: callbackSet :: Lens' (AppState cb_agUg) (Lookup cb_agUg)
+ Web.DDP.Deadpan.DSL: callbackSet :: Lens' (AppState cb_agNK) (Lookup cb_agNK)
- Web.DDP.Deadpan.DSL: collections :: Lens' (AppState cb_agUg) (TVar EJsonValue)
+ Web.DDP.Deadpan.DSL: collections :: Lens' (AppState cb_agNK) (TVar EJsonValue)
- Web.DDP.Deadpan.DSL: deadpanApp :: Iso (DeadpanApp a_aive) (DeadpanApp a_aizD) (RWST Connection () (AppState Callback) IO a_aive) (RWST Connection () (AppState Callback) IO a_aizD)
+ Web.DDP.Deadpan.DSL: deadpanApp :: Iso (DeadpanApp a_aioI) (DeadpanApp a_ait7) (RWST Connection () (AppState Callback) IO a_aioI) (RWST Connection () (AppState Callback) IO a_ait7)
- Web.DDP.Deadpan.DSL: defaultCallback :: Lens' (AppState cb_agUg) cb_agUg
+ Web.DDP.Deadpan.DSL: defaultCallback :: Lens' (AppState cb_agNK) cb_agNK

Files

Deadpan-DDP.cabal view
@@ -1,5 +1,5 @@ name:                Deadpan-DDP-version:             0.3.0.1+version:             0.3.0.2 synopsis:            Write clients for Meteor's DDP Protocol description:         The Deadpan-DDP project includes a debugging-tool, as well as a general purpose library.                      .@@ -18,7 +18,9 @@                      `Web.DDP.Deadpan.runClient` with                      .                      * An initial application state (this includes initial callbacks)+                     .                      * A set of connection parameters+                     .                      * A `Web.DDP.Deadpan.DSL.Deadpan` application                      .                      There are several callback-sets provided in "Web.DDP.Deadpan",
src/Data/EJson/Prism.hs view
@@ -1,7 +1,22 @@+{-|+  Description: Making EJsonValue Control.Lens compatible through `Control.Lens.Prism`s++  Making EJsonValue Control.Lens compatible through `Control.Lens.Prism`s++  Since EJsonValue is a sum-type, you need to take advantage of the `Control.Lens.Prism`+  class provided by the Lens library if you wish to use it in a lens-compatible way.++  The set of instances is so-far incomplete.+-}+ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE OverloadedStrings #-} -module Data.EJson.Prism where+module Data.EJson.Prism+  ( _EJObject+  , _EJString+  )+  where  -- External Imports @@ -14,32 +29,13 @@ import Data.EJson.EJson  --- TODO: Remove this "helpful" documentation---- prism :: (b -> t) -> (s -> Either t a) -> Prism s t a b------ type Prism s t a b =--- forall (p :: * -> * -> *) (f :: * -> *).--- (Choice p, Control.Applicative.Applicative f) =>--- p a (f b) -> p s (f t)------ prism' :: (b -> s) -> (s -> Maybe a) -> Prism s s a b------ preview ::--- Control.Monad.Reader.Class.MonadReader s m =>--- Getting (Data.Monoid.First a) s a -> m (Maybe a)------ _Just :: Prism (Maybe a) (Maybe b) a b--- _Just = prism Just $ maybe (Left Nothing) Right------ _Left :: Prism (Either a c) (Either b c) a b--- _Left = prism Left $ either Right (Left . Right)+-- | _EJObject is a prism that allows access to the value represented by a+--   lookup via a key in to an EJObject. ----- _Right :: Prism (Either c a) (Either c b) a b--- _Right = prism Right $ either (Left . Left) Right+--   This is constructed as a convenience so that you do not need to compose,+--   or even have knowledge of the underlying HashMap implementaiton of+--   EJObject. ----- _EJObject :: Text -> Prism EJsonValue (Maybe EJsonValue) EJsonValue EJsonValue- _EJObject :: Text -> Prism' EJsonValue EJsonValue _EJObject k = prism' (const EJNull) $ f -- TODO: Does const violate prism laws?   where f (EJObject h) = Data.HashMap.Strict.lookup k h@@ -51,6 +47,9 @@ prop_ejopristest_object :: Bool prop_ejopristest_object = ejobject [("hello","world")] ^? _EJObject "hello" == Just "world" +-- | _EJString is a prism that points to the EJString constructor of+--   the EJsonValue data-type.+-- _EJString :: Prism' EJsonValue Text _EJString = prism' (const EJNull) $ f -- TODO: Does const violate prism laws?   where f (EJString s) = Just s