Haskell做语法和I / O.(Haskell do syntax and I/O)
我正在玩Haskell中的一个简单程序:
hello :: String -> String hello s = "Hello, " ++ (trim s) ++ "!\n" trim :: String -> String trim [] = [] trim s = head $ words s main :: IO() main = do putStr "\nPlease enter your name: " name <- getLine hstring <- return $ hello name putStr hstring
这是我期待的输出:
Please enter your name: John Doe Hello, John!
当我将程序加载到ghci时,这可以正常工作。 但是当我使用编译程序时
ghc -o hello.exe hello.hs
它启动,等待输入,然后同时打印两个提示:
John Doe Please enter your name: Hello, John!
为什么交互式环境和编译器之间的行为有所不同,我如何让编译器做我想做的事情?
先谢谢您的帮助!
I was playing around with a simple program in Haskell:
hello :: String -> String hello s = "Hello, " ++ (trim s) ++ "!\n" trim :: String -> String trim [] = [] trim s = head $ words s main :: IO() main = do putStr "\nPlease enter your name: " name <- getLine hstring <- return $ hello name putStr hstring
This is the output I am expecting:
Please enter your name: John Doe Hello, John!
This works as expected when I load the program into ghci. However when I compile the program using
ghc -o hello.exe hello.hs
it starts, waits for input, and then prints both prompts at the same time:
John Doe Please enter your name: Hello, John!
Why is the behavior different between the interactive environment and compiler, and how can I make the compiler do what I want?
Thanks in advance for the help!
原文:https://stackoverflow.com/questions/6222521
满意答案
您应该添加该属性
android:windowSoftInputMode="stateAlwaysHidden"
给你在AndroidManifest.xml中的活动
You should add the attribute
android:windowSoftInputMode="stateAlwaysHidden"
to you activity in AndroidManifest.xml
相关问答
更多活动开始时,屏幕键盘会自动打开(OnScreen keyboard opens automatically when Activity starts)
带有EditText的AlertDialog,自动打开软键盘,重点放在EditText上不起作用(AlertDialog with EditText, open soft keyboard automatically with focus on EditText doesn't work)
自动显示键盘(Show keyboard automatically)
如何在UITextField上自动打开键盘?(How to open the keyboard automatically on UITextField?)
Android:当焦点在EditText上时自动显示软键盘(Android: show soft keyboard automatically when focus is on an EditText)
当Activity启动时,EditText具有焦点,但不显示软键盘(EditText has focus when Activity starts, but soft keyboard is not shown)
EditText焦点自动打开键盘(EditText focus opens Keyboard automatically)
如何在EditText获得焦点时自动显示软键盘(How Show soft keyboard automatically when EditText receives focus)
如何让Edittext的软键盘输出得到焦点(How to let the soft keyboard output from the Edittext which gets focus)
wpf键盘焦点:菜单打开后失去焦点?(wpf keyboard focus: losing focus after menu opens?)
相关文章
更多Hadoop的I/O
Hadoop I/O系统介绍
Hadoop1.0.4 HDFS I/O性能测试
Java中如何用I/O流读取一个Word文档的内容?
O2O
WiFi入口流量O2O微应用平台
阿虎烧烤的新感悟-O2O你真的会玩吗?
玩电商?O2O才是微信想要的
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!