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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:35:21+00:00 2026-05-15T18:35:21+00:00

I wish to say that a certain parametrized monad st works with a regular

  • 0

I wish to say that a certain parametrized monad st works with a regular memory, but a subclass of my parametrized monad should impose an additional constraint on the type of memory. In code:

class Memory m where
    ...

class State st where
    unit :: Memory m => a -> st m m a
    bind :: (Memory m1, Memory m2, Memory m3) => st m1 m2 a -> (a -> st m2 m3 b) -> st m1 m3 b

class RMemory m where
    ...

class State st => RState st where
    -- no operators

now my problem is that I wish to impose that whenever (RState st) is true, then inside the definition of (State st) Memory is replaced with RMemory; this would turn State into something that is parametric in the typeclass of its memory. Can this be done?

  • 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-15T18:35:21+00:00Added an answer on May 15, 2026 at 6:35 pm

    I suspect you can’t do this directly. You can however cheat very effectively by adding a level of indirection. See John Hughes’ Restricted Data Types in Haskell for how to do it: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.39.2816

    This is the same technique used, e.g., to obtain open recursion in syb-with-class.

    I’m fairly certain that this should point you in the right direction.

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

Sidebar

Related Questions

Lets say I have an object that has stringProp1, stringProp2. I wish to store
Say I've got an integer, 13941412, that I wish to separate into bytes (the
Well, sad to say, but I have 2 questions, which I wish I could've
My question is i have a certain money amount, lets say 552. I wish
I wish to say: public void Problem(Guid optional = Guid.Empty) { } But the
Say that I have Class A and Class B. Class B is a subclass
Lets say I wish to be able to render different view logic for two
I wish to use JSON.Net on a brand spankin new Mono class library (say
Hie frnds, I have two tables say Orders and OrdersXML now I wish to
I wish the UIPIckerView would allow you to scroll then select but since it

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.