typeDecl :: IParser D.SourceDecl
typeDecl =
 do reserved "type" <?> "type declaration"
    forcedWS
    isAlias <- optionMaybe (string "alias" >> forcedWS)

    name <- capVar
    args <- spacePrefix lowVar
    padded equals

    case isAlias of
      Just _ ->
          do  tipe <- Type.expr <?> "a type"
              return (D.TypeAlias name args tipe)

      Nothing ->
          do  tcs <- pipeSep1 Type.constructor <?> "a constructor for a union type"
              return $ D.Datatype name args tcs
typeDecl :: IParser D.SourceDecl
typeDecl =
 do reserved "type" <?> "type declaration"
    forcedWS
    isAlias <- optionMaybe (string "alias" >> forcedWS)

    name <- capVar
    args <- spacePrefix lowVar
    padded equals

    case isAlias of
      Just _ ->
          do  tipe <- Type.expr <?> "a type"
              return (D.TypeAlias name args tipe)

      Nothing ->
          do  tcs <- pipeSep1 Type.constructor <?> "a constructor for a union type"
              return $ D.Datatype name args tcs
typeDecl =
 do reserved "type" <?> "type declaration"
    forcedWS
    isAlias <- optionMaybe (string "alias" >> forcedWS)

    name <- capVar
    args <- spacePrefix lowVar
    padded equals

    case isAlias of
      Just _ ->
          do  tipe <- Type.expr <?> "a type"
              return (D.TypeAlias name args tipe)

      Nothing ->
          do  tcs <- pipeSep1 Type.constructor <?> "a constructor for a union type"
              return $ D.Datatype name args tcs