init
This commit is contained in:
25
autotypes/src/AutoTypes.hs
Normal file
25
autotypes/src/AutoTypes.hs
Normal file
@@ -0,0 +1,25 @@
|
||||
module AutoTypes
|
||||
( autoTypes,
|
||||
autoTypes',
|
||||
)
|
||||
where
|
||||
|
||||
import Debug.Trace
|
||||
import qualified AutoTypes.Unify as U
|
||||
import Data.Aeson (Value, decodeFileStrict', encode)
|
||||
import Data.Maybe (fromJust)
|
||||
import System.Environment (getArgs)
|
||||
import System.FilePath (takeFileName)
|
||||
|
||||
autoTypes :: FilePath -> [FilePath] -> IO U.T
|
||||
autoTypes fp fps = autoTypes' <$> go fp <*> mapM go (fp : fps)
|
||||
where go = fmap fromJust . decodeFileStrict'
|
||||
|
||||
autoTypes' :: Value -> [Value] -> U.T
|
||||
autoTypes' t' ts' =
|
||||
let types = map U.fromJson (Debug.Trace.traceShowId (t' : ts'))
|
||||
in head
|
||||
( foldr1
|
||||
(\ls rs -> (concat [U.unify1 l r | l <- ls, r <- rs]))
|
||||
(map (: []) types)
|
||||
)
|
||||
Reference in New Issue
Block a user