Skip to content

markandrus/twiml-haskell

Repository files navigation

twiml

twiml on Hackage twiml-haskell on Travis CI

This package provides a library for constructing TwiML. Install using

$ cabal install twiml

Documentation is available through GitHub (for HEAD) or Hackage for the current and preceding releases.

For the Twilio REST API, see twilio-haskell.

Example

The following Haskell code

{-# LANGUAGE RebindableSyntax #-}
{-# LANGUAGE RecordWildCards #-}

import Prelude
import Control.Lens
import Data.Default
import Text.XML.Twiml
import qualified Text.XML.Twiml.Syntax as Twiml

example :: VoiceTwiml
example =
  voiceResponse $ do
    say "Hello, world" $ def & voice .~ Man
    hangup
  where Twiml.Syntax{..} = def

is transformed into

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say voice="man">Hello, world</Say>
  <Hangup/>
</Response>

Contributing

Feel free to contribute to any of the open issues, bugfixes, etc. When you think you're ready to merge, ensure the tests are passing and open a pull request. If you are adding new functionality, please include new tests as well. Finally, add yourself to the AUTHORS file.