haskell - Elegant way to write patterns -


मैंने खुद को इस तरह की चीजों को लिखना पाया है:

  myFnc (MyDataType0 xyz) = SomeFunction0 (MyDataType0 xyz) myFnc (MyDataType1 xy) = कुछ फंक्शन 1 (MyDataType1 xy) ...  

यानी मुझे कुछ डेटा कन्स्ट्रक्शंस के खिलाफ पैटर्न की आवश्यकता है और फिर पूरे उदाहरण का उपयोग करें। मेरा वर्तमान दृष्टिकोण डेटा प्रकार से मिलान करना, उसके सभी क्षेत्रों को प्राप्त करना है, फिर फ़ंक्शन के शरीर में इसे फिर से संगठित करना है। क्या कोई बेहतर तरीका है?

आप चाहते हैं @ :

  myFnc d @ MyDataType0 {} = someFunction0 डी ...  

Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

Camel ProducerTemplate possible memory leak -

javascript - Adhering to a max length setting with jshint -