So it seems that 
 (1) lift1 o x = MyNum (o x) 
Needed to be rewritten to 
(2)  lift1 o (MyNum x) = MyNum (o x) 
I am not sure  why the constructor is used on the LHS of (2)
Thanks for all your help.
Pat


On 2 October 2016 at 17:03, PATRICK BROWNE <patrick.browne@dit.ie> wrote:
Yes, I am running ghci 8.0.1.
Below, I have added the language pragmas suggested by the compiler
Regards,
Pat
.
{-#  LANGUAGE  MultiParamTypeClasses,FlexibleInstances,FlexibleContexts,UndecidableInstances #-}

data MyNumbers a = MyNum a deriving Show

class (Floating a) => Numbers a where
 sqr :: a -> a
 

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) 
 
instance (Floating (MyNumbers Float)) => Numbers (MyNumbers Float) where
  sqr x = lift1 sqr x  

On 2 October 2016 at 16:38, Francesco Ariis <fa-ml@ariis.it> wrote:
On Sun, Oct 02, 2016 at 03:54:07PM +0100, PATRICK BROWNE wrote:
> 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
>

I get different errors from yours (missing extension, Illegal
instance declaration). Can you paste the exact file you are
loading with ghci (because you are using ghci, right?)?
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners



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