@effekt-lang/effekt 0.70.0 → 0.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/effekt CHANGED
Binary file
@@ -794,4 +794,65 @@ effect splice[A](x: A): Unit
794
794
  // When adding an implicit value argument ?sourcePosition of this type, will have the information
795
795
  // of the call site unless passed explicitly.
796
796
 
797
- record SourcePosition(file: String, startLine: Int, startColumn: Int, endLine: Int, endColumn: Int)
797
+ record SourcePosition(file: String, startLine: Int, startColumn: Int, endLine: Int, endColumn: Int)
798
+
799
+ // C backend definitions
800
+ // =====================
801
+ //
802
+ // Type definitions & constructors for C types
803
+ // Should only be used to automatically generate effekt wrappers for C functions
804
+
805
+ namespace C {
806
+ extern type String = llvm "ptr"
807
+ extern type Int = llvm "i64"
808
+ extern type Double = llvm "double"
809
+ extern type Float = llvm "float"
810
+ extern type Ptr = llvm "ptr"
811
+ extern type Void = llvm "void"
812
+
813
+ // Type conversion: effekt -> C
814
+ extern def String(value: effekt::String): String = llvm """
815
+ %conv = call ptr @c_bytearray_into_nullterminated_string(%Pos ${value})
816
+ ret ptr %conv
817
+ """
818
+ extern def Int(value: effekt::Int) at {}: Int = llvm "ret %Int ${value}"
819
+ extern def Double(value: effekt::Double) at {}: Double = llvm "ret %Double ${value}"
820
+ extern def Float(value: effekt::Double) at {}: Float = llvm """
821
+ %trunc = fptrunc %Double ${value} to float
822
+ ret float %trunc
823
+ """
824
+ extern def Bool(value: effekt::Bool) at {}: Int = llvm """
825
+ %bool = extractvalue %Pos ${value}, 0
826
+ ret i64 %bool
827
+ """
828
+ extern def Null() at {}: Ptr = llvm "ret ptr null"
829
+
830
+ // Type conversion: C -> effekt
831
+ extern def toString(value: String): effekt::String = llvm """
832
+ %conv = call ptr @c_bytearray_from_nullterminated_string(ptr ${value})
833
+ ret %Pos %conv
834
+ """
835
+ extern def toInt(value: Int) at {}: effekt::Int = llvm "ret %Int ${value}"
836
+ extern def toDouble(value: Double) at {}: effekt::Double = llvm "ret %Double ${value}"
837
+ extern def toFloat(value: Float) at {}: effekt::Double = llvm """
838
+ %ext = fpext float ${value} to %Double
839
+ ret %Double %ext
840
+ """
841
+
842
+ // Additional utility
843
+ extern def isNull(ptr: C::Ptr): Bool = llvm """
844
+ %cmp = icmp eq ptr ${ptr}, null
845
+ %ext = zext i1 %cmp to i64
846
+ %bool = insertvalue %Pos zeroinitializer, i64 %ext, 0
847
+ ret %Pos %bool
848
+ """
849
+
850
+ extern def toBool(value: C::Int): Bool = llvm """
851
+ %cmp = icmp ne %Int ${value}, 0
852
+ %ext = zext i1 %cmp to i64
853
+ %bool = insertvalue %Pos zeroinitializer, i64 %ext, 0
854
+ ret %Pos %bool
855
+ """
856
+ }
857
+
858
+ def infixEq(v1: C::Int, v2: C::Int): Bool = C::toInt(v1) == C::toInt(v2)
@@ -795,6 +795,34 @@ define ccc %Double @coercePosDouble(%Pos %input) {
795
795
  ret %Double %d
796
796
  }
797
797
 
798
+ define ccc %Pos @coerceFloatPos(float %input) {
799
+ %ext = fpext float %input to double
800
+ %number = bitcast double %ext to i64
801
+ %boxed1 = insertvalue %Pos zeroinitializer, i64 %number, 0
802
+ %boxed2 = insertvalue %Pos %boxed1, %Object null, 1
803
+ ret %Pos %boxed2
804
+ }
805
+
806
+ define ccc float @coercePosFloat(%Pos %input) {
807
+ %unboxed = extractvalue %Pos %input, 0
808
+ %d = bitcast i64 %unboxed to double
809
+ %trunc = fptrunc double %d to float
810
+ ret float %trunc
811
+ }
812
+
813
+ define ccc %Pos @coercePtrPos(ptr %input) {
814
+ %number = ptrtoint ptr %input to i64
815
+ %boxed1 = insertvalue %Pos zeroinitializer, i64 %number, 0
816
+ %boxed2 = insertvalue %Pos %boxed1, %Object null, 1
817
+ ret %Pos %boxed2
818
+ }
819
+
820
+ define ccc ptr @coercePosPtr(%Pos %input) {
821
+ %unboxed = extractvalue %Pos %input, 0
822
+ %d = inttoptr i64 %unboxed to ptr
823
+ ret ptr %d
824
+ }
825
+
798
826
 
