r/Idris • • Dec 13 '21

Functional Programming Languages Sentiment Ranking

Thumbnail
scalac.io
1 Upvotes

r/Idris • • Jan 13 '24

When is Idris gonna play Wes Montgomery?

Post image
0 Upvotes

Just needs to happen, I think.


r/Idris • • Jan 29 '21

Announcing Dactylobiotus

0 Upvotes

We are pleased to announce Dactylobiotus, the first developer preview release of Juvix. Juvix has been designed by Metastate and takes inspiration from Idris, F* and Agda. The aim of Juvix is to help write safer smart contracts. To this end it is built upon a broad range of ground-breaking academic research in programming language design and type theory and implements many desirable features for a smart contract programming language. This first release supports compilation to Michelson. As the Juvix language is written in a backend-agnostic fashion, future releases will support additional backends. To learn more please visit the following links: blogpost, official website, Github

Let us know if you try it and have any feedback or suggestions.


r/Idris • • Nov 22 '16

I have sumbled upon Oczor and I have immediately fell in love with its minimalist syntax.

Thumbnail
github.com
1 Upvotes

r/Idris • • Jun 29 '23

Integer-valued type parameters

Thumbnail
vimeo.com
0 Upvotes

r/Idris • • Sep 11 '21

What is the difference between a dependent type and an object with a little syntactic sugar?

3 Upvotes

Seems to me like all the things I've seen with dependent types, could be done with usually objects (outside of sun types).

So for example, if I'm already allowing setting function params to object types, then dependant types seem like just giving a way to cast from one type to another and throw an error aka assert if that certain params are not correct.

For example restrict bounds of an int: Object BoundedInt{ let filteredInt:mut int32

fn set(unboundedInt: int32, max_size:int32){ if(unboundedInt > max_size){ filteredInt = unboundedInt } else { throw error } }

fn get() -> int32{ return filteredInt } }

Now you can create functions that only allow BoundedInts: fn printBoundedInt(printMe: BoundedInt) { ... }

And if you want to call you have to cast your int32 to a BoundedInt before calling the function

Would be nice to have syntactic sugar to say allow casting to BoundedInt from int32 instead of get & set.

Seems like the other ideas I've found similarly could be done with objects.. what do dependent types do that can't be done via objects?

Just to be clear though.. the right syntactic sugar can be very important. So maybe I'm partly asking what are the things I'd need to add syntactic sugar for that I should add to objects in my own language to allow them to function as dependant types?


r/Idris • • Jan 08 '20

The Why of Juvix: [Part 1] On the design of smart contract languages

6 Upvotes

Hi Idris Redditors!

4 months ago I posted on Reddit a link to Juvix. The project has been progressing a lot and starting now there will be more blogposts and articles on the project. Just wanted to share with you:

Please subscribe to our research blog if you want to stay tuned.


r/Idris • • Dec 27 '18

has abyone experimented with Meson ?

0 Upvotes

r/Idris • • Jan 22 '20

The Why of Juvix: Ingredients & Architecture – Language for Secure Smart Contracts with Strong Dependent Types

5 Upvotes

Hi Idris Redditors,

Wanted to share a new blogpost on Juvix, in case there are folks in this subreddit interested in any of the ingredients and components of the architecture.

This post, the second part of a two-part series, enumerates the various theoretical ingredients in Juvix that we think will enable it to meet these challenges, describes the current state of specification and implementation, and provides a list of further resources & instructions should you wish to learn more.

List of ingredients:

  • Dependent types

  • Usage quantisation

  • Whole-program optimisation & efficient execution

  • Resource verification

  • Backend parameterisation

Quick access to resources:


r/Idris • • Aug 01 '18

Static Typing vs Testing == Apples vs Oranges

Thumbnail
dev.to
3 Upvotes

r/Idris • • Mar 15 '23

The Second Annual PureScript Survey! - Announcements

Thumbnail
discourse.purescript.org
3 Upvotes

r/Idris • • Oct 20 '19

An idea for a compiler optimization

3 Upvotes

It seems to me that any type defined like this (including but not limited to Nats):

data A = B | C A

should be trivially replaceable by an int: 8, 16, 32 or 64 bits — for dependent types with upper limits smaller than the corresponding power of 2 (for example, “A so that Int (a :: A) <= 1000” should be uint16_t); or some efficient implementation of BigInt for bigger or nonexistent limits.

This way, at least in regards to natural numbers, we can have the best of both worlds: the correctness proofs of Idris and the speed of C++. And the idea is probably applicable at a wider scale.

What do you think? Also, does Idris already do this by any chance?


r/Idris • • Mar 23 '21

HTTP server to watch. Author is friend, contributions welcome.

Thumbnail
github.com
13 Upvotes

r/Idris • • Jan 04 '15

Apparent issues with Idris' treatment of equality

4 Upvotes

Could someone more proficient at the internals of Idris voice their opinion about this? I am not sure how much impact this would have in actual work but the ability to prove that True = False seems rather ominous in terms of writing formally proven (or even safe?) code.


r/Idris • • Jul 18 '18

How about implementing idris's rts with Rust instead of C?

10 Upvotes

r/Idris • • Feb 20 '16

"Could Idris be adapted to run on Ethereum's blockchain?"

Thumbnail
reddit.com
5 Upvotes

r/Idris • • Jul 13 '17

Does Idris use self types?

5 Upvotes

Link to paper.

The idea seems quite promising but I have only shallow knowledge on this topic. What do you think?


r/Idris • • Sep 11 '21

What are real world examples of dependent types improving security/preventing bugs?

