From f34565aa32dc7badab76cf199e4d0b8cc22c2b05 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 13 Jan 2016 22:17:22 +0100 Subject: FFP 11.4 --- ws2015/ffp/blaetter/11/GameUnits.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ws2015/ffp/blaetter/11/GameUnits.hs') diff --git a/ws2015/ffp/blaetter/11/GameUnits.hs b/ws2015/ffp/blaetter/11/GameUnits.hs index a47614e..d8853e9 100644 --- a/ws2015/ffp/blaetter/11/GameUnits.hs +++ b/ws2015/ffp/blaetter/11/GameUnits.hs @@ -70,7 +70,9 @@ battle att def = do stockUnitShortcuts :: Q [Dec] --- declares a constants of type Unit for each unit on the -stockUnitShortcuts = undefined -- !!! TODO !!! - - \ No newline at end of file +-- declares a constants of type Unit for each unit on the stockUnitList +stockUnitShortcuts = sequence $ zipWith toDec ([0..] :: [Int]) stockUnitList + where + toDec n c = valD (varP (mkName . uncapitalize $ name c)) (normalB [| stockUnitList !! $n' |]) [] + where + n' = litE . integerL $ toInteger n -- cgit v1.2.3