mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-30 06:52:49 -06:00
overloading API and examples
This commit is contained in:
14
lib/resource-1.0/api/MkOverload.hs
Normal file
14
lib/resource-1.0/api/MkOverload.hs
Normal file
@@ -0,0 +1,14 @@
|
||||
import List
|
||||
|
||||
main = do
|
||||
s <- readFile "constrs"
|
||||
mapM_ (putStrLn . mkOne) $ lines s
|
||||
|
||||
mkOne [] = []
|
||||
mkOne s =
|
||||
" mk" ++ cons ++ " " ++ rest ++
|
||||
"\n =" ++ fun ++ " ;"
|
||||
where
|
||||
(fun,rest) = span (/=':') s
|
||||
cons = last $ takeWhile (/="--") $ words rest
|
||||
|
||||
Reference in New Issue
Block a user