I need to find the length of a trail in Haskell Diagrams.
I've found the function stdArcLength which seems to give me the length. I have no idea how I would convert this into an Int or a Double.
round and floor throws ambigoues errors. How should I go about converting this (N p) (which I don't what is) to a Double?
EDIT: Example and error.
I have a function called mkPathLength :: Int -> Int -> AnimationAttribute which I first try to call like so mkPathLength (stdArcLength l) 0. This gives the following error
Couldn't match expected type ‘Int’ with actual type ‘N p0’ The type variable ‘p0’ is ambiguous
Understandably, I can't pass it directly as an Int, so I try to round it. That gives me this error
Ambiguous type variable ‘p0’ arising from a use of ‘round’ prevents the constraint ‘(RealFrac (N p0))’ from being solved. Probable fix: use a type annotation to specify what ‘p0’ should be.
Providing a type annotation doesn't seem to work either, but I'm not entirely sure which parts it want me to annonate.
My file has the following extensions:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NegativeLiterals #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
EDIT v2 Removing "NoMonomorphismRestriction" has solved the issue. I don't even know what it does.