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

Issue with type = ... and pattern matching #380

Closed
geraldus opened this issue Jan 9, 2014 · 2 comments
Closed

Issue with type = ... and pattern matching #380

geraldus opened this issue Jan 9, 2014 · 2 comments

Comments

@geraldus
Copy link

geraldus commented Jan 9, 2014

Hello buddies! Sorry if I stupid and annoying.
Consider following code, which works:

I have small helper:

fromNullable :: Nullable a -> a
fromNullable (Nullable smth) = smth

Every time before I use it I must be sure if value is not Null. That's not big deal.

snap :: String -> Fay (Nullable Fragment)
snap = ffi "Snap(%1);"

When I snaping back a real object but not Null then it is OK to pass the result to fromNullable and unwrap Fragment.

Then I wanted to make my code a bit cleaner and finished with this:

type NullFragment = Nullable Fragment
snap :: String -> Fay NullFragment

But this time I'm getting a runtime exception unfortunately, because in this case I could not pattern match (Nullable smth) anymore.

Uncaught unhandled case in fromNullable

Is this a bug or just another not implemented feature?

@bergmark
Copy link
Member

Resolving type aliases in the FFI hasn't been implemented yet, #185.

On Thu, Jan 9, 2014 at 11:04 PM, Артур Файзрахманов <
[email protected]> wrote:

Hello buddies! Sorry if I stupid and annoying.
Consider following code, which works:

I have small helper:

fromNullable :: Nullable a -> a
fromNullable (Nullable smth) = smth

Every time before I use it I must be sure if value is not Null. That's
not big deal.

snap :: String -> Fay (Nullable Fragment)
snap = ffi "Snap(%1);"

When I snaping back a real object but not Null then it is OK to pass the
result to fromNullable and unwrap Fragment.

Then I wanted to make my code a bit cleaner and finished with this:

type NullFragment = Nullable Fragment
snap :: String -> Fay NullFragment

But this time I'm getting a runtime exception unfortunately, because in
this case I could not pattern match (Nullable smth) anymore.

Uncaught unhandled case in fromNullable

Is this a bug or just another not implemented feature?


Reply to this email directly or view it on GitHubhttps://github.com//issues/380
.

@bergmark
Copy link
Member

I'll close this in favor of that ticket, please subscribe to that one for updates.

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