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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:41:56+00:00 2026-05-23T15:41:56+00:00

I have started learning Haskell from Learn You a Haskell . In one of

  • 0

I have started learning Haskell from Learn You a Haskell. In one of the early parts there is an example with binary trees and I started thinking about implementing a remove function and hence got sidetracked to zippers and am now looking at Zippers

As part of the exercises on the linked wiki page on zippers, I have functions with the following method declarations

get :: Node a -> a

put :: a -> Node a -> Node a

retrieveNode :: Thread -> Node a -> Node a

retrieve :: Thread -> Node a -> a

Now I try to implement the following function

update :: Thread -> Node a -> (a -> a) -> Node a
update t n f = put (f (get (retrieveNode t n)) retrieveNode t n) -- Line 29 referenced

Loading this in ghci gives:

Prelude> :l theseus.hs 
[1 of 1] Compiling Main             ( theseus.hs, interpreted )

theseus.hs:29:15:
    Couldn't match expected type `Node a'
       against inferred type `Node a1 -> Node a1'
    In the expression:
        put (f (get (retrieveNode t n)) retrieveNode t n)
    In the definition of `update':
        update t n f = put (f (get (retrieveNode t n)) retrieveNode t n)
Failed, modules loaded: none.

I read up on the Monomorphism restriction, but couldn’t decide if this is relevant for my code.

  • 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-23T15:41:56+00:00Added an answer on May 23, 2026 at 3:41 pm

    You’re missing the second argument to put. From a glance it looks like you just got your parenthesis wrong. Try this.

    update :: Thread -> Node a -> (a -> a) -> Node a
    update t n f = put (f (get (retrieveNode t n))) (retrieveNode t n)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started learning ruby reading from different resources. One of them is
I have started learning flex 4 and I got myself thinking about how to
I have recently started learning Perl and one of my latest assignments involves searching
I have just started learning C# and would have one question that I cannot
Since I have started learning about rendering to a texture I grew to understand
I have just started learning python and am getting caught up. I come from
i have started learning something about log4j as so far its working fine here
I have started learning Objective C with no prior programming experience from the 'Become
I have just started learning java and i have about 8 months time. My
I have just started learning about Android and I was planning on making a

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.