У меня PureScript 0.8.2. В PureScript Halogen функция component
имеет сигнатуру:
component :: forall s f g. ComponentSpec s f g -> Component s f g
куда
-- | A spec for a component.
type ComponentSpec s f g =
{ render :: s -> ComponentHTML f
, eval :: Natural f (ComponentDSL s f g)
}
Итак, component
ожидает записи. Но в проекте шаблона Halogen component
вызывается следующим образом:
ui = component render eval
Я смотрю на две разные функции component
? или аргументы, разделенные пробелом, преобразуются в запись? Итак, я попробовал следующее в psci
:
> type Point = { x :: Int, y :: Int }
> let
addP :: Point -> Int
addP p = p.x + p.y
> addP {x: 4, y: 5 }
9
> addP 4 5
Error found:
in module $PSCI
at line 1, column 1 - line 1, column 8
Could not match type
{ x :: Int
, y :: Int
}
with type
Int
....