parseLetrec = do reserved "letrec"
                 ctx <- getState
                 (TmBind var binding) <- (parseAbbBind True)
                 reserved "in"
                 body <- parseTerm
                 setState ctx
                 case binding of
                   TmAbbBind t (Just ty)
                       -> return $ TmLet var (TmFix (TmAbs var ty t)) body
                   otherwise      
                       -> fail "malformed letrec statement"
parseLetrec = do reserved "letrec"
                 ctx <- getState
                 (TmBind var binding) <- (parseAbbBind True)
                 reserved "in"
                 body <- parseTerm
                 setState ctx
                 case binding of
                   TmAbbBind t (Just ty)
                       -> return $ TmLet var (TmFix (TmAbs var ty t)) body
                   otherwise      
                       -> fail "malformed letrec statement"
parseLetrec = do reserved "letrec"
                 ctx <- getState
                 (TmBind var binding) <- (parseAbbBind True)
                 reserved "in"
                 body <- parseTerm
                 setState ctx
                 case binding of
                   TmAbbBind t (Just ty)
                       -> return $ TmLet var (TmFix (TmAbs var ty t)) body
                   otherwise      
                       -> fail "malformed letrec statement"