This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mappable f where | |
map :: (a -> b) -> f a -> f b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typeclass Mappable<f> { | |
f<b> map(Func<a, b>, f<a>); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Monad m where | |
(>>=) :: m a -> ( a -> m b) -> m b | |
(>>) :: m a -> m b -> m b | |
x >> y = x >>= \_ -> y | |
return :: a -> m a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typeclass Monad<m> { | |
m<b> >>= <a, b>(m<a>, Func<a, m<b>>); | |
m<b> >> <a, b>(m<a> x, m<b> y) { | |
return >>= <a, b>(x, (ignored) => y); | |
} | |
m<a> return_ <a>(a); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
instance Monad Maybe where | |
Nothing >>= f = Nothing | |
(Just x) >>= f = f x | |
return = Just | |
instance Monad [] where | |
xs >>= f = concat (map f xs) | |
return x = [x] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typeclassinstance Monad<Nullable> { | |
Nullable<b> >>= <a,b>(Nullable<a> x, Func<a, Nullable<b>> f) { | |
if (x.HasValue) { | |
return f(x.Value); | |
} else { | |
return null; | |
} | |
} | |
Nullable<a> return_ <a>(x) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do | |
x1 <- expr1 | |
x2 <- expr2 | |
expr3 | |
expr1 >>= (\x1 -> (expr2 >>= (\x2 -> expr3))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do | |
expr1 | |
expr2 | |
expr1 >> expr2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ hie.exe | |
2020-01-27 00:43:25.619924 [ThreadId 3] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "C:\\Users\\caleb\\Documents\\deepdecompilerproject\\dd-c-preprocessor\\stack.yaml"} | |
stty: 'standard input': Inappropriate ioctl for device | |
stty: 'standard input': Inappropriate ioctl for device | |
stty: 'standard input': Inappropriate ioctl for device | |
2020-01-27 00:43:27.9500122 [ThreadId 3] - Module "C:\Users\caleb\Documents\deepdecompilerproject\dd-c-preprocessor\File.hs" is loaded by Cradle: Cradle {cradleRootDir = "C:\\Users\\caleb\\Documents\\deepdecompilerproject\\dd-c-preprocessor", cradleOptsProg = CradleAction: Cabal-Helper-Stack} | |
2020-01-27 00:43:27.9500122 [ThreadId 3] - Executing Stack GHC with args: --numeric-version | |
2020-01-27 00:43:28.4603862 [ThreadId 3] - Executing Stack GHC with args: --print-libdir | |
2020-01-27 00:43:28.957058 [ThreadId 3] - New cradle: C:\Users\caleb\Documents\deepdecompilerproject\dd-c-preprocessor\test\Spec.hs | |
2020-01-27 00:43:28.960053 [ThreadId 3] - Cabal-Helper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import pickle | |
import os | |
import random | |
import sourcenode | |
import torch.nn as nn | |
import torch.utils.checkpoint | |
import torch.utils.data | |
import math | |
import objprocessor |