happy: fix for justStaticExecutables#463608
Conversation
|
I tested basic functionality with: Calc.y{
module Main where
import Data.Char (isDigit, isSpace)
}
%name calc
%tokentype { Token }
%error { parseError }
%token
int { TokenInt $$ }
'+' { TokenPlus }
%%
Exp : Exp '+' int { $1 + $3 }
| int { $1 }
{
data Token
= TokenInt Int
| TokenPlus
deriving Show
lexer :: String -> [Token]
lexer [] = []
lexer (c:cs)
| isSpace c = lexer cs
| isDigit c = lexerNum (c:cs)
| c == '+' = TokenPlus : lexer cs
| otherwise = error $ "Unknown character: " ++ [c]
lexerNum :: String -> [Token]
lexerNum cs = TokenInt (read num) : lexer rest
where (num,rest) = span isDigit cs
parseError :: [Token] -> a
parseError _ = error "Parse error"
main :: IO ()
main = do
let input = "10 + 20 + 30"
print $ "Input: " ++ input
print $ "Result: " ++ show (calc (lexer input))
}$ ./result/bin/happy Calc.y
Warning: With happy 2.0, the --ghc flag has become non-optional. To suppress this warning, pass the --ghc flag.
$ nix run nixpkgs#ghc -- Calc.hs -o calc
[1 of 2] Compiling Main ( Calc.hs, Calc.o )
[2 of 2] Linking calc
$ ./calc
"Input: 10 + 20 + 30"
"Result: 60" |
|
I created #463650, which avoids the need for many package rebuilds. |
sternenseemann
left a comment
There was a problem hiding this comment.
I prefer this being fixed globally. There is time to get this into a staging cycle for 25.11, so no need to rush a worse version of this fix to master. We'll need to check whether the current staging branch will reach 25.11 or we'll need to backport.
Checked that happy(-lib) only use version and getDataDir.
|
@sternenseemann |
We already had staging branch-off, so if this should go into 25.11, we need to backport it to staging-25.11. |
|
Successfully created backport PR for |
Things done
Remove references to
happy-libpath so thathappycan build on aarch64-darwin.See: #304352
ZHF: #457852
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.