Re: [Haskell-cafe] mueval, interpreter options

2013-04-02 Thread Gwern Branwen
On Tue, Apr 2, 2013 at 1:34 PM, Johannes Waldmann <
waldm...@imn.htwk-leipzig.de> wrote:

> I don't understand mueval's design anyway here:
> do the interpreter options mean that these are automatically on,
> or just that the source text will be allowed to switch then on?
> (I'd prefer the latter.)
>

I'm not clear on what you're doing there (I don't recognize your snippet),
but extensions are enabled as options:

  -X EXTENSION   --extension=EXTENSIONPass additional flags enabling
extensions just like you would to ghc. Example: -XViewPatterns

So for example:

$ mueval -e "let f (id -> x) = x in f 1" -XViewPatterns
 1
$ mueval -e "let f (id -> x) = x in f 1" -XMultiParamTypeClasses
 Illegal view pattern:  id -> x
 Use -XViewPatterns to enable view patterns

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


[Haskell-cafe] mueval, interpreter options

2013-04-02 Thread Johannes Waldmann
What am I missing? 

I want to use mueval to read a file
that contains "instance Serial m a => Serial m (Tree a)"

(as in
http://hackage.haskell.org/packages/archive/smallcheck/1.0.2/doc/html/Test-SmallCheck-Series.html)

so I put in my call of mueval: 

let Right opts = M.interpreterOpts []
keepCurrentDir $ do
System.Directory.setCurrentDirectory d
I.runInterpreter $ Mueval.Interpreter.interpreter $ opts
{ M.timeLimit = 10 -- seconds?
, M.modules = Just [ "Prelude"
, "Test.SmallCheck.Drivers", "Test.SmallCheck.Series"
, "GHC.Generics" ]
, M.namedExtensions = [ "MultiParamTypeClasses"
  , "FlexibleInstances", "DeriveGeneric" ]
   

but it gives me "MultiParamTypeClasses is not enabled" on inputs like

{-# language MultiParamTypeClasses #-}

import  Test.SmallCheck.Series
import GHC.Generics

data Tree a = Null | Fork (Tree a) a (Tree a)
deriving Generic

instance Serial m a => Serial m (Tree a) where


I don't understand mueval's design anyway here:
do the interpreter options mean that these are automatically on,
or just that the source text will be allowed to switch then on?
(I'd prefer the latter.)


Thanks - J.W.


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