diff options
author | Camil Staps | 2017-07-27 23:46:04 +0200 |
---|---|---|
committer | Camil Staps | 2017-07-27 23:46:04 +0200 |
commit | 3e21c67505edf6441d7561b2d52359468861b549 (patch) | |
tree | 0c030c6186bf1b653f6806483f57ffffb4481415 | |
parent | Centralise errors (needed for positional errors #5) (diff) |
Cleanup
-rw-r--r-- | Sil/Error.dcl | 2 | ||||
-rw-r--r-- | Sil/Error.icl | 3 | ||||
-rw-r--r-- | sil.icl | 9 |
3 files changed, 6 insertions, 8 deletions
diff --git a/Sil/Error.dcl b/Sil/Error.dcl index b953f60..15a660a 100644 --- a/Sil/Error.dcl +++ b/Sil/Error.dcl @@ -1,5 +1,6 @@ definition module Sil.Error +from StdFile import class <<< from StdOverloaded import class toString from Sil.Syntax import :: Expression @@ -26,3 +27,4 @@ from Sil.Types import :: Type | UnknownError String instance toString Error +instance <<< Error diff --git a/Sil/Error.icl b/Sil/Error.icl index b5d5941..6a9d07e 100644 --- a/Sil/Error.icl +++ b/Sil/Error.icl @@ -1,5 +1,6 @@ implementation module Sil.Error +import StdFile import StdString import Text @@ -23,3 +24,5 @@ where toString (C_TypeMisMatch t e) = "Type mismatch: expected " <+ t <+ " for '" <+ e <+ "'." toString (C_BasicInitWithoutValue n) = "Basic value '" <+ n <+ "' must have an initial value." toString (UnknownError e) = "Unknown error: " <+ e <+ "." + +instance <<< Error where <<< f e = f <<< toString e <<< "\r\n" @@ -91,7 +91,7 @@ Start w = finish 1 io err w # prog = 'SC'.compile prog | isError prog - # err = err <<< fromError prog <<< "\r\n" + # err = err <<< fromError prog = finish 1 io err w # f = f <<< fromOk prog # (_,w) = fclose f w @@ -136,10 +136,3 @@ where sleep i w = code inline { ccall sleep "I:I:A" } - -instance <<< (MaybeError e a) | <<< e & <<< a -where - <<< f (Ok a) = f <<< a - <<< f (Error e) = f <<< e - -instance <<< Error where <<< f e = f <<< toString e |