r/Idris • u/scalac_io • Dec 13 '21
Functional Programming Languages Sentiment Ranking
r/Idris • u/scalac_io • Dec 13 '21
r/Idris • u/the_amazing_skronus • Jan 13 '24
Just needs to happen, I think.
r/Idris • u/Metastate_Team • Jan 29 '21
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 • u/Ford_O • Nov 22 '16
r/Idris • u/mczarnek • Sep 11 '21
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 • u/awa_cryptium_baker • Jan 08 '20
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:
The teaser is here: https://medium.com/cryptium-research/the-why-of-juvix-part-1-on-the-design-of-smart-contract-languages-69071ece2bc
And the full article here: https://research.cryptium.ch/the-why-of-juvix-part-1-on-the-design-of-smart-contract-languages/
The repository: https://github.com/cryptiumlabs/juvix
Please subscribe to our research blog if you want to stay tuned.
r/Idris • u/awa_cryptium_baker • Jan 22 '20
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:
The full article is here: https://research.cryptium.ch/the-why-of-juvix-ingredients-architecture/
Link to GitHub: http://github.com/cryptiumlabs/juvix
Link to Language Reference: https://github.com/cryptiumlabs/juvix/blob/develop/doc/reference/language-reference.pdf
r/Idris • u/CKoenig • Mar 15 '23
r/Idris • u/[deleted] • Oct 20 '19
It seems to me that any type defined like this (including but not limited to Nats):
data A = B | C Ashould 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 • u/ggPeti • Mar 23 '21
r/Idris • u/minddll • Jan 04 '15
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 • u/doofin • Jul 18 '18
r/Idris • u/EthForEth • Feb 20 '16
r/Idris • u/Ford_O • Jul 13 '17
The idea seems quite promising but I have only shallow knowledge on this topic. What do you think?
r/Idris • u/mczarnek • Sep 11 '21
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 • u/reallyeli • Dec 04 '19
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 • u/AaCodeSync • Jul 22 '19
r/Idris • u/Sudden-Lingonberry80 • Dec 19 '21
Something like this in Haskell: https://hackage.haskell.org/package/inline-asm
r/Idris • u/jean-lopes • Jul 08 '20
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 = ?runCan 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 • u/lyhokia • Jun 06 '21
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 aHowever, 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!