GHC 7.8 compatibility, based on a patch suggested by José Romildo Malaquias
Ignore-this: 4a655a3a1d2348054d2028f5c26dc0d5 darcs-hash:20140525015603-7469c-30d96daeffde6da775c2b8f6579c0a2fbbfc479a
This commit is contained in:
parent
91f119bbfb
commit
00f914ebde
@ -1,4 +1,4 @@
|
||||
{-# LANGUAGE MagicHash #-}
|
||||
{-# LANGUAGE MagicHash,BangPatterns #-}
|
||||
module Data.Array.Static where
|
||||
|
||||
import Data.Static
|
||||
@ -11,5 +11,5 @@ bounds :: Ix i => StaticArray i e -> (i,i)
|
||||
bounds (StaticArray s e _) = (s,e)
|
||||
|
||||
(!) :: (StaticElement e,Ix i) => StaticArray i e -> i -> e
|
||||
(!) (StaticArray s e addr) i = let (I# ri) = index (s,e) i
|
||||
(!) (StaticArray s e addr) i = let !(I# ri) = index (s,e) i
|
||||
in extract addr ri
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{-# LANGUAGE MagicHash,FlexibleInstances,BangPatterns #-}
|
||||
{-# LANGUAGE MagicHash,FlexibleInstances,BangPatterns,CPP #-}
|
||||
module Data.Static where
|
||||
|
||||
import GHC.Exts
|
||||
@ -36,7 +36,11 @@ instance StaticElement Char where
|
||||
|
||||
instance StaticElement (Maybe Char) where
|
||||
extract addr i = let !v = indexWord32OffAddr# addr i
|
||||
#if __GLASGOW_HASKELL__ >= 708
|
||||
in if isTrue# (eqWord# v (int2Word# 4294967295#)) -- -1 in Word32
|
||||
#else
|
||||
in if eqWord# v (int2Word# 4294967295#) -- -1 in Word32
|
||||
#endif
|
||||
then Nothing
|
||||
else (if (I# (word2Int# v)) > 0x10FFFF
|
||||
then error (show (I# (word2Int# v))++" is not a valid char ("++show (I# i)++")")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user