indexed-list-literals 0.2.1.0 → 0.2.1.1
raw patch · 3 files changed
+27/−7 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +1/−0
- indexed-list-literals.cabal +1/−1
- src/Data/IndexedListLiterals.hs +25/−6
ChangeLog.md view
@@ -0,0 +1,1 @@+Improved/Fixed the haddock documentation
indexed-list-literals.cabal view
@@ -2,7 +2,7 @@ -- further documentation, see http://haskell.org/cabal/users-guide/ name: indexed-list-literals-version: 0.2.1.0+version: 0.2.1.1 synopsis: Type safe indexed list literals homepage: https://github.com/davidm-d/indexed-list-literals license: BSD3
src/Data/IndexedListLiterals.hs view
@@ -31,9 +31,15 @@ -- | the fromList variants take a list and convert it into a tuple -- it's sort of the inverse of toList--- fromListP (len @3) [1,2,3] == Just (1,2,3)--- fromListP (len @3) ["word","up"] == Nothing--- fromListP (len @1) ['z'] == Just (Only 'z')+--+-- >> fromListP (len @3) [1,2,3]+-- > Just (1,2,3)+--+-- >> fromListP (len @3) ["word","up"]+-- > Nothing+--+-- >> fromListP (len @1) ['z']+-- > Just (Only 'z') @ fromListP :: forall input (length :: Nat) output len. (KnownNat length, ILL input length output) => len length -> [output] -> Maybe input@@ -42,9 +48,14 @@ len :: Proxy a len = Proxy --- | (fromList [1,2,3] :: Maybe (Int, Int, Int)) `shouldBe` Just (1,2,3)--- (fromList ["word","up"] :: Maybe (String, String, String)) `shouldBe` Nothing--- (fromList ['z'] :: Maybe (Only Char)) `shouldBe` Just (Only 'z')+-- | >> fromList [1,2,3] :: Maybe (Int, Int, Int)+-- > Just (1,2,3)+--+-- >> fromList ["word","up"] :: Maybe (String, String, String)+-- > Nothing+-- +-- >> fromList ['z'] :: Maybe (Only Char)+-- > Just (Only 'z') fromList :: forall input (length :: Nat) output. (KnownNat length, ILL input length output) => [output] -> Maybe input@@ -56,6 +67,14 @@ -- | A type class which allows you to write tuples which can be transformed to and from a list -- the length of the list is also provided as a Nat class IndexedListLiterals (input :: Type) (length :: Nat) (output :: Type) | output length -> input, input -> output length where+ -- | >> toList (Only 1)+ -- > [1]+ --+ -- >> toList (1,2,3)+ -- > [1,2,3]+ --+ -- >> toList ZeroTuple+ -- > [] toList :: input -> [output] -- | a partial fromList with bad error messages fromList' :: [output] -> input