Re: [Haskell-cafe] AlternativePrelude extension

2010-01-16 Thread Sjur Gjøstein Karevoll
Laurdag 16. januar 2010 22.40.17 skreiv Malcolm Wallace:
> > I'm thinking the syntax would be something like
> > AlternativePrelude="MyPrelude".
> 
> There is a general principle that the semantics of a program should be
> completely described by the source code itself, and not dependent on
> options that may or may not be specified elsewhere.  Hence, the idea
> of adding {-# LANGUAGE #-} pragmas, so that the source code is self-
> contained.
> 
> Specifying {-# LANGUAGE NoImplicitPrelude #-} together with "import
> MyPrelude" satisfies this principle, as does {-# LANGUAGE
> AlternativePrelude="MyPrelude" #-} in all files where it matters.  But
> the difference in usability is slight.
> 
> If you are suggesting that {-# LANGUAGE AlternativePrelude="MyPrelude"
> #-} should somehow escape the scope of the module it appears in, then
> I think we heading for less firm ground.
> 
> Regards,
>  Malcolm
> 
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 

Having a LANGUAGE pragma, or indeed any pragma, escape the module it's used in 
would be pretty silly, wouldn't it?

In principle I'm a fan of the LANGUAGE pragmas. Self-contained source is 
usually much easier to read that source that depends on whatever command the 
author used to build the thing.

However, the option to set language extension globally is still available, 
either as an option to the compiler when building, or in the cabal file 
describing the package. Allowing an alternative prelude in this fashion makes 
it easier to switch out the standard for alternatives in existing projects 
just to see what might happen, how things are changed or just for giggles. It 
might not be advisable to do so in code you plan on unleashing on the world, 
but it would make experimenting with alternatives cheaper than it currently 
is.

-- 
Sjur Gjøstein Karevoll
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] AlternativePrelude extension

2010-01-16 Thread Malcolm Wallace

I'm thinking the syntax would be something like
AlternativePrelude="MyPrelude".


There is a general principle that the semantics of a program should be  
completely described by the source code itself, and not dependent on  
options that may or may not be specified elsewhere.  Hence, the idea  
of adding {-# LANGUAGE #-} pragmas, so that the source code is self- 
contained.


Specifying {-# LANGUAGE NoImplicitPrelude #-} together with "import  
MyPrelude" satisfies this principle, as does {-# LANGUAGE  
AlternativePrelude="MyPrelude" #-} in all files where it matters.  But  
the difference in usability is slight.


If you are suggesting that {-# LANGUAGE AlternativePrelude="MyPrelude"  
#-} should somehow escape the scope of the module it appears in, then  
I think we heading for less firm ground.


Regards,
Malcolm

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] AlternativePrelude extension

2010-01-15 Thread Sjur Gjøstein Karevoll
Here's an idea I'd like to air:

A new extension called AlternativePrelude. Like the NoImplicitPrelude 
extension we have already, this would disable implicitly importing the Prelude 
in every other module, but would also implicitly import a substitute.

The purpose is to make it easier to play around with alternative preludes. 
Today we have to specify NoImplicitPrelude, but also explicitly import our 
alternative everywhere, making the transition between the different preludes 
that much more painful. With this new extension, the alternative prelude can 
be specified in the cabal file, or on the command line when building. This will 
hopefully make the alternative prelude efforts a little bit more mainstream, 
giving us more data we can use to consider modifications to the current 
standard prelude.

I'm thinking the syntax would be something like 
AlternativePrelude="MyPrelude". This is new among the extensions in that it 
requires a parameter.

An alternative is an ImplicitImport extension that doesn't disable the 
implicit importing of the Prelude, but while this does serve the same purpose 
as the AlternativePrelude proposal, I think it might be easier to use it for 
nefarious purposes.

--
Sjur Gjøstein Karevoll
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe