We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Consider the following contrived example, which is a (much) reduced form of a real application:
{-# LANGUAGE NoImplicitPrelude #-} module List where import Prelude import FFI data Foo = Foo list :: ([Int] -> Fay ()) -> Fay () list = listFFI listFFI :: (Automatic a -> Fay ()) -> Fay () listFFI = ffi "(function(f){f([])})(%1)" foo :: (Foo -> Fay ()) -> Fay () foo = fooFFI fooFFI :: (Automatic a -> Fay ()) -> Fay () fooFFI = ffi "(function(f){f({instance:'Foo'})})(%1)" main :: Fay () main = do foo $ \x -> case x of Foo -> putStrLn "Foo worked" _ -> error "Foo: should never be reached" list $ \ints -> do print ints case ints of [] -> putStrLn "Empty list" _:_ -> putStrLn "Non-empty list" _ -> error "List: should never be reached"
I believe both listFFI and fooFFI are correct in their usage of Automatic in the type signature. However, as presented, the code error with:
Foo worked [] node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ List: should never be reached
On the other hand, if I remove the Automatic from both locations, I get:
Automatic
node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ Foo: should never be reached
I believe the only workaround is to wrap up lists in a data constructor, but that's quite a hack.
The text was updated successfully, but these errors were encountered:
See #251.
Sorry, something went wrong.
This was fixed in 0.15.
No branches or pull requests
Consider the following contrived example, which is a (much) reduced form of a real application:
I believe both listFFI and fooFFI are correct in their usage of Automatic in the type signature. However, as presented, the code error with:
On the other hand, if I remove the
Automatic
from both locations, I get:I believe the only workaround is to wrap up lists in a data constructor, but that's quite a hack.
The text was updated successfully, but these errors were encountered: