Skip to content

Commit

Permalink
Reinstate check for erasure on type-level lambdas + add todo and test…
Browse files Browse the repository at this point in the history
… case
  • Loading branch information
jespercockx committed Mar 13, 2024
1 parent 1335c39 commit f73415a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Agda2Hs/Compile/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,12 @@ compileType t = do

Sort s -> return (Hs.TyStar ())

-- This case is only reachable for erased lambdas
Lam argInfo restAbs -> underAbstraction_ restAbs compileType
-- TODO: we should also drop lambdas that can be erased based on their type
-- (e.g. argument is of type Level/Size or in a Prop) but currently we do
-- not have access to the type of the lambda here.
Lam argInfo restAbs
| hasQuantity0 argInfo -> underAbstraction_ restAbs compileType
| otherwise -> genericDocError =<< text "Not supported: type-level lambda" <+> prettyTCM t

_ -> fail
where fail = genericDocError =<< text "Bad Haskell type:" <?> prettyTCM t
Expand Down
9 changes: 9 additions & 0 deletions test/Fail/TypeLambda.agda
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

module Fail.TypeLambda where

open import Haskell.Prelude

foo : (f : (Set Set) Set) (x : f (λ y Nat)) (y : f List) Nat
foo f x y = 42

{-# COMPILE AGDA2HS foo #-}
2 changes: 2 additions & 0 deletions test/golden/TypeLambda.err
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test/Fail/TypeLambda.agda:6,1-4
Not supported: type-level lambda λ y → Nat

0 comments on commit f73415a

Please sign in to comment.