0
votes

Can Elm Html have Bool type variable so instead of type annotation of

Html Msg 

have

Html Bool 

Does anybody knows? Thanks a lot to all.

1
The answer is yes. It can be anything as long as you handle it appropriately in update.glennsl
Here's an Ellie demonstrating it: ellie-app.com/5yw38K3Qnb7a1glennsl
Of course, the reality is you almost always want a real message type, as it's much more flexible and descriptive. Most of the time your boolean value is going to represent something that is more clearly represented by a custom type.Gareth Latty

1 Answers

1
votes

Yes. Elm Html uses the type Html msg (with a small caps msg). This means that msg can be whatever type.

In many code examples found online, msg is Msg. But that is just their choice, and they have defined Msg themselves somewhere else in the code.

In your code you can use any other type, like Bool.