[Haskell-cafe] Need help with scrap-your-boilerplate

Michael Sperber sperber at deinprogramm.de
Thu Oct 2 13:17:08 UTC 2014


I'm a casual Haskell user, and am trying to use scrap-your-boilerplate
to write a transformation - and failing.  The rub is that the base
function is polymorphic, boiling down to this:

data Foo a = Foo a

bar :: Foo a -> Foo a
bar x = x

Now, I'm trying to use SYB like so:

foo :: Typeable a => a -> a
foo = mkT bar

... but I get:

    Could not deduce (Typeable a0) arising from a use of ‘mkT’
    from the context (Typeable a)
      bound by the type signature for foo :: Typeable a => a -> a
      at foo.hs:...
    The type variable ‘a0’ is ambiguous
    Note: there are several potential instances:

Is there any way I could make this work?

Any help would be much appreciated!

-- 
Regards,
Mike



More information about the Haskell-Cafe mailing list