<commit_before>
module Fixity(
    FixityInfo, Associativity(..),
    toHseFixity,
    fromFixitySig, toFixitySig
    ) where

import GHC.Generics(Associativity(..))
import qualified Language.Haskell.Exts as HSE
import HsBinds
import HsExtension
import OccName
import RdrName
import SrcLoc
import BasicTypes

-- Lots of things define a fixity. None define it quite right, so let's have our own type.
type FixityInfo = (String, Associativity, Int)


toHseFixity :: FixityInfo -> HSE.Fixity
toHseFixity = undefined

<commit_msg>Properly implement toHseFixity<commit_after>
module Fixity(
    FixityInfo, Associativity(..),
    toHseFixity,
    fromFixitySig, toFixitySig
    ) where

import GHC.Generics(Associativity(..))
import qualified Language.Haskell.Exts as HSE
import HsBinds
import HsExtension
import OccName
import RdrName
import SrcLoc
import BasicTypes

-- Lots of things define a fixity. None define it quite right, so let's have our own type.
type FixityInfo = (String, Associativity, Int)


toHseFixity :: FixityInfo -> HSE.Fixity
toHseFixity (name, dir, i) = HSE.Fixity (f dir) i $ HSE.UnQual () $ HSE.Ident () name
    where
        f LeftAssociative = HSE.AssocLeft ()
        f RightAssociative = HSE.AssocRight ()
        f NotAssociative = HSE.AssocNone ()

{'fraction_non_alphanumeric': 0.0822884012539185, 'fraction_numerical': 0.0, 'mean_word_length': 4.007843137254902, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3545733', 'n_tokens_mistral': 429, 'n_tokens_neox': 420, 'n_words': 131}