Can. In a strictly interpreting uncompiled implementation, you can represent functions as
data Function = F Source | Compo Function Function
and then you just define
compositionSplit (Compo fg) = Just (f,g) compositionSplit _ = Nothing
Such an implementation will consider the equality of functions (according to relational transparency) as intensional , not extensional . Since the language itself does not say anything about the equality of the functions of AFAIK, this should not affect anything (except, perhaps, performance).
In compiled implementations, this can also be achieved, for example. keeping the origin for each object in memory.
AndrewC gives a winning counter argument: for two values a=f.(gh) and b=(fg).h , if we want to consider them equal values, which we usually do, in Haskell - fst.unJust.deCompo will produce two different result, violation of link transparency. Therefore, it cannot be part of the pure FP paradigm. He would have to return what we could legitimately consider equal values ββin two cases, and we could not disassemble it without violating purity. Perhaps such a thing may exist in some unclean monad, but this is not what the OP asked for, unfortunately. :) So, this answer is erroneous.
Will ness
source share