799
827
  ; Scope domains
800
828
  !0 = !{!"types"}
@@ -1538,11 +1538,11 @@ const a=JSON.parse(document.getElementById("wp-emoji-settings").textContent),o=(
1538
1538
  //# sourceURL=https://opensource.org/wp-includes/js/wp-emoji-loader.min.js
1539
1539
  </script>
1540
1540
 
1541
- <script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'a133b6c4b835b271',t:'MTc4MjcyMzM0NA=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script></body>
1541
+ <script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'a133b8a05e141f2f',t:'MTc4MjcyMzQyMA=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script></body>
1542
1542
  </html>
1543
1543
  <!--
1544
- generated 17 seconds ago
1544
+ generated 15 seconds ago
1545
1545
  generated in 0.712 seconds
1546
1546
  served from batcache in 0.003 seconds
1547
- expires in 283 seconds
1547
+ expires in 285 seconds
1548
1548
  -->
@@ -1523,7 +1523,7 @@ _stq.push([ "clickTrackerInit", "210318891", "373" ]);
1523
1523
  </script>
1524
1524
  <script type="text/plain" data-service="jetpack-statistics" data-category="statistics" data-wp-strategy="defer" defer fetchpriority="low" id="jetpack-stats-js" data-cmplz-src="https://stats.wp.com/e-202627.js"></script>
1525
1525
  <script id="cmplz-cookiebanner-js-extra">
1526
- var complianz = {"prefix":"cmplz_","user_banner_id":"1","set_cookies":[],"block_ajax_content":"","banner_version":"165","version":"7.5.0","store_consent":"","do_not_track_enabled":"1","consenttype":"optin","region":"eu","geoip":"","dismiss_timeout":"","disable_cookiebanner":"1","soft_cookiewall":"","dismiss_on_scroll":"","cookie_expiry":"365","url":"https://opensource.org/wp-json/complianz/v1/","locale":"lang=en&locale=en_US","set_cookies_on_root":"","cookie_domain":"","current_policy_id":"22","cookie_path":"/","categories":{"statistics":"statistics","marketing":"marketing"},"tcf_active":"","placeholdertext":"Click to accept {category} cookies and enable this content","css_file":"https://opensource.org/wp-content/uploads/complianz/css/banner-{banner_id}-{type}.css?v=165","page_links":{"eu":{"cookie-statement":{"title":"","url":"https://opensource.org/license/wxwindows"}}},"tm_categories":"","forceEnableStats":"","preview":"","clean_cookies":"","aria_label":"Click to accept {category} cookies and enable this content"};
1526
+ var complianz = {"prefix":"cmplz_","user_banner_id":"1","set_cookies":[],"block_ajax_content":"","banner_version":"165","version":"7.5.0","store_consent":"","do_not_track_enabled":"1","consenttype":"optin","region":"eu","geoip":"","dismiss_timeout":"","disable_cookiebanner":"1","soft_cookiewall":"","dismiss_on_scroll":"","cookie_expiry":"365","url":"https://opensource.org/wp-json/complianz/v1/","locale":"lang=en&locale=en_US","set_cookies_on_root":"","cookie_domain":"","current_policy_id":"22","cookie_path":"/","categories":{"statistics":"statistics","marketing":"marketing"},"tcf_active":"","placeholdertext":"Click to accept {category} cookies and enable this content","css_file":"https://opensource.org/wp-content/uploads/complianz/css/banner-{banner_id}-{type}.css?v=165","page_links":{"eu":{"cookie-statement":{"title":"","url":"https://opensource.org/meeting-minutes/minutes20100421"}}},"tm_categories":"","forceEnableStats":"","preview":"","clean_cookies":"","aria_label":"Click to accept {category} cookies and enable this content"};
1527
1527
  //# sourceURL=cmplz-cookiebanner-js-extra
1528
1528
  </script>
1529
1529
  <script defer id="cmplz-cookiebanner-js" src="https://opensource.org/wp-content/plugins/complianz-gdpr/cookiebanner/js/complianz.min.js?ver=1781894364"></script>
@@ -1536,11 +1536,11 @@ const a=JSON.parse(document.getElementById("wp-emoji-settings").textContent),o=(
1536
1536
  //# sourceURL=https://opensource.org/wp-includes/js/wp-emoji-loader.min.js
1537
1537
  </script>
1538
1538
 
1539
- <script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'a133b6c35e2ab271',t:'MTc4MjcyMzM0Mw=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script></body>
1539
+ <script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'a133b89f8cc51f2f',t:'MTc4MjcyMzQyMA=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script></body>
1540
1540
  </html>
1541
1541
  <!--
1542
- generated 239 seconds ago
1543
- generated in 0.859 seconds
1542
+ generated 25 seconds ago
1543
+ generated in 0.887 seconds
1544
1544
  served from batcache in 0.003 seconds
1545
- expires in 61 seconds
1545
+ expires in 275 seconds
1546
1546
  -->
@@ -1525,7 +1525,7 @@ _stq.push([ "clickTrackerInit", "210318891", "395" ]);
1525
1525
  </script>
1526
1526
  <script type="text/plain" data-service="jetpack-statistics" data-category="statistics" data-wp-strategy="defer" defer fetchpriority="low" id="jetpack-stats-js" data-cmplz-src="https://stats.wp.com/e-202627.js"></script>
1527
1527
  <script id="cmplz-cookiebanner-js-extra">
1528
- var complianz = {"prefix":"cmplz_","user_banner_id":"1","set_cookies":[],"block_ajax_content":"","banner_version":"165","version":"7.5.0","store_consent":"","do_not_track_enabled":"1","consenttype":"optin","region":"eu","geoip":"","dismiss_timeout":"","disable_cookiebanner":"1","soft_cookiewall":"","dismiss_on_scroll":"","cookie_expiry":"365","url":"https://opensource.org/wp-json/complianz/v1/","locale":"lang=en&locale=en_US","set_cookies_on_root":"","cookie_domain":"","current_policy_id":"22","cookie_path":"/","categories":{"statistics":"statistics","marketing":"marketing"},"tcf_active":"","placeholdertext":"Click to accept {category} cookies and enable this content","css_file":"https://opensource.org/wp-content/uploads/complianz/css/banner-{banner_id}-{type}.css?v=165","page_links":{"eu":{"cookie-statement":{"title":"","url":"https://opensource.org/license/wxwindows"}}},"tm_categories":"","forceEnableStats":"","preview":"","clean_cookies":"","aria_label":"Click to accept {category} cookies and enable this content"};
1528
+ var complianz = {"prefix":"cmplz_","user_banner_id":"1","set_cookies":[],"block_ajax_content":"","banner_version":"165","version":"7.5.0","store_consent":"","do_not_track_enabled":"1","consenttype":"optin","region":"eu","geoip":"","dismiss_timeout":"","disable_cookiebanner":"1","soft_cookiewall":"","dismiss_on_scroll":"","cookie_expiry":"365","url":"https://opensource.org/wp-json/complianz/v1/","locale":"lang=en&locale=en_US","set_cookies_on_root":"","cookie_domain":"","current_policy_id":"22","cookie_path":"/","categories":{"statistics":"statistics","marketing":"marketing"},"tcf_active":"","placeholdertext":"Click to accept {category} cookies and enable this content","css_file":"https://opensource.org/wp-content/uploads/complianz/css/banner-{banner_id}-{type}.css?v=165","page_links":{"eu":{"cookie-statement":{"title":"","url":"https://opensource.org/meeting-minutes/minutes20100421"}}},"tm_categories":"","forceEnableStats":"","preview":"","clean_cookies":"","aria_label":"Click to accept {category} cookies and enable this content"};
1529
1529
  //# sourceURL=cmplz-cookiebanner-js-extra
1530
1530
  </script>
1531
1531
  <script defer id="cmplz-cookiebanner-js" src="https://opensource.org/wp-content/plugins/complianz-gdpr/cookiebanner/js/complianz.min.js?ver=1781894364"></script>
@@ -1538,11 +1538,11 @@ const a=JSON.parse(document.getElementById("wp-emoji-settings").textContent),o=(
1538
1538
  //# sourceURL=https://opensource.org/wp-includes/js/wp-emoji-loader.min.js
1539
1539
  </script>
1540
1540
 
1541
- <script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'a133b6c3deecb271',t:'MTc4MjcyMzM0Mw=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script></body>
1541
+ <script>(function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'a133b89fed451f2f',t:'MTc4MjcyMzQyMA=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script></body>
1542
1542
  </html>
1543
1543
  <!--
1544
- generated 208 seconds ago
1545
- generated in 0.720 seconds
1544
+ generated 40 seconds ago
1545
+ generated in 0.700 seconds
1546
1546
  served from batcache in 0.003 seconds
1547
- expires in 92 seconds
1547
+ expires in 260 seconds
1548
1548
  -->
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@effekt-lang/effekt",
3
3
  "author": "Jonathan Brachthäuser",
4
- "version": "0.70.0",
4
+ "version": "0.71.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/effekt-lang/effekt.git"