Replies: 6 comments
-
An added bonus of this also lets us write things like [ if foo then class_ "foo bar" else mempty ] (Even better if we had |
Beta Was this translation helpful? Give feedback.
-
Interesting. I like the surface level syntax of this: div_ [ class_ "flex flex-wrap gap-2", tailSse_ streamLink ] do
-- This will be hidden by CSS if any images are actually in this <div>.
div_ [ class_ "hidden only:block" ] do
notice "No images have been captured." It's definitely more consistent and supports the simple case and also the flexible case. I'm not sure about the types, whether it should be |
Beta Was this translation helpful? Give feedback.
-
Opened a related issue for 'lucid2' https://github.com/chrisdone/lucid/issues/129 |
Beta Was this translation helpful? Give feedback.
-
I'm glad you like the idea!
I'm also not sure. I lean the other way. I'm not sure I'd want to see a "got |
Beta Was this translation helpful? Give feedback.
-
You raise a good point, type errors are a little confusing with nested lists. I think the discussion is already in breaking change land, so I wouldn't worry about API change as much as the best design. |
Beta Was this translation helpful? Give feedback.
-
Yep, this would be my first choice. |
Beta Was this translation helpful? Give feedback.
-
I'm proposing a fairly big change to
lucid
, which is that allAttribute
-forming functions instead return[Attribute]
. The reason for this is that it composes considerably better when we want to group attributes. I'm using the htmx library, and one thing I'd like to do is factor out a little set of attributes I commonly use to connect an element to a server-sent event stream:However, actually using this is a bit annoying. I end up needing to sometimes use
[]
, and sometimes(x : y : tailSse_ ..)
:To me
lucid
is about consistency, and this is no longer very consistent. I could always use[]
:which is OK, but noisy, and I've had to give up using list syntax. Instead, if
class_
returned[Attribute]
, I could do:This essentially means
div_ :: [[Attribute]]
, and it appliesconcat
itself.Another option may just be to redefine
Attribute
asat which point
div_
doesn't need to change its type.Sorry this is a bit rambly, but I hope it makes sense! Curious to hear your thoughts.
Beta Was this translation helpful? Give feedback.
All reactions