suggestion: add a .ehs file type

Robin Bate Boerop robin_bb at acm.org
Wed Dec 12 16:47:32 EST 2007


Alex, Lennart's suggestion makes me think: Why not make SearchPath
into a preprocessor?  It could recognize a .ehs extension, and then do
some very simple preprocessing (adds pragmas according to user's
settings).

-- 
Robin Bate Boerop

On 22/11/2007, Lennart Augustsson <lennart at augustsson.net> wrote:
> Or use a preprocessor that inserts a LANGUAGE pragma. :)
>
> On Nov 22, 2007 9:14 AM, Simon Marlow <simonmarhaskell at gmail.com> wrote:
> >
> > Alex Jacobson wrote:
> >
> > > In any case, I'm pretty sure the correct answer is not 50 language
> > > pragmas with arbitrary spellings for various language features at the
> > > top of each source file.
> >
> > You probably won't like any of these, but there are many ways to avoid
> > writing out all the pragmas at the top of each file.
> >
> > 1. Use Cabal's extensions field.
> >
> > 2. Use CPP
> >
> > MyExtensions.h :
> >
> > {-# LANGUAGE TemplateHaskell, FlexibleInstances,
> >              OverlappingInstances, UndecidableInstances, CPP,
> >              ScopedTypeVariables, PatternSignatures, GADTs,
> >              PolymorphicComponents, FlexibleContexts,
> >              MultiParamTypeClasses, DeriveDataTypeable,
> >              PatternGuards #-}
> >
> > MyModule.hs:
> > {-# LANGUAGE CPP #-}
> > #include "MyExtensions.h"
> >
> > 3. Use a shell alias
> >
> > alias ghce='ghc -XTemplateHaskell -XFlexibleInstances ...'
> >
> > 4. use a script wrapper for GHC
> >
> > #!/bin/sh
> > exec ghc -XTemplateHaskell -XFlexibleInstances ... $*
> >
> > I'm sure there are more...
> >
> > Cheers,
> >        Simon
> >
> >
> >
> >
> > > -Alex-
> > >
> > > Simon Marlow wrote:
> > >> Alex Jacobson wrote:
> > >>> I'm fine with that as well.  I'm just opposed to being force to look
> > >>> up the precise names the compiler happens to use for each language
> > >>> extension I happen to use.  Having -fglasgow-exts turned on by
> > >>> default also works.
> > >>
> > >> -fglasgow-exts is a historical relic.  It's just an arbitrary
> > >> collection of extensions.  It doesn't contain all the extensions
> > >> provided by GHC, as many of them steal syntax and you probably don't
> > >> want them all on at the same time.  We're trying to move away from
> > >> -fglasgow-exts, which is why GHC 6.8.1 provides separate flags for all
> > >> the extensions we provide. Eventually we'll have a new standard
> > >> (Haskell' or whatever) that will collect many of the extensions
> > >> together, so you'll just have to write {-# LANGUAGE Haskell' #-}.
> > >>
> > >> Cheers,
> > >>     Simon


More information about the Glasgow-haskell-users mailing list