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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:51:22+00:00 2026-05-27T04:51:22+00:00

After the long-winded discussion at Write this Scala Matrix multiplication in Haskell , I

  • 0

After the long-winded discussion at Write this Scala Matrix multiplication in Haskell, I was left wondering…what would a type-safe matrix multiplication look like? So here’s your challenge: either link to a Haskell implementation, or implement yourself, the following:

data Matrix ... = ...

matrixMult :: Matrix ... -> Matrix ... -> Matrix ...
matrixMult ... = ...

Where matrixMult produces a type error at compile time if you try to multiply two matricies with incompatible dimensions. Brownie points if you link to papers or books that discuss this precise topic, and/or discuss yourself how useful/useless this functionality is.

  • 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-27T04:51:23+00:00Added an answer on May 27, 2026 at 4:51 am

    There are a number of packages that implement this:

    • http://hackage.haskell.org/package/hmatrix-static
    • http://hackage.haskell.org/packages/archive/repa-algorithms/2.2.0.1/doc/html/Data-Array-Repa-Algorithms-Matrix.html
    • http://hackage.haskell.org/packages/archive/blas/0.7.6/doc/html/Data-Matrix-Dense.html#t:Matrix
    • http://hackage.haskell.org/package/Vec

    The Repa papers in particular have a really nice discussion of the design space and choices made: http://repa.ouroborus.net/

    Of historical interest is McBride’s “Faking It” from 2001 which describes strongly typed vectors. The techniques he employs are fairly similar to those used in the above packages. They were obviously known in circles doing dependently typed programming, but my impression is that the “Faking It” paper is one of the earlier instances where these were used in Haskell. Oleg’s 2005 Monad Reader article on number-parameterized types has some good discussion on the history of these techniques as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this post appears to be long winded. I have a parent repeater
This question is long winded because I have been updating the question over a
I received this message after long time of using the same application without programming
After long investigations and reading this question I still didn't get a good solution
This might not be a programming question but I am posting it after long
This question is a little long-winded, but essentially I want to modify a pie
Hopefully this won't be too long-winded, but trying to be complete: So I have
somewhat related to: libxml2 from java yes, this question is rather long-winded - sorry.
I'm coming back to C++ after long years spent on other technologies and i'm
I'm working on different data structures which are obtained after long computation time. Is

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.