# Haskell 1428

Almost all lowercase characters are used as function names.

*P.S.* Are there any game about these kind (2d pointer) esolangs ? They must be very amusing !

    import qualified Data.Map as M
    import System.Environment
    import Data.Char
    import System.Random
    type I=Integer
    data S=S{p::(I,I),d,e::Int,s::[I],r::S->S,m::M.Map(I,I)Char}
    a=zip">v<^\\/_|x+-*,%()=:~!?$@&r{}gponi"[q 0,q 1,q 2,q 3,
     i[1,0,3,2],i[0,3,2,1],i[0,3,2,1],i[2,1,0,3],\s->do x<-randomRIO(0,3);t$s{d=x},
     h(+),h(-),h(*),h div,h mod,h$j(<),h$j(>),h$j(==),
     o(\(x:y)->x:x:y),o tail,t.g.g,\q->t$if s q==[]||head(s q)==0 then g q else q,
     o(\(x:y:z)->(y:x:z)),o(\(x:y:z:w)->(y:z:x:w)),\q->t$(r q)q,
     o reverse,o(\s->last s:init s),o(\s->tail s++[head s]),
     \q->let(i:j:x)=s q in t$q{s=l(b(i,j)q):x},
     \q->let(i:j:k:x)=s q in t$q{s=x,m=M.insert(i,j)(n k)(m q)},
     y$putChar.n,y$putStr.show,\q->do c<-getChar;t(q{s=l c:(s q)})
     ]++[(x,t.c i)|(x,i)<-zip['0'..'9'][0..9]++zip['a'..'f'][10..15]]
    b p q=maybe ' 'id$M.lookup p(m q)
    c x q=q{s=x:s q}
    f(i,j)0=(i,j+1)
    f(i,j)1=(i+1,j)
    f(i,j)2=(i,j-1)
    f(i,j)3=(i-1,j)
    g q=q{p=f(p q)(d q)}
    h f=o(\(b:a:k)->f b a:k)
    i a s=t$s{d=a!!(d s)}
    j f a b|f a b=1|1<2=0
    k=zip[0,1..]
    l=toInteger.ord
    n=chr.fromInteger
    o f q=t$q{s=f(s q)}
    q x=i[x,x..]
    t=return
    u s=M.fromList.foldr1(++)$[map(\(j,x)->((i,j),x))l|(i,l)<-k$map k$lines s]
    v q=let(x:y)=s q in q{r=w x,s=y}
    w x q=q{s=x:(s q),r=v}
    y o q=let(i:x)=s q in o i>>t(q{s=x})
    z q=[[[y=<<(maybe t id$lookup x a)q,t()]!!j(==)x ';',y$c(l x)q]!!k,w]!!j elem x"'\""
     where k=e q;x=b(p q)q;w=y$q{e=1-k};y=z.g
    main=z.S(0,0)0 0[]v.u=<<readFile.head=<<getArgs


## An Example Fish Program
    mm  v                           
       >              v
       ~>1f+00p       v                     
        ;v?)+afg00    <             #<-- Condition of loop 1
       p>>~ 410p      v             
       0vv?)+cfg01    <  <          #<-- Condition of loop 2
       00>~10g00gg'.'=?v~     v     #<-- Go this route when 
       +0    vp01+1g01~<            #    we find a digit.
       1g    >           ^   
       ^<                      
       v                      <   
                              >       >~      ;
    0  >10g0cg"0"$-+00gg:" "=?^~:"."=?^v   
       ^     pc0+1gc0 n-$"0"          ~<
                                   
        .......................  
        .......................  
        ......112233...........   This program prints 
        .......................   the number on this field.
        .......................     <------------
        .......................  
        .......................      
        .......................       
        .......................