packages feed

front 0.0.0.5 → 0.0.0.6

raw patch · 5 files changed

+52/−113 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

README.md view
@@ -26,6 +26,7 @@ 3. Import `Shared` module. 4. Choose proper communication model (Only session, Broadcast, etc.). 5. That's it.+6. The only thing you need to keep in mind that one of records in your types should have name `commandValue`!  ## Examples @@ -35,6 +36,13 @@   ```   stack install --flag="front:examples"   ```+  +  or +  +  ```+  cabal v2-build --flags examples+  ```+     - usage:   ```   cd examples/todo@@ -60,26 +68,8 @@ stack build ``` -For client (issue: faylang/fay#459):--```-cabal sandbox init-cabal install # fay executable and libraries will be loaded-export HASKELL_PACKAGE_SANDBOX=`echo .cabal-sandbox/*-packages.conf.d/`-.cabal-sandbox/bin/fay \-  --package fay-dom,fay-websockets \-  --include shared,fay \-  -o bundle.js fay/Client.hs-```--or--```-~/.local/bin/fay \-  --package fay-dom,fay-websockets \-  --include shared,fay \-  -o bundle.js fay/Client.hs-```+For client: there is nothing special you need on client side. +`bundle.js` already had everything included.  Please do not hesitate to open Issue to discuss your questions or use cases. 
examples/todo/Shared.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP                #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFunctor      #-} {-# LANGUAGE NoImplicitPrelude  #-}@@ -10,81 +9,26 @@  import           Data.Data import           Data.Text (Text)-#ifdef FAY-import           Client-#endif-import           Bridge  type EntryId = Int  data Visibility = All | Active | Completed-#ifdef FAY-  deriving (Typeable, Data)-#else   deriving (Show, Typeable, Data, Eq)-#endif  data Msg = Msg1 MsgCommon | Msg2 MsgEntry-#ifdef FAY-  deriving (Typeable, Data)-#else   deriving (Show, Typeable, Data)-#endif  data MsgCommon   = Add-  | UpdateField Text+  | UpdateField { commandValue :: Text }   | CheckAll Bool   | DeleteComplete   | ChangeVisibility Visibility-#ifdef FAY-  deriving (Typeable, Data)-#else   deriving (Show, Typeable, Data)-#endif - data MsgEntry   = Editing EntryId Bool-  | UpdateEntry EntryId Text+  | UpdateEntry { entryId :: EntryId, commandValue :: Text }   | Check EntryId Bool   | Delete EntryId-#ifdef FAY-  deriving (Typeable, Data)-#else   deriving (Show, Typeable, Data)-#endif---#ifdef FAY--- | Boilerplate that teaches client how to assign value into the message.-update :: Msg -> Text -> Msg--- FIXME: update (Update ix _oldval) newval = Update ix newval-update (Msg1 msgCommon) x = Msg1 (updateMsgCommon msgCommon x)-update (Msg2 msgEntry)  x = Msg2 (updateMsgEntry msgEntry x)--updateMsgCommon :: MsgCommon -> Text -> MsgCommon-updateMsgCommon Add _ = Add-updateMsgCommon (UpdateField _) val2     = UpdateField val2-updateMsgCommon (CheckAll _) val3 = case val3 of-  "checked" -> CheckAll True-  _         -> CheckAll False-updateMsgCommon DeleteComplete _ = DeleteComplete-updateMsgCommon (ChangeVisibility old) val4 = case val4 of-  "All"       -> ChangeVisibility All-  "Active"    -> ChangeVisibility Active-  "Completed" -> ChangeVisibility Completed-  _           -> ChangeVisibility old--updateMsgEntry :: MsgEntry -> Text -> MsgEntry-updateMsgEntry (Editing eid _old) val1 = case val1 of-  "" -> Editing eid False-  _  -> Editing eid True-updateMsgEntry (UpdateEntry eid _) val2 = UpdateEntry eid val2-updateMsgEntry (Check eid _) val3 = case val3 of-  "" -> Check eid False-  _  -> Check eid True-updateMsgEntry (Delete eid) _ = Delete eid--main = runWith update-#endif
front.cabal view
@@ -2,7 +2,7 @@ --  see http://haskell.org/cabal/users-guide/  name:                front-version:             0.0.0.5+version:             0.0.0.6 synopsis:            A reactive frontend web framework description:         A reactive frontend web framework. See haskell-front.org for more details. homepage:            haskell-front.org
src/Text/Blaze/Front.hs view
@@ -1,4 +1,5 @@-{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}+{-# LANGUAGE FlexibleInstances    #-}+{-# LANGUAGE TypeSynonymInstances #-} -- | BlazeMarkup is a markup combinator library. It provides a way to embed -- markup languages like HTML and SVG in Haskell in an efficient and convenient -- way, with a light-weight syntax.@@ -66,14 +67,14 @@     , contents     ) where -import Data.Int (Int32, Int64)-import Data.Word (Word, Word32, Word64)+import           Data.Int                  (Int32, Int64)+import           Data.Word                 (Word32, Word64) -import Data.Text (Text)-import qualified Data.Text.Lazy as LT+import           Data.Text                 (Text)+import qualified Data.Text.Lazy            as LT -import Prelude-import Text.Blaze.Front.Internal+import           Prelude+import           Text.Blaze.Front.Internal  -- | Class allowing us to use a single function for Markup values --
src/Text/Blaze/Front/Internal.hs view
@@ -1,8 +1,13 @@ -{-# LANGUAGE OverloadedStrings, GeneralizedNewtypeDeriving, Rank2Types,-             FlexibleInstances, ExistentialQuantification,-             DeriveDataTypeable, MultiParamTypeClasses, DeriveFunctor,-             FunctionalDependencies #-}+{-# LANGUAGE DeriveDataTypeable         #-}+{-# LANGUAGE DeriveFunctor              #-}+{-# LANGUAGE ExistentialQuantification  #-}+{-# LANGUAGE FlexibleInstances          #-}+{-# LANGUAGE FunctionalDependencies     #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE MultiParamTypeClasses      #-}+{-# LANGUAGE OverloadedStrings          #-}+{-# LANGUAGE Rank2Types                 #-} -- | The BlazeMarkup core, consisting of functions that offer the power to -- generate custom markup elements. It also offers user-centric functions, -- which are exposed through 'Text.Blaze'.@@ -68,26 +73,25 @@  import           Control.Applicative -import           Data.ByteString.Char8        (ByteString)-import qualified Data.ByteString              as B-import qualified Data.ByteString.Lazy         as BL-import qualified Data.List                    as List-import           Data.Monoid                  (Monoid, mempty)-import           Data.Semigroup               (Semigroup, sconcat)-import           Data.Text                    (Text)-import qualified Data.Text                    as T-import qualified Data.Text.Encoding           as T-import qualified Data.Text.Lazy               as LT-import           Data.Typeable                (Typeable)+import qualified Data.ByteString       as B+import           Data.ByteString.Char8 (ByteString)+import qualified Data.ByteString.Lazy  as BL+import qualified Data.List             as List+import           Data.Semigroup        (sconcat)+import           Data.Text             (Text)+import qualified Data.Text             as T+import qualified Data.Text.Encoding    as T+import qualified Data.Text.Lazy        as LT+import           Data.Typeable         (Typeable) -import           GHC.Exts                     (IsString (..))+import           GHC.Exts              (IsString (..)) -import           Prelude                      hiding (null)+import           Prelude               hiding (null)  import           Bridge-import           Text.Blaze.Internal (StaticString(..), ChoiceString(..))+import           Text.Blaze.Internal   (ChoiceString (..), StaticString (..)) -import           Unsafe.Coerce (unsafeCoerce)+import           Unsafe.Coerce         (unsafeCoerce)   -- | The core Markup datatype. The 'ev' type-parameter tracks the type of@@ -426,15 +430,15 @@ -- combinators. -- external :: MarkupM ev a -> MarkupM ev a-external (MapActions f x) = MapActions f (external x)-external (OnEvent ev x) = OnEvent ev (external x)-external (Content x) = Content $ External x-external (Append x y) = Append (external x) (external y)-external (Parent x y z i) = Parent x y z $ external i-external (CustomParent x i) = CustomParent x $ external i-external (AddAttribute x y z i) = AddAttribute x y z $ external i+external (MapActions f x)           = MapActions f (external x)+external (OnEvent ev x)             = OnEvent ev (external x)+external (Content x)                = Content $ External x+external (Append x y)               = Append (external x) (external y)+external (Parent x y z i)           = Parent x y z $ external i+external (CustomParent x i)         = CustomParent x $ external i+external (AddAttribute x y z i)     = AddAttribute x y z $ external i external (AddCustomAttribute x y i) = AddCustomAttribute x y $ external i-external x = x+external x                          = x {-# INLINABLE external #-}  -- | Take only the text content of an HTML tree.