diff options
Diffstat (limited to 'packages/base/src/Internal/Specialized.hs')
-rw-r--r-- | packages/base/src/Internal/Specialized.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/base/src/Internal/Specialized.hs b/packages/base/src/Internal/Specialized.hs index 5f89779..9a68ad5 100644 --- a/packages/base/src/Internal/Specialized.hs +++ b/packages/base/src/Internal/Specialized.hs | |||
@@ -104,7 +104,7 @@ data IntegralRep t a = IntegralRep | |||
104 | , rep2i :: Vector a -> Vector t | 104 | , rep2i :: Vector a -> Vector t |
105 | , rep2iM :: Matrix a -> Matrix t | 105 | , rep2iM :: Matrix a -> Matrix t |
106 | , rep2one :: a -> t | 106 | , rep2one :: a -> t |
107 | , modulo :: Maybe t | 107 | , modulo :: !(Maybe t) |
108 | } | 108 | } |
109 | 109 | ||
110 | instance Show (IntegralRep t a) where | 110 | instance Show (IntegralRep t a) where |
@@ -126,7 +126,7 @@ withTypes :: p (a::k) -> q (b::h) -> f a b -> f a b | |||
126 | withTypes _ _ = id | 126 | withTypes _ _ = id |
127 | 127 | ||
128 | modint :: forall t n. (Read t, Storable t, Integral t) => TypeRep n -> IntegralRep t (Mod n t) | 128 | modint :: forall t n. (Read t, Storable t, Integral t) => TypeRep n -> IntegralRep t (Mod n t) |
129 | modint r = IntegralRep i2f i2fM f2i f2iM unMod (Just n) | 129 | modint r = IntegralRep i2f i2fM f2i f2iM unMod (n `seq` Just n) |
130 | where | 130 | where |
131 | -- n = withTypeable r $ fromIntegral . natVal $ (undefined :: Proxy n) -- If only.. | 131 | -- n = withTypeable r $ fromIntegral . natVal $ (undefined :: Proxy n) -- If only.. |
132 | n = case unsafePerformIO $ readIORef cachedNat of | 132 | n = case unsafePerformIO $ readIORef cachedNat of |
@@ -136,7 +136,7 @@ modint r = IntegralRep i2f i2fM f2i f2iM unMod (Just n) | |||
136 | _ -> unsafePerformIO $ do | 136 | _ -> unsafePerformIO $ do |
137 | let newnat = read . show $ r -- XXX: Hack to get nat value from Type.Reflection | 137 | let newnat = read . show $ r -- XXX: Hack to get nat value from Type.Reflection |
138 | case someNatVal $ fromIntegral newnat of | 138 | case someNatVal $ fromIntegral newnat of |
139 | Just somenat -> writeIORef cachedNat somenat | 139 | Just somenat@(SomeNat nt) -> nt `seq` writeIORef cachedNat somenat |
140 | _ -> return () | 140 | _ -> return () |
141 | return newnat | 141 | return newnat |
142 | 142 | ||