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

Impossible Sat instance #24

Open
GoogleCodeExporter opened this issue Mar 14, 2015 · 0 comments
Open

Impossible Sat instance #24

GoogleCodeExporter opened this issue Mar 14, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

[Reported by Tillmann Rendel]

Hi again,

unfortunately, the version with nested quotes via type-level naturals does not
work out for me (GHC 7.0.3). The attached code leads to a non-terminating
type-level computation, where Alpha (T (S ... (S a) ... )) is considered for
more and more S. Maybe somehow related to the reification of the Alpha
dictionaries?

(I am also not sure how to define the Subst instance for T, but I would have
figured something out, I guess).

  Tillmann

[-- Attachment #2: staging.lhs --]
[-- Type: text/plain, Encoding: 7bit, Size: 0.6K --]

> {-# LANGUAGE TemplateHaskell
>            , UndecidableInstances
>            , ScopedTypeVariables
>            , FlexibleInstances
>            , MultiParamTypeClasses
>            , GADTs
>            , StandaloneDeriving
>            , Rank2Types
>   #-}
>
> module UnboundStaged where
>
> import Unbound.LocallyNameless

> data Z
> data S n
>
> type N a = Name (T a)
>
> data T a where
>   App :: T a -> T a -> T a
>   Lam :: Bind (N a) (T a) -> T a
>   Var :: N a -> T a
>   Quo :: T (S n) -> T n
>   Spl :: T n -> T (S n)
> deriving instance Show (T a)

> instance Rep a => Alpha (T a)
>

This seems to be a bug in GHC 7.0.x (the 7.0 series had several bugs
relating to inferring dictionaries).  Under GHC 7.2.1 the code
compiles fine.  Unfortunately, it seems it also tickles a bug in our
code to support GADTs:

    *UnboundStaged> fv ((Quo (lam "x" (Spl (var "x")))) :: T Z) :: [N Z]
    *** Exception: Impossible Sat instance!

Original issue reported on code.google.com by [email protected] on 19 Sep 2012 at 4:09

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

1 participant