GrammaticalFramework / gf-core

Grammatical Framework core: compiler, shell & runtimes
https://www.grammaticalframework.org
Other
129 stars 35 forks source link

Add flag for making Haskell export PGF2 compatible #90

Closed johnjcamilleri closed 3 years ago

johnjcamilleri commented 3 years ago

(This is mostly a TODO for my future self).

Currently gf --make --output-format=haskell produces something starting with this:

{-# OPTIONS_GHC -fglasgow-exts #-}
{-# LANGUAGE GADTs #-}
module AbstractName where

import Control.Monad.Identity
import Data.Monoid
import PGF hiding (Tree)

I want to make two additions.

  1. A --haskell=pgf2 flag which instead produces this preamble:
    
    import Control.Monad.Identity
    import PGF2 hiding (Tree)

showCId :: CId -> String showCId = id

2. A `--haskell=module:A.B.C` which produces this module declaration:
```haskell
module A.B.C where

and names the file itself C.hs

johnjcamilleri commented 3 years ago

A --haskell=module:A.B.C which produces this module declaration: module A.B.C where and names the file itself C.hs

Turns out this is already available via the --name=A.B.C flag (although the resulting file is name A.B.C.hs, but I can live with that).