Created
November 8, 2022 22:42
-
-
Save paraseba/7fb8ddfb6502d85b0b2ae31c8f9d899e to your computer and use it in GitHub Desktop.
Alternative way to build a ThemeInstance. See https://rebeccaskinner.net/posts/2021-08-25-introduction-to-type-level-programming.html
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
addColor :: forall (c :: Symbol) t. KnownSymbol c => SomeColor -> ThemeInstance t -> ThemeInstance (c : t) | |
addColor sc (ThemeInstance m) = ThemeInstance $ Map.insert colorName sc m | |
where colorName = symbolVal (Proxy @c) | |
emptyThemeInstance :: ThemeInstance '[] | |
emptyThemeInstance = ThemeInstance Map.empty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment