Skip to content

Commit

Permalink
Document difference between {..} and (..) errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanMartinez committed Nov 27, 2018
1 parent 58bc4d9 commit cfc307f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions 21-Hello-World/04-Debugging/src/01-General-Debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,28 @@ In the following error...

Why? Because [the compiler uses a mixture of unification and type inference to check types](https://github.com/purescript/purescript/issues/3111#issuecomment-335596641). See [purescript/purescript#3399](https://github.com/purescript/purescript/issues/3399) for more information.

## Distinguishing the Difference between `{...}` and `(...)` errors

(thomashoneyman recommended I document this. These examples might be incorrect since I am not fully aware of the comment that garyb made, but the general idea still applies.)

Recall that `{ label :: Type }` is syntax sugar for `Record (label :: Type)`

So, the below error means a `Record` could not unify with some other type:
```
Could not match type
{ label :: Type }
with type
String
```

Whereas the below error means a `Record` was the correct type, but some of its label-type associations were missing.
```
Could not match type
Record (label :: Type)
with type
Record (label :: Type, forgottenLabel :: OtherType)
```

## Type Directed Search

Otherwise known as "typed holes."
Expand Down

0 comments on commit cfc307f

Please sign in to comment.