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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:26:28+00:00 2026-05-24T04:26:28+00:00

I have been developing some code that uses Data.Array to use multidimensional arrays, now

  • 0

I have been developing some code that uses Data.Array to use multidimensional arrays,
now I want to put those arrays into a data type so I have something like this

data MyType = MyType { a :: Int, b :: Int, c :: Array }

Data.Array has type:

(Ix i, Num i, Num e) => Array i e

Where “e” can be of any type not just Num.

I am convinced I am missing a concept completely.

How do I accomplish this?
What is special about the Data.Array type that is different from Int, Num, String etc?

Thanks for the help!

  • 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-24T04:26:30+00:00Added an answer on May 24, 2026 at 4:26 am

    Array is not a type. It’s a type constructor. It has kind * -> * -> * which means that you give it two types to get a type back. You can sort of think of it like a function. Types like Int are of kind *. (Num is a type class, which is an entirely different thing).

    You’re declaring c to be a field of a record, i.e., c is a value. Values have to have a type of kind *. (There are actually a few more kinds for unboxed values but don’t worry about that for now).

    So you need to provide two type arguments to make a type for c. You can choose two concrete types, or you can add type arguments to MyType to allow the choice to be made elsewhere.

    data MyType1 = MyType { a, b :: Int, c :: Array Foo Bar }
    data MyType2 i e = MyType { a, b :: Int, c :: Array i e }
    

    References

    • Kinds for C++ users.
    • Kind (type theory) on Wikipedia.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been developing a small Java utility that uses two frameworks: Encog and
I have been developing a library that is getting pretty large, and now I
I have been developing websites for a couple of years now and I almost
I have been developing in asp.net since its existence (also classic asp before that)
Up till now I have been developing my personal and school projects at home
I have been tasked with developing a solution that tracks changes to a database.
I'm developing an iPhone application that uses the iPod library to play some songs.
I've been developing an application that uses wxPython as the GUI librar, and py2exe
I have been developing a program lately that compiles and runs a C++ Program
I'm developing a twitter application for Windows Phone 7 and have been doing some

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.