Dutch national flag problem: Difference between revisions

Content added Content deleted
m (added signature to isDutch)
m (deleted first line of the entry text as suggested by Paddy3118)
Line 265: Line 265:
</pre>
</pre>
=={{header|Haskell}}==
=={{header|Haskell}}==
This problem is very easy to solve in Haskell. No algorithms necessary, because Haskell provides everything we need.

With the Color data type we take care that no other values than Red, White and Blue can be used.
With the Color data type we take care that no other values than Red, White and Blue can be used.
The "deriving" clause is a key aspect: We want Haskell to make Color automatically an instance of the classes Show, Eq, Ord and Enum.
The "deriving" clause is a key aspect: We want Haskell to make Color automatically an instance of the classes Show, Eq, Ord and Enum.