Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Optic.Core (Lens', lens)
- type State =
- { userName :: String
- , password :: String
- , formError :: String
- }
- _userName :: Lens' State String
- _userName = lens _.userName (r str -> r { userName = str })
- eval :: forall eff.
- Query ~> ParentDSL State Query UserNameField.Query Slot Void (Aff (console :: CONSOLE , ajax :: AJAX | eff))
- eval = case _ of
- HandleInput userName next -> do
- -- this code causes trouble:
- _userName .= userName
- -- while this code works:
- -- modify (set _userName userName)
- pure next
- Could not match type
- { userName :: String
- , password :: String
- , formError :: String
- }
- with type
- ( userName :: String
- , password :: String
- , formError :: String
- )
- while trying to match type t3
- { userName :: String
- , password :: String
- , formError :: String
- }
- with type t2
- while checking that expression _userName
- has type (t0 -> t1) -> t2 -> t2
- in value declaration eval
- where t1 is an unknown type
- t0 is an unknown type
- t2 is an unknown type
- t3 is an unknown type
- [TypesDoNotUnify]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement