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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:17:09+00:00 2026-06-13T13:17:09+00:00

I have two closely related questions: First, how can the Haskell’s Arrow class be

  • 0

I have two closely related questions:

First, how can the Haskell’s Arrow class be modeled / represented in Agda?

 class Arrow a where 
      arr :: (b -> c) -> a b c
      (>>>) :: a b c -> a c d -> a b d
      first :: a b c -> a (b,d) (c,d)
      second :: a b c -> a (d,b) (d,c)
      (***) :: a b c -> a b' c' -> a (b,b') (c,c')
      (&&&) :: a b c -> a b c' -> a b (c,c')

(the following Blog Post states that it should be possible…)

Second, in Haskell, the (->) is a first-class citizen and just another higher-order type and its straightforward to define (->) as one instance of the Arrow class. But how is that in Agda? I could be wrong, but I feel, that Agdas -> is a more integral part of Agda, than Haskell’s -> is. So, can Agdas -> be seen as a higher-order type, i.e. a type function yielding Set which can be made an instance of Arrow?

  • 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-13T13:17:10+00:00Added an answer on June 13, 2026 at 1:17 pm

    Type classes are usually encoded as records in Agda, so you can encode the Arrow class as something like this:

    open import Data.Product -- for tuples
    
    record Arrow (A : Set → Set → Set) : Set₁ where
      field  
        arr    : ∀ {B C} → (B → C) → A B C
        _>>>_  : ∀ {B C D} → A B C → A C D → A B D
        first  : ∀ {B C D} → A B C → A (B × D) (C × D)
        second : ∀ {B C D} → A B C → A (D × B) (D × C)
        _***_  : ∀ {B C B' C'} → A B C → A B' C' → A (B × B') (C × C')
        _&&&_  : ∀ {B C C'} → A B C → A B C' → A B (C × C')
    

    While you can’t refer to the function type directly (something like _→_ is not valid syntax), you can write your own name for it, which you can then use when writing an instance:

    _=>_ : Set → Set → Set
    A => B = A → B
    
    fnArrow : Arrow _=>_  -- Alternatively: Arrow (λ A B → (A → B)) or even Arrow _
    fnArrow = record
      { arr    = λ f → f
      ; _>>>_  = λ g f x → f (g x)
      ; first  = λ { f (x , y) → (f x , y) }
      ; second = λ { f (x , y) → (x , f y) }
      ; _***_  = λ { f g (x , y) → (f x , g y) }
      ; _&&&_  = λ f g x → (f x , g x)
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two questions regarding RewriteRule, but they're both closely related so I hope
I have two closely related classes which I'll call Widget and Sprocket. Sprocket has
In my database I have two closely related tables. There is a frequently called
I have two closely related sites, a main site and a mobile site, hosted
I have two classes (MVC view model) which inherits from one abstract base class.
I have two columns say Main and Sub . (they can be of same
Let's say I have a div with two anchors: <div id=#dialog> <a href=# class=ok>Delete</a>
This is part of a series of at least two closely related, but distinct
This is part of a series of at least two closely related, but distinct
This is closely related to a previous question i asked. I have a many-to-many

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.