from typing import List


def dashed(positions: List[int], chain: str) -> str:
    """
    Take a set of positions (i.e., 1 2 3 7 8 9) and a chain ("A"), and produce a
    repr like "A:1-3 A:7-9"
    """
 
    #print(positions)
    positions = sorted(positions)
    acc_start = None
    acc_end = None
    numbering = ""
    for p in range(1, max(positions)+1):
        #print("examining", p)
        if p in positions and p != max(positions):
            #print("\tfound in positions", p)
            if acc_start is None:
                acc_start = p
            acc_end = p
            #print("now acc_start acc_end", acc_start, acc_end)
        elif p != max(positions):
            if acc_start is not None and acc_end is not None:
                if acc_start != acc_end:
                    numbering += "{ch}:{start}-{end} ".format(ch=chain, start=acc_start, end=acc_end)
                else:
                    numbering += "{ch}:{only} ".format(ch=chain, only=acc_start)
                acc_start = None
                acc_end = None
        else:
            if p in positions:
                acc_end = p
            if acc_start is None:
                numbering += "{ch}:{only} ".format(ch=chain, only=acc_end)
            else:
                numbering += "{ch}:{start}-{end} ".format(ch=chain, start=acc_start, end=acc_end)

    return numbering