Hi,

What is the proper way to implement a non-monadic function that checks
whether a given value is correct and gives a proper error message
otherwise ? What is the recommended option ?

* Either String a

check val
  | valid val = Right val
  | otherwise = Left errorMsg


* Maybe String

check val
  | valid val = Nothing
  | otherwise = Just errorMsg


Cheers,
Jose

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to