-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for type level strings to grammar
Referencing integer literals in type signature include patterns already need to adjust patterns for `type` and `class` etc Closes #50 See #51
- Loading branch information
1 parent
195d9bf
commit eb2806f
Showing
2 changed files
with
140 additions
and
86 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
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,21 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleInstances #-} | ||
{-# LANGUAGE FunctionalDependencies #-} | ||
{-# LANGUAGE KindSignatures #-} | ||
{-# LANGUAGE MultiParamTypeClasses #-} | ||
|
||
import GHC.TypeLits | ||
|
||
data Label (l :: Symbol) = Get | ||
|
||
class Has a l b | a l -> b where | ||
from :: a -> Label l -> b | ||
|
||
data Point = Point Int Int deriving Show | ||
|
||
instance Has Point "of" Int where from (Point x _) _ = x | ||
|
||
example = from (Point 1 2) (Get :: Label "of") | ||
|
||
main :: IO () | ||
main = undefined |