Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7586999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:33:54+00:00 2026-05-30T19:33:54+00:00

This is a follow up question to this one: Syntax confusion (do block) So,

  • 0

This is a follow up question to this one: Syntax confusion (do block) So, please see it for more information and the original code. After I’ve been kindly helped, I’ve discovered yet another problem, which I suspect to be caused by “overloaded strings” whatever that means.

It looks like the simple-mysql library does something to string literal, so that they are understood by the parser to be of type Query. This is also what their examples demonstrate. However, all examples use unrealistically short queries, where you don’t need to wrap the code. I do need to wrap it, and string concatenation causes the resulting string to not to be recognized as of type Query. Why did anyone decide that this kind of approach will be useful is beyond my comprehension, I just want to be done with this assignment…

So, please, if you happen to know, kindly advise what to do / how can I have string converted to query.

The problematic code and the error are shown below:

-- Couldn't match expected type `Query' against inferred type `[a]'
-- In the expression:
--       "select count('*')"
--     ++  "from table"
--       ++  "where ((acquisition_date <= ?)"
--         ++  "and ((sale_date is null) or " ++ "(sale_date < ?)))"
-- In the definition of `countGoodsQuery':
--     countGoodsQuery = "select count('*')"
--                     ++  "from table"
--                       ++  "where ((acquisition_date <= ?)"
--                         ++  "and ((sale_date is null) or " ++ "(sale_date < ?)))"

countGoodsQuery :: Query
countGoodsQuery = "select count('*')" ++
                  "from table" ++
                  "where ((acquisition_date <= ?)" ++
                  "and ((sale_date is null) or " ++
                  "(sale_date < ?)))"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:33:56+00:00Added an answer on May 30, 2026 at 7:33 pm

    You can wrap a string literal across multiple lines by adding a backslash at the end of the line, and another backslash where the string should continue, so you can write your example like this:

    countGoodsQuery :: Query
    countGoodsQuery = "select count('*')\
                      \from table\
                      \where ((acquisition_date <= ?)\
                      \and ((sale_date is null) or \
                      \(sale_date < ?)))"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a follow-up question to this one . Take a look at these
This is a follow-on question from the one I asked here . Can constraints
This is like a follow-up question to this one . Basically what I'm doing
I have a follow-up question to this one . I created a new form,
I have a follow up question to this one . Now that I have
This is really a follow on question to a previous one , where I
This question is a follow up on one of my other questions, Can I
This question is a follow on from this one ... I am binding to
This is a follow-up questions on a previous one . Consider this code, which
Note that this is a follow-up question from my previous one: How to memorize

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.