1{-# LANGUAGE NoImplicitPrelude #-}
4Copyright: (c) 2017-2020 Kowainik
5SPDX-License-Identifier: MPL-2.0
6Maintainer: Kowainik <xrom.xkov@gmail.com>
8 A version of 'Data.TMap.TMap' parametrized by an interpretation @f@. This
9sort of parametrization may be familiar to users of @vinyl@ records.
11@'TypeRepMap' f@ is a more efficient replacement for @DMap
12'Type.Reflection.TypeRep' f@ (where @DMap@ is from the @dependent-map@
15Here is an example of using 'Prelude.Maybe' as an interpretation, with a
16comparison to 'Data.TMap.TMap':
19 'Data.TMap.TMap' 'TypeRepMap' 'Prelude.Maybe'
20-------------- -------------------
21 Int -> 5 Int -> Just 5
22 Bool -> True Bool -> Nothing
23 Char -> \'x\' Char -> Just \'x\'
26In fact, a 'Data.TMap.TMap' is defined as 'TypeRepMap'
27'Data.Functor.Identity'.
29Since 'Type.Reflection.TypeRep' is poly-kinded, the interpretation can use
30any kind for the keys. For instance, we can use the 'GHC.TypeLits.Symbol'
31kind to use 'TypeRepMap' as an extensible record:
34newtype Field name = F (FType name)
36type family FType (name :: Symbol) :: Type
37type instance FType "radius" = Double
38type instance FType "border-color" = RGB
39type instance FType "border-width" = Double
42--------------------------------------
44 "border-color" -> F (rgb 148 0 211)
45 "border-width" -> F 0.5
76import Data.TypeRepMap.Internal
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list