Skip to content
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

type synonyms #12

Closed
abau opened this issue Apr 17, 2013 · 2 comments
Closed

type synonyms #12

abau opened this issue Apr 17, 2013 · 2 comments

Comments

@abau
Copy link
Owner

abau commented Apr 17, 2013

Support type synonyms, so we can write:

type Foo = Bar
data Spam = Spam Foo

Possible implementation: expand type synonyms in Template Haskell frontend.

@jwaldmann
Copy link
Collaborator

Yes. that would be convenient for writing (documenting) constraint programs.

Implementation should be easy (and needs no expansion)?

  • ignore type synonyms when generating code (you do type inference anyway)
  • copy the type synonym declarations verbatim (for the "original" code that is used for testing at the end)

@abau
Copy link
Owner Author

abau commented May 22, 2013

you do type inference anyway

But type inference fails with type synonyms.

data Bool = False | True
type Foo   = Bool
data Maybe = Just Foo | Nothing
main x = case x of
  Just b     -> b
  Nothing -> False

gives

No unifier found for 'Foo' and 'Bool'

Anyway, I implemented synonym expansion in TH frontend (cf. 60c8dba). It's supposed to work with both non-parametrized synonyms

type Foo = ....

and parametrized synonyms

type Foo x = ... x ....

@abau abau closed this as completed May 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants