... | @@ -2,7 +2,7 @@ |
... | @@ -2,7 +2,7 @@ |
|
|
|
|
|
|
|
|
|
This page outlines the design for a GHC feature to provide support for user-specified type errors.
|
|
This page outlines the design for a GHC feature to provide support for user-specified type errors.
|
|
The main idea was [ presented by Lennart Augustsson at the 2015 Haskell Symposium in Vancouver BC](https://youtu.be/ZlZbSiYrqcQ).
|
|
The main idea was [presented by Lennart Augustsson at the 2015 Haskell Symposium in Vancouver BC](https://youtu.be/ZlZbSiYrqcQ).
|
|
|
|
|
|
|
|
|
|
The relevant ticket is [\#9637](https://gitlab.haskell.org//ghc/ghc/issues/9637).
|
|
The relevant ticket is [\#9637](https://gitlab.haskell.org//ghc/ghc/issues/9637).
|
... | @@ -304,7 +304,7 @@ get :: forall l fs n a. |
... | @@ -304,7 +304,7 @@ get :: forall l fs n a. |
|
get (Struct p) _ = plusPtr p (fromInteger (natVal (Proxy :: Proxy n)))
|
|
get (Struct p) _ = plusPtr p (fromInteger (natVal (Proxy :: Proxy n)))
|
|
|
|
|
|
|
|
|
|
type MyStruct = [ '("A",Word8), '("B",Word8), '("C",Int) ]
|
|
type MyStruct = ['("A",Word8), '("B",Word8), '("C",Int) ]
|
|
|
|
|
|
testOk :: Struct MyStruct -> Ptr Word8
|
|
testOk :: Struct MyStruct -> Ptr Word8
|
|
testOk s = get s (Proxy :: Proxy "B")
|
|
testOk s = get s (Proxy :: Proxy "B")
|
... | @@ -316,7 +316,7 @@ testNotOk s = get s (Proxy :: Proxy "X") |
... | @@ -316,7 +316,7 @@ testNotOk s = get s (Proxy :: Proxy "X") |
|
--}
|
|
--}
|
|
|
|
|
|
{-
|
|
{-
|
|
type MyOtherStruct = [ '("A",Int), '("B",Word8) ]
|
|
type MyOtherStruct = ['("A",Int), '("B",Word8) ]
|
|
|
|
|
|
testNotOk :: Struct MyOtherStruct -> Ptr Word8
|
|
testNotOk :: Struct MyOtherStruct -> Ptr Word8
|
|
testNotOk s = get s (Proxy :: Proxy "B")
|
|
testNotOk s = get s (Proxy :: Proxy "B")
|
... | @@ -328,4 +328,4 @@ testNotOk s = get s (Proxy :: Proxy "B") |
... | @@ -328,4 +328,4 @@ testNotOk s = get s (Proxy :: Proxy "B") |
|
|
|
|
|
|
|
|
|
The Helium people have also addressed the problem of customizable error messages.
|
|
The Helium people have also addressed the problem of customizable error messages.
|
|
See Heeren, Hage, Swierstra on [ Scripting the Type Inference Process](http://www.staff.science.uu.nl/~hage0101/scriptingthetypeinferencer.pdf). |
|
See Heeren, Hage, Swierstra on [Scripting the Type Inference Process](http://www.staff.science.uu.nl/~hage0101/scriptingthetypeinferencer.pdf). |