New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use varExp function. #165

Merged
merged 2 commits into from Sep 2, 2015
Jump to file or symbol
Failed to load files and symbols.
+6 −6
Diff settings

Always

Just for now

View
@@ -11,7 +11,6 @@ import Text.Printf (printf)
import Language.Haskell.TH
import Data.Word (Word8)
import Data.Bits
import Data.Text.Lazy.Builder (fromLazyText)
import qualified Data.Text.Lazy as TL
renderCssUrl :: (url -> [(TS.Text, TS.Text)] -> TS.Text) -> CssUrl url -> TL.Text
View
@@ -2,6 +2,8 @@
module Text.MkSizeType (mkSizeType) where
import Language.Haskell.TH.Syntax
import Data.Text.Lazy.Builder (fromLazyText)
import qualified Data.Text.Lazy as TL
mkSizeType :: String -> String -> Q [Dec]
mkSizeType name' unit = return [ dataDec name
@@ -39,11 +41,10 @@ toCssInstanceDec :: Name -> Dec
toCssInstanceDec name = InstanceD [] (instanceType "ToCss" name) [toCssDec]
where toCssDec = FunD (mkName "toCss") [Clause [] showBody []]
showBody = NormalB $ (AppE dot from) `AppE` ((AppE dot pack) `AppE` show')
-- FIXME this whole section makes me a little nervous
from = VarE (mkName "fromLazyText")
pack = VarE (mkName "TL.pack")
dot = VarE (mkName ".")
show' = VarE (mkName "show")
from = VarE 'fromLazyText
pack = VarE 'TL.pack
dot = VarE 'Prelude.fmap
show' = VarE 'Prelude.show
instanceType :: String -> Name -> Type
instanceType className name = AppT (ConT $ mkName className) (ConT name)
ProTip! Use n and p to navigate between commits in a pull request.