Restricted Data Types: A reformulation

Ashley Yakeley ashley at semantic.org
Wed Feb 8 01:49:53 EST 2006


In article <20060208043444.GI4014 at momenergy.repetae.net>,
 John Meacham <john at repetae.net> wrote:

> Ah. I think I see the objection now. Will have to think about it some.

Here's a simpler example:

  class HasInt a where
      getInt :: a -> Int
  instance HasInt Int where
      getInt = id

  newtype HasInt a => T a = T Int a

  instance Monad T where     -- problem
      return a = T (getInt a) a
      (T i _) >> (T _ b) = T i b

  foo :: (Monad m) => m Int
  foo = (return True) >> (return 3)

  fooT :: T Int
  fooT = foo

-- 
Ashley Yakeley, Seattle WA



More information about the Haskell-prime mailing list