on master help sign in
* ElmSource instance for strict text
58a6eb6Vincent Ambo
elm/src/Language/Elm.hs+7
@@ -19,6 +19,7 @@ import Initialize
19import Text.Blaze.Html (Html)
19import Text.Blaze.Html (Html)
20import Language.Elm.Quasi
20import Language.Elm.Quasi
21
21
22+import qualified Data.Text as TS
22import qualified Data.Text.Lazy as TL
23import qualified Data.Text.Lazy as TL
23
24
24class ElmSource a where
25class ElmSource a where
@@ -41,6 +42,12 @@ instance ElmSource Elm where
41 toParts = toPartsHelper . TL.unpack . renderElm
42 toParts = toPartsHelper . TL.unpack . renderElm
42 toHtml elmL title = generateHtml elmL title . TL.unpack . renderElm
43 toHtml elmL title = generateHtml elmL title . TL.unpack . renderElm
43
44
45+-- |Strict text
46+instance ElmSource TS.Text where
47+ toParts = toPartsHelper . TS.unpack
48+ toHtml elmL title = generateHtml elmL title . TS.unpack
49+
50+-- |Lazy text
44instance ElmSource TL.Text where
51instance ElmSource TL.Text where
45 toParts = toPartsHelper . TL.unpack
52 toParts = toPartsHelper . TL.unpack
46 toHtml elmL title = generateHtml elmL title . TL.unpack
53 toHtml elmL title = generateHtml elmL title . TL.unpack