Skip to content

Commit

Permalink
v0.1.1.0 strict fields for types in GHC.TypeLits.List
Browse files Browse the repository at this point in the history
  • Loading branch information
mstksg committed Dec 21, 2015
1 parent 377486d commit 27952cf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
0.1.1.0
=======
<https://github.com/mstksg/typelits-witnesses/releases/tag/v0.1.1.0>

* Added strict fields to `NatList`, `SomeNats`, `SymbolList`, and
`SomeSymbols`. It really doesn't make any sense for them to be lazy.

0.1.0.1
=======
<https://github.com/mstksg/typelits-witnesses/releases/tag/v0.1.0.1>
Expand Down
10 changes: 6 additions & 4 deletions src/GHC/TypeLits/List.hs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ instance (KnownNat n, KnownNats ns) => KnownNats (n ': ns) where
-- It's a 'NatList', but you don't know what the list contains at
-- compile-time.
data SomeNats :: * where
SomeNats :: KnownNats ns => NatList ns -> SomeNats
SomeNats :: KnownNats ns => !(NatList ns) -> SomeNats

-- | Singleton-esque type for "traversing" over type-level lists of 'Nat's.
-- Essentially contains a (value-level) list of @'Proxy' n@s, but each 'n'
Expand All @@ -100,7 +100,8 @@ data SomeNats :: * where
-- Typically generated using 'natsList'.
data NatList :: [Nat] -> * where
ØNL :: NatList '[]
(:<#) :: (KnownNat n, KnownNats ns) => Proxy n -> NatList ns -> NatList (n ': ns)
(:<#) :: (KnownNat n, KnownNats ns)
=> !(Proxy n) -> !(NatList ns) -> NatList (n ': ns)

infixr 5 :<#
deriving instance Show (NatList ns)
Expand Down Expand Up @@ -216,7 +217,7 @@ instance (KnownSymbol n, KnownSymbols ns) => KnownSymbols (n ': ns) where
-- | Represents unknown type-level lists of 'Symbol's. It's a 'SymbolList',
-- but you don't know what the list contains at compile-time.
data SomeSymbols :: * where
SomeSymbols :: KnownSymbols ns => SymbolList ns -> SomeSymbols
SomeSymbols :: KnownSymbols ns => !(SymbolList ns) -> SomeSymbols

-- | Singleton-esque type for "traversing" over type-level lists of
-- 'Symbol's. Essentially contains a (value-level) list of @'Proxy' n@s,
Expand All @@ -226,7 +227,8 @@ data SomeSymbols :: * where
-- Typically generated using 'symbolsList'.
data SymbolList :: [Symbol] -> * where
ØSL :: SymbolList '[]
(:<$) :: (KnownSymbol n, KnownSymbols ns) => Proxy n -> SymbolList ns -> SymbolList (n ': ns)
(:<$) :: (KnownSymbol n, KnownSymbols ns)
=> !(Proxy n) -> !(SymbolList ns) -> SymbolList (n ': ns)

infixr 5 :<$
deriving instance Show (SymbolList ns)
Expand Down
2 changes: 1 addition & 1 deletion typelits-witnesses.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: typelits-witnesses
version: 0.1.0.1
version: 0.1.1.0
synopsis: Existential witnesses, singletons, and classes for operations on GHC TypeLits
description: Provides witnesses for 'KnownNat' and 'KnownSymbol'
instances for various operations on GHC TypeLits - in
Expand Down

0 comments on commit 27952cf

Please sign in to comment.