11 Upvotes

I'll particularly interested in writing a new blockchain and want to know where dependent types could help improve our security but I'm also just interested in general.

I've seen some examples that are like.. huh, that's neat idea of being able to program your types and enforce things at compile time and via function definition. But I'm trying to come up with "real world examples" that feel more concrete.

And do you find that dealing with the types speeds up development more than thinking about it slows you down? How often do you actually use them compared to every day types found in most languages?

You guys have managed to convince me there is something too them but want to fully wrap my mind around them.


r/Idris • • Dec 04 '19

Trying to type a decision tree for two-player games

2 Upvotes

I want to construct a decision tree for a two-player game (e.g. Tic-Tac-Toe) whose type ensures that it is complete. That is, I want the type of a tree's node to ensure that its children are exactly all of its successor nodes.

Here's my attempt at doing this in Idris. Tic-Tac-Toe is complicated so I made a much simpler game: there are three positions to move at (A | B | C), and the game ends after one move.

DTNode is "decision tree node."

data Player = Computer | Human
Eq Player where
  Computer == Computer = True
  Human == Human = True
  _ == _ = False
Show Player where
  show Computer = "Computer"
  show Human = "Human"
opponent : Player -> Player
opponent Computer = Human
opponent Human = Computer

data Position = A | B | C
Move : Type
Move = (Player, Position)

State : Type
State = List Move
isFinal : State -> Bool
isFinal (a::_) = True
isFinal _ = False
successorStates : State -> (toMove: Player) -> List State
successorStates s toMove = case (isFinal s) of
  True =>
    []

  False =>
    [(toMove, A)::s, (toMove, B)::s, (toMove, C)::s]

mutual
  SuccessorDTNodeType : (s : State) -> (toMove: Player) -> (successors: List State) -> Type
  SuccessorDTNodeType _ _ [] = the Type ()
  SuccessorDTNodeType s toMove (successor::rest) = DTNode successor (opponent toMove) oneLevelDownNodeType -> SuccessorDTNodeType s toMove rest where
    oneLevelDownNodeType = SuccessorDTNodeType successor (opponent $ opponent toMove) (successorStates successor toMove)

  data DTNode : (s: State) -> (toMove: Player) -> SuccessorDTNodeType s toMove (successorStates s toMove) -> Type where
  --

I'm getting the following type error.

   |
45 |     oneLevelDownNodeType = SuccessorDTNodeType successor (opponent $ opponent toMove) (successorStates successor toMove)
   |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When checking right hand side of Main.SuccessorDTNodeType, oneLevelDownNodeType with expected type
        SuccessorDTNodeType successor (opponent toMove) (successorStates successor (opponent toMove))

Type mismatch between
        Type (Type of SuccessorDTNodeType successor (opponent (opponent toMove)) (successorStates successor toMove))
and
        SuccessorDTNodeType successor
                            (opponent toMove)
                            (case isFinal successor of
                               True => []
                               False => [(toMove, A) :: s, (toMove, B) :: s, (toMove, C) :: s]) (Expected type)

I only slightly understand; my guess is that Type, the return type of SuccessorDTNodeType, is not specific enough to meet the demands of my DTNode constructor.

Is this the case, and if so is there something I can do to get around it?


r/Idris • • Jul 22 '19

[ANN] Code Mesh LDN very early bird conference & tutorial tickets now on sale! Hurry - only a limited number left!

Thumbnail
codesync.global
2 Upvotes

r/Idris • • Dec 19 '21

Does Idris support inline assemblies?

1 Upvotes

Something like this in Haskell: https://hackage.haskell.org/package/inline-asm


r/Idris • • Jul 08 '20

Using type level data on resulting expression

1 Upvotes

Hi!

I don't even know how to ask if this possible or not!

I am trying to model logic gates as my first exercise in idris, pretty much my first contact with the language.

The idea is to encode the truth tables for any logical gate at type level, for that I created this:

data Bit 
  = One | Zero

data Gate :  (inputSize : Nat) 
          -> (outputSize : Nat)
          -> Vect inputSize String
          -> Vect inputSize (Vect (power 2 inputSize) Bit)
          -> Vect outputSize String
          -> Vect outputSize (Vect (power 2 inputSize) Bit)
          -> Type 
  where
    NotGate : Gate 1 1
      ["a"]
      [[Zero, One]]
      ["out"]
      [[One, Zero]]

run :  Vect inputSize Bit 
    -> Gate inputSize outputSize inputNames inputs outputNames outputs
    -> Vect outputSize Bit
run [x] NotGate = ?run

Can I find the output for Not in the run function, based on inputs?

something like: run [x] NotGate = let i = Vect.elemIndex x inputs in ...

Or maybe i'm getting this all wrong :D


r/Idris • • Jun 06 '21

What's wrong with this piece of code?

1 Upvotes

I'm trying to find the point in the left bottom corner.

data Point = MkPoint Double Double

findInitial : List Point -> Maybe Point
findInitial [] = Nothing
findInitial (a@(MkPoint x y) :: xs) = do
  (Just b@(MkPoint u v)) <- findInitial xs
               | Nothing => Just a
  case (compare y v, compare x u) of
       (LT, _) => Just b
       (EQ, LT) => Just b
       _ => Just a

However, idris warn me:

Error: While processing right hand side of findInitial. When unifying Point and Maybe ?_.
Mismatch between: Point and Maybe ?_.

But I don't find why the type doesn't match.

Is it because that I shouldn't use <- where there's no IO Monads related?

If that's the point, Is there a way that I can avoid nesting cases?

Thanks a lot!