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 6762997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:25:29+00:00 2026-05-26T14:25:29+00:00

Sequence (toBlock $ VarDeclAssign foo (JBool False)) (Return $ JBool True) This is the

  • 0
Sequence (toBlock $ VarDeclAssign "foo" (JBool False)) (Return $ JBool True)

This is the only way I can do it at the moment. I tried a foldl but EmptyBlock has a different type so it wouldn’t build.

Can I use do notation or something here instead?

  • 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-26T14:25:29+00:00Added an answer on May 26, 2026 at 2:25 pm

    Looking at the documentation, the problem is that the types of EmptyBlock and Sequence are

    EmptyBlock :: Block ()   
    Sequence :: Block () -> Stmt t -> Block t
    

    Most statements are of type Stmt (), except for Return :: Expr t -> Stmt t. From what I can tell, this is to ensure that there can only be a single return statement in a block, and it must be at the end.

    The reason why foldl Sequence EmptyBlock didn’t work for you is that foldl has the type (a -> b -> a) -> a -> [b] -> a, and if you look at the first argument, it’s clear that Sequence can only be used if you pick t = () so that a = Block () and b = Stmt ().

    This means that you can use foldl to combine all statements except for the Return, which you have to manually insert at the end. Hopefully, that shouldn’t be too inconvenient.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The sequence goes like this.. 7,8,77,78,87,88,777,778,787,788 and so on.. What can be the logic
I have a sequence of elements. The sequence can only be iterated once and
If I have sequence of sequences (maybe a list of tuples) I can use
Given the following sequence: normal %(b)BOLD% normal I want to transform this into the
I have a sequence of new objects. They all look like similar to this:
I've got a sequence of checkboxes on a C# Winform. Each checkbox can have
This sequence I created works well in LINQPad IQueryable<AccessRequest> filteredRows1; // retrieve the last
I have a string sequence that goes like this: <x:object*10/> . I want to
Let us have some sequence A, {-1, 3, 2, 5} for example. We can
I have this commands sequence into a Rake file task :compile => :environment do

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.