Closed geraldus closed 10 years ago
Resolving type aliases in the FFI hasn't been implemented yet, #185.
On Thu, Jan 9, 2014 at 11:04 PM, Артур Файзрахманов < notifications@github.com> 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/faylang/fay/issues/380 .
I'll close this in favor of that ticket, please subscribe to that one for updates.
Hello buddies! Sorry if I stupid and annoying. Consider following code, which works:
I have small helper:
Every time before I use it I must be sure if value is not
Null
. That's not big deal.When I
snap
ing back a real object but notNull
then it is OK to pass the result tofromNullable
and unwrapFragment
.Then I wanted to make my code a bit cleaner and finished with this:
But this time I'm getting a runtime exception unfortunately, because in this case I could not pattern match
(Nullable smth)
anymore.Is this a bug or just another not implemented feature?