l :: Lexer (Pos Token)
literal = withPos $ Lit <$> choice [ unitLit
                                   , numLit
                                   , charLit
                                   , strLit
                                   ]
    where
    unitLit = const MurexUnit <$> string "()"
    numLit = MurexNum <$> anyNumber
    charLit = (<?> "character") $ MurexChar <$> between2 (char '\'') literalChar
    strLit = (<?> "string") $ A.toMurexString . catMaybes <$> between2 (char '\"') (many strChar)
        where
        strChar = maybeLiteralChar <|> (Just <$> oneOf "\'\n")
    --TODO string interpolation: needs nesting stack

comm
literal :: Lexer (Pos Token)
literal = withPos $ Lit <$> choice [ unitLit
                                   , numLit
                                   , charLit
                                   , strLit
                                   ]
    where
    unitLit = const MurexUnit <$> string "()"
    numLit = MurexNum <$> anyNumber
    charLit = (<?> "character") $ MurexChar <$> between2 (char '\'') literalChar
    strLit = (<?> "string") $ A.toMurexString . catMaybes <$> between2 (char '\"') (many strChar)
        where
        strChar = maybeLiteralChar <|> (Just <$> oneOf "\'\n")
    --TODO string interpolation: needs nesting stack
literal = withPos $ Lit <$> choice [ unitLit
                                   , numLit
                                   , charLit
                                   , strLit
                                   ]
    where
    unitLit = const MurexUnit <$> string "()"
    numLit = MurexNum <$> anyNumber
    charLit = (<?> "character") $ MurexChar <$> between2 (char '\'') literalChar
    strLit = (<?> "string") $ A.toMurexString . catMaybes <$> between2 (char '\"') (many strChar)
        where
        strChar = maybeLiteralChar <|> (Just <$> oneOf "\'\n")
    --TODO string interpolation: needs nesting stack