[Haskell-cafe] (SPAM 3)Re: fmap use
Tom Ellis
tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk
Fri Dec 14 15:42:06 UTC 2018
If you want to print something out use putStrLn. It will work.
On Fri, Dec 14, 2018 at 03:36:03PM +0100, Damien Mattei wrote:
> so itried you code,surpringly it compiles but when i launch it the
> function can not print somethin on screen, i assume it is because
> function are pure in haskell, nor with putStrln or Debug.trace:
>
> getBD_WDS :: Connection -> String -> IO Float
> getBD_WDS conn name = do
> let qry_head = "select DNUM from WDS where DISC = ?" :: Query
>
> bd_rows <- query conn qry_head (Only name)
>
> let lg = Prelude.length bd_rows
>
> -- putStrLn (if lg > 1 then "some" else "one or zero")
> let tst = trace (if lg > 1 then "some" else "one or zero") (if lg > 1
> then "some" else "one or zero")
>
> -- let noBDtxt :: Text
> let noBDtxt = fromOnly (Prelude.head bd_rows)
>
> -- noBDstr :: String
> let noBDstr = Text.unpack noBDtxt
>
> -- noBDfp :: Float
> let noBDfp = read noBDstr
>
> return noBDfp
More information about the Haskell-Cafe
mailing list