DocRef type for easy navigation in code base


I am writing a Halogen app. There is a route type with data constructors for every page.
This type tend to be big and I would like to have clickable refs to corresponding page modules to get smooth codebase surfing experience.

import Type.Proxy
type ProxyFormFromModuleFoo = Proxy FormFromModuleFoo

data Route 
  = Home (Proxy JustTypeForRef) 
  | Login (Proxy LoginForm)

The type is not used in production code.
There is a few issues with that:

  • cycle appears, because route module is imported by all page modules (language server supports looped modules now - clicking working in vscode)
  • unused declaration warning

a special version of Proxy (e.g. DocRef) with tuned semantic would help - field is removed at translation phase (i.e. not presented in JS generated code) and compiler allows cycles for modules importing just “Proxied” types

module A
import B (JustRefB)
import Prelude
import Type.DocRef

data Foo = Foo Int (DocRef JustRefB)
module B
import A (Foo)
import Prelude

type JustRefB = Unit

newtype Bar = Bar Foo