summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2017-02-19 10:07:56 -0500
committerBen Gamari <ben@smart-cactus.org>2017-02-20 13:33:12 -0500
commit27a2854124cc1c101570104501beea234a4ee921 (patch)
tree470e0ed56b5673cac31dca4ce752279dac50c07d /libraries
parent8dd4e3bbbaa3a262c45368985a575e970f7b7fe3 (diff)
downloadhaskell-27a2854124cc1c101570104501beea234a4ee921.tar.gz
A number of Typeable wibbles from review
I forgot to fold these in to the patch merged earlier.
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/Data/Typeable/Internal.hs10
-rw-r--r--libraries/base/GHC/Show.hs2
-rw-r--r--libraries/base/changelog.md8
-rw-r--r--libraries/ghc-boot/GHC/Serialized.hs4
4 files changed, 11 insertions, 13 deletions
diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs
index 800dc2a66f..c230d3a95a 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -77,7 +77,7 @@ import GHC.Base
import qualified GHC.Arr as A
import GHC.Types ( TYPE )
import Data.Type.Equality
-import GHC.List ( splitAt, foldl )
+import GHC.List ( splitAt, foldl' )
import GHC.Word
import GHC.Show
import GHC.TypeLits ( KnownSymbol, symbolVal' )
@@ -209,7 +209,7 @@ instance Ord (TypeRep a) where
-- | A non-indexed type representation.
data SomeTypeRep where
- SomeTypeRep :: forall k (a :: k). TypeRep a -> SomeTypeRep
+ SomeTypeRep :: forall k (a :: k). !(TypeRep a) -> SomeTypeRep
instance Eq SomeTypeRep where
SomeTypeRep a == SomeTypeRep b =
@@ -308,7 +308,7 @@ typeRepTyCon (TrFun _ _ _) = error "typeRepTyCon: FunTy" -- TODO
eqTypeRep :: forall k1 k2 (a :: k1) (b :: k2).
TypeRep a -> TypeRep b -> Maybe (a :~~: b)
eqTypeRep a b
- | typeRepFingerprint a == typeRepFingerprint b = Just (unsafeCoerce# HRefl)
+ | typeRepFingerprint a == typeRepFingerprint b = Just (unsafeCoerce HRefl)
| otherwise = Nothing
@@ -349,7 +349,7 @@ instantiateKindRep vars = go
applyTy (SomeTypeRep acc) ty
| SomeTypeRep ty' <- go ty
= SomeTypeRep $ mkTrApp (unsafeCoerce acc) (unsafeCoerce ty')
- in foldl applyTy tycon_app ty_args
+ in foldl' applyTy tycon_app ty_args
go (KindRepVar var)
= vars A.! var
go (KindRepApp f a)
@@ -517,7 +517,7 @@ splitApps = go []
go xs (TrApp _ f x) = go (SomeTypeRep x : xs) f
go [] (TrFun _ a b) = (funTyCon, [SomeTypeRep a, SomeTypeRep b])
go _ (TrFun _ _ _) =
- error "Data.Typeable.Internal.splitApps: Impossible"
+ errorWithoutStackTrace "Data.Typeable.Internal.splitApps: Impossible"
funTyCon :: TyCon
funTyCon = typeRepTyCon (typeRep @(->))
diff --git a/libraries/base/GHC/Show.hs b/libraries/base/GHC/Show.hs
index 510c655a11..c52824b165 100644
--- a/libraries/base/GHC/Show.hs
+++ b/libraries/base/GHC/Show.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP, NoImplicitPrelude, BangPatterns, StandaloneDeriving,
- MagicHash, UnboxedTuples, PolyKinds #-}
+ MagicHash, UnboxedTuples #-}
{-# OPTIONS_HADDOCK hide #-}
#include "MachDeps.h"
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index fd8f188628..68650e323d 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -56,14 +56,14 @@
imported from `Control.Applicative`. It is likely to be added to the
`Prelude` in the future. (#13191)
- * A new module exposing GHC's new type-indexed type representation
- mechanism, `Type.Reflection`, is now provided.
+ * A new module, `Type.Reflection`, exposing GHC's new type-indexed type
+ representation mechanism is now provided.
* `Data.Dynamic` now exports the `Dyn` data constructor, enabled by the new
type-indexed type representation mechanism.
- * `Data.Type.Equality` now provides a kind heterogeneous type equality type,
- `(:~~:)`.
+ * `Data.Type.Equality` now provides a kind heterogeneous type equality
+ evidence type, `(:~~:)`.
## 4.9.0.0 *May 2016*
diff --git a/libraries/ghc-boot/GHC/Serialized.hs b/libraries/ghc-boot/GHC/Serialized.hs
index 42a9604c08..161bbb31f7 100644
--- a/libraries/ghc-boot/GHC/Serialized.hs
+++ b/libraries/ghc-boot/GHC/Serialized.hs
@@ -29,9 +29,7 @@ data Serialized = Serialized TypeRep [Word8]
-- | Put a Typeable value that we are able to actually turn into bytes into a 'Serialized' value ready for deserialization later
toSerialized :: forall a. Typeable a => (a -> [Word8]) -> a -> Serialized
-toSerialized serialize what = Serialized rep (serialize what)
- where
- rep = typeOf what
+toSerialized serialize what = Serialized (typeOf what) (serialize what)
-- | If the 'Serialized' value contains something of the given type, then use the specified deserializer to return @Just@ that.
-- Otherwise return @Nothing@.