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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:15:45+00:00 2026-06-11T21:15:45+00:00

If I have a function like so: func:: Arg1->Arg2->String and Arg1 has a constructor

  • 0

If I have a function like so:

func:: Arg1->Arg2->String

and Arg1 has a constructor like:

data Arg1 = something1 something2 something3

I want to pattern match on one of the Arg1 constructors within func (below I have pattern matched on “Val1”):

func:: Arg1->Arg2->String
func (a b Val1) e = "Something"

but it keeps saying I have a problem with parsing symbol ‘a’

The variables in the brackets just represent Arg1??? “e” is the Arg2 parameter.

EDIT: This seems to work:

func:: Arg1-> Arg2-> String
func (A b Val1) e = "Something"

but I cannot pattern-match on A because i’m not bothered about that value.

EDIT2: Seems like I need to do:

data Arg1 = Arg1 something1 something2 something3

for it to work?!?!

  • 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-11T21:15:46+00:00Added an answer on June 11, 2026 at 9:15 pm

    You have to pattern match on the constructor as well.
    You also forgot to specify the constructor for Arg1.

    func :: Arg1 -> Arg2 -> String
    func (Arg1 a b Val1 d) e = "Foobar"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a C# function that look like this: bool func(string name, bool retry)
I have a function like the following: // Convert To JPG // public string
I need to parse a string like func1(arg1, arg2); func2(arg3, arg4); . It's not
I have a json object named data like below And I have a function
I have function calls that look like this (for no apparent reason): func (
If I have the following function: def intercept(func): # do something here @intercept(arg1=20) def
I have a recursive function which can be written like: void func(TypeName *dataStructure, LL_Node
I have a list of strings that look like funcname(arg, another_arg)*20 + second_func(arg1, arg2)
In php we can pass default arguments to a function like so function func_name(arg1,arg2=4,etc...)
I have function like this: function ypg_delete_img($id, $img) { $q = $this->ypg_get_one($id); $imgs =

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.