mikeizbicki / subhask

Type safe interface for working in subcategories of Hask
BSD 3-Clause "New" or "Revised" License
418 stars 43 forks source link

Use Ƨ⃒ for vector application on the left #23

Open cbarrett opened 8 years ago

cbarrett commented 8 years ago

In the third tutorial a request is made for a reversed dollar sign Unicode character. In my shell (fish 2.1.2, in Terminal on OS X 10.10.5) the following outputs the character in the title:

~> echo \u01A7\u20d2 Ƨ⃒

It uses the "Latin Capital Letter Tone Two" and a combining character "Combining Long Vertical Line Overlay." You can also use 01A8 for the lower case reversed s, although I expect the sizing will vary from font to font.

(I would have just sent an email but I wasn't sure what the right place for that was.)

bmabsout commented 8 years ago

Why not use '&' ? like Data.Function does,I use it all the time and I also have reverse composition written as &.(I know >>> exists but I prefer uniform syntax) and fmap as &> , i found these to be very nice.

mikeizbicki commented 8 years ago

I believe the & combinator in Data.Function does something completely different. A matrix is equivalent to a linear function of type a +> b +> c, where I'll be using +> to denote a linear category. Specializing to this type, ($) :: (a +> b +> c) -> (a +> b +> c), and (&) :: a -> (b +> c) -> b +> c. What & is doing is just syntactically letting you apply a function to the left. The proposed (Ƨ⃒) operator, however, has a semantic meaning of applying of applying arguments to a function in a different order. One way to implement it would be to give it a type (Ƨ⃒) :: (a +> b +> c) -> (b +> a +> c) (compare this to ($)). This is one way to interpret "left multiplication of a matrix by a vector."