agda2hs icon indicating copy to clipboard operation
agda2hs copied to clipboard

module exports list

Open jmchapman opened this issue 4 years ago • 5 comments

jmchapman avatar Dec 10 '20 12:12 jmchapman

The naive solution would be to always generate an export list and add all public definitions that we compiled to it. The problem is that you might have FOREIGN blocks with functions that you also want to export, or when you want to reexport things from other modules.

Possible solution:

{-# FOREIGN AGDA2HS export (foo, bar, module Bla) #-}

The question is whether we should populate the export list with public definitions we know about or require the user to be explicit about everything that should be exported. If the former we probably want a

{-# FOREIGN AGDA2HS export all #-}

to say that you don't want an export list.

UlfNorell avatar Dec 10 '20 13:12 UlfNorell

Is there a use-case where you'd want to not export a function in Haskell but you'd be happy to export it in Agda? Otherwise using private blocks as a way to remove things from the export list seems sensible.

gallais avatar Dec 10 '20 13:12 gallais

You might want to export a lemma about a function to other modules so it can be used for further proofs about that function.

EDIT: I realized these would anyway not be translated to Haskell, so never mind. Using private makes perfect sense.

jespercockx avatar Dec 10 '20 14:12 jespercockx

"whether we should populate the export list with public definitions we know about"

Would this also include known definitions which are being re-exported from other modules?

dxts avatar Jun 16 '21 16:06 dxts

Would this also include known definitions which are being re-exported from other modules?

Only if these are public on the Agda side, presumably.

jespercockx avatar Oct 23 '23 11:10 jespercockx