@@ -618,16 +618,23 @@ recordType syn
618618 (applyAll fc fields (PRef fc (sMN 0 "fldx"))))
619619 Just v -> return (applyAll fc fields v)
620620 <?> "record setting expression"
621− where fieldType :: IdrisParser (Name, PTerm)
622− fieldType = do n <- fnName
621+ where fieldType :: IdrisParser ([Name], PTerm)
622+ fieldType = do n <- sepBy1 fnName (symbol "->")
623623 lchar '='
624624 e <- expr syn
625625 return (n, e)
626626 <?> "field setter"
627− applyAll :: FC -> [(Name, PTerm)] -> PTerm -> PTerm
627+ applyAll :: FC -> [([Name], PTerm)] -> PTerm -> PTerm
628628 applyAll fc [] x = x
629− applyAll fc ((n, e) : es) x
630− = applyAll fc es (PApp fc (PRef fc (mkType n)) [pexp e, pexp x])
629+ applyAll fc ((ns, e) : es) x
630+ = applyAll fc es (doUpdate fc ns e x)
631+
632+ doUpdate fc [n] e get
633+ = PApp fc (PRef fc (mkType n)) [pexp e, pexp get]
634+ doUpdate fc (n : ns) e get
635+ = PApp fc (PRef fc (mkType n))
636+ [pexp (doUpdate fc ns e (PApp fc (PRef fc n) [pexp get])),
637+ pexp get]
631638
632639-- | Creates setters for record types on necessary functions
633640mkType :: Name -> Name