私はhaskellを学んでいて、Haskellのコードを使い、モジュールを使うための小さなテストプログラムを書くことに決めました。現在、Cypto.PasswordStoreを使用してパスワードハッシュを作成するために、最初の引数を使用しようとしています。私のプログラムをテストするために、私は最初の引数からハッシュを作成して、画面にハッシュを印刷しようとしています。どのように私はStrLnにData.ByteString.Internal.ByteStringを配置しますか?
import Crypto.PasswordStore
import System.Environment
main = do
args <- getArgs
putStrLn (makePassword (head args) 12)
私は次のエラーを取得しています:
testmakePassword.hs:8:19:
Couldn't match expected type `String'
with actual type `IO Data.ByteString.Internal.ByteString'
In the return type of a call of `makePassword'
In the first argument of `putStrLn', namely
`(makePassword (head args) 12)'
In a stmt of a 'do' block: putStrLn (makePassword (head args) 12)
私は、参照として、以下のリンクを使用してきたが、私は今、ちょうど裁判-erroring無駄にしています。 http://hackage.haskell.org/packages/archive/bytestring/0.9.0.4/doc/html/Data-ByteString-Internal.html http://hackage.haskell.org/packages/archive/pwstore-purehaskell/2.1/doc/html/Crypto-PasswordStore.html
感謝を!これは私のために働く。このコードでは廃止予定の関数について警告していますが、答えは必要なものです。 _Warning: 'B.putStrLn 'を使用しています。 (Data.ByteStringからインポートしました): 廃止予定:「Data.ByteString.Char8.putStrLnを代わりに使用してください。 – NerdGGuy
@NerdGGuy' Data.ByteString'を完全に削除して、 Data.ByteString.Char8'の代わりに(編集を参照) – AndrewC
Data.ByteString.Char8を使用すると意味があります – NerdGGuy