Search code examples
haskelltypestuplessimultaneousrenaming

2 Simultaneous type renamings in Haskell


we've been given the task to make a Dictionary, as a List of tuples with (String, String). The problem here is that I actually have no idea if I can rename String twice at the same time, since I want the tuple to look like this

(German, English)

Is it even possible to just make it look like this?

type German =  String
type English = String
type Dictionary = [(German, English)]

Or would there be any conflicts? It was kinda frustrating not finding a single entry about this, been almost 2 hours and not a single line of code stands right now :|


Solution

  • Yes, you can do that. You can't do the opposite

    type German = String
    type German = Int        -- conflicts here!