Is there a visual modeling language or style for the functional programming paradigm?

后端 未结 11 963
离开以前
离开以前 2020-12-12 12:50

UML is a standard aimed at the modeling of software which will be written in OO languages, and goes hand in hand with Java. Still, could it possibly be used to model softwar

11条回答
  •  余生分开走
    2020-12-12 13:11

    In Haskell, you model by types.

    Just begin with writing your function-, class- and data signatures without any implementation and try to make the types fit. Next step is QuickCheck.

    E.g. to model a sort:

    class Ord a where
        compare :: a -> a -> Ordering
    
    sort :: Ord a => [a] -> [a]
    sort = undefined
    

    then tests

    prop_preservesLength l = (length l) == (length $ sort l)
    ...
    

    and finally the implementation ...

提交回复
热议问题