I am playing with Elm time example and trying to add more hands. To do it I extract code for hand like this:
view : Model -> Html Msg
view model =
let
angle =
turns (Time.inMinutes model.time)
in
svg [ viewBox "0 0 100 100", width "300px" ]
[ circle [ cx "50", cy "50", r "45", fill "#0B79CE" ] []
, clockHand angle "#023963"
]
clockHand: Float -> String -> Svg -- PROBLEM HERE
clockHand angle color =
let
handX =
toString (50 + 40 * cos angle)
handY =
toString (50 + 40 * sin angle)
in
line [ x1 "50", y1 "50", x2 handX, y2 handY, stroke color ] []
It works ok without the type declaration for clockHand
, but when I add it - compiler returns me this:
-- TOO FEW ARGUMENTS -----------------------------------------------------------
Type Svg.Svg has too few arguments.
80| clockHand: Float -> String -> Svg
^^^
Expecting 1, but got 0.
Documentation for line tells that it has type
line : List Attribute -> List Svg -> Svg
Just as I was expecting. What did I miss here? What is the correct type? What arguments it is expecting?