countUnmatchedBraces::Int->Char->IntcountUnmatchedBracescountcharacter|character=='{'=count-1|character=='}'=count+1|otherwise=countunmatchedBraces::String->IntunmatchedBraces=foldlcountUnmatchedBraces0zero::Int->Boolzero=(==)0areCurlyBracesMatched::String->BoolareCurlyBracesMatched=zero.unmatchedBracesman::IO()main=doputStrLn$show$areCurlyBracesMatched"const f = a => { console.log(a)"-- FalseputStrLn$show$areCurlyBracesMatched"const f = a => { console.log(a) }"-- TrueputStrLn$show$areCurlyBracesMatched"const f = a => console.log(a)"-- True
My take at the challenge written in Haskell.
Try it online.