-
Notifications
You must be signed in to change notification settings - Fork 92
Ports purescript-proxy into this repo
#230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
87368e8
05cc6ba
5a31dfd
9a08737
1100459
a4a2eba
13a09d8
556ad85
8764b0d
cd942d2
5cd190c
164e592
5709450
f9a884e
7a99f83
fa7d8d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,20 +5,21 @@ module Data.Symbol | |
| , SProxy(..) | ||
| ) where | ||
|
|
||
| import Type.Proxy (Proxy(..)) | ||
|
|
||
| -- | A value-level proxy for a type-level symbol. | ||
| data SProxy (sym :: Symbol) = SProxy | ||
|
|
||
| -- | A class for known symbols | ||
| class IsSymbol (sym :: Symbol) where | ||
| reflectSymbol :: SProxy sym -> String | ||
| reflectSymbol :: Proxy sym -> String | ||
|
|
||
| -- local definition for use in `reifySymbol` | ||
| foreign import unsafeCoerce :: forall a b. a -> b | ||
|
|
||
| reifySymbol :: forall r. String -> (forall sym. IsSymbol sym => SProxy sym -> r) -> r | ||
| reifySymbol s f = coerce f { reflectSymbol: \_ -> s } SProxy where | ||
| reifySymbol :: forall r. String -> (forall sym. IsSymbol sym => Proxy sym -> r) -> r | ||
|
||
| reifySymbol s f = coerce f { reflectSymbol: \_ -> s } Proxy where | ||
| coerce | ||
| :: (forall sym1. IsSymbol sym1 => SProxy sym1 -> r) | ||
| -> { reflectSymbol :: SProxy "" -> String } -> SProxy "" -> r | ||
| :: (forall sym1. IsSymbol sym1 => Proxy sym1 -> r) | ||
| -> { reflectSymbol :: Proxy "" -> String } -> Proxy "" -> r | ||
| coerce = unsafeCoerce | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.