Hi All,
This is the error I’m getting:
elm-test-rs 3.0.0 for elm 0.19.1
--------------------------------
-- TYPE MISMATCH --------------------------------- /tmp/solution/tests/Tests.elm
This function cannot handle the argument sent through the (|>) pipe:
88| { name = "", coach = Coach "" True, stats = Stats 1 0, someOtherField = "" }
89| |> rootForTeam
^^^^^^^^^^^
The argument is:
{ coach : Int -> Coach
, name : String
, someOtherField : String
, stats : Stats
}
But (|>) is piping it to a function that expects:
{ coach : Int -> Coach
, name : String
, someOtherField : String
, stats : { a | false : comparable, losses : Int, wins : comparable }
}
Here’s my attempt:
module Bandwagoner exposing (..)
-- TODO: please define a type alias for the 'Coach' record
type alias Coach =
{ name: String
, formerPlayer: Bool
, losses: Int
}
-- TODO: please define the 'Stats' record
type alias Stats =
{
wins: Int
, losses: Int
}
-- TODO: please define the 'Team' record
type alias Team =
{ name: String
, coach: Coach
, stats: Stats
}
replaceCoach newCoach team =
-- Debug.todo "Please implement this function"
{team | coach = newCoach}
createTeam name stats coach =
-- Debug.todo "Please implement this function"
Team name coach stats
-- TODO: use an extensible record to accept any record that has a `stats: Stats` field
-- TODO: use pattern matching in the function parameter to get the `stats` field from the record
rootForTeam team =
--Debug.todo "Please implement this function, try to pattern match in the function parameter"
team.stats.wins > team.stats.false
any hints?
Thanks