[Haskell-cafe] what are correct ways to translate haskell code ?

Dan Dart haskellcafe at dandart.co.uk
Wed May 24 15:32:27 UTC 2023

It seems to me that when you have an isomorphism between two types, a
natural transformation from one to the other would usually be included
in whichever of the two types are the newer (or maybe both). For
example, Vector_2 would have e.g.

fromTuple :: (a, b) -> Vector_2 a b
fromTuple (a, b) = C a b

toTuple :: Vactor_2 a b -> (a, b)
toTuple (C a b) = (a, b)

then in the interim, one could use these to interface between them.

When types and natural transformation functions like these exist in
scope, text editor plugins should be able to take advantage of these
using parsers such as happy/alex/ghc's/hlint.

I've used specifically hlint rules to rewrite, maybe that will help for now?


More information about the Haskell-Cafe mailing list