Skip to content

Documented declConflict errors #281

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

Merged
merged 2 commits into from
Sep 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions errors/DeclConflict.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
# `DeclConflict` Error

## Example

Each of these pairs will fail with a DeclConflict error.
```purescript
module ShortFailingExample where
module Main where

data T = Fail | Fail

data T1 = Fail1
data T2 = Fail1

...
class Fail2
data T3 = Fail2
```

## Cause

Explain why a user might see this error.
This error occurs when a data constructor, type, or type class conflicts with another data constructor, type, or type class.

## Fix
This can be fixed by using non-conflicting names or by putting conflicting names into a separate module. Then, if the names are later used together in a module they can be distinguished via a qualified import:
```purescript
module Main where

import Module1 as Module1 -- includes: data Works = Works
import Module2 as Module2 -- includes: data Works = Works

- Suggest possible solutions.
x :: Module1.Works
x = Module1.Works

## Notes
y :: Module2.Works
y = Module2.Works
```

- Additional notes.