Advertisement
Guest User

Untitled

a guest
Apr 6th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. import Optic.Core (Lens', lens)
  2.  
  3. type State =
  4. { userName :: String
  5. , password :: String
  6. , formError :: String
  7. }
  8.  
  9. _userName :: Lens' State String
  10. _userName = lens _.userName (r str -> r { userName = str })
  11.  
  12. eval :: forall eff.
  13. Query ~> ParentDSL State Query UserNameField.Query Slot Void (Aff (console :: CONSOLE , ajax :: AJAX | eff))
  14. eval = case _ of
  15. HandleInput userName next -> do
  16. -- this code causes trouble:
  17. _userName .= userName
  18. -- while this code works:
  19. -- modify (set _userName userName)
  20. pure next
  21.  
  22. Could not match type
  23.  
  24. { userName :: String
  25. , password :: String
  26. , formError :: String
  27. }
  28.  
  29. with type
  30.  
  31. ( userName :: String
  32. , password :: String
  33. , formError :: String
  34. )
  35.  
  36.  
  37. while trying to match type t3
  38. { userName :: String
  39. , password :: String
  40. , formError :: String
  41. }
  42. with type t2
  43. while checking that expression _userName
  44. has type (t0 -> t1) -> t2 -> t2
  45. in value declaration eval
  46.  
  47. where t1 is an unknown type
  48. t0 is an unknown type
  49. t2 is an unknown type
  50. t3 is an unknown type
  51. [TypesDoNotUnify]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement