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

Erroneous type errors with higher-order functions #224

Open
jazullo opened this issue Aug 16, 2023 · 0 comments
Open

Erroneous type errors with higher-order functions #224

jazullo opened this issue Aug 16, 2023 · 0 comments

Comments

@jazullo
Copy link
Collaborator

jazullo commented Aug 16, 2023

Consider the following:

fix :: ((a -> b) -> a -> b) -> a -> b
fix f x = f (\y -> fix f y) x

fac :: Int -> Int
fac x = fix (\go n -> if n > 0 then n * go (n-1) else 1) x

This typechecks under GHC, but Gibbon yields the following error:

gibbon: arrIns: Not an arrow type: ForAll [] (MetaTv (Meta 23))
CallStack (from HasCallStack):
  error, called at src/Gibbon/L0/Syntax.hs:305:14 in gibbon-0.2-inplace:Gibbon.L0.Syntax

Note that fix can successfully typecheck on it's own, but typechecking it's application is bugged. I think this is an issue with higher-order functions in general rather than a fixpoint function specifically, another example of this would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant