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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:19:01+00:00 2026-06-17T09:19:01+00:00

In this function: play :: [Bool] -> ([Bool] -> Bool) -> ([Bool] -> Bool)

  • 0

In this function:

play :: [Bool] -> ([Bool] -> Bool) -> ([Bool] -> Bool) -> [Bool]
play history agent1 agent2  = history ++ (agent1 history) ++ (agent2 history)

Where one of the agents may be:

titForTat :: [Bool] -> Bool
titForTat history
    | last history = True
    | otherwise    = False

I get the error:

    Couldn't match expected type `[Bool]' with actual type `Bool'
    In the return type of a call of `agent1'
    In the first argument of `(++)', namely `(agent1 history)'
    In the second argument of `(++)', namely
      `(agent1 history) ++ (agent2 history)'

It looks to me that the return type of agent1 should be a list of Booleans, but there seems to be an error. I’m sorry if this is a very beginner question. Thank you

  • 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-06-17T09:19:01+00:00Added an answer on June 17, 2026 at 9:19 am

    (++) expects two lists, but your agent functions just return a bool. Try

    play history agent1 agent2  = history ++ [agent1 history] ++ [agent2 history]
    

    If the order in which you store items in your history doesn’t matter, using (:) would be more efficient, i.e.

    play history agent1 agent2  = agent1 history : agent2 history : history
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this function: public static void Play(string FileName, bool Async = false) {
i have this function to play music with web audio API: function playMusic(){ if(countPre<count
I am using this function to play sound on my iPhone app. the problem
In my activity i want to play online video but this function is not
I am playing an embeded youtube video with the play() function. This is all
$(function () { var ptitle = $('div.portfolioItem div.image img').attr(title); $(this).each(function () { $('a.play').attr({ 'title':
I have this code: <script> function EvalSound(soundobj) { var thissound=document.getElementById(soundobj); thissound.Play(); } </script> <embed
This function works fine: std::string get_str() { return std::get<0>( make_tuple(std::string(hi)) ); } But if
This function is in a Class file in App_Code folder Public Shared Function CRUD(ByVal
This function works as it should, window.setInterval(function(){ var active = $('#frontpageControls a.active'); var next

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.