To rebind Haskell's proc-notation, paragraph 7.3.11 "Rebindable syntax and the implicit Prelude import" of the GHC User's Guide states that the Arrow notation uses the arr
, first
, ... functions that are in scope. It also states that the types "must match the Prelude types very closely".
Anyone who wants to use this, is encouraged to ask. So, how close do these types have to match the Prelude types?
I'm not aware of any full documentation on rebinding the proc
notation--I think this is in the category of things they tossed in there because it made sense to have it, but there aren't any clear motivating examples for using it yet.
I did a quick empirical test, enabling the relevant extensions, giving the rebound functions bogus types, and then looking at the type errors. What I saw was something roughly like this:
arr :: (a -> b) -> t a b
(>>>) :: t a b -> t b c -> t a c
first :: t a b -> t (a, c) (b, c)
I assume the remaining functions are similar. Roughly, these are exactly the same types as the standard functions, minus only the Arrow
constraint in the context.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With