diff --git a/Database/HSparql/Connection.hs b/Database/HSparql/Connection.hs
--- a/Database/HSparql/Connection.hs
+++ b/Database/HSparql/Connection.hs
@@ -125,4 +125,4 @@
                           , rqBody = ""
                           }
   response <- simpleHTTP request >>= getResponseBody
-  return $ parseString (TurtleParser Nothing Nothing) (E.decodeUtf8 (B.pack response))
+  return $ parseString (TurtleParser Nothing Nothing) $ E.decodeUtf8 (B.pack response)
diff --git a/Database/HSparql/QueryGenerator.hs b/Database/HSparql/QueryGenerator.hs
--- a/Database/HSparql/QueryGenerator.hs
+++ b/Database/HSparql/QueryGenerator.hs
@@ -71,6 +71,7 @@
 
 import Control.Monad.State
 import Data.List (intercalate)
+import Data.String.Utils
 
 
 -- State monads
@@ -498,17 +499,16 @@
   qshow Nothing = ""
 
 instance QueryShow RDFLiteral where
-  -- Always use triple-quoted strings to avoid having to deal with quote-escaping
-  qshow (RDFLiteral s)           = "\"\"\"" ++ s ++ "\"\"\""
-  qshow (RDFLiteralLang s lang')  = "\"\"\"" ++ s ++ "\"\"\"@" ++ lang'
-  qshow (RDFLiteralIRIRef s ref) = "\"\"\"" ++ s ++ "\"\"\"^^" ++ qshow ref
-
+  qshow (RDFLiteral s)           = "\"" ++ escapeQuotes s ++ "\""
+  qshow (RDFLiteralLang s lang')  = "\"" ++ escapeQuotes s ++ "\"@" ++ lang'
+  qshow (RDFLiteralIRIRef s ref) = "\"" ++ escapeQuotes s ++ "\"^^" ++ qshow ref
 
 instance QueryShow GraphTerm where
   qshow (IRIRefTerm ref)           = qshow ref
   qshow (RDFLiteralTerm s)         = qshow s
   qshow (BooleanLiteralTerm True)  = show "true"
   qshow (BooleanLiteralTerm False) = show "false"
+  qshow (NumericLiteralTerm i)     = show i
 
 instance QueryShow VarOrTerm where
   qshow (Var  v) = qshow v
@@ -612,3 +612,9 @@
                            , qshow (AskForm qd)
                            ]
              in query
+
+
+-- Internal utilities
+
+escapeQuotes :: String -> String
+escapeQuotes = replace "\"" "\\\""
diff --git a/hsparql.cabal b/hsparql.cabal
--- a/hsparql.cabal
+++ b/hsparql.cabal
@@ -1,6 +1,6 @@
 Name:          hsparql
 Homepage:      https://github.com/robstewart57/hsparql
-Version:       0.2.0
+Version:       0.2.1
 Synopsis:      A SPARQL query generator and DSL, and a client to query a SPARQL server.
 Category:      Database
 Description:
@@ -18,7 +18,7 @@
 bug-reports:   https://github.com/robstewart57/hsparql/issues
 Stability:     Experimental
 Build-type:    Simple
-Cabal-Version: >= 1.8
+Cabal-Version: >= 1.9.2
 
 library
   Exposed-modules: Database.HSparql.Connection
@@ -29,6 +29,7 @@
                , xml
                , rdf4h >= 1.0.0
                , bytestring
+               , MissingH
                , network
                , text
   extensions:  RankNTypes FlexibleInstances
@@ -37,10 +38,10 @@
   type:          exitcode-stdio-1.0
   main-is:       AllTests.hs
   build-depends: hsparql
-                 , rdf4h
+                 , rdf4h >= 1.0.0
                  , base
                  , text
-                 , Cabal >= 1.9.2
+                 , containers
                  , http-types
                  , HUnit
                  , test-framework
diff --git a/tests/AllTests.hs b/tests/AllTests.hs
--- a/tests/AllTests.hs
+++ b/tests/AllTests.hs
@@ -23,7 +23,15 @@
                     response req = case rawQueryString req of
                                         "?query=PREFIX%20foaf%3A%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%20PREFIX%20dbpedia%3A%20%3Chttp%3A%2F%2Fdbpedia.org%2Fproperty%2F%3E%20PREFIX%20dbprop%3A%20%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2F%3E%20SELECT%20%20%3Fx1%20WHERE%20%7B%3Fx0%20dbpedia%3Agenre%20dbprop%3AWeb_browser%20.%20%3Fx0%20foaf%3Aname%20%3Fx1%20.%7D"
                                                 -> selectResponse
+                                        "?query=PREFIX%20dbprop%3A%20%3Chttp%3A%2F%2Fdbpedia.org%2Fproperty%2F%3E%20PREFIX%20dbpedia%3A%20%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2F%3E%20ASK%20%7B%20%3Fx0%20dbprop%3Agenre%20dbpedia%3AWeb_browser%20.%20%7D"
+                                                -> askResponse
+                                        "?query=PREFIX%20example%3A%20%3Chttp%3A%2F%2Fwww.example.com%2F%3E%20PREFIX%20foaf%3A%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%20PREFIX%20dbprop%3A%20%3Chttp%3A%2F%2Fdbpedia.org%2Fproperty%2F%3E%20PREFIX%20dbpedia%3A%20%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2F%3E%20CONSTRUCT%20%7B%20%3Fx0%20example%3AhasName%20%3Fx1%20.%20%7D%20WHERE%20%7B%3Fx0%20dbprop%3Agenre%20dbpedia%3AWeb_browser%20.%20%3Fx0%20foaf%3Aname%20%3Fx1%20.%7D"
+                                                -> constructResponse
+                                        "?query=PREFIX%20dbpedia%3A%20%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2F%3E%20DESCRIBE%20dbpedia%3AEdinburgh%20WHERE%20%7B%7D"
+                                                -> describeResponse
                                         otherwise
-                                                -> errorResponse
-                    selectResponse = ResponseFile status200 [("Content-Type", "application/xml")] "tests/fixtures/sparql_select_response.xml" Nothing
-                    errorResponse = responseLBS status500 [] ""
+                                                -> error "Unexpected URI"
+                    selectResponse = ResponseFile status200 [("Content-Type", "application/sparql-results+xml")] "tests/fixtures/sparql_select_response.xml" Nothing
+                    askResponse = ResponseFile status200 [("Content-Type", "text/plain")] "tests/fixtures/sparql_ask_response.text" Nothing
+                    constructResponse = ResponseFile status200 [("Content-Type", "text/turtle")] "tests/fixtures/sparql_construct_response.ttl" Nothing
+                    describeResponse = ResponseFile status200 [("Content-Type", "text/turtle")] "tests/fixtures/sparql_describe_response.ttl" Nothing
