Tuple instances for StaticElement
Ignore-this: 50d3356bb845ae964e3a4b45cac0235d darcs-hash:20090829135510-a4fee-131e4610a14dbd1b9f6d17aa65f41e2b5458311e
This commit is contained in:
parent
44d37e6bea
commit
871b207ab2
@ -43,4 +43,25 @@ instance StaticElement (Maybe Char) where
|
||||
else Just (chr (I# (word2Int# v)))
|
||||
)
|
||||
gen Nothing = gen (-1::Word32)
|
||||
gen (Just c) = gen (fromIntegral (ord c)::Word32)
|
||||
gen (Just c) = gen (fromIntegral (ord c)::Word32)
|
||||
|
||||
instance StaticElement a => StaticElement (a,a) where
|
||||
extract addr i = let x1 = extract addr (i *# 2#)
|
||||
x2 = extract addr (i *# 2# +# 1#)
|
||||
in (x1,x2)
|
||||
gen (x1,x2) = gen x1 ++ gen x2
|
||||
|
||||
instance StaticElement a => StaticElement (a,a,a) where
|
||||
extract addr i = let x1 = extract addr (i *# 3#)
|
||||
x2 = extract addr (i *# 3# +# 1#)
|
||||
x3 = extract addr (i *# 3# +# 2#)
|
||||
in (x1,x2,x3)
|
||||
gen (x1,x2,x3) = gen x1 ++ gen x2 ++ gen x3
|
||||
|
||||
instance StaticElement a => StaticElement (a,a,a,a) where
|
||||
extract addr i = let x1 = extract addr (i *# 4#)
|
||||
x2 = extract addr (i *# 4# +# 1#)
|
||||
x3 = extract addr (i *# 4# +# 2#)
|
||||
x4 = extract addr (i *# 4# +# 3#)
|
||||
in (x1,x2,x3,x4)
|
||||
gen (x1,x2,x3,x4) = gen x1 ++ gen x2 ++ gen x3 ++ gen x4
|
||||
9
Setup.hs
9
Setup.hs
@ -5,8 +5,9 @@ import Data.Encoding.Preprocessor.Mapping
|
||||
import Data.Encoding.Preprocessor.XMLMappingBuilder
|
||||
|
||||
main = defaultMainWithHooks (simpleUserHooks
|
||||
{hookedPreProcessors = ("mapping",\_ _ -> mappingPreprocessor)
|
||||
:("mapping2",\_ _ -> mappingPreprocessor)
|
||||
:("xml",\_ _ -> xmlPreprocessor)
|
||||
:(hookedPreProcessors simpleUserHooks)
|
||||
{hookedPreProcessors = (("mapping",\_ _ -> mappingPreprocessor)
|
||||
:("mapping2",\_ _ -> mappingPreprocessor)
|
||||
:("xml",\_ _ -> xmlPreprocessor)
|
||||
:(hookedPreProcessors simpleUserHooks)
|
||||
)
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user