# Problem with basic example from diagrams-cairo

16 views

### Jorge Devoto

Dec 12, 2018, 11:19:57 AM12/12/18
to diagrams-discuss
Hi to everybody

I tried to compile the example

import Diagrams.Prelude
import Diagrams.Backend.Cairo.CmdLine

d = circle 1 # fc blue

main = mainWith (pad 1.1 d)

which appears in the diagrams-cairo documentation. I get these errors

Circle.hs:5:5:
No instance for (Ord n0) arising from a use of ‘circle’
The type variable ‘n0’ is ambiguous
Relevant bindings include
d :: QDiagram b0 V2 n0 m0 (bound at Circle.hs:5:1)
Note: there are several potential instances:
instance [safe] forall (k :: BOX)
(k1 :: BOX)
(k2 :: BOX)
(k3 :: BOX)
(p :: k -> k1 -> *)
(f :: k2 -> k)
(g :: k3 -> k1)
(a :: k2)
(b :: k3).
Ord (p (f a) (g b)) =>
Ord (Data.Bifunctor.Biff.Biff p f g a b)
-- Defined in ‘Data.Bifunctor.Biff’
instance [safe] forall (k :: BOX)
(k1 :: BOX)
(f :: k1 -> *)
(a :: k1)
(b :: k).
Ord (f a) =>
Ord (Data.Bifunctor.Clown.Clown f a b)
-- Defined in ‘Data.Bifunctor.Clown’
instance [safe] forall (k :: BOX) (p :: * -> k -> *) (a :: k).
Ord (p (Data.Bifunctor.Fix.Fix p a) a) =>
Ord (Data.Bifunctor.Fix.Fix p a)
-- Defined in ‘Data.Bifunctor.Fix’
...plus 320 others
In the first argument of ‘(#)’, namely ‘circle 1’
In the expression: circle 1 # fc blue
In an equation for ‘d’: d = circle 1 # fc blue

Circle.hs:5:12:
No instance for (Num n0) arising from the literal ‘1’
The type variable ‘n0’ is ambiguous
Relevant bindings include
d :: QDiagram b0 V2 n0 m0 (bound at Circle.hs:5:1)
Note: there are several potential instances:
instance Num n => Num (Data.Bytes.VarInt.VarInt n)
-- Defined in ‘Data.Bytes.VarInt’
instance Num a => Num (Measured n a)
-- Defined in ‘Diagrams.Core.Measure’
instance Num (f a) => Num (Point f a) -- Defined in ‘Linear.Affine’
...plus 102 others
In the first argument of ‘circle’, namely ‘1’
In the first argument of ‘(#)’, namely ‘circle 1’
In the expression: circle 1 # fc blue

Circle.hs:5:16:
No instance for (Data.Typeable.Internal.Typeable n0)
arising from a use of ‘fc’
In the second argument of ‘(#)’, namely ‘fc blue’
In the expression: circle 1 # fc blue
In an equation for ‘d’: d = circle 1 # fc blue

Circle.hs:7:8:
No instance for (diagrams-lib-1.3.0.8:Diagrams.Backend.CmdLine.Mainable
(QDiagram b0 V2 n0 m0))
arising from a use of ‘mainWith’
In the expression: mainWith (pad 1.1 d)
In an equation for ‘main’: main = mainWith (pad 1.1 d)

Circle.hs:7:18:
No instance for (Floating n0) arising from a use of ‘pad’
The type variable ‘n0’ is ambiguous
Note: there are several potential instances:
instance Floating a => Floating (Measured n a)
-- Defined in ‘Diagrams.Core.Measure’
instance Floating a => Floating (Linear.Plucker.Plucker a)
-- Defined in ‘Linear.Plucker’
instance RealFloat a => Floating (Linear.Quaternion.Quaternion a)
-- Defined in ‘Linear.Quaternion’
...plus 27 others
In the first argument of ‘mainWith’, namely ‘(pad 1.1 d)’
In the expression: mainWith (pad 1.1 d)
In an equation for ‘main’: main = mainWith (pad 1.1 d)

Circle.hs:7:22:
No instance for (Fractional n0) arising from the literal ‘1.1’
The type variable ‘n0’ is ambiguous
Note: there are several potential instances:
instance Fractional a => Fractional (Measured n a)
-- Defined in ‘Diagrams.Core.Measure’
instance Fractional (f a) => Fractional (Point f a)
-- Defined in ‘Linear.Affine’
instance Fractional a => Fractional (Linear.Plucker.Plucker a)
-- Defined in ‘Linear.Plucker’
...plus 37 others
In the first argument of ‘pad’, namely ‘1.1’
In the first argument of ‘mainWith’, namely ‘(pad 1.1 d)’
In the expression: mainWith (pad 1.1 d)

What am i doing wrong?

Thanks for any help

Jorge