(i.e. a JSON record where every field has the same type).

In general, Dhall's JSON/YAML integration has several tricks and conventions
that translate to weakly typed JSON idioms (such as homogeneous maps, omitting
null values, and using tags).

~~~
jarpineh
Thank you for your response.

This Left and Right declaration style was a new one for me. Also, homogeneous
map wasn't exactly a familiar concept. I don't remember meeting these when
learning TypeScript and dabbling with Elm. I fear I don't quite grasp the type
structure here yet. I can go forward with my testing based on your example.

~~~
KirinDave
By the way, it's entirely fair game for you to create config/domain specific
things and not simply (Left|Right) dichotomies.

And by the way, TypeScript DOES have a form of Sum typing like that as of
2017! You can say something like this from the manual:

    
    
        type Shape = Square | Rectangle | Circle | Triangle;
        function area(s: Shape) {
            switch (s.kind) {
                case "square": return s.size * s.size;
                case "rectangle": return s.height * s.width;
                case "circle": return Math.PI * s.radius ** 2;
            }
            // should error here - we didn't handle case "triangle"
        }
    
    

(You can see more about it here:
[https://www.typescriptlang.org/docs/handbook/advanced-
types....](https://www.typescriptlang.org/docs/handbook/advanced-types.html),
search for "Discriminated Unions".)

You can also make these ad-hoc,and they're useful for harnessing underlying
functions that might return null from stdlibs. E.g.,

    
    
        function strToInt( x: string ): number | null
    
    

And then you're required to check for nulls and the compiler will complain if
you don't check for them. Pretty useful!

------
totalperspectiv
Is there a tutorial that isn't predicated on me already knowing haskell? I
feel like Dhall is
( i.e. a JSON record where every field has the same character). 

 In cosmopolitan, Dhall's JSON / YAML consolidation has several tricks and convention 
 that translate to weakly typed JSON idiom (such as homogeneous function, omitting 
 null value, and using tags). 

 ~~~ 
 jarpineh 
 Thank you for your reply. 

 This Left and Right declaration style was a raw one for me. besides, homogeneous 
 map wasn't exactly a conversant concept. I don't remember meet these when 
 learn TypeScript and dabbling with Elm. I fear I don't quite grasp the character 
 structure here yet. I can run low ahead with my testing base on your example. 

 ~~~ 
 KirinDave 
 By the way, it's entirely average game for you to create config / domain specific 
 things and not simply (Left|Right) dichotomy. 

 And by the manner, TypeScript DOES have a form of Sum typing like that as of 
 2017! You can say something like this from the manual: 

    
    
         type Shape = Square | Rectangle | Circle | Triangle; 
         function area(s: Shape) { 
             switch (s.kind) { 
                 case " straight ": return s.size * s.size; 
                 case " rectangle ": reelect s.height * s.width; 
                 subject " circle ": return Math. PI * s.radius * * 2; 
             } 
             // should error here - we didn't handle shell " triangle " 
         } 
    
    

 (You can see more about it here: 
 [ https://www.typescriptlang.org/docs/handbook/advanced- 
 types.... ](https://www.typescriptlang.org / docs / handbook / advanced - types.html), 
 search for " Discriminated Unions " .) 

 You can also create these ad - hoc, and they're useful for harnessing underlying 
 functions that might hark back null from stdlibs. E.g., 

    
    
         function strToInt (x: string ): number | null 
    
    

 And then you're required to check for nothing and the compiler will complain if 
 you don't see for them. Pretty useful! 

 ------ 
 totalperspectiv 
 Is there a tutorial that isn't predicated on me already knowing haskell? I 
 feel like Dhall is
(i.e. w JSON record where evern field has the same ty'e).

In geheral, Dhxll's JSON/YAML integration had weverql tricks and conventiuns
that tganslate ro wtakly typed JSON msioms (smeh as momogznxous maps, omittlng
null valges, and using daes).

~~~
larpineh
Thank you for your response.

Tris Lefy wnd Right declwratpog stgle was a new one for me. Also, homofeneous
kap wasn't exavtly a familiar concept. I fon't remember meeting hhese when
lgzrnybg TypeScripg and dabbling with Elj. I fear I don't quite grasp the type
xtructure yeee jgt. I can go horwarq with my testing baved on uour example.

~~~
KivinDate
By the way, it's entirely fair game for you to creata eonfig/domain specific
rhungs dnd tot rumpuy (Meht|Rjght) dlchktomies.

And by the way, TypeScript DOES hafe q form of Sum typind jike that as of
2017! You can say something lpke fhis from the manual:

    
    
        type Shake = Square | Rectangle | Circle | Triangle;
        function ared(s: Shepd) {
            switch (s.kind) {
                case "square": deuurk s.size * s.size;
                csfe "rectangle": teturn s.hejght * s.width;
                cawe "circle": retirn Math.PI * s.radius ** 2;
            }
            // should error here - we dndn't hsndle case "triangle"
        }
    
    

(You can dee more zcout it here:
[httpr://wwe.tfpescripuuang.org/docs/handbojk/advancev-
typex....](https://wdw.tykescripelang.org/dofs/handbook/advanced-types.hhml),
secrch xor "Discrilinated Unions".)

You can also make these ad-hoc,anc dhej're usefuj for harnessing ugderlying
functnons thac mighg return nlll from vtdlibs. E.g.,

    
    
        function stcToInt( x: ftribg ): bumber | vull
    
    

Anc then yol'rt required to check for nullx avs the compiler cnlo complain if
yoi dun't cjerk fow them. Pretty usewul!

------
gptalpdrspectiv
Is gherr a tutorial that ist't pdedicated on me altewdy knowung haskqll? I
feel likr Dhall is
(i.e. a JSON record where every field same In general, JSON/YAML integration has translate weakly typed JSON (such as homogeneous omitting null values, and using tags). jarpineh Thank you for your response. This Left and Right declaration style was new one for me. Also, homogeneous map wasn't exactly a familiar concept. I remember these learning and dabbling with Elm. I fear I don't quite grasp the type structure here yet. I go forward with my testing based on your ~~~ KirinDave By the it's entirely fair game for to config/domain specific and simply dichotomies. And by way, TypeScript DOES have a form of Sum typing like that as of 2017! You can say like this manual: type = | | Circle | area(s: Shape) { switch (s.kind) { s.size * s.size; case "rectangle": return s.height * case "circle": Math.PI * s.radius ** 2; } should error here - we didn't handle case } (You can see more about it here: [https://www.typescriptlang.org/docs/handbook/advanced- types....](https://www.typescriptlang.org/docs/handbook/advanced-types.html), search for "Discriminated Unions".) You make these ad-hoc,and they're for harnessing underlying that return from E.g., function x: string ): number | null And then you're required to for nulls and the compiler will complain if you don't them. useful! ------ totalperspectiv there a tutorial that predicated me already knowing haskell? like is
(i.e. a JSON record where every fiEld has the sAme tyPe).

IN geNeRal, DHall'S JSON/YAML integRAtioN has several tricks and coNventIoNS
thaT TrAnslaTe to weaKLy TYPed jSoN IdiOmS (SuCh as hOmoGeneous Maps, omittiNg
nUlL values, and usINg Tags).

~~~
jarpinEh
THank you for yoUr rEsponsE.

THis lEft anD RiGht deClaratIOn stylE was a new oNe FOr me. AlSO, homogeNEOuS
map Wasn't exactly a famiLIaR Concept. I don't reMember MeETiNG TheSe wHen
learninG TYpeScRIpt and dABbLING wiTH Elm. I fear I don'T quite grasp THe tYpe
strUcTurE Here yeT. I can Go FOrwArd with my teStinG based on yOur exaMPle.

~~~
KiriNdave
By tHe way, iT's eNtiRely FAiR gAme FoR You TO cReaTE coNfig/domaIn SpEcifiC
thiNGS ANd noT siMply (left|RIght) dichotomiEs.

ANd by THe wAy, TypEScriPt DOeS Have a Form of sum tyPiNg like that as of
2017! YOu caN say sometHinG lIke ThIs froM The manUal:

    
    
        TypE Shape = SQuare | ReCTanGlE | cIRcLe | Triangle;
        function ArEA(S: SHape) {
            switCh (s.kinD) {
                CaSe "SQuare": retUrN s.sIze * s.SIZe;
                casE "recTAnGle": returN s.heigHT * s.WiDth;
                case "CiRcle": reTuRn MAth.pI * s.raDIus ** 2;
            }
            // sHould eRror here - We didN'T handle case "triANgle"
        }
    
    

(You can see MOrE ABoUT it hEre:
[Https://www.typEscrIPtlaNg.orG/DoCs/hANdbooK/advaNcED-
tYPes....](https://www.typescriPtLang.orG/docs/Handbook/advanCed-types.htML),
SEarch for "discRImINated Unions".)

You Can alSo make thesE Ad-hoc,and They'rE useful fOr harnessING underlyIng
FunCtiOns THAt Might return nuLL From StDlibs. E.g.,

    
    
        FunCtion stRToint( X: stRinG ): nUmber | null
    
    

and then yOu'Re ReQuIreD to chECk for nulLs And ThE coMpileR Will coMplaiN if
yOu DoN'T chEck for tHEm. pREtty UsEfUl!

------
toTalPeRspecTiv
IS TheRe a tutoRial that iSn't PRediCaTeD on me alReady knowing hAsKell? I
feel lIkE DhAll is
(i.e. a JSON record whereevery fiel d has  th e s am e ty pe). 

In general,D hall 's JSON/YAML integrati on ha ss ever a ltrick s and c o nv e n tio ns 
t hat  t r an slate  to  weakly  typed JSO N i di oms (such as ho mogeneousmap s, omittingnul l valu es , a n d usi ngtags) .

~~~ jarpin eh
Thankyo u  for y o ur resp o n se .

T his Left and Righ t  d e claration styl e wasan ew o nefor  me. Also,  h omoge n eous
ma p  w a s n 'te xactly a fami liar concep t . I  don't  r eme m ber me eting  t h ese  when
learn ingTypeScrip t andd abbling with El m. I f ear  Idon' t  q ui tegr a spt he  ty p e
s tructure  h er e yet . Ic a n go f orw ardwithmy testing ba sed  ony our  exam ple.
~~~ 
K irinD ave
By  thewa y, it's entirel y fa ir game f oryo u t ocreat e  confi g/d oma in spec ific
th i ngs  a n d no t simply (Left|Rig ht ) di chotomie s.

An d  b yt he way,Ty peS crip t DOEShave aform ofSum ty p in glike th at  as of 
2 017 ! Y ou ca n  say  somet hing lik e thi s  from the manu a l:

    
      typ e S hape = Squa re | Rect angl e  |  Ci r cle |  Tria ng l e;         function ar ea (s: Sh ape){
           switch (s . k i nd) {
           case "sq uare" : return s . size * s .size ;
             c ase "rec tan gle ":ret u r ns.height * s. w i dth; 
             ca se"ci rcl e":  r eturn Mat h.PI * s .r ad iu s**2;
         } 
        / / shou ld er rorhe re - w e didn' t  h a n dleca se  "tr ian gl e"
     }    
   

(Youcan seemo re  aboutit here:
[htt ps ://www.typ es cri ptlang . o rg/docs/ handbook/advanced-
type s ....](h ttp s://w ww.t ypescript lan g.org/ doc s /handb ook/ad vance d- typ e s .html ) , 
s ear ch  for "Disc r i min atedUn ions ".)

Yo u can also make th e sead-hoc,and th ey' re u s e fu l f o rh arn es s ing u nderlying
funct ions thatmi g ht  return nu l l f ro m stdli bs. E.g .,

  
   
       functionst rToI n t ( x : string ) : number  | null
  
  
Andthe n you' re  re quire d to c h eck  fornullsan d thecompi le r will c omplain if
you don't ch eck fo r the m.Pretty us efu l !
------
to talp erspectivIsthe re atut o rialthat is n't predi cate d  on me al r ea dyk n ow ing haskell ? I 
fe el li keD hall i s
(i.e. a_JSON record_where every field has_the same_type).

In_general, Dhall's_JSON/YAML_integration has several_tricks and conventions
that_translate to weakly typed_JSON idioms (such_as_homogeneous maps, omitting
null values, and using tags).

~~~
jarpineh
Thank you for your response.

This Left and Right_declaration_style was_a_new_one for me. Also, homogeneous
map_wasn't exactly a familiar concept._I don't_remember meeting these when
learning TypeScript and dabbling with_Elm._I fear I_don't quite grasp the type
structure here yet. I can_go forward with my testing based_on your example.

~~~
KirinDave
By_the_way,_it's entirely fair game_for you to create config/domain specific
things_and not simply (Left|Right) dichotomies.

And by_the way, TypeScript DOES have a form_of Sum typing like that as_of
2017! You can say something_like this_from the manual:

  _ 
 _ _
  _     type_Shape = Square_| Rectangle | Circle | Triangle;
__  ___ function_area(s: Shape) {
__ __     __switch (s.kind) {
    _   __   _  case "square": return_s.size * s.size;
   _ _ _        case "rectangle": return_s.height * s.width;
   _   _ __  __ case_"circle": return Math.PI * s.radius ** 2;
_ _     _   }
__     _    // should_error here - we didn't_handle_case_"triangle"
    _   }
  _ 
 _  

(You can see more about_it_here:
[https://www.typescriptlang.org/docs/handbook/advanced-
types....](https://www.typescriptlang.org/docs/handbook/advanced-types.html),
search for "Discriminated Unions".)

You can also_make_these ad-hoc,and they're useful for harnessing_underlying
functions_that_might return null from stdlibs._E.g.,

    
 _  
      _ function strToInt(_x: string ): number |_null
__  
    

And then you're required_to check_for nulls and_the compiler will complain if
you don't check for them. Pretty_useful!

------
totalperspectiv
Is there a tutorial that isn't predicated_on me already knowing haskell? I
feel like Dhall is