Subject: Re: [Hat] How to use Control.Monad.State?
From: Larry Evans <[email-masked]>
To: "Hat, the Haskell tracing system" <[email-masked]>
Date: Mon, 10 Nov 2008 11:30:21 -0600
List-Id: "Hat, the Haskell tracing system" <hat.haskell.org>

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

{- 
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)

_______________________________________________
Hat mailing list
[email-masked]
http://www.haskell.org/mailman/listinfo/hat