>> Functor is quite loaded name and may lead to confusion.
> Yes, the name is a problem. OpenAxiom uses "Functorial".
> But I think Functor is fine, given the context that Haskell is
> using this name.
BTW, in Aldor the "Maybe" domain is called "Partial".
Traditionally, my usage of the term "functor" in the context of
AXIOM/FriCAS would be that it is any parametrized domain.
If a (domain)constructor with name Functor is introduced, that would
confuse me a bit, if that thing is restricted to just export
map: (S -> S, %) -> %
Additionally, if the definition is
Functor(S : Type) : Category == Type with
map: (S -> S, %) -> %
then this "Functor" is of type "Category" and this I find rather
strange. If one defines "Foo(X: Category): Category == ..." then I would
be tempted to call Foo (which can be seen as a "function" with type
Category->Category) as a Functor, but you want "Functor" instead of
"Foo" and that does not fit with category theory in my understanding.
Like Waldek, I also think that MapCategory2 would fit better into
FriCAS. I am not so much in favour of copying the terminology of
Haskell. In particular, if FriCAS is going to implement
> Monad(S : Type) : Category == Type with
> _>_> : (%, S -> %) -> %
that would confuse me quite a bit.
Naming of functions and domains aside, I find this implementation
somewhat hacky, in particular the line starting with "if FA is Maybe A".
> )abbrev package FUNCTOR2 FunctorPackage
> FunctorPackage(A : Type, B : Type, FA : Functor A, FB : Functor B) :
> Exports == Implementation where
> Exports == with
> map : (A -> B, FA) -> FB
> Implementation == add
> if FA is Maybe A and FB is Maybe B then
> map(f, fa) ==
> if nothing?(fa)$Maybe(A) then nothing()$Maybe(B)
> just f fromJust fa
If FA and FB are restricted to just one domain, then why would one want
to put them as parameters?
FunctorPackage(A : Type, B : Type) :
Exports == Implementation where
FA ==> Maybe A
FB ==> Maybe B
Exports == with
map : (A -> B, FA) -> FB
Implementation == add
map(f, fa) ==
if nothing?(fa)$FA then nothing()$FB
just f fromJust fa
You probably suggested that, because the "if" line shouldn't be there
and you actually wanted something that applies to all pairs of monads.
But your FunctorPackage just does the lifting of map for only one
particular monad (namely Maybe).
I'm still of the opinion that the concept of monads cannot be nicely
defined in SPAD.
Note that in
class Monad m where
(>>=) :: m a -> (a -> m b) -> m b
(>>) :: m a -> m b -> m b
return :: a -> m a
fail :: String -> m a
the "m" appears in front of a and in front of b. I'm not aware of a
SPAD/Aldor syntax that can describe this situation.
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
To post to this group, send email to firstname.lastname@example.org.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.