Created
January 13, 2020 15:08
-
-
Save jchia/f58b562f1909439a1961006f13213592 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Works, but verbose: | |
let lineParser' = do | |
[email protected]{[email protected]{ | |
[email protected]{sourceLine, sourceColumn}}} <- getParserState | |
let pstateSourcePos' :: MP.SourcePos | |
pstateSourcePos' = pstateSourcePos{sourceLine = mkPos lineNo, sourceColumn = mkPos 1} | |
setParserState parserState{statePosState=statePosState{pstateSourcePos=pstateSourcePos'}} | |
lineParser | |
-- I want to do this instead because it's less verbose, but it doesn't compile: | |
let lineParser' = do | |
[email protected]{[email protected]{ | |
[email protected]{sourceLine, sourceColumn}}} <- getParserState | |
let pstateSourcePos' :: MP.SourcePos | |
pstateSourcePos' = pstateSourcePos{sourceLine = mkPos lineNo, sourceColumn = mkPos 1} | |
setParserState parserState{statePosState=statePosState{pstateSourcePos=pstateSourcePos'}} | |
lineParser |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment