Skip to content

Commit

Permalink
Add HappstackForm type alias
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspervdj committed Dec 8, 2010
1 parent 08dc752 commit 5eef822
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions examples/Happstack.lhs
@@ -1,7 +1,7 @@
Example illustrating happstack with digestive-functors. This requires the
digestive-functors-happstack package.

> {-# LANGUAGE OverloadedStrings, TypeSynonymInstances, FlexibleContexts #-}
> {-# LANGUAGE OverloadedStrings, TypeSynonymInstances #-}
> import Data.Maybe (fromMaybe)
> import Control.Applicative ((<$>), (<*>))
> import Control.Monad.Trans (liftIO)
Expand All @@ -16,7 +16,6 @@ digestive-functors-happstack package.

> import Text.Digestive.Types
> import Text.Digestive.Blaze.Html5
> import Text.Digestive.Forms hiding (inputFile)
> import Text.Digestive.Forms.Happstack

The next instance should not be needed once Happstack 0.6 is released, we'll
Expand All @@ -31,8 +30,8 @@ We're going to create a very simple file upload server.
> data Upload = Upload LB.ByteString String
> deriving (Show)

> uploadForm :: (Monad m, Functor m, FormInput i (Maybe String, LB.ByteString))
> => Form m i Html BlazeFormHtml Upload
> uploadForm :: (Monad m, Functor m)
> => HappstackForm m Html BlazeFormHtml Upload
> uploadForm = Upload
> <$> fmap (fromMaybe "Unknown" . fmap snd) inputFile
> <*> label "Destination name: " ++> inputText Nothing
Expand Down

0 comments on commit 5eef822

Please sign in to comment.