Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

What is the Haskell equivalent to struct in C?

Question in thread title. If I worded that properly. My initial thought was:

PHP Code

<?php 
data Fish 
= Name | Species |Teeth | Age 

PHP Code

<?php 
struct fish 
{ 
  const 
char *name; 
  const 
char *species; 
  
int teeth;
  
int age; 
} 

but I'm not totally sure. Any assistance?
You are probably looking for a record data structure.
Found out it is similar to the product type in Haskell

Here it is...

PHP Code

<?php 
data Fish 
= Fish { 
  
name :: String, 
  
species :: String, 
  
teeth :: Int, 
  
age :: Int 
} 


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Help] by .eXeAug 9, 2023 04:41 AM 0 87 Aug 9, 2023 04:41 AM
Last Post: .eXe
[Help] by AirbourneApr 8, 2023 12:02 PM 1 76 Apr 8, 2023 12:02 PM
Last Post: luctvmgrzfsxn754
by hdev0Sep 1, 2019 02:57 PM 0 94 Sep 1, 2019 02:57 PM
Last Post: hdev0