encoding/Data/Array/Static/Builder.hs
Henning Guenther 6101ee16ae Switch from Template-based code generating to text-based
Ignore-this: f58ceb5e1068be132b0a67a851b096f4
This has two advantages:
1. TemplateHaskell is painfully slow. There, I said it.
2. TemplateHaskell doesn't yet support some extensions that can be usefull for this library. Specifically the MagicHash extension.

darcs-hash:20090813023321-a4fee-0da13d0da6454f6ba3bd111ed6b80268d9e1b45c
2009-08-12 19:33:21 -07:00

12 lines
476 B
Haskell

{-# LANGUAGE MagicHash #-}
module Data.Array.Static.Builder where
import Data.Static
buildStaticArray :: (StaticElement e,Show i) => (i,i) -> [e] -> String
buildStaticArray (s,e) els = "StaticArray ("++show s++") ("++show e++") \""
++concat (map (\w -> '\\':show w) (concat (map gen els)))
++"\"#"
buildStaticArray' :: (StaticElement e) => [e] -> String
buildStaticArray' els = buildStaticArray (0,length els-1) els