Newcomer's issue with Halogen class property

halogen
#1

Hi,
I’m starting to try to use PureScript. I have a problem while trying to add a class property to a span item. Here’s my function:

htmlifyInterpr :: forall p i. Interpretation -> Array (HTML p i)
htmlifyInterpr (INT _ False str) = [ HH.span_ [HP.class_ (HH.ClassName “omitted”)] [ HH.text str] ]

And here’s the compilation error:

htmlifyInterpr (INT _ False str) = [ HH.span_ [HP.class_ (HH.ClassName “omitted”)] [ HH.text str] ]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Could not match type

IProp

with type

HTML

while trying to match type IProp
( class :: String
| t2
)
with type HTML t0
while checking that expression (apply class_) (ClassName “omitted”)
has type HTML t0 t1
in value declaration htmlifyInterpr

The examples I’ve found on internet seem quite similar with my function, I really didn’t find what I did wrong.
All the best.

#2

You want HH.span rather than HH.span_. The underscore’d version doesn’t accept a props/attrs array.

1 Like