O'Reilly logo

Haskell Cookbook by Yogesh Sajanikar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it... 

  1. Create a new folder blaze-html. We will not be creating a separate project. Instead, create a new file called index.hs file. Open the file and enable the extension OverloadedStrings for being able to use a generic string syntax for supporting text as well as ByteString
        {-# LANGUAGE OverloadedStrings #-}
  1. Add the necessary imports:
 import Prelude
 import qualified Prelude as P
 import Data.Monoid (mempty,(<>))

 import Text.Blaze.Html5 hiding (main)
 import qualified Text.Blaze.Html5 as H
 import Text.Blaze.Html5.Attributes
 import qualified Text.Blaze.Html5.Attributes as A
 import Text.Blaze.Html.Renderer.Utf8 (renderHtml)
 import qualified Data.ByteString.Lazy.Char8 as BC
  1. Define the functions to represent often used ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required