I asked previously about an internal error that occured in the version of
Hugs98 
that I compiled myself. I solved my problems by downloading precompiled
binaries.

My programs worked fine with these precompiled binaries, but 
now I managed to write something which causes internal error in
the precompiled interpreter. The code is at the end of message. 
It is the rApply method makes the problems. My intention with rApply was to
implement call-by-name application in a modular interpreter. I tried to
write it without anotations first, but the typechecker complains. So I put
anotations and got the internal error:
__   __ __  __  ____   ___      _________________________________________
||   || ||  || ||  || ||__      Hugs 98: Based on the Haskell 98 standard
||___|| ||__|| ||__||  __||     Copyright (c) 1994-1999
||---||         ___||           World Wide Web: http://haskell.org/hugs
||   ||                         Report bugs to: [EMAIL PROTECTED]
||   || Version: February 2000  _________________________________________

Hugs mode: Restart with command line option +98 for Haskell 98 mode

Reading file "e:\lang\hugs98\lib\Prelude.hs":
Reading file "main.hs":
Type checking
INTERNAL ERROR: findBtyvsInt
Prelude>

I started Hugs with a batch file:

@echo off
set HUGSPATH=e:\lang\hugs98\lib;e:\lang\hugs98\lib\exts;e:\lang\hugs98\lib\hugs
set EDITOR=uedit32 +s
e:\lang\hugs98\hugs.exe -P%HUGSPATH% -E%EDITOR% -98 +o -c100 %1 %2

The same happens on my friend's machine. I'm using Windows97, and he uses 
Windows98. Would you be so kind and try the short program bellow on your
version of interpreter for the start? I have tried many other programs in
this interpreter
and they worked fine. My version is from February 2000.

[The problematic code follows]
---------------------------------------------------------------------
module Main where

class Subtype sub sup where
  inj :: sub -> sup
  prj :: sup -> Maybe sub

class Monad m => EnvMonad e m where
  rdEnv :: m e
  inEnv :: e -> m a -> m a

mprj :: (Monad m, Subtype sub sup) => m sup -> m sub
mprj ma = do x <- ma
             case prj x of
               Just a  -> return a
               Nothing -> error "Projection failed"

newtype FMap a b = FM {unFM :: [(a,b)]}

class (EnvMonad (FMap String (m dom)) m, 
       Subtype (m dom -> m dom) dom) 
    => Reflexive dom m where
  rApply :: m dom -> m dom -> m dom

instance (EnvMonad (FMap String (m dom)) m,
          Subtype (m dom -> m dom) dom) 
          => Reflexive dom m where
{- This does not type check
  rApply mf mx = do f <- mprj mf
                    env <- rdEnv
                    f (inEnv env mx)   
-}
  -- I tried to help the type checker, but all i got was
  -- INTERNAL ERROR: findBtyvsInt
  rApply mf mx = do (f :: m a -> m a) <- mprj mf
                    (env :: FMap String (m dom)) <- rdEnv
                    f (inEnv env mx)
-- end of module Main ---------------------------------------------


Reply via email to