<commit_before>package com.zeyad.rxredux.core.utils

import android.content.Context

sealed class Either<out A, out B> {
    class Left<A>(val value: A) : Either<A, Nothing>()
    class Right<B>(val value: B) : Either<Nothing, B>()

    fun isRight(): Boolean = when (this) {
        is Either.Left -> false
        is Either.Right -> true
    }

    fun isLeft(): Boolean = when (this) {
        is Either.Left -> true
        is Either.Right -> false
    }
}

fun Either<String, Int>.getErrorMessage(context: Context): String {
    return when (this) {
        is Either.Left<String> -> value
        is Either.Right<Int> -> context.getString(value)
    }
}<commit_msg>Added Either another helper function<commit_after>package com.zeyad.rxredux.core.utils

import android.content.Context

sealed class Either<out A, out B> {
    class Left<A>(val value: A) : Either<A, Nothing>()
    class Right<B>(val value: B) : Either<Nothing, B>()

    fun isRight(): Boolean = when (this) {
        is Either.Left -> false
        is Either.Right -> true
    }

    fun isLeft(): Boolean = when (this) {
        is Either.Left -> true
        is Either.Right -> false
    }
}

fun Either<String, Int>.getErrorMessage(context: Context): String {
    return when (this) {
        is Either.Left<String> -> value
        is Either.Right<Int> -> context.getString(value)
    }
}

fun Either<String, Int>.getLeft(): String {
    return when (this) {
        is Either.Left<String> -> value
        is Either.Right<Int> -> throw IllegalAccessException("This is the Right not left!")
    }
}
{'fraction_non_alphanumeric': 0.13333333333333333, 'fraction_numerical': 0.0, 'mean_word_length': 2.7169811320754715, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3747090', 'n_tokens_mistral': 484, 'n_tokens_neox': 478, 'n_words': 139}