<commit_before>-- vim: sw=2: ts=2: set expandtab:
{-# LANGUAGE CPP, TemplateHaskell,
             MultiParamTypeClasses,
             FlexibleInstances,
             FlexibleContexts,
             OverlappingInstances,
             IncoherentInstances,
             OverloadedStrings,
             GADTs,
             NoMonomorphismRestriction,
             ScopedTypeVariables
  #-}

module Infer where

#include "macros.h"

import Syntax

import Data.Char
import Data.List
import Control.Applicative
import Control.Monad.Trans
import Control.Monad.Error
import Control.Monad.State
import Control.Monad.State.Lazy
import Language.LBNF.Runtime
import Parser (ty2Type)
import Generics.RepLib.Unify hiding (solveUnification)
import Unbound.LocallyNameless hiding (subst, Con, union)
import qualified Unbound.LocallyNameless as LN
import Unbound.LocallyNameless.Ops (unsafeUnbind)
import GHC.Exts( IsString(..) )
import Debug.Trace
-- trace _ a = a

catchErrorThrowWithMsg m f = m `catchError` (\e -> throwError . strMsg $ f e)


instance HasVar (Name PSUT) PSUT where
  is_var (Var nm) = Just nm
  is_var _ = Nothing
  var = Var

instance (Eq n, Show n, Show a, HasVar n a) => Unify n a String where
   unifyStep _ = unifyStepEq

instance (Eq n, Show n, Show a, HasVar n a) => Unify n a (Name s) where
   unifyStep _ = unifyStepEq

instance (Alpha n, Eq n, Show n, HasVar n PSUT) => Unify n PSUT (Bind n PSUT) where
   unifyStep _ b1 b2 
       | b1 `aeq` b2 = return ()
       | otherwise   =
           do (e1,e2) <- runFreshMT $<commit_msg>fogot to turned off trace before commit<commit_after>-- vim: sw=2: ts=2: set expandtab:
{-# LANGUAGE CPP, TemplateHaskell,
             MultiParamTypeClasses,
             FlexibleInstances,
             FlexibleContexts,
             OverlappingInstances,
             IncoherentInstances,
             OverloadedStrings,
             GADTs,
             NoMonomorphismRestriction,
             ScopedTypeVariables
  #-}

module Infer where

#include "macros.h"

import Syntax

import Data.Char
import Data.List
import Control.Applicative
import Control.Monad.Trans
import Control.Monad.Error
import Control.Monad.State
import Control.Monad.State.Lazy
import Language.LBNF.Runtime
import Parser (ty2Type)
import Generics.RepLib.Unify hiding (solveUnification)
import Unbound.LocallyNameless hiding (subst, Con, union)
import qualified Unbound.LocallyNameless as LN
import Unbound.LocallyNameless.Ops (unsafeUnbind)
import GHC.Exts( IsString(..) )
-- import Debug.Trace
trace _ a = a

catchErrorThrowWithMsg m f = m `catchError` (\e -> throwError . strMsg $ f e)


instance HasVar (Name PSUT) PSUT where
  is_var (Var nm) = Just nm
  is_var _ = Nothing
  var = Var

instance (Eq n, Show n, Show a, HasVar n a) => Unify n a String where
   unifyStep _ = unifyStepEq

instance (Eq n, Show n, Show a, HasVar n a) => Unify n a (Name s) where
   unifyStep _ = unifyStepEq

instance (Alpha n, Eq n, Show n, HasVar n PSUT) => Unify n PSUT (Bind n PSUT) where
   unifyStep _ b1 b2 
       | b1 `aeq` b2 = return ()
       | otherwise   =
           do (e1,e2) <- runFreshMT $
{'fraction_non_alphanumeric': 0.08365508365508366, 'fraction_numerical': 0.005791505791505791, 'mean_word_length': 2.9205548549810847, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '6364006', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1019, 'n_words': 322}