简体   繁体   中英

Tasty HUnit test against Either

I am fairly new to Haskell, and I was wondering if there is a way to test a pattern match, as in erlang. An example is a function that returns an Either ab, Can I match against Left b, whilst ignoring b itself?

In my case, I have Either String Error. I simply want to test if an error occurs, but it's a bit tedious to write out the entire error text for each test case, so I simply want to assert that it in fact does return a Right error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM