I want do something on mysql with hdbc , I want know how can I convert SqlByteString to String? when I try to use fromSql bytestrobj, I got an error
<interactive>:20:1: error:
• Non type-variable argument
in the constraint: Data.Convertible.Base.Convertible SqlValue a
(Use FlexibleContexts to permit this)
• When checking the inferred type
it :: forall a. Data.Convertible.Base.Convertible SqlValue a => a
*InitPriceTable Database.HDBC Database.HDBC.Types> conn<-connectMySQL defaultMySQLConnectInfo {mysqlUser ="root",mysqlPassword ="root",mysqlDatabase ="linclon"}
fromSqlhas the type signatureIf you just write
fromSql bytestrobj, Haskell cannot tell which typeathis expression has. In order to forcea = ByteStringyou can supply the type manually:Example ghci-session:
If the type can be inferred, then you can drop the type annotation: