[Haskell-cafe] Re-order type
Lennart Augustsson
lennart at augustsson.net
Sun Oct 10 08:32:11 EDT 2010
You can use Djinn to generate the glue. Note that in the example you
give there are many possible ways to make the glue just looking at the
types.
Changing the output types of f so they can't be confused with the
input types we get:
Djinn> ? compose :: (c1 -> a1 -> d) -> (a-> b -> c -> (b1,c1,a1)) ->
(a -> b -> c -> d)
compose :: (c1 -> a1 -> d) -> (a -> b -> c -> (b1, c1, a1)) -> a -> b -> c -> d
compose a b c d e =
case b c d e of
(_, f, g) -> a f g
-- Lennart
2010/10/9 André Batista Martins <andre_bm at netcabo.pt>:
> Hello,
> exists any algorithm to determine how terms can be changed to safisty the
> type of one function?
>
>
> example:
>
> f:: a-> b -> c -> (b,c,a)
>
> f1 :: c -> a -> d
>
> In my first function "f" i want assign the output "c" and "a" for to input
> of function "f1".
> I searched for any solution, but i didn't find any anything.
>
> One clue i have found is "minimal edit distance algorithm" for 2 strings.
> Perhaps if i convert de output type of "f" to one string, and de input of
> "f1" to another string and then use this algorithm , i will get one "dirty"
> solution...
>
> I'm open to any sugestion.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
More information about the Haskell-Cafe
mailing list