haskell - No instance for MyClass arising from a use of `throwError' -


i have problem typing. started study monad transformers this article. little changed them example. now, code is:

data pwderror = pwderror string  type pwderrormonad = errort pwderror io  isvalid :: string -> errort string pwderrormonad bool isvalid s     | length s < 5 = throwerror "password short!"     | otherwise = return true 

now, have error:

no instance (error pwderror) arising use of `throwerror' in expression: throwerror "password short!" in equation `isvalid':     isvalid s       | length s < 5 = throwerror "password short!"       | otherwise = return true 

could me compile program?

you need make pwderror instance of the error typeclass.

the following should sufficient, though haven't tried compile it:

instance error pwderror   strmsg = pwderror 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -