[Haskell-beginners] database, list result, extraction and conversion

Damien Mattei mattei at oca.eu
Thu Dec 6 11:16:08 UTC 2018


again un haskell beginner question ;-) ...
i have this: [Only {fromOnly = "-04.3982"}]
as result of a database query, i understand it's a list and i can get
the first element:

*Main> Data.List.head [Only {fromOnly = "-04.3982"}]
Only {fromOnly = "-04.3982"}
*Main> let s = Data.List.head [Only {fromOnly = "-04.3982"}]
*Main> s
Only {fromOnly = "-04.3982"}
*Main> show s
"Only {fromOnly = \"-04.3982\"}"

but how can i get the String "-04.3982" ? and after converting it to a Float
-- 
Damien.Mattei at unice.fr, Damien.Mattei at oca.eu, UNS / OCA / CNRS


More information about the Beginners mailing list