From 9fbd2406895733fe6a32e2f5e35cca66e4030fe6 Mon Sep 17 00:00:00 2001 From: Antti Rasinen Date: Wed, 1 Jul 2015 10:30:40 +0300 Subject: [PATCH] Add example of Float / Int confusion when type signature is present In this example, Elm has a conflict between Int and Float. However, the type signature contains an Int and a Float. Based on the error message below, I can not understand what Elm thinks is the definition and which Float or Int is incorrect. The type annotation for `ngon2` does not match its definition. 3| ngon2 : Float -> Int -> Shape As I infer the type of values flowing through your program, I see a conflict between these two types: Int Float --- type-definition-mismatch.elm | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 type-definition-mismatch.elm diff --git a/type-definition-mismatch.elm b/type-definition-mismatch.elm new file mode 100644 index 0000000..8b1b18b --- /dev/null +++ b/type-definition-mismatch.elm @@ -0,0 +1,9 @@ +import Graphics.Collage exposing (..) + +ngon2 : Float -> Int -> Shape +ngon2 f r = + let + n = truncate f + in + ngon n r +