Let's say I have such code:
test pattern | Pattern == (_, no (wire_)) = 1 | Pattern == (_, and (wire_) (wire_)) = 2 | Otherwise, = 0
Where I am trying to match it against one of the many possibilities, some with one ("wire"), some of the two I have the actual input For example: ("p", not (wire "x")). I would like a pattern which can accept any letter as input (with what I was hoping _) and disappointingly failed (invalid _). Is it possible to do this in Haskell?
OK, it makes a lot of sense after editing.
==
Compare value , but _
is an pattern . Patterns only appear in the following syntax references:
- Left side (pattern) binding, i.e. "what is
=
" at the top level orwhere
block orlet
expression or command (indo
notation); -
left of
-> In
case-
in
/ code> expression;
Functions binding or lambda (
\
) as a formal argument for functions in expressions.
(I hope I have not forgotten any!) In your case, you can just get what you write by typing
test (_, No (wire_)) = 1 test (_, and (wire_) (wire_)) = 2 test _ = 0
You can type " What can the right version of pattern == ask for (_, no (wire_))
". Well, you can write:
(_ _ _ _ _ _ _tn_n_n_not_not_not_not_id=2) case pattern of --------- _ _> ------------------------------------ >
Comments
Post a Comment