Created
January 9, 2013 12:07
-
-
Save master-q/4492651 to your computer and use it in GitHub Desktop.
jhc-Cさんはforever <http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Monad.html#v:forever> をgotoループに変換する。
This file contains hidden or 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
static void A_STD | |
ftheMain(gc_t gc) | |
{ | |
fPrelude_IO_putStr(gc,PROMOTE(c375)); | |
saved_gc = gc; | |
(void)jhc_utf8_putchar((int)10); | |
fR$__fControl_Monad_forever__57:; | |
{ wptr_t v9; | |
fPrelude_IO_putStr(gc,PROMOTE(c377)); | |
v9 = fPrelude_IO_getLine(gc); | |
{ wptr_t v100000; | |
wptr_t v100004; | |
gc_frame0(gc,1,v9); | |
v100000 = fData_Map_fromList(gc,PROMOTE(c392)); | |
v100004 = fData_Map_lookup(gc,v9,v100000); | |
if (SET_RAW_TAG(CJhc_Type_Basic_Nothing) == v100004) { | |
wptr_t v20; | |
v20 = fPrelude_IO_putStr(gc,v9); | |
demote(v20); | |
} else { | |
sptr_t v36; | |
/* ("CJhc.Type.Basic.Just" ni36) */ | |
v36 = ((struct sCJhc_Type_Basic_Just*)v100004)->a1; | |
wptr_t v100006 = eval(gc,v36); | |
bapply__15390(gc,v100006); | |
} | |
goto fR$__fControl_Monad_forever__57; | |
} | |
} | |
return; | |
} |
This file contains hidden or 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
main :: IO () | |
main = do | |
putStrLn "Haskell bootmenu" | |
forever $ do | |
putStr "> " | |
s <- getLine | |
fromMaybe (putStr s) $ Map.lookup s commands |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Haskell元ソースコードは https://gitorious.org/metasepi/netbsd-arafura/blobs/arafura/metasepi-arafura/sys/arch/i386/stand/boot/Boot2Ara.hs のあたり。