agda / agda2hs

Compiling Agda code to readable Haskell

Home Page:https://agda.github.io/agda2hs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Internal error with erased module parameter and 'where' function

jespercockx opened this issue · comments

The following file produces an internal error when given to agda2hs:

module ReduceBug {@0 name  : Set} where

postulate 
  Term : Set  Set

reduce : Term name  Term name
reduce v = go v
  where postulate
    go : Term name  Term name

{-# COMPILE AGDA2HS reduce #-}

The error message:

An internal error has occurred. Please report this as a bug.
Location of the error: __IMPOSSIBLE__, called at src/full/Agda/TypeChecking/Substitute.hs:230:38 in Agda-2.6.4.1-8d2624b65fdd0db0ceced7a4414cd73aa757a2fddd00ce30a24ac87f9baa99a8:Agda.TypeChecking.Substitute

and the last debug output before it dies:

Compiling function:  ReduceBug.go
Compiling top-level type {@0 name = name₁ : Set} (v : Term name₁) →
                         Term name₁ → Term name₁
Getting telescope for ReduceBug._
Current context:  [(v, Term v), {(name₁, Set)}, {(name, Set)}]
Context arguments:  [{_}, {_}, v]
Module section:  {@0 name = name₂ : Set} (v₁ : Term name₂)

@flupe You added the support for erased module parameters. I looked at the code for compileTopLevelType but could not really make sense of it. Could you please take a look?