-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [#6] Add README, refresh docs, refactor, add hlint * Fix after review
- Loading branch information
Showing
12 changed files
with
86 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- ignore: {name: "Use camelCase"} | ||
|
||
- arguments: | ||
- -XTypeApplications | ||
|
||
- warn: {name: "Use explicit module export list"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,30 @@ | ||
# typerep-map | ||
|
||
[](https://hackage.haskell.org/package/typerep-map) | ||
[](https://travis-ci.org/vrom911/typerep-map) | ||
[](https://travis-ci.org/kowainik/typerep-map) | ||
[](http://stackage.org/lts/package/typerep-map) | ||
[](http://stackage.org/nightly/package/typerep-map) | ||
[](https://github.com/vrom911/typerep-map/blob/master/LICENSE) | ||
|
||
`typerep-map` introduces `TypeRepMap` — data structure like [`Map`](http://hackage.haskell.org/package/containers-0.6.0.1/docs/Data-Map-Lazy.html#t:Map), but where types serve as keys, and values have the types specified in the corresponding key spots. | ||
|
||
```haskell | ||
ghci> let typeRepMap = insert (Identity True) $ insert (Identity (42 :: Int)) empty | ||
|
||
ghci> size typeRepMap | ||
2 | ||
|
||
ghci> let res = lookup typeRepMap | ||
|
||
ghci> res :: Maybe (Identity Int) | ||
Just (Identity 42) | ||
|
||
ghci> res :: Maybe (Identity Bool) | ||
Just (Identity True) | ||
|
||
ghci> res :: Maybe (Identity String) | ||
Nothing | ||
|
||
ghci> lookup (insert (Identity "hello") typeRepMap) :: Maybe (Identity String) | ||
Just (Identity "hello") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters