
if it was so easy! GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help Prelude> fromOnly [Only {fromOnly = "-04.3982"}] <interactive>:1:12: error: Not in scope: data constructor ‘Only’ and in a program: bd_rows <- query conn qry_head (Only (name::String)) putStrLn $ show bd_rows putStrLn $ show name let resLst = [] let noBD = fromOnly bd_rows forM_ bd_rows $ \(Only a) -> putStrLn $ Data.Text.unpack a Prelude> :load UpdateSidonie [1 of 1] Compiling Main ( UpdateSidonie.hs, interpreted ) UpdateSidonie.hs:93:25: error: • Couldn't match expected type ‘Only a’ with actual type ‘[Only Text]’ • In the first argument of ‘fromOnly’, namely ‘bd_rows’ In the expression: fromOnly bd_rows In an equation for ‘noBD’: noBD = fromOnly bd_rows • Relevant bindings include noBD :: a (bound at UpdateSidonie.hs:93:9) | 93 | let noBD = fromOnly bd_rows | ^^^^^^^ Failed, no modules loaded. Le 06/12/2018 14:07, Francesco Ariis a écrit :
On Thu, Dec 06, 2018 at 12:16:08PM +0100, Damien Mattei wrote:
*Main> show s "Only {fromOnly = \"-04.3982\"}"
but how can i get the String "-04.3982" ? and after converting it to a Float?
I suspect that "fromOnly" accessor will do!
http://hackage.haskell.org/package/mysql-simple-0.4.5/docs/Database-MySQL-Si...
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-- Damien.Mattei@unice.fr, Damien.Mattei@oca.eu, UNS / OCA / CNRS