records - How to fix this Purescript error: Could not match {...} with (...)? -


i have state halogen component including lens this:

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 }) 

and want modify state in eval function of same component this:

eval :: forall eff.         query ~> parentdsl state query usernamefield.query slot void (aff (console :: console , ajax :: ajax | eff)) eval = case _ of     handleinput username next ->       -- code causes trouble:       _username .= username       -- while code works:       -- modify (set _username username)       pure next 

however, error message:

  not match type      { username :: string     , password :: string     , formerror :: string     }    type      ( username :: string     , password :: string     , formerror :: string     )   while trying match type t3                              { username :: string                              , password :: string                              , formerror :: string                              }   type t2 while checking expression _username   has type (t0 -> t1) -> t2 -> t2 in value declaration eval  t1 unknown type       t0 unknown type       t2 unknown type       t3 unknown type  [typesdonotunify] 

note difference between { , ( (took me while). don't know latter type means , have no clue why error introduced monadstate-based lense.

mystery solved: unintentionally mixed 2 packages

purescript-lens , purescript-profunctor-lenses. lenses came former , assign function (.=) present in latter, installed apparently implicit subdependency.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -