[Haskell-beginners] Problems with lifting code
PATRICK BROWNE
patrick.browne at dit.ie
Sun Oct 2 14:54:07 UTC 2016
Hi,
I am trying, without sucess, to run the code below from [1] (Section 4.3).
Obviouly I am missing something.
I would like to keep as close to the original code as possible.
Any help would be apreciated.
Regards,
Pat
[1] http://publik.tuwien.ac.at/files/pub-geo_2321.pdf
data MyNumbers a = MyNum a deriving Show
class (Floating a) => Numbers a where
sqr :: a -> a
-- Not sure if i need these
-- instance Num (MyNumbers a) where
-- instance Fractional (MyNumbers a) where
class Lifts b a where
lift0 :: a -> b a
lift1 :: (a -> a) -> b a -> b a
instance Lifts MyNumbers a where
lift0 x = MyNum x
lift1 o x = MyNum (o x) -- ** Couldn't match expected type `a' with
actual type `MyNumbers a' **
instance (Floating (MyNumbers Float)) => Numbers (MyNumbers Float) where
sqr x = lift1 sqr x -- ** could not deduce (Numbers Float) arising from
a use of `sqr' **
--
This email originated from DIT. If you received this email in error, please
delete it from your system. Please note that if you are not the named
addressee, disclosing, copying, distributing or taking any action based on
the contents of this email or attachments is prohibited. www.dit.ie
Is ó ITBÁC a tháinig an ríomhphost seo. Má fuair tú an ríomhphost seo trí
earráid, scrios de do chóras é le do thoil. Tabhair ar aird, mura tú an
seolaí ainmnithe, go bhfuil dianchosc ar aon nochtadh, aon chóipeáil, aon
dáileadh nó ar aon ghníomh a dhéanfar bunaithe ar an ábhar atá sa
ríomhphost nó sna hiatáin seo. www.dit.ie
Tá ITBÁC ag aistriú go Gráinseach Ghormáin – DIT is on the move to
Grangegorman <http://www.dit.ie/grangegorman>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20161002/b6a91873/attachment.html>
More information about the Beginners
mailing list