Re: How to use Control.Monad.State?
Larry Evans <[email protected]> Mon, 10 Nov 2008 11:30:21 -0600
| Newsgroups | gmane.comp.lang.haskell.hat |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--------------070909010708020103090100
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
On 11/10/08 07:37, Larry Evans wrote:
[snip]
> But the compiler then says it can't find the library.
>
> What should I do to debug this code with hat?
> TIA
>
From reading section 2 of:
http://www.haskell.org/hat/hatuser.html
I tried just using hmake; however, my hmake didn't understand -ghc.
So I just rm'ed the compiler option, but when the attached
tickSimple.hs was compiled, I got:
{---cut here---
make hat
hmake -hat -P/usr/lib/haskell-packages/ghc6/lib/hat-2.05/ghc-6.8.2/Hat
-XMultiParamTypeClasses -XFunctionalDependencies -XFlexibleInstances
tickSimple
hat-trans -P/usr/lib/haskell-packages/ghc6/lib/hat-2.05/ghc-6.8.2/Hat
tickSimple.hs
Wrote Hat/tickSimple.hs
/usr/bin/haskell-compiler -XMultiParamTypeClasses
-XFunctionalDependencies -XFlexibleInstances
-i/usr/lib/haskell-packages/ghc6/lib/hat-2.05/ghc-6.8.2/Hat -c -package
hat -o Hat/tickSimple.o Hat/tickSimple.hs
Hat/tickSimple.hs:4:0:
Bad interface file:
/usr/lib/haskell-packages/ghc6/lib/hat-2.05/ghc-6.8.2/Hat/Prelude.hi
Something is amiss; requested module main:Prelude differs from
name found in the interface file hat-2.5:Hat.Prelude
make: *** [hat] Error 1
}---cut here---
Please, how do I get hat to work with tickSimple.hs?
-regards,
Larry
--------------070909010708020103090100
Content-Type: text/x-haskell;
name="tickSimple.hs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="tickSimple.hs"
{-
Purpose:
Trace the the tick example Examples section of:
http://hackage.haskell.org/packages/archive/mtl/latest/doc/html/Control-Monad-State.html#4
-}
module Main where
import Control.Monad.State
tick :: State Int Int
tick = do n <- get
put (n+1)
return n
plusOne :: Int -> Int
plusOne n = execState tick n
plus :: Int -> Int -> Int
plus n x = execState (sequence $ replicate n tick) x
main = do
print (plusOne 2)
print (plus 2 3)
--------------070909010708020103090100
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Hat mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/hat
--------------070909010708020103090100--