No description provided.
(Moved this comment by a guest commenter from the old Disqus comment system)
Have a question:
If I change the query from this:
query "SELECT * FROM messages WHERE somenum = ?" [toSql n]
query "SELECT * FROM messages"
Why do I now get [[Row]] as the result type instead of [Row]?
You wouldn't. If you look at the type of query:
query :: HasHdbc m c s => String -> [SqlValue] -> m [Row]
You see that you need to apply this function to both a String (you SQL query) and a list of SqlValues. Since you have omitted the list in your example, you will be left with a partially applied function of type [SqlValue] -> m [Row]. In other words, if you do not want to bind any values to your query, you will still need to apply the function to an empty list to end up with a m [Row]
[SqlValue] -> m [Row]
Would you mind sketching how you would create the command line tool, outside the Snap context, with the HasHdbc typeclass? I understand typeclasses on a basic level, but the type signature of getHdbcState :: m (HdbcSnaplet c s) is a bit of a challenge for me to adapt to a program outside the Snap context.
getHdbcState :: m (HdbcSnaplet c s)