Skip to content

No instance for Show (ejercicio mcm) #3

@flbulgarelli

Description

@flbulgarelli

Hay un problema con el ejercicio de mcm.

El mcm definido así:

mcm a b = (a * b) / (gcd a b)

Arroja el siguiente error:

ム mcm 2 4

/tmp/compilation58:5:15:
No instance for (Show s0) arising from a use of ‘show’
The type variable ‘s0’ is ambiguous
Note: there are several potential instances:
instance Show Double -- Defined in ‘GHC.Float’
instance Show Float -- Defined in ‘GHC.Float’
instance (Integral a, Show a) => Show (GHC.Real.Ratio a)
-- Defined in ‘GHC.Real’
...plus 25 others
In the second argument of ‘(.)’, namely ‘show’
In the expression: putStr . show
In the expression: putStr . show $ mcm 2 4

/tmp/compilation58:5:22:
No instance for (Integral s0) arising from a use of ‘mcm’
The type variable ‘s0’ is ambiguous
Note: there are several potential instances:
instance Integral Int -- Defined in ‘GHC.Real’
instance Integral Integer -- Defined in ‘GHC.Real’
instance Integral GHC.Types.Word -- Defined in ‘GHC.Real’
In the second argument of ‘($)’, namely ‘mcm 2 4’
In the expression: putStr . show $ mcm 2 4
In an equation for ‘main’: main = putStr . show $ mcm 2 4

/tmp/compilation58:5:26:
No instance for (Num s0) arising from the literal ‘2’
The type variable ‘s0’ is ambiguous
Note: there are several potential instances:
instance Num Double -- Defined in ‘GHC.Float’
instance Num Float -- Defined in ‘GHC.Float’
instance Integral a => Num (GHC.Real.Ratio a)
-- Defined in ‘GHC.Real’
...plus three others
In the first argument of ‘mcm’, namely ‘2’
In the second argument of ‘($)’, namely ‘mcm 2 4’
In the expression: putStr . show $ mcm 2 4

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions