<commit_before>module Search where

import Data.Maybe (catMaybes)
import qualified Data.Map as M

import Fingering -- (Fret, StringFingering, ChordFingering)
import Instrument -- (Instrument, GuitarString, FretNumber)
import Note (Note, semitoneDistance)

-- |Finds a fingering for a note on a specific string.
findFret :: Note -- ^ note
         -> GuitarString -- ^ a string
         -> FretNumber -- ^ number of frets on the string
         -> Maybe Fret -- ^ Just fret number if possible, Nothing otherwise
findFret note (GuitarString openNote) frets =
    case semitoneDistance openNote note of
    x | x == 0 -> Just Open
    x | x > 0, x <= frets -> Just $ Fret x
    _ -> Nothing
<commit_msg>Cleanup.<commit_after>{-# LANGUAGE PatternGuards #-}
module Search where

import Data.Maybe (catMaybes)
import qualified Data.Map as M

import Fingering
import Instrument
import Note (Note, semitoneDistance)

-- |Finds a fingering for a note on a specific string.
findFret :: Note -- ^ note
         -> GuitarString -- ^ a string
         -> FretNumber -- ^ number of frets on the string
         -> Maybe Fret -- ^ Just fret number if possible, Nothing otherwise
findFret note (GuitarString openNote) frets =
    case semitoneDistance openNote note of
    x | x == 0 -> Just Open
    x | x > 0, x <= frets -> Just $ Fret x
    _ -> Nothing

{'fraction_non_alphanumeric': 0.09321401938851603, 'fraction_numerical': 0.002982848620432513, 'mean_word_length': 2.8563218390804597, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '5645285', 'n_tokens_mistral': 408, 'n_tokens_neox': 393, 'n_words': 